[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

justin.garcia at apple.com justin.garcia at apple.com
Fri Jan 21 15:10:12 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 45164d4fc13e4d50ed375f4208a16115f6e28d8d
Author: justin.garcia at apple.com <justin.garcia at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 8 02:59:58 2011 +0000

    https://bugs.webkit.org/show_bug.cgi?id=51851
    Implement RenderSVGInlineText::localCaretRect()
    
    Reviewed by Dan Bernstein.
    
    WebCore:
    
    * rendering/svg/RenderSVGInlineText.cpp:
    (WebCore::RenderSVGInlineText::localCaretRect): Implemented.
    
    LayoutTests:
    
    * svg/text/caret-in-svg-text-expected.txt: Added.
    * svg/text/caret-in-svg-text.xhtml: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75308 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 41bb61d..803367f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-07  Justin Garcia  <justin.garcia at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51851
+        Implement RenderSVGInlineText::localCaretRect()
+
+        * svg/text/caret-in-svg-text-expected.txt: Added.
+        * svg/text/caret-in-svg-text.xhtml: Added.
+
 2011-01-06  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/svg/text/caret-in-svg-text-expected.txt b/LayoutTests/svg/text/caret-in-svg-text-expected.txt
new file mode 100644
index 0000000..ec7fd3d
--- /dev/null
+++ b/LayoutTests/svg/text/caret-in-svg-text-expected.txt
@@ -0,0 +1,7 @@
+Sheriff Woody
+שדגש
+
+Success
+Success
+Failure. Was: 20,546,0,18, expected: 58,546,0,18
+Failure. Was: 58,546,0,18, expected: 20,546,0,18
diff --git a/LayoutTests/svg/text/caret-in-svg-text.xhtml b/LayoutTests/svg/text/caret-in-svg-text.xhtml
new file mode 100644
index 0000000..c7b4c4f
--- /dev/null
+++ b/LayoutTests/svg/text/caret-in-svg-text.xhtml
@@ -0,0 +1,35 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body style="margin: 0px; ">
+  <div style="width: 400px; height: 100px;">
+    <svg xmlns="http://www.w3.org/2000/svg"> 
+        <text x="20" y="30"><tspan>Sheriff Woody</tspan></text>
+        <text x="20" y="50"><tspan>שדגש</tspan></text>
+    </svg>
+  </div>
+  <div id="log"></div>
+  <script>
+  function log(message) {
+    document.getElementById("log").innerText = document.getElementById("log").innerText + "\n" + message;
+  }
+  function assert(found, expected) {
+      if (found == expected)
+        log("Success");
+      else
+        log("Failure. Was: " + found + ", expected: " + expected);
+  }
+  if (window.layoutTestController) {
+    window.layoutTestController.dumpAsText();
+    // First offset, left edge, LTR text
+    assert(textInputController.firstRectForCharacterRange(0, 0), "20,566,0,18");
+    // Last offset, right edge, RTL text
+    assert(textInputController.firstRectForCharacterRange(13, 0), "114,566,0,18");
+
+    // FIXME: These edges are incorrect (although carets in the middle of RTL runs are correct).
+    // First offset, right edge, RTL text
+    assert(textInputController.firstRectForCharacterRange(14, 0), "58,546,0,18");
+    // Last offset, left edge, RTL text
+    assert(textInputController.firstRectForCharacterRange(18, 0), "20,546,0,18");
+  }
+  </script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0385faa..2795651 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-07  Justin Garcia  <justin.garcia at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51851
+        Implement RenderSVGInlineText::localCaretRect()
+
+        * rendering/svg/RenderSVGInlineText.cpp:
+        (WebCore::RenderSVGInlineText::localCaretRect): Implemented.
+
 2011-01-07  Ryosuke Niwa  <rniwa at webkit.org>
 
         Unreviewed; Added the missing null pointer check for r75293.
diff --git a/WebCore/rendering/svg/RenderSVGInlineText.cpp b/WebCore/rendering/svg/RenderSVGInlineText.cpp
index 49727ee..b791f3e 100644
--- a/WebCore/rendering/svg/RenderSVGInlineText.cpp
+++ b/WebCore/rendering/svg/RenderSVGInlineText.cpp
@@ -92,9 +92,25 @@ InlineTextBox* RenderSVGInlineText::createTextBox()
     return box;
 }
 
-IntRect RenderSVGInlineText::localCaretRect(InlineBox*, int, int*)
+IntRect RenderSVGInlineText::localCaretRect(InlineBox* box, int caretOffset, int*)
 {
-    return IntRect();
+    if (!box->isInlineTextBox())
+        return IntRect();
+
+    InlineTextBox* textBox = static_cast<InlineTextBox*>(box);
+    if (static_cast<unsigned>(caretOffset) < textBox->start() || static_cast<unsigned>(caretOffset) > textBox->start() + textBox->len())
+        return IntRect();
+
+    // Use the edge of the selection rect to determine the caret rect.
+    if (static_cast<unsigned>(caretOffset) < textBox->start() + textBox->len()) {
+        IntRect rect = textBox->selectionRect(0, 0, caretOffset, caretOffset + 1);
+        int x = box->isLeftToRightDirection() ? rect.x() : rect.right();
+        return IntRect(x, rect.y(), caretWidth, rect.height());
+    }
+
+    IntRect rect = textBox->selectionRect(0, 0, caretOffset - 1, caretOffset);
+    int x = box->isLeftToRightDirection() ? rect.right() : rect.x();
+    return IntRect(x, rect.y(), caretWidth, rect.height());
 }
 
 IntRect RenderSVGInlineText::linesBoundingBox() const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list