Title: [152554] trunk
Revision
152554
Author
[email protected]
Date
2013-07-10 16:56:42 -0700 (Wed, 10 Jul 2013)

Log Message

Range.getClientRects() not working correctly for partially contained vertically styled text nodes
<rdar://problem/14305675>
https://bugs.webkit.org/show_bug.cgi?id=118447

Reviewed by David Hyatt.

Source/WebCore: 

Original patch by Mac Murrett, tweaked by me.

Test: fast/dom/Range/getClientRects-vertical.html

* rendering/RenderText.cpp:
(WebCore::localQuadForTextBox):
Use the physical accessors rather than the logical ones to get the correct metrics.

LayoutTests: 

* fast/dom/Range/getClientRects-vertical-expected.txt: Added.
* fast/dom/Range/getClientRects-vertical.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152553 => 152554)


--- trunk/LayoutTests/ChangeLog	2013-07-10 23:48:35 UTC (rev 152553)
+++ trunk/LayoutTests/ChangeLog	2013-07-10 23:56:42 UTC (rev 152554)
@@ -1,3 +1,14 @@
+2013-07-10  Sam Weinig  <[email protected]>
+
+        Range.getClientRects() not working correctly for partially contained vertically styled text nodes
+        <rdar://problem/14305675>
+        https://bugs.webkit.org/show_bug.cgi?id=118447
+
+        Reviewed by David Hyatt.
+
+        * fast/dom/Range/getClientRects-vertical-expected.txt: Added.
+        * fast/dom/Range/getClientRects-vertical.html: Added.
+
 2013-07-10  Eric Carlson  <[email protected]>
 
         [Mac] every enabled text track should be listed in the track menu

Added: trunk/LayoutTests/fast/dom/Range/getClientRects-vertical-expected.txt (0 => 152554)


--- trunk/LayoutTests/fast/dom/Range/getClientRects-vertical-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/getClientRects-vertical-expected.txt	2013-07-10 23:56:42 UTC (rev 152554)
@@ -0,0 +1,10 @@
+This tests that Range.getClientRects() work correctly for partially selected vertical text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS range1.getClientRects()[0].width is range2.getClientRects()[0].width
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Range/getClientRects-vertical.html (0 => 152554)


--- trunk/LayoutTests/fast/dom/Range/getClientRects-vertical.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/getClientRects-vertical.html	2013-07-10 23:56:42 UTC (rev 152554)
@@ -0,0 +1,41 @@
+<html>
+  <head>
+    <script src=""
+    <style>
+        .test { -webkit-writing-mode: vertical-lr; }
+    </style>
+    </script>
+    </head>
+    <body>
+        <div id="testarea">
+            <p>
+                <div class="test" id="test1">Hello</div>
+            </p>
+            <p>
+                <div class="test" id="test2">Hello</div>
+            </p>
+        </div>
+        <script> 
+            description("This tests that Range.getClientRects() work correctly for partially selected vertical text.")
+            
+            // Select a whole element's worth of text.
+            var range1 = document.createRange();
+            range1.selectNodeContents(document.getElementById("test1").firstChild);
+
+
+            // Select slightly less than a whole elements worth of text.
+            var range2 = document.createRange();
+            range2.selectNodeContents(document.getElementById("test2").firstChild);
+            range2.setEnd(range2.endContainer, range2.endOffset - 1);
+
+            // They should have the same width.
+            shouldBe("range1.getClientRects()[0].width", "range2.getClientRects()[0].width");
+
+
+            // Cleanup
+            var testarea = document.getElementById("testarea");
+            testarea.parentNode.removeChild(testarea);
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (152553 => 152554)


--- trunk/Source/WebCore/ChangeLog	2013-07-10 23:48:35 UTC (rev 152553)
+++ trunk/Source/WebCore/ChangeLog	2013-07-10 23:56:42 UTC (rev 152554)
@@ -1,3 +1,19 @@
+2013-07-10  Sam Weinig  <[email protected]>
+
+        Range.getClientRects() not working correctly for partially contained vertically styled text nodes
+        <rdar://problem/14305675>
+        https://bugs.webkit.org/show_bug.cgi?id=118447
+
+        Reviewed by David Hyatt.
+
+        Original patch by Mac Murrett, tweaked by me.
+
+        Test: fast/dom/Range/getClientRects-vertical.html
+
+        * rendering/RenderText.cpp:
+        (WebCore::localQuadForTextBox):
+        Use the physical accessors rather than the logical ones to get the correct metrics.
+
 2013-07-10  Christophe Dumez  <[email protected]>
 
         Reduce number of header includes in SVG

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (152553 => 152554)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2013-07-10 23:48:35 UTC (rev 152553)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2013-07-10 23:56:42 UTC (rev 152554)
@@ -331,10 +331,10 @@
             // Change the height and y position (or width and x for vertical text)
             // because selectionRect uses selection-specific values.
             if (box->isHorizontal()) {
-                r.setHeight(box->logicalHeight());
+                r.setHeight(box->height());
                 r.setY(box->y());
             } else {
-                r.setWidth(box->logicalWidth());
+                r.setWidth(box->width());
                 r.setX(box->x());
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to