Title: [123146] trunk
Revision
123146
Author
[email protected]
Date
2012-07-19 13:46:03 -0700 (Thu, 19 Jul 2012)

Log Message

In flipped blocks writing modes, no flipping occurs when mapping RenderText’s local coordinates to absolute
https://bugs.webkit.org/show_bug.cgi?id=91780

Reviewed by Anders Carlsson.

Source/WebCore: 

Test: fast/writing-mode/flipped-blocks-text-map-local-to-container.html

When RenderObject::mapLocalToContainer() was called on a RenderText with ApplyContainerFlip,
it would not flip (if the container was not a box) but it would always pass
DoNotApplyContainerFlip when recurring to the parent. This meant that no one applied the flip.

* rendering/RenderInline.cpp:
(WebCore::RenderInline::mapLocalToContainer): Made the setting of applyContainerFlip to
false unconditional on the container actually being flipped.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::mapLocalToContainer): Rather than always passing
DoNotApplyContainerFlip when recurring to the parent, changed this function to pass through
the value of applyContainerFlip it was called with, unless it applied the flip itself.

LayoutTests: 

* fast/writing-mode/flipped-blocks-text-map-local-to-container-expected.txt: Added.
* fast/writing-mode/flipped-blocks-text-map-local-to-container.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123145 => 123146)


--- trunk/LayoutTests/ChangeLog	2012-07-19 20:34:56 UTC (rev 123145)
+++ trunk/LayoutTests/ChangeLog	2012-07-19 20:46:03 UTC (rev 123146)
@@ -1,3 +1,13 @@
+2012-07-19  Dan Bernstein  <[email protected]>
+
+        In flipped blocks writing modes, no flipping occurs when mapping RenderText’s local coordinates to absolute
+        https://bugs.webkit.org/show_bug.cgi?id=91780
+
+        Reviewed by Anders Carlsson.
+
+        * fast/writing-mode/flipped-blocks-text-map-local-to-container-expected.txt: Added.
+        * fast/writing-mode/flipped-blocks-text-map-local-to-container.html: Added.
+
 2012-07-19  Erik Arvidsson  <[email protected]>
 
         Window top should not be replaceable

Added: trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container-expected.txt (0 => 123146)


--- trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container-expected.txt	2012-07-19 20:46:03 UTC (rev 123146)
@@ -0,0 +1,2 @@
+Lorem ipsum dolor sit amet consectetur adipiscing elit.
+PASS

Added: trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container.html (0 => 123146)


--- trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/flipped-blocks-text-map-local-to-container.html	2012-07-19 20:46:03 UTC (rev 123146)
@@ -0,0 +1,24 @@
+<meta name=viewport content="width=device-width">
+<div style="border: solid; -webkit-writing-mode: horizontal-bt; -webkit-logical-width: 200px; -webkit-logical-height: 400px;
+    font-size: 36px; line-height: 2;
+">
+    Lorem ipsum dolor <span id="target">sit</span> amet consectetur adipiscing elit.
+</div>
+<p id="result">
+    FAIL: Test did not run.
+</p>
+<script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+    }
+    var target = document.getElementById("target");
+    var range = document.createRange();
+    range.selectNode(target.firstChild);
+    var textTop = range.getClientRects()[0].top;
+    range.selectNode(target);
+    var spanTop = range.getClientRects()[0].top;
+    if (spanTop === textTop)
+        result.innerText = "PASS";
+    else
+        result.innerText  = "FAIL: Text top was " + textTop + " but expected " + spanTop + ".";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (123145 => 123146)


--- trunk/Source/WebCore/ChangeLog	2012-07-19 20:34:56 UTC (rev 123145)
+++ trunk/Source/WebCore/ChangeLog	2012-07-19 20:46:03 UTC (rev 123146)
@@ -1,3 +1,24 @@
+2012-07-19  Dan Bernstein  <[email protected]>
+
+        In flipped blocks writing modes, no flipping occurs when mapping RenderText’s local coordinates to absolute
+        https://bugs.webkit.org/show_bug.cgi?id=91780
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/writing-mode/flipped-blocks-text-map-local-to-container.html
+
+        When RenderObject::mapLocalToContainer() was called on a RenderText with ApplyContainerFlip,
+        it would not flip (if the container was not a box) but it would always pass
+        DoNotApplyContainerFlip when recurring to the parent. This meant that no one applied the flip.
+
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::mapLocalToContainer): Made the setting of applyContainerFlip to
+        false unconditional on the container actually being flipped.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::mapLocalToContainer): Rather than always passing
+        DoNotApplyContainerFlip when recurring to the parent, changed this function to pass through
+        the value of applyContainerFlip it was called with, unless it applied the flip itself.
+
 2012-07-19  Erik Arvidsson  <[email protected]>
 
         Window top should not be replaceable

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (123145 => 123146)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2012-07-19 20:34:56 UTC (rev 123145)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2012-07-19 20:46:03 UTC (rev 123146)
@@ -1135,9 +1135,11 @@
     if (!o)
         return;
 
-    if (applyContainerFlip && o->isBox() && o->style()->isFlippedBlocksWritingMode()) {
-        IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
-        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint);
+    if (applyContainerFlip && o->isBox()) {
+        if (o->style()->isFlippedBlocksWritingMode()) {
+            IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
+            transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint);
+        }
         applyContainerFlip = DoNotApplyContainerFlip;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (123145 => 123146)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2012-07-19 20:34:56 UTC (rev 123145)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2012-07-19 20:46:03 UTC (rev 123146)
@@ -1993,7 +1993,7 @@
     return transformState.lastPlanarPoint();
 }
 
-void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
+void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot applyContainerFlip, bool* wasFixed) const
 {
     if (repaintContainer == this)
         return;
@@ -2004,8 +2004,11 @@
 
     // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called.
     LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint());
-    if (o->isBox() && o->style()->isFlippedBlocksWritingMode())
-        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint);
+    if (applyContainerFlip && o->isBox()) {
+        if (o->style()->isFlippedBlocksWritingMode())
+            transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint);
+        applyContainerFlip = DoNotApplyContainerFlip;
+    }
 
     LayoutSize columnOffset;
     o->adjustForColumns(columnOffset, roundedLayoutPoint(transformState.mappedPoint()));
@@ -2015,7 +2018,7 @@
     if (o->hasOverflowClip())
         transformState.move(-toRenderBox(o)->scrolledContentOffset());
 
-    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed);
+    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed);
 }
 
 const RenderObject* RenderObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to