Title: [153725] trunk
Revision
153725
Author
a...@apple.com
Date
2013-08-05 14:56:15 -0700 (Mon, 05 Aug 2013)

Log Message

        <rdar://problem/14637103> REGRESSION (r153060?): Microphone appears in the way
        of text when dictating an e-mail
        https://bugs.webkit.org/show_bug.cgi?id=119496

        Reviewed by Ryosuke Niwa.

        Test: platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html

        * rendering/RenderObject.cpp: (WebCore::RenderObject::absoluteBoundingBoxRectForRange):
        FloatRect::unite() doesn't preserve empty rects, which we need here.
        We alrady handle the case of collapsed range in Editor::firstRectForRange(), and
        this is similar, but we can't currently cover both with one simple fix.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153724 => 153725)


--- trunk/LayoutTests/ChangeLog	2013-08-05 21:26:25 UTC (rev 153724)
+++ trunk/LayoutTests/ChangeLog	2013-08-05 21:56:15 UTC (rev 153725)
@@ -1,3 +1,17 @@
+2013-08-05  Alexey Proskuryakov  <a...@apple.com>
+
+        <rdar://problem/14637103> REGRESSION (r153060?): Microphone appears in the way
+        of text when dictating an e-mail
+        https://bugs.webkit.org/show_bug.cgi?id=119496
+
+        Reviewed by Ryosuke Niwa.
+
+        * platform/mac/editing/input/firstrectforcharacterrange-caret-in-br-expected.txt: Added.
+        * platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html: Added.
+
+        * platform/wk2/TestExpectations: textInputController.firstRectForCharacterRange is
+        not available in WTR.
+
 2013-08-05  Morten Stenshorne  <msten...@opera.com>
 
         Region based columns not painted correctly in non-default writing-modes

Added: trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br-expected.txt (0 => 153725)


--- trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br-expected.txt	2013-08-05 21:56:15 UTC (rev 153725)
@@ -0,0 +1,9 @@
+PASS xLocation > 0 is true
+PASS width is 0
+PASS height > 10 is true
+PASS height < 30 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
Property changes on: trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Added: trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html (0 => 153725)


--- trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html	2013-08-05 21:56:15 UTC (rev 153725)
@@ -0,0 +1,32 @@
+<head>
+<script src=""
+</head>
+<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">a
+<div><br></div>
+<script>
+document.designMode='on';
+window.getSelection().setPosition(document.body, 2);
+
+if (window.textInputController) {
+    var firstRect = textInputController.firstRectForCharacterRange(2, 1);
+
+    // This should be a reasonable rect for a caret.
+    var xLocation = firstRect[0];
+    var width = firstRect[2];
+    var height = firstRect[3];
+    shouldBeTrue("xLocation > 0");
+    shouldBe("width", "0");
+    shouldBeTrue("height > 10");
+    shouldBeTrue("height < 30");
+
+    // Delete test data for nicer output.
+    document.execCommand("Delete");
+    document.execCommand("Delete");
+} else {
+    debug("To test manually, invoke Dictation. Its popover should be positioned reasonably.");
+}
+</script>
+<div id=result></div>
+</body>
+<script src=""
+</html>
Property changes on: trunk/LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html
___________________________________________________________________

Added: svn:mime-type

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (153724 => 153725)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-05 21:26:25 UTC (rev 153724)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-05 21:56:15 UTC (rev 153725)
@@ -125,6 +125,7 @@
 platform/mac/editing/input/5576619.html
 platform/mac/editing/input/bold-node.html
 platform/mac/editing/input/caret-primary-bidi.html
+platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html
 platform/mac/editing/input/firstrectforcharacterrange-plain.html
 platform/mac/editing/input/firstrectforcharacterrange-styled.html
 platform/mac/editing/input/firstrectforcharacterrange-vertical.html

Modified: trunk/Source/WebCore/ChangeLog (153724 => 153725)


--- trunk/Source/WebCore/ChangeLog	2013-08-05 21:26:25 UTC (rev 153724)
+++ trunk/Source/WebCore/ChangeLog	2013-08-05 21:56:15 UTC (rev 153725)
@@ -1,3 +1,18 @@
+2013-08-05  Alexey Proskuryakov  <a...@apple.com>
+
+        <rdar://problem/14637103> REGRESSION (r153060?): Microphone appears in the way
+        of text when dictating an e-mail
+        https://bugs.webkit.org/show_bug.cgi?id=119496
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: platform/mac/editing/input/firstrectforcharacterrange-caret-in-br.html
+
+        * rendering/RenderObject.cpp: (WebCore::RenderObject::absoluteBoundingBoxRectForRange):
+        FloatRect::unite() doesn't preserve empty rects, which we need here.
+        We alrady handle the case of collapsed range in Editor::firstRectForRange(), and
+        this is similar, but we can't currently cover both with one simple fix.
+
 2013-08-05  Morten Stenshorne  <msten...@opera.com>
 
         Region based columns not painted correctly in non-default writing-modes

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (153724 => 153725)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2013-08-05 21:26:25 UTC (rev 153724)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2013-08-05 21:56:15 UTC (rev 153725)
@@ -1243,10 +1243,13 @@
     Vector<FloatQuad> quads;
     range->textQuads(quads);
 
-    FloatRect result;
-    for (size_t i = 0; i < quads.size(); ++i)
-        result.unite(quads[i].boundingBox());
+    if (quads.isEmpty())
+        return FloatRect();
 
+    FloatRect result = quads[0].boundingBox();
+    for (size_t i = 1; i < quads.size(); ++i)
+        result.uniteEvenIfEmpty(quads[i].boundingBox());
+
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to