[webkit-changes] cvs commit: WebCore/kwq KWQScrollView.mm
David
hyatt at opensource.apple.com
Sat Jul 30 18:08:14 PDT 2005
hyatt 05/07/30 18:08:13
Modified: . ChangeLog
khtml/html html_elementimpl.cpp
khtml/rendering render_theme.cpp render_theme.h
khtml/xml dom_nodeimpl.cpp dom_nodeimpl.h
kwq KWQScrollView.mm
Log:
Editor still broken.
Revision Changes Path
1.4507 +19 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4506
retrieving revision 1.4507
diff -u -r1.4506 -r1.4507
--- ChangeLog 30 Jul 2005 21:19:41 -0000 1.4506
+++ ChangeLog 31 Jul 2005 01:08:05 -0000 1.4507
@@ -1,3 +1,22 @@
+2005-07-29 David Hyatt <hyatt at apple.com>
+
+ This patch makes simulated clicks actually go into active state briefly. Spacebar
+ on the new checkboxes results in a pressed look.
+
+ Reviewed by darin
+
+ * khtml/html/html_elementimpl.cpp:
+ (HTMLElementImpl::click):
+ * khtml/rendering/render_theme.cpp:
+ (khtml::RenderTheme::stateChanged):
+ * khtml/rendering/render_theme.h:
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::ContainerNodeImpl::setActive):
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeImpl::setActive):
+ * kwq/KWQScrollView.mm:
+ (QScrollView::updateContents):
+
2005-07-30 Anders Carlsson <andersca at mac.com>
Reviewed and landed by Darin Adler.
1.93 +8 -1 WebCore/khtml/html/html_elementimpl.cpp
Index: html_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- html_elementimpl.cpp 30 Jul 2005 02:33:17 -0000 1.92
+++ html_elementimpl.cpp 31 Jul 2005 01:08:12 -0000 1.93
@@ -559,10 +559,17 @@
if (sendMouseEvents) {
QMouseEvent pressEvt(QEvent::MouseButtonPress, QPoint(x,y), Qt::LeftButton, 0);
dispatchMouseEvent(&pressEvt, EventImpl::MOUSEDOWN_EVENT);
+ if (r)
+ setActive(true, true);
QMouseEvent upEvent(QEvent::MouseButtonRelease, QPoint(x,y), Qt::LeftButton, 0);
dispatchMouseEvent(&upEvent, EventImpl::MOUSEUP_EVENT);
+ if (r)
+ setActive(false);
+ } else if (r) {
+ setActive(true, true);
+ setActive(false);
}
-
+
// always send click
QMouseEvent clickEvent(QEvent::MouseButtonRelease, QPoint(x,y), Qt::LeftButton, 0);
dispatchMouseEvent(&clickEvent, EventImpl::KHTML_CLICK_EVENT);
1.8 +4 -3 WebCore/khtml/rendering/render_theme.cpp
Index: render_theme.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_theme.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- render_theme.cpp 30 Jul 2005 02:33:23 -0000 1.7
+++ render_theme.cpp 31 Jul 2005 01:08:12 -0000 1.8
@@ -82,18 +82,19 @@
return appearance != CheckboxAppearance && appearance != RadioAppearance;
}
-void RenderTheme::stateChanged(RenderObject* o, ControlState state) const
+bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const
{
// Default implementation assumes the controls dont respond to changes in :hover state
if (state == HoverState)
- return;
+ return false;
// Assume pressed state is only responded to if the control is enabled.
if (state == PressedState && !isEnabled(o))
- return;
+ return false;
// Repaint the control.
o->repaint();
+ return true;
}
bool RenderTheme::isChecked(const RenderObject* o) const
1.7 +1 -1 WebCore/khtml/rendering/render_theme.h
Index: render_theme.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_theme.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- render_theme.h 29 Jul 2005 02:40:40 -0000 1.6
+++ render_theme.h 31 Jul 2005 01:08:12 -0000 1.7
@@ -68,7 +68,7 @@
// This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed
// or a control becomes disabled.
- virtual void stateChanged(RenderObject* o, ControlState state) const;
+ virtual bool stateChanged(RenderObject* o, ControlState state) const;
// This method is called whenever the theme changes on the system in order to flush cached resources from the
// old theme.
1.166 +24 -4 WebCore/khtml/xml/dom_nodeimpl.cpp
Index: dom_nodeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- dom_nodeimpl.cpp 30 Jul 2005 20:27:56 -0000 1.165
+++ dom_nodeimpl.cpp 31 Jul 2005 01:08:12 -0000 1.166
@@ -2298,7 +2298,7 @@
setChanged();
}
-void ContainerNodeImpl::setActive(bool down)
+void ContainerNodeImpl::setActive(bool down, bool pause)
{
if (down == active()) return;
@@ -2307,10 +2307,30 @@
// note that we need to recalc the style
// FIXME: Move to ElementImpl
if (m_render) {
- if (m_render->style()->affectedByActiveRules())
+ bool reactsToPress = m_render->style()->affectedByActiveRules();
+ if (reactsToPress)
setChanged();
- if (renderer() && renderer()->style()->hasAppearance())
- theme()->stateChanged(renderer(), PressedState);
+ if (renderer() && renderer()->style()->hasAppearance()) {
+ if (theme()->stateChanged(renderer(), PressedState))
+ reactsToPress = true;
+ }
+ if (reactsToPress && pause) {
+ // The delay here is subtle. It relies on an assumption, namely that the amount of time it takes
+ // to repaint the "down" state of the control is about the same time as it would take to repaint the
+ // "up" state. Once you assume this, you can just delay for 100ms - that time (assuming that after you
+ // leave this method, it will be about that long before the flush of the up state happens again).
+ QTime startTime;
+ startTime.restart();
+
+ // Do an immediate repaint.
+ m_render->repaint(true);
+
+ int remainingTime = 100 - startTime.elapsed();
+
+ // Now pause for a small amount of time (1/10th of a second from before we repainted in the pressed state)
+ if (remainingTime > 0)
+ usleep(remainingTime * 1000);
+ }
}
}
1.93 +2 -2 WebCore/khtml/xml/dom_nodeimpl.h
Index: dom_nodeimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- dom_nodeimpl.h 29 Jul 2005 23:02:44 -0000 1.92
+++ dom_nodeimpl.h 31 Jul 2005 01:08:13 -0000 1.93
@@ -234,7 +234,7 @@
void setHasChangedChild( bool b = true ) { m_hasChangedChild = b; }
void setInDocument(bool b=true) { m_inDocument = b; }
virtual void setFocus(bool b=true) { m_focused = b; }
- virtual void setActive(bool b=true) { m_active = b; }
+ virtual void setActive(bool b=true, bool pause=false) { m_active = b; }
void setInActiveChain(bool b=true) { m_inActiveChain = b; }
virtual void setHovered(bool b=true) { m_hovered = b; }
void setChanged(bool b=true);
@@ -522,7 +522,7 @@
bool getLowerRightCorner(int &xPos, int &yPos) const;
virtual void setFocus(bool=true);
- virtual void setActive(bool=true);
+ virtual void setActive(bool active = true, bool pause = false);
virtual void setHovered(bool=true);
virtual unsigned long childNodeCount() const;
virtual NodeImpl *childNode(unsigned long index);
1.82 +5 -4 WebCore/kwq/KWQScrollView.mm
Index: KWQScrollView.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQScrollView.mm,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- KWQScrollView.mm 14 Jul 2005 02:22:12 -0000 1.81
+++ KWQScrollView.mm 31 Jul 2005 01:08:13 -0000 1.82
@@ -360,10 +360,11 @@
// up building a large complicated NSRegion if we don't perform the check.
NSRect dirtyRect = NSIntersectionRect(rect, [view visibleRect]);
if (!NSIsEmptyRect(dirtyRect)) {
- if (now)
- [view displayRect:dirtyRect];
- else
- [view setNeedsDisplayInRect:dirtyRect];
+ [view setNeedsDisplayInRect:dirtyRect];
+ if (now) {
+ [[view window] displayIfNeeded];
+ [[view window] flushWindowIfNeeded];
+ }
}
KWQ_UNBLOCK_EXCEPTIONS;
More information about the webkit-changes
mailing list