[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dbates at webkit.org dbates at webkit.org
Thu Apr 8 02:13:53 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit eff15e83694b56a5815191f7b188944951f5ef93
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 8 17:54:36 2010 +0000

    2010-03-08  Daniel Bates  <dbates at rim.com>
    
            Reviewed by Simon Fraser.
    
            https://bugs.webkit.org/show_bug.cgi?id=34819
    
            Fixes an issue where we repaint the caret rectangle even if the associated
            selection is not in a content editable element. This is extraneous since the
            caret is only visible when the selection is in a content editable element.
            Hence, we should only repaint the caret rectangle when the associated selection
            is in a content editable element.
    
            Note, we always paint the caret when caret browsing is enabled.
    
            Test: fast/repaint/no-caret-repaint-in-non-content-editable-element.html
    
            * editing/SelectionController.cpp:
            (WebCore::SelectionController::recomputeCaretRect): Modified to call method
            SelectionController::shouldRepaintCaret.
            (WebCore::SelectionController::shouldRepaintCaret): Added.
            (WebCore::SelectionController::invalidateCaretRect): Modified to call method
            SelectionController::shouldRepaintCaret.
            * editing/SelectionController.h:
    2010-03-08  Daniel Bates  <dbates at rim.com>
    
            Reviewed by Simon Fraser.
    
            https://bugs.webkit.org/show_bug.cgi?id=34819
    
            Tests that we do not repaint the caret rectangle when the associated selection is
            not in a content editable element.
    
            * fast/repaint/no-caret-repaint-in-non-content-editable-element.html: Added.
            * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum: Added.
            * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png: Added.
            * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55669 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9d94fb7..0e51907 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-03-08  Daniel Bates  <dbates at rim.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34819
+
+        Tests that we do not repaint the caret rectangle when the associated selection is
+        not in a content editable element.
+
+        * fast/repaint/no-caret-repaint-in-non-content-editable-element.html: Added.
+        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum: Added.
+        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png: Added.
+        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt: Added.
+
 2010-03-08  Shu Chang  <Chang.Shu at nokia.com>
 
         Reviewed by Holger Freyther.
diff --git a/LayoutTests/fast/repaint/no-caret-repaint-in-non-content-editable-element.html b/LayoutTests/fast/repaint/no-caret-repaint-in-non-content-editable-element.html
new file mode 100644
index 0000000..629c0f2
--- /dev/null
+++ b/LayoutTests/fast/repaint/no-caret-repaint-in-non-content-editable-element.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script src="resources/repaint.js"></script>
+<script>
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitEnableCaretBrowsing", false);
+function repaintTest()
+{
+    if (!window.eventSender)
+        return;
+
+    var target = document.getElementById("target");
+    eventSender.mouseMoveTo(target.offsetLeft, target.offsetTop);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+window.onload = runRepaintTest;
+</script>
+</head>
+<body>
+    <p>This tests that clicking on a non-content editable element does not cause a repaint of it in whole or in part.</p>
+    <p id="target">This element is not content editable.</p>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum
new file mode 100644
index 0000000..cf84b05
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum
@@ -0,0 +1 @@
+d215b9117c8b2194cb4d7ed412dbd055
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png
new file mode 100644
index 0000000..dacd150
Binary files /dev/null and b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt
new file mode 100644
index 0000000..02615d7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x576
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 663x18
+          text run at (0,0) width 663: "This tests that clicking on a non-content editable element does not cause a repaint of it in whole or in part."
+      RenderBlock {P} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 226x18
+          text run at (0,0) width 226: "This element is not content editable."
+caret: position 0 of child 0 {#text} of child 3 {P} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7118888..ebca4f2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-03-08  Daniel Bates  <dbates at rim.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34819
+
+        Fixes an issue where we repaint the caret rectangle even if the associated
+        selection is not in a content editable element. This is extraneous since the
+        caret is only visible when the selection is in a content editable element.
+        Hence, we should only repaint the caret rectangle when the associated selection
+        is in a content editable element.
+
+        Note, we always paint the caret when caret browsing is enabled.
+
+        Test: fast/repaint/no-caret-repaint-in-non-content-editable-element.html
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::recomputeCaretRect): Modified to call method
+        SelectionController::shouldRepaintCaret.
+        (WebCore::SelectionController::shouldRepaintCaret): Added.
+        (WebCore::SelectionController::invalidateCaretRect): Modified to call method
+        SelectionController::shouldRepaintCaret.
+        * editing/SelectionController.h:
+
 2010-03-08  Eric Carlson  <eric.carlson at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 25982d4..f0c4d54 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -973,12 +973,21 @@ bool SelectionController::recomputeCaretRect()
     if (RenderView* view = toRenderView(m_frame->document()->renderer())) {
         // FIXME: make caret repainting container-aware.
         view->repaintRectangleInViewAndCompositedLayers(oldAbsoluteCaretRepaintBounds, false);
-        view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);
+        if (shouldRepaintCaret(view))
+            view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);
     }
 
     return true;
 }
 
+bool SelectionController::shouldRepaintCaret(const RenderView* view) const
+{
+    ASSERT(view);
+    Frame* frame = view->frameView() ? view->frameView()->frame() : 0; // The frame where the selection started.
+    bool caretBrowsing = frame && frame->settings() && frame->settings()->caretBrowsingEnabled();
+    return (caretBrowsing || isContentEditable());
+}
+
 void SelectionController::invalidateCaretRect()
 {
     if (!isCaret())
@@ -1004,7 +1013,8 @@ void SelectionController::invalidateCaretRect()
     m_needsLayout = true;
 
     if (!caretRectChanged) {
-        if (RenderView* view = toRenderView(d->renderer()))
+        RenderView* view = toRenderView(d->renderer());
+        if (view && shouldRepaintCaret(view))
             view->repaintRectangleInViewAndCompositedLayers(caretRepaintRect(), false);
     }
 }
diff --git a/WebCore/editing/SelectionController.h b/WebCore/editing/SelectionController.h
index 6849cb6..8521df0 100644
--- a/WebCore/editing/SelectionController.h
+++ b/WebCore/editing/SelectionController.h
@@ -37,6 +37,7 @@ namespace WebCore {
 class Frame;
 class GraphicsContext;
 class RenderObject;
+class RenderView;
 class VisiblePosition;
 
 class SelectionController : public Noncopyable {
@@ -155,6 +156,7 @@ private:
 
     void layout();
     IntRect caretRepaintRect() const;
+    bool shouldRepaintCaret(const RenderView* view) const;
 
     int xPosForVerticalArrowNavigation(EPositionType);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list