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

darin at apple.com darin at apple.com
Thu Apr 8 01:04:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 077495ff3f12c90996ed60d66814f0eeaebee087
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 01:01:12 2010 +0000

    Move more of the selection and caret painting code from Frame to SelectionController.
    https://bugs.webkit.org/show_bug.cgi?id=33619
    
    Reviewed by Dan Bernstein.
    
    WebCore:
    
    Helpful preparation step for a bug fix I am working on.
    
    * editing/SelectionController.cpp:
    (WebCore::SelectionController::SelectionController): Initialize new data members.
    Note that m_caretVisible starts as true for the drag caret controller to match the
    old behavior for painting.
    (WebCore::SelectionController::setSelection): Changed to call selectionLayoutChanged
    in its new name and location.
    (WebCore::SelectionController::paintCaret): Added checks that were formerly done
    at the Frame level. Tweaked formatting and changed to use early return as well.
    (WebCore::SelectionController::focusedOrActiveStateChanged): Updated for call
    moved into this class.
    (WebCore::SelectionController::updateAppearance): Moved the
    Frame::selectionLayoutChanged function here. Had to rename it because the word
    "layout" is usedfor other purposes in this function.
    (WebCore::SelectionController::setCaretVisible): Moved here from Frame.
    (WebCore::SelectionController::clearCaretRectIfNeeded): Ditto.
    (WebCore::SelectionController::caretBlinkTimerFired): Ditto.
    
    * editing/SelectionController.h: Added new functions. Moved conditional function
    out of class definition for clarity. Removed unneeded == and != operators.
    Removed unneeded use of bit fields.
    
    * page/Frame.cpp: Moved functions to SelectionController.
    (WebCore::Frame::Frame): Removed initialization of moved data members.
    
    * page/Frame.h: Removed things moved to SelectionController as well as unneeded
    forward declaration of Timer class template.
    
    * page/FrameView.cpp:
    (WebCore::FrameView::layout): Updated for new location of function.
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::paintCaret): Ditto.
    
    WebKit/qt:
    
    * Api/qwebpage.cpp:
    (QWebPagePrivate::inputMethodEvent): Seems possibly wrong to be directly invoking this
    setCaretVisible here, but I updated it to call it in its new location.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d163aab..3464813 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2010-01-13  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Move more of the selection and caret painting code from Frame to SelectionController.
+        https://bugs.webkit.org/show_bug.cgi?id=33619
+
+        Helpful preparation step for a bug fix I am working on.
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::SelectionController): Initialize new data members.
+        Note that m_caretVisible starts as true for the drag caret controller to match the
+        old behavior for painting.
+        (WebCore::SelectionController::setSelection): Changed to call selectionLayoutChanged
+        in its new name and location.
+        (WebCore::SelectionController::paintCaret): Added checks that were formerly done
+        at the Frame level. Tweaked formatting and changed to use early return as well.
+        (WebCore::SelectionController::focusedOrActiveStateChanged): Updated for call
+        moved into this class.
+        (WebCore::SelectionController::updateAppearance): Moved the
+        Frame::selectionLayoutChanged function here. Had to rename it because the word
+        "layout" is usedfor other purposes in this function.
+        (WebCore::SelectionController::setCaretVisible): Moved here from Frame.
+        (WebCore::SelectionController::clearCaretRectIfNeeded): Ditto.
+        (WebCore::SelectionController::caretBlinkTimerFired): Ditto.
+
+        * editing/SelectionController.h: Added new functions. Moved conditional function
+        out of class definition for clarity. Removed unneeded == and != operators.
+        Removed unneeded use of bit fields.
+
+        * page/Frame.cpp: Moved functions to SelectionController.
+        (WebCore::Frame::Frame): Removed initialization of moved data members.
+
+        * page/Frame.h: Removed things moved to SelectionController as well as unneeded
+        forward declaration of Timer class template.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout): Updated for new location of function.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintCaret): Ditto.
+
 2010-01-13  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 518df45..5b2d0d0 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,6 +47,7 @@
 #include "Range.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
+#include "Settings.h"
 #include "TextIterator.h"
 #include "TypingCommand.h"
 #include "htmlediting.h"
@@ -64,12 +65,15 @@ const int NoXPosForVerticalArrowNavigation = INT_MIN;
 SelectionController::SelectionController(Frame* frame, bool isDragCaretController)
     : m_frame(frame)
     , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation)
+    , m_caretBlinkTimer(this, &SelectionController::caretBlinkTimerFired)
     , m_needsLayout(true)
     , m_absCaretBoundsDirty(true)
     , m_lastChangeWasHorizontalExtension(false)
     , m_isDragCaretController(isDragCaretController)
     , m_isCaretBlinkingSuspended(false)
     , m_focused(frame && frame->page() && frame->page()->focusController()->focusedFrame() == frame)
+    , m_caretVisible(isDragCaretController)
+    , m_caretPaint(true)
 {
 }
 
@@ -145,7 +149,8 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi
     if (!s.isNone())
         m_frame->setFocusedNodeIfNeeded();
     
-    m_frame->selectionLayoutChanged();
+    updateAppearance();
+
     // Always clear the x position used for vertical arrow navigation.
     // It will be restored by the vertical arrow navigation code if necessary.
     m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation;
@@ -981,28 +986,32 @@ void SelectionController::invalidateCaretRect()
     }
 }
 
-void SelectionController::paintCaret(GraphicsContext* p, int tx, int ty, const IntRect& clipRect)
+void SelectionController::paintCaret(GraphicsContext* context, int tx, int ty, const IntRect& clipRect)
 {
-    if (! m_selection.isCaret())
+#if ENABLE(TEXT_CARET)
+    if (!m_caretVisible)
+        return;
+    if (!m_caretPaint)
+        return;
+    if (!m_selection.isCaret())
         return;
-
-    if (m_needsLayout)
-        layout();
 
     IntRect drawingRect = localCaretRect();
     drawingRect.move(tx, ty);
     IntRect caret = intersection(drawingRect, clipRect);
-    if (!caret.isEmpty()) {
-        Color caretColor = Color::black;
-        ColorSpace colorSpace = DeviceColorSpace;
-        Element* element = rootEditableElement();
-        if (element && element->renderer()) {
-            caretColor = element->renderer()->style()->color();
-            colorSpace = element->renderer()->style()->colorSpace();
-        }
+    if (caret.isEmpty())
+        return;
 
-        p->fillRect(caret, caretColor, colorSpace);
+    Color caretColor = Color::black;
+    ColorSpace colorSpace = DeviceColorSpace;
+    Element* element = rootEditableElement();
+    if (element && element->renderer()) {
+        caretColor = element->renderer()->style()->color();
+        colorSpace = element->renderer()->style()->colorSpace();
     }
+
+    context->fillRect(caret, caretColor, colorSpace);
+#endif
 }
 
 void SelectionController::debugRenderer(RenderObject *r, bool selected) const
@@ -1262,7 +1271,7 @@ void SelectionController::focusedOrActiveStateChanged()
     // Caret appears in the active frame.
     if (activeAndFocused)
         m_frame->setSelectionFromNone();
-    m_frame->setCaretVisible(activeAndFocused);
+    setCaretVisible(activeAndFocused);
 
     // Update for caps lock state
     m_frame->eventHandler()->capsLockStateMayHaveChanged();
@@ -1301,6 +1310,100 @@ bool SelectionController::isFocusedAndActive() const
     return m_focused && m_frame->page() && m_frame->page()->focusController()->isActive();
 }
 
+void SelectionController::updateAppearance()
+{
+    ASSERT(!m_isDragCaretController);
+
+#if ENABLE(TEXT_CARET)
+    bool caretRectChanged = recomputeCaretRect();
+
+    bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+    bool shouldBlink = m_caretVisible
+        && isCaret() && (isContentEditable() || caretBrowsing);
+
+    // If the caret moved, stop the blink timer so we can restart with a
+    // black caret in the new location.
+    if (caretRectChanged || !shouldBlink)
+        m_caretBlinkTimer.stop();
+
+    // Start blinking with a black caret. Be sure not to restart if we're
+    // already blinking in the right location.
+    if (shouldBlink && !m_caretBlinkTimer.isActive()) {
+        if (double blinkInterval = m_frame->page()->theme()->caretBlinkInterval())
+            m_caretBlinkTimer.startRepeating(blinkInterval);
+
+        if (!m_caretPaint) {
+            m_caretPaint = true;
+            invalidateCaretRect();
+        }
+    }
+#endif
+
+    RenderView* view = m_frame->contentRenderer();
+    if (!view)
+        return;
+
+    VisibleSelection selection = this->selection();
+
+    if (!selection.isRange()) {
+        view->clearSelection();
+        return;
+    }
+
+    // Use the rightmost candidate for the start of the selection, and the leftmost candidate for the end of the selection.
+    // Example: foo <a>bar</a>.  Imagine that a line wrap occurs after 'foo', and that 'bar' is selected.   If we pass [foo, 3]
+    // as the start of the selection, the selection painting code will think that content on the line containing 'foo' is selected
+    // and will fill the gap before 'bar'.
+    Position startPos = selection.start();
+    Position candidate = startPos.downstream();
+    if (candidate.isCandidate())
+        startPos = candidate;
+    Position endPos = selection.end();
+    candidate = endPos.upstream();
+    if (candidate.isCandidate())
+        endPos = candidate;
+
+    // We can get into a state where the selection endpoints map to the same VisiblePosition when a selection is deleted
+    // because we don't yet notify the SelectionController of text removal.
+    if (startPos.isNotNull() && endPos.isNotNull() && selection.visibleStart() != selection.visibleEnd()) {
+        RenderObject* startRenderer = startPos.node()->renderer();
+        RenderObject* endRenderer = endPos.node()->renderer();
+        view->setSelection(startRenderer, startPos.deprecatedEditingOffset(), endRenderer, endPos.deprecatedEditingOffset());
+    }
+}
+
+void SelectionController::setCaretVisible(bool flag)
+{
+    if (m_caretVisible == flag)
+        return;
+    clearCaretRectIfNeeded();
+    m_caretVisible = flag;
+    updateAppearance();
+}
+
+void SelectionController::clearCaretRectIfNeeded()
+{
+#if ENABLE(TEXT_CARET)
+    if (!m_caretPaint)
+        return;
+    m_caretPaint = false;
+    invalidateCaretRect();
+#endif
+}
+
+void SelectionController::caretBlinkTimerFired(Timer<SelectionController>*)
+{
+#if ENABLE(TEXT_CARET)
+    ASSERT(m_caretVisible);
+    ASSERT(isCaret());
+    bool caretPaint = m_caretPaint;
+    if (isCaretBlinkingSuspended() && caretPaint)
+        return;
+    m_caretPaint = !caretPaint;
+    invalidateCaretRect();
+#endif
+}
+
 #ifndef NDEBUG
 
 void SelectionController::formatForDebugger(char* buffer, unsigned length) const
diff --git a/WebCore/editing/SelectionController.h b/WebCore/editing/SelectionController.h
index d03df52..7cad435 100644
--- a/WebCore/editing/SelectionController.h
+++ b/WebCore/editing/SelectionController.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
 
 #include "IntRect.h"
 #include "Range.h"
+#include "Timer.h"
 #include "VisibleSelection.h"
 #include <wtf/Noncopyable.h>
 
@@ -110,6 +111,8 @@ public:
     
     void nodeWillBeRemoved(Node*);
 
+    void setCaretVisible(bool = true);
+    void clearCaretRectIfNeeded();
     bool recomputeCaretRect(); // returns true if caret rect moved
     void invalidateCaretRect();
     void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect);
@@ -124,6 +127,9 @@ public:
     bool isFocusedAndActive() const;
     void pageActivationChanged();
 
+    // Painting.
+    void updateAppearance();
+
 #ifndef NDEBUG
     void formatForDebugger(char* buffer, unsigned length) const;
     void showTreeForThis() const;
@@ -148,44 +154,42 @@ private:
 
     int xPosForVerticalArrowNavigation(EPositionType);
     
-#if PLATFORM(MAC) || PLATFORM(GTK)
     void notifyAccessibilityForSelectionChange();
-#else
-    void notifyAccessibilityForSelectionChange() {};
-#endif
 
     void focusedOrActiveStateChanged();
     bool caretRendersInsideNode(Node*) const;
     
     IntRect absoluteBoundsForLocalRect(const IntRect&) const;
 
+    void caretBlinkTimerFired(Timer<SelectionController>*);
+
     Frame* m_frame;
+
     int m_xPosForVerticalArrowNavigation;
 
     VisibleSelection m_selection;
 
-    IntRect m_caretRect;        // caret rect in coords local to the renderer responsible for painting the caret
-    IntRect m_absCaretBounds;   // absolute bounding rect for the caret
+    Timer<SelectionController> m_caretBlinkTimer;
+
+    IntRect m_caretRect; // caret rect in coords local to the renderer responsible for painting the caret
+    IntRect m_absCaretBounds; // absolute bounding rect for the caret
     IntRect m_absoluteCaretRepaintBounds;
     
-    bool m_needsLayout : 1;       // true if the caret and expectedVisible rectangles need to be calculated
-    bool m_absCaretBoundsDirty: 1;
-    bool m_lastChangeWasHorizontalExtension : 1;
-    bool m_isDragCaretController : 1;
-    bool m_isCaretBlinkingSuspended : 1;
-    bool m_focused : 1;
-
+    bool m_needsLayout; // true if m_caretRect and m_absCaretBounds need to be calculated
+    bool m_absCaretBoundsDirty;
+    bool m_lastChangeWasHorizontalExtension;
+    bool m_isDragCaretController;
+    bool m_isCaretBlinkingSuspended;
+    bool m_focused;
+    bool m_caretVisible;
+    bool m_caretPaint;
 };
 
-inline bool operator==(const SelectionController& a, const SelectionController& b)
+#if !(PLATFORM(MAC) || PLATFORM(GTK))
+inline void SelectionController::notifyAccessibilityForSelectionChange()
 {
-    return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity();
-}
-
-inline bool operator!=(const SelectionController& a, const SelectionController& b)
-{
-    return !(a == b);
 }
+#endif
 
 } // namespace WebCore
 
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 18bc3bf..77f06ca 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -133,7 +133,6 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
     , m_script(this)
     , m_selectionGranularity(CharacterGranularity)
     , m_selectionController(this)
-    , m_caretBlinkTimer(this, &Frame::caretBlinkTimerFired)
     , m_editor(this)
     , m_eventHandler(this)
     , m_animationController(this)
@@ -141,8 +140,6 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
 #if ENABLE(ORIENTATION_EVENTS)
     , m_orientation(0)
 #endif
-    , m_caretVisible(false)
-    , m_caretPaint(true)
     , m_highlightTextMatches(false)
     , m_inViewSourceMode(false)
     , m_needsReapplyStyles(false)
@@ -557,25 +554,6 @@ void Frame::notifyRendererOfSelectionChange(bool userTriggered)
         toRenderTextControl(renderer)->selectionChanged(userTriggered);
 }
 
-void Frame::setCaretVisible(bool flag)
-{
-    if (m_caretVisible == flag)
-        return;
-    clearCaretRectIfNeeded();
-    m_caretVisible = flag;
-    selectionLayoutChanged();
-}
-
-void Frame::clearCaretRectIfNeeded()
-{
-#if ENABLE(TEXT_CARET)
-    if (m_caretPaint) {
-        m_caretPaint = false;
-        selection()->invalidateCaretRect();
-    }
-#endif
-}
-
 // Helper function that tells whether a particular node is an element that has an entire
 // Frame and FrameView, a <frame>, <iframe>, or <object>.
 static bool isFrameElement(const Node *n)
@@ -628,89 +606,6 @@ void Frame::setFocusedNodeIfNeeded()
         page()->focusController()->setFocusedNode(0, this);
 }
 
-void Frame::selectionLayoutChanged()
-{
-    bool caretRectChanged = selection()->recomputeCaretRect();
-
-#if ENABLE(TEXT_CARET)
-    bool caretBrowsing = settings() && settings()->caretBrowsingEnabled();
-    bool shouldBlink = m_caretVisible
-        && selection()->isCaret() && (selection()->isContentEditable() || caretBrowsing);
-
-    // If the caret moved, stop the blink timer so we can restart with a
-    // black caret in the new location.
-    if (caretRectChanged || !shouldBlink)
-        m_caretBlinkTimer.stop();
-
-    // Start blinking with a black caret. Be sure not to restart if we're
-    // already blinking in the right location.
-    if (shouldBlink && !m_caretBlinkTimer.isActive()) {
-        if (double blinkInterval = page()->theme()->caretBlinkInterval())
-            m_caretBlinkTimer.startRepeating(blinkInterval);
-
-        if (!m_caretPaint) {
-            m_caretPaint = true;
-            selection()->invalidateCaretRect();
-        }
-    }
-#else
-    if (!caretRectChanged)
-        return;
-#endif
-
-    RenderView* view = contentRenderer();
-    if (!view)
-        return;
-
-    VisibleSelection selection = this->selection()->selection();
-
-    if (!selection.isRange())
-        view->clearSelection();
-    else {
-        // Use the rightmost candidate for the start of the selection, and the leftmost candidate for the end of the selection.
-        // Example: foo <a>bar</a>.  Imagine that a line wrap occurs after 'foo', and that 'bar' is selected.   If we pass [foo, 3]
-        // as the start of the selection, the selection painting code will think that content on the line containing 'foo' is selected
-        // and will fill the gap before 'bar'.
-        Position startPos = selection.start();
-        Position candidate = startPos.downstream();
-        if (candidate.isCandidate())
-            startPos = candidate;
-        Position endPos = selection.end();
-        candidate = endPos.upstream();
-        if (candidate.isCandidate())
-            endPos = candidate;
-
-        // We can get into a state where the selection endpoints map to the same VisiblePosition when a selection is deleted
-        // because we don't yet notify the SelectionController of text removal.
-        if (startPos.isNotNull() && endPos.isNotNull() && selection.visibleStart() != selection.visibleEnd()) {
-            RenderObject *startRenderer = startPos.node()->renderer();
-            RenderObject *endRenderer = endPos.node()->renderer();
-            view->setSelection(startRenderer, startPos.deprecatedEditingOffset(), endRenderer, endPos.deprecatedEditingOffset());
-        }
-    }
-}
-
-void Frame::caretBlinkTimerFired(Timer<Frame>*)
-{
-#if ENABLE(TEXT_CARET)
-    ASSERT(m_caretVisible);
-    ASSERT(selection()->isCaret());
-    bool caretPaint = m_caretPaint;
-    if (selection()->isCaretBlinkingSuspended() && caretPaint)
-        return;
-    m_caretPaint = !caretPaint;
-    selection()->invalidateCaretRect();
-#endif
-}
-
-void Frame::paintCaret(GraphicsContext* p, int tx, int ty, const IntRect& clipRect) const
-{
-#if ENABLE(TEXT_CARET)
-    if (m_caretPaint && m_caretVisible)
-        selection()->paintCaret(p, tx, ty, clipRect);
-#endif
-}
-
 void Frame::paintDragCaret(GraphicsContext* p, int tx, int ty, const IntRect& clipRect) const
 {
 #if ENABLE(TEXT_CARET)
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index a2478be..6940fc8 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -63,8 +63,6 @@ namespace WebCore {
     class HTMLTableCellElement;
     class RegularExpression;
 
-    template <typename T> class Timer;
-
     class Frame : public RefCounted<Frame> {
     public:
         static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
@@ -236,13 +234,9 @@ namespace WebCore {
 
         bool shouldChangeSelection(const VisibleSelection&) const;
         bool shouldDeleteSelection(const VisibleSelection&) const;
-        void clearCaretRectIfNeeded();
         void setFocusedNodeIfNeeded();
-        void selectionLayoutChanged();
         void notifyRendererOfSelectionChange(bool userTriggered);
 
-        void setCaretVisible(bool = true);
-        void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
         void paintDragCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
 
         bool isContentEditable() const; // if true, everything in frame is editable
@@ -264,10 +258,6 @@ namespace WebCore {
 
         void setUseSecureKeyboardEntry(bool);
 
-    private:
-        void caretBlinkTimerFired(Timer<Frame>*);
-
-    public:
         SelectionController* dragCaretController() const;
 
         String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
@@ -337,7 +327,6 @@ namespace WebCore {
 
         mutable SelectionController m_selectionController;
         mutable VisibleSelection m_mark;
-        Timer<Frame> m_caretBlinkTimer;
         mutable Editor m_editor;
         mutable EventHandler m_eventHandler;
         mutable AnimationController m_animationController;
@@ -349,9 +338,6 @@ namespace WebCore {
 #if ENABLE(ORIENTATION_EVENTS)
         int m_orientation;
 #endif
-        
-        bool m_caretVisible;
-        bool m_caretPaint;
 
         bool m_highlightTextMatches;
         bool m_inViewSourceMode;
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index a9b2b9e..86e13a7 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -690,7 +690,7 @@ void FrameView::layout(bool allowSubtree)
     m_layoutRoot = 0;
 
     m_frame->selection()->setNeedsLayout();
-    m_frame->selectionLayoutChanged();
+    m_frame->selection()->updateAppearance();
    
     m_layoutSchedulingEnabled = true;
 
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index fc714cd..7a2ff9c 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1679,7 +1679,7 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType typ
         offsetForContents(tx, ty);
 
         if (type == CursorCaret)
-            document()->frame()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect);
+            document()->frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect);
         else
             document()->frame()->paintDragCaret(paintInfo.context, tx, ty, paintInfo.rect);
     }
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 2147eab..598d7d6 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -1236,7 +1236,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
             break;
         }
         case QInputMethodEvent::Cursor: {
-            frame->setCaretVisible(a.length); //if length is 0 cursor is invisible
+            frame->selection()->setCaretVisible(a.length); //if length is 0 cursor is invisible
             if (a.length > 0) {
                 RenderObject* caretRenderer = frame->selection()->caretRenderer();
                 if (caretRenderer) {
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index a5733da..4f9bcc5 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-13  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Move more of the selection and caret painting code from Frame to SelectionController.
+        https://bugs.webkit.org/show_bug.cgi?id=33619
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::inputMethodEvent): Seems possibly wrong to be directly invoking this
+        setCaretVisible here, but I updated it to call it in its new location.
+
 2010-01-11  Simon Hausmann  <simon.hausmann at nokia.com>
 
         Reviewed by Holger Freyther.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list