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

hyatt at apple.com hyatt at apple.com
Wed Dec 22 17:52:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6e457da25729fdcb59c96c89dccc860e5ed834fb
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 2 00:02:24 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=46645
    
    Reviewed by Dan Bernstein.
    
    Generalize overflow section scrollOriginX code to be a point and to work in both horizontal
    and vertical modes.
    
    Not testable yet, since the rightmost/leftmost/topmost/lowestPosition functions are returning
    horrendously wrong values in the vertical text case for overflow:auto objects.
    
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::RenderLayer):
    (WebCore::RenderLayer::scrollToOffset):
    (WebCore::RenderLayer::computeScrollDimensions):
    (WebCore::RenderLayer::updateOverflowStatus):
    * rendering/RenderLayer.h:
    (WebCore::RenderLayer::scrolledContentOffset):
    (WebCore::RenderLayer::scrollXOffset):
    (WebCore::RenderLayer::scrollYOffset):
    (WebCore::RenderLayer::scrollToXOffset):
    (WebCore::RenderLayer::scrollToYOffset):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1cb9312..56fa81d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-12-01  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46645
+
+        Generalize overflow section scrollOriginX code to be a point and to work in both horizontal
+        and vertical modes.
+
+        Not testable yet, since the rightmost/leftmost/topmost/lowestPosition functions are returning
+        horrendously wrong values in the vertical text case for overflow:auto objects.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::scrollToOffset):
+        (WebCore::RenderLayer::computeScrollDimensions):
+        (WebCore::RenderLayer::updateOverflowStatus):
+        * rendering/RenderLayer.h:
+        (WebCore::RenderLayer::scrolledContentOffset):
+        (WebCore::RenderLayer::scrollXOffset):
+        (WebCore::RenderLayer::scrollYOffset):
+        (WebCore::RenderLayer::scrollToXOffset):
+        (WebCore::RenderLayer::scrollToYOffset):
+
 2010-12-01  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index dbdd2ef..dc28fee 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -143,8 +143,8 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer)
     , m_height(0)
     , m_scrollX(0)
     , m_scrollY(0)
-    , m_scrollOriginX(0)
     , m_scrollLeftOverflow(0)
+    , m_scrollTopOverflow(0)
     , m_scrollWidth(0)
     , m_scrollHeight(0)
     , m_inResizeMode(false)
@@ -1338,11 +1338,12 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai
     // complicated (since it will involve testing whether our layer
     // is either occluded by another layer or clipped by an enclosing
     // layer or contains fixed backgrounds, etc.).
-    int newScrollX = x - m_scrollOriginX;
-    if (m_scrollY == y && m_scrollX == newScrollX)
+    int newScrollX = x - m_scrollOrigin.x();
+    int newScrollY = y - m_scrollOrigin.y();
+    if (m_scrollY == newScrollY && m_scrollX == newScrollX)
         return;
     m_scrollX = newScrollX;
-    m_scrollY = y;
+    m_scrollY = newScrollY;
 
     // Update the positions of our child layers. Don't have updateLayerPositions() update
     // compositing layers, because we need to do a deep update from the compositing ancestor.
@@ -1972,22 +1973,26 @@ void RenderLayer::computeScrollDimensions(bool* needHBar, bool* needVBar)
     
     m_scrollDimensionsDirty = false;
     
-    bool ltr = renderer()->style()->isLeftToRightDirection();
-
     int clientWidth = box->clientWidth();
     int clientHeight = box->clientHeight();
 
-    m_scrollLeftOverflow = ltr ? 0 : min(0, box->leftmostPosition(true, false) - box->borderLeft());
+    bool hasLeftOverflow = (!box->style()->isHorizontalWritingMode() || !box->style()->isLeftToRightDirection()) && box->style()->writingMode() != LeftToRightWritingMode;
+    bool hasTopOverflow = (box->style()->isHorizontalWritingMode() || !box->style()->isLeftToRightDirection()) && box->style()->writingMode() != TopToBottomWritingMode;
+
+    m_scrollLeftOverflow = !hasLeftOverflow ? 0 : min(0, box->leftmostPosition(true, false) - box->borderLeft());
+    m_scrollTopOverflow = !hasTopOverflow ? 0 : min(0, box->topmostPosition(true, false) - box->borderTop());
 
-    int rightPos = ltr ?
+    int rightPos = !hasLeftOverflow ?
                     box->rightmostPosition(true, false) - box->borderLeft() :
                     clientWidth - m_scrollLeftOverflow;
-    int bottomPos = box->lowestPosition(true, false) - box->borderTop();
+    int bottomPos = !hasTopOverflow ?
+                    box->lowestPosition(true, false) - box->borderTop() :
+                    clientHeight - m_scrollTopOverflow;
 
     m_scrollWidth = max(rightPos, clientWidth);
     m_scrollHeight = max(bottomPos, clientHeight);
     
-    m_scrollOriginX = ltr ? 0 : m_scrollWidth - clientWidth;
+    m_scrollOrigin = IntPoint(!hasLeftOverflow ? 0 : m_scrollWidth - clientWidth, !hasTopOverflow ? 0 : m_scrollHeight - clientHeight);
 
     if (needHBar)
         *needHBar = rightPos > clientWidth;
@@ -2001,7 +2006,6 @@ void RenderLayer::updateOverflowStatus(bool horizontalOverflow, bool verticalOve
         m_horizontalOverflow = horizontalOverflow;
         m_verticalOverflow = verticalOverflow;
         m_overflowStatusDirty = false;
-        
         return;
     }
     
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index 789ee0c..d041e3d 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -233,14 +233,14 @@ public:
     // Scrolling methods for layers that can scroll their overflow.
     void scrollByRecursively(int xDelta, int yDelta);
 
-    IntSize scrolledContentOffset() const { return IntSize(scrollXOffset() + m_scrollLeftOverflow, scrollYOffset()); }
+    IntSize scrolledContentOffset() const { return IntSize(scrollXOffset() + m_scrollLeftOverflow, scrollYOffset() + m_scrollTopOverflow); }
 
-    int scrollXOffset() const { return m_scrollX + m_scrollOriginX; }
-    int scrollYOffset() const { return m_scrollY; }
+    int scrollXOffset() const { return m_scrollX + m_scrollOrigin.x(); }
+    int scrollYOffset() const { return m_scrollY + m_scrollOrigin.y(); }
 
     void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true);
-    void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY); }
-    void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOriginX, y); }
+    void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY + m_scrollOrigin.y()); }
+    void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOrigin.x(), y); }
     void scrollRectToVisible(const IntRect&, bool scrollToAnchor = false, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded);
 
     IntRect getRectToExpose(const IntRect& visibleRect, const IntRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
@@ -608,9 +608,22 @@ protected:
     // Our scroll offsets if the view is scrolled.
     int m_scrollX;
     int m_scrollY;
-    int m_scrollOriginX;        // only non-zero for rtl content
-    int m_scrollLeftOverflow;   // only non-zero for rtl content
-
+    
+    // There are 8 possible combinations of writing mode and direction.  Scroll origin (and its corresponding left/top overflow)
+    // will be non-zero in the x or y axis if there is any reversed direction or writing-mode.  The combinations are:
+    // writing-mode / direction     scrollOrigin.x() set    scrollOrigin.y() set
+    // horizontal-tb / ltr          NO                      NO
+    // horizontal-tb / rtl          YES                     NO
+    // horizontal-bt / ltr          NO                      YES
+    // horizontal-bt / rtl          YES                     YES
+    // vertical-lr / ltr            NO                      NO
+    // vertical-lr / rtl            NO                      YES
+    // vertical-rl / ltr            YES                     NO
+    // vertical-rl / rtl            YES                     YES
+    IntPoint m_scrollOrigin;
+    int m_scrollLeftOverflow;
+    int m_scrollTopOverflow;
+    
     // The width/height of our scrolled area.
     int m_scrollWidth;
     int m_scrollHeight;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list