[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 12:21:52 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 408f1fc59b16a421c7f3c2b7010bfe81007a27b1
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 00:40:14 2010 +0000

    2010-08-19  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Sam Weinig.
    
            Clean up some selection code
            https://bugs.webkit.org/show_bug.cgi?id=44314
    
            Change the concept of "layout" in SelectionController to "updateCaretRect", renaming
            methods accordingly.
    
            Move selection and printing methods in RenderView.h into groups.
    
            No behavioral changes.
    
            * editing/SelectionController.cpp:
            (WebCore::SelectionController::SelectionController):
            (WebCore::SelectionController::setSelection):
            (WebCore::SelectionController::modify):
            (WebCore::SelectionController::setCaretRectNeedsUpdate):
            (WebCore::SelectionController::updateCaretRect):
            (WebCore::SelectionController::localCaretRect):
            (WebCore::SelectionController::recomputeCaretRect): Test m_caretRectNeedsUpdate first.
            (WebCore::SelectionController::invalidateCaretRect):
            * editing/SelectionController.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::layout):
            * rendering/RenderLayer.cpp:
            (WebCore::RenderLayer::scrollToOffset):
            * rendering/RenderView.h:
            (WebCore::RenderView::selectionStart):
            (WebCore::RenderView::selectionEnd):
            (WebCore::RenderView::printRect):
            (WebCore::RenderView::setPrintRect):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65716 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bdd7a8a..d0108e8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -269,6 +269,40 @@
 
 2010-08-19  Simon Fraser  <simon.fraser at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Clean up some selection code
+        https://bugs.webkit.org/show_bug.cgi?id=44314
+        
+        Change the concept of "layout" in SelectionController to "updateCaretRect", renaming
+        methods accordingly.
+        
+        Move selection and printing methods in RenderView.h into groups.
+
+        No behavioral changes.
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::SelectionController):
+        (WebCore::SelectionController::setSelection):
+        (WebCore::SelectionController::modify):
+        (WebCore::SelectionController::setCaretRectNeedsUpdate):
+        (WebCore::SelectionController::updateCaretRect):
+        (WebCore::SelectionController::localCaretRect):
+        (WebCore::SelectionController::recomputeCaretRect): Test m_caretRectNeedsUpdate first.
+        (WebCore::SelectionController::invalidateCaretRect):
+        * editing/SelectionController.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollToOffset):
+        * rendering/RenderView.h:
+        (WebCore::RenderView::selectionStart):
+        (WebCore::RenderView::selectionEnd):
+        (WebCore::RenderView::printRect):
+        (WebCore::RenderView::setPrintRect):
+
+2010-08-19  Simon Fraser  <simon.fraser at apple.com>
+
         Fix Chromium build.
         
         * svg/SVGElement.cpp:
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 063783e..3672e3e 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -70,7 +70,7 @@ SelectionController::SelectionController(Frame* frame, bool isDragCaretControlle
     , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation)
     , m_granularity(CharacterGranularity)
     , m_caretBlinkTimer(this, &SelectionController::caretBlinkTimerFired)
-    , m_needsLayout(true)
+    , m_caretRectNeedsUpdate(true)
     , m_absCaretBoundsDirty(true)
     , m_isDragCaretController(isDragCaretController)
     , m_isCaretBlinkingSuspended(false)
@@ -116,7 +116,7 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi
     if (m_isDragCaretController) {
         invalidateCaretRect();
         m_selection = s;
-        m_needsLayout = true;
+        m_caretRectNeedsUpdate = true;
         invalidateCaretRect();
         return;
     }
@@ -150,7 +150,7 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi
 
     m_selection = s;
     
-    m_needsLayout = true;
+    m_caretRectNeedsUpdate = true;
     
     if (!s.isNone())
         m_frame->setFocusedNodeIfNeeded();
@@ -705,7 +705,7 @@ bool SelectionController::modify(EAlteration alter, EDirection direction, TextGr
         m_granularity = CharacterGranularity;
 
 
-    setNeedsLayout();
+    setCaretRectNeedsUpdate();
 
     setIsDirectional(alter == AlterationExtend);
 
@@ -886,12 +886,12 @@ void SelectionController::setExtent(const Position &pos, EAffinity affinity, boo
     setSelection(VisibleSelection(m_selection.base(), pos, affinity), true, true, userTriggered);
 }
 
-void SelectionController::setNeedsLayout(bool flag)
+void SelectionController::setCaretRectNeedsUpdate(bool flag)
 {
-    m_needsLayout = flag;
+    m_caretRectNeedsUpdate = flag;
 }
 
-void SelectionController::layout()
+void SelectionController::updateCaretRect()
 {
     if (isNone() || !m_selection.start().node()->inDocument() || !m_selection.end().node()->inDocument()) {
         m_caretRect = IntRect();
@@ -934,7 +934,7 @@ void SelectionController::layout()
         }
     }
 
-    m_needsLayout = false;
+    m_caretRectNeedsUpdate = false;
 }
 
 RenderObject* SelectionController::caretRenderer() const
@@ -954,8 +954,8 @@ RenderObject* SelectionController::caretRenderer() const
 
 IntRect SelectionController::localCaretRect()
 {
-    if (m_needsLayout)
-        layout();
+    if (m_caretRectNeedsUpdate)
+        updateCaretRect();
     
     return m_caretRect;
 }
@@ -992,6 +992,9 @@ IntRect SelectionController::caretRepaintRect() const
 
 bool SelectionController::recomputeCaretRect()
 {
+    if (!m_caretRectNeedsUpdate)
+        return false;
+
     if (!m_frame)
         return false;
         
@@ -999,9 +1002,6 @@ bool SelectionController::recomputeCaretRect()
     if (!v)
         return false;
 
-    if (!m_needsLayout)
-        return false;
-
     IntRect oldRect = m_caretRect;
     IntRect newRect = localCaretRect();
     if (oldRect == newRect && !m_absCaretBoundsDirty)
@@ -1060,7 +1060,7 @@ void SelectionController::invalidateCaretRect()
     // changes which may have been done.
     // And, we need to leave this layout here so the caret moves right 
     // away after clicking.
-    m_needsLayout = true;
+    m_caretRectNeedsUpdate = true;
 
     if (!caretRectChanged) {
         RenderView* view = toRenderView(d->renderer());
diff --git a/WebCore/editing/SelectionController.h b/WebCore/editing/SelectionController.h
index d5d6849..5fa2769 100644
--- a/WebCore/editing/SelectionController.h
+++ b/WebCore/editing/SelectionController.h
@@ -105,7 +105,7 @@ public:
 
     // Bounds of (possibly transformed) caret in absolute coords
     IntRect absoluteCaretBounds();
-    void setNeedsLayout(bool flag = true);
+    void setCaretRectNeedsUpdate(bool flag = true);
 
     void setIsDirectional(bool);
     void willBeModified(EAlteration, EDirection);
@@ -169,7 +169,7 @@ private:
     VisiblePosition modifyMovingLeft(TextGranularity);
     VisiblePosition modifyMovingBackward(TextGranularity);
 
-    void layout();
+    void updateCaretRect();
     IntRect caretRepaintRect() const;
     bool shouldRepaintCaret(const RenderView* view) const;
 
@@ -199,7 +199,7 @@ private:
     IntRect m_absCaretBounds; // absolute bounding rect for the caret
     IntRect m_absoluteCaretRepaintBounds;
     
-    bool m_needsLayout; // true if m_caretRect and m_absCaretBounds need to be calculated
+    bool m_caretRectNeedsUpdate; // true if m_caretRect and m_absCaretBounds need to be calculated
     bool m_absCaretBoundsDirty;
     bool m_isDirectional;
     bool m_isDragCaretController;
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 58a7ba7..9127333 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -786,7 +786,7 @@ void FrameView::layout(bool allowSubtree)
     }
     m_layoutRoot = 0;
 
-    m_frame->selection()->setNeedsLayout();
+    m_frame->selection()->setCaretRectNeedsUpdate();
     m_frame->selection()->updateAppearance();
    
     m_layoutSchedulingEnabled = true;
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 0e17eab..e07b15d 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -1349,7 +1349,7 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai
     Frame* frame = renderer()->frame();
     if (frame) {
         // The caret rect needs to be invalidated after scrolling
-        frame->selection()->setNeedsLayout();
+        frame->selection()->setCaretRectNeedsUpdate();
 
         FloatQuad quadForFakeMouseMoveEvent = FloatQuad(rectForRepaint);
         if (repaintContainer)
diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h
index cf2c5e9..0a411fd 100644
--- a/WebCore/rendering/RenderView.h
+++ b/WebCore/rendering/RenderView.h
@@ -71,12 +71,18 @@ public:
     enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld };
     void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);
     void clearSelection();
-    virtual RenderObject* selectionStart() const { return m_selectionStart; }
-    virtual RenderObject* selectionEnd() const { return m_selectionEnd; }
+    RenderObject* selectionStart() const { return m_selectionStart; }
+    RenderObject* selectionEnd() const { return m_selectionEnd; }
+    IntRect selectionBounds(bool clipToVisibleContent = true) const;
+    void selectionStartEnd(int& startPos, int& endPos) const;
 
     bool printing() const;
     void setPrintImages(bool enable) { m_printImages = enable; }
     bool printImages() const { return m_printImages; }
+
+    IntRect printRect() const { return m_printRect; }
+    void setPrintRect(const IntRect& r) { m_printRect = r; }
+
     void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_minimumColumnHeight = 0; m_forcedPageBreak = false; }
     void setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak = false);
     void setMinimumColumnHeight(int height) { m_minimumColumnHeight = height; }
@@ -88,8 +94,6 @@ public:
     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
-    IntRect selectionBounds(bool clipToVisibleContent = true) const;
-
 #if USE(ACCELERATED_COMPOSITING)
     void setMaximalOutlineSize(int o);
 #else
@@ -99,11 +103,6 @@ public:
 
     virtual IntRect viewRect() const;
 
-    void selectionStartEnd(int& startPos, int& endPos) const;
-
-    IntRect printRect() const { return m_printRect; }
-    void setPrintRect(const IntRect& r) { m_printRect = r; }
-
     void updateWidgetPositions();
     void addWidget(RenderWidget*);
     void removeWidget(RenderWidget*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list