Title: [136280] trunk
Revision
136280
Author
[email protected]
Date
2012-11-30 15:00:41 -0800 (Fri, 30 Nov 2012)

Log Message

Make RenderLayer::updateLayerPosition() private
https://bugs.webkit.org/show_bug.cgi?id=102624

Reviewed by Ryosuke Niwa.

Source/WebCore:

Made updateLayerPosition() private. The only external caller was
MouseRelatedEvent::computeRelativePosition(), which has no business updating
layer positions. In fact it had positively dangerous behavior; doing just
a style update without layout, and then calling absoluteToLocal() and walking
layers. Fixed by having it call updateLayoutIgnorePendingStylesheets().

This revealed a bug where event.offsetX/offsetY could be wrong in some cases.
fast/events/stopPropagation-submit.html does a simulated click (which has
client coordinates at 0,0), so the image submit coordinates were incorrectly
0,0. Now that we do layout before computing them, they are correctly reported
as being relative to the element.

* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::computeRelativePosition):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
* rendering/RenderLayer.h:
(RenderLayer):

LayoutTests:

New results with correctly computed event offsets.

* fast/events/stopPropagation-submit-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136279 => 136280)


--- trunk/LayoutTests/ChangeLog	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/LayoutTests/ChangeLog	2012-11-30 23:00:41 UTC (rev 136280)
@@ -1,3 +1,14 @@
+2012-11-30  Simon Fraser  <[email protected]>
+
+        Make RenderLayer::updateLayerPosition() private
+        https://bugs.webkit.org/show_bug.cgi?id=102624
+
+        Reviewed by Ryosuke Niwa.
+
+        New results with correctly computed event offsets.
+
+        * fast/events/stopPropagation-submit-expected.txt:
+
 2012-11-30  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r136142.

Modified: trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt (136279 => 136280)


--- trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt	2012-11-30 23:00:41 UTC (rev 136280)
@@ -1,2 +1,2 @@
 PASS
-?x=0&y=0
+?x=-8&y=-60

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (136279 => 136280)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-30 23:00:41 UTC (rev 136280)
@@ -4211,6 +4211,9 @@
 webkit.org/b/103609 [ MountainLion ] fast/regions/firstletter-inside-flowthread.html [ ImageOnlyFailure ]
 webkit.org/b/103609 [ MountainLion ] fast/regions/listmarker-inside-flowthread.html [ ImageOnlyFailure ]
 
+# Rebaseline after https://bugs.webkit.org/show_bug.cgi?id=102624
+webkit.org/b/102624 fast/events/stopPropagation-submit-expected.txt [ Text ]
+
 # Some compositing tests doesn't work on multiple platforms.
 webkit.org/b/103721 [ Mac Win Linux ] compositing/geometry/vertical-scroll-composited.html [ ImageOnlyFailure ]
 webkit.org/b/103721 [ Mac Win Linux ] compositing/reflections/load-video-in-reflection.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (136279 => 136280)


--- trunk/Source/WebCore/ChangeLog	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/Source/WebCore/ChangeLog	2012-11-30 23:00:41 UTC (rev 136280)
@@ -1,5 +1,31 @@
 2012-11-30  Simon Fraser  <[email protected]>
 
+        Make RenderLayer::updateLayerPosition() private
+        https://bugs.webkit.org/show_bug.cgi?id=102624
+
+        Reviewed by Ryosuke Niwa.
+
+        Made updateLayerPosition() private. The only external caller was
+        MouseRelatedEvent::computeRelativePosition(), which has no business updating
+        layer positions. In fact it had positively dangerous behavior; doing just
+        a style update without layout, and then calling absoluteToLocal() and walking
+        layers. Fixed by having it call updateLayoutIgnorePendingStylesheets().
+        
+        This revealed a bug where event.offsetX/offsetY could be wrong in some cases.
+        fast/events/stopPropagation-submit.html does a simulated click (which has
+        client coordinates at 0,0), so the image submit coordinates were incorrectly
+        0,0. Now that we do layout before computing them, they are correctly reported
+        as being relative to the element.
+
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::MouseRelatedEvent::computeRelativePosition):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
+        * rendering/RenderLayer.h:
+        (RenderLayer):
+
+2012-11-30  Simon Fraser  <[email protected]>
+
         Late-loading stylesheets can cause composited layers to be blank
         https://bugs.webkit.org/show_bug.cgi?id=103773
 

Modified: trunk/Source/WebCore/dom/MouseRelatedEvent.cpp (136279 => 136280)


--- trunk/Source/WebCore/dom/MouseRelatedEvent.cpp	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/Source/WebCore/dom/MouseRelatedEvent.cpp	2012-11-30 23:00:41 UTC (rev 136280)
@@ -161,7 +161,7 @@
     m_offsetLocation = m_pageLocation;
 
     // Must have an updated render tree for this math to work correctly.
-    targetNode->document()->updateStyleIfNeeded();
+    targetNode->document()->updateLayoutIgnorePendingStylesheets();
 
     // Adjust offsetLocation to be relative to the target's position.
     if (RenderObject* r = targetNode->renderer()) {
@@ -173,17 +173,15 @@
     }
 
     // Adjust layerLocation to be relative to the layer.
-    // FIXME: We're pretty sure this is the wrong definition of "layer."
-    // Our RenderLayer is a more modern concept, and layerX/Y is some
-    // other notion about groups of elements (left over from the Netscape 4 days?);
-    // we should test and fix this.
+    // FIXME: event.layerX and event.layerY are poorly defined,
+    // and probably don't always correspond to RenderLayer offsets.
+    // https://bugs.webkit.org/show_bug.cgi?id=21868
     Node* n = targetNode;
     while (n && !n->renderer())
         n = n->parentNode();
 
     RenderLayer* layer;
     if (n && (layer = n->renderer()->enclosingLayer())) {
-        layer->updateLayerPosition();
         for (; layer; layer = layer->parent()) {
             m_layerLocation -= toLayoutSize(layer->location());
         }

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (136279 => 136280)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2012-11-30 22:45:03 UTC (rev 136279)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2012-11-30 23:00:41 UTC (rev 136280)
@@ -390,9 +390,6 @@
 
     bool canRender3DTransforms() const;
 
-    // Returns true if the position changed.
-    bool updateLayerPosition();
-
     enum UpdateLayerPositionsFlag {
         CheckForRepaint = 1,
         IsCompositingUpdateRoot = 1 << 1,
@@ -739,6 +736,9 @@
     void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
     void updateScrollbarsAfterLayout();
 
+    // Returns true if the position changed.
+    bool updateLayerPosition();
+
     void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
 
     enum UpdateLayerPositionsAfterScrollFlag {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to