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

hyatt at apple.com hyatt at apple.com
Wed Dec 22 14:52:20 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d9dc55a531c447528d6d47b89751149b9501e7eb
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 22 20:29:21 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=48149
    
    Reviewed by Sam Weinig.
    
    Update block direction line overflow computation to be writing-mode-aware.
    
    * rendering/InlineBox.h:
    (WebCore::InlineBox::logicalBottom):
    * rendering/InlineFlowBox.cpp:
    (WebCore::InlineFlowBox::computeBlockDirectionOverflow):
    * rendering/InlineFlowBox.h:
    (WebCore::InlineFlowBox::setInlineDirectionOverflowPositions):
    (WebCore::InlineFlowBox::setBlockDirectionOverflowPositions):
    * rendering/RenderBlockLineLayout.cpp:
    (WebCore::RenderBlock::layoutInlineChildren):
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::blockDirectionOverflow):
    * rendering/RenderBox.h:
    * rendering/RootInlineBox.cpp:
    (WebCore::RootInlineBox::addHighlightOverflow):
    * rendering/style/RenderStyle.h:
    (WebCore::InheritedFlags::getTextShadowBlockDirectionExtent):
    (WebCore::InheritedFlags::getBoxShadowBlockDirectionExtent):
    (WebCore::InheritedFlags::getShadowBlockDirectionExtent):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70330 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f210577..66de413 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-10-22  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48149
+        
+        Update block direction line overflow computation to be writing-mode-aware.
+
+        * rendering/InlineBox.h:
+        (WebCore::InlineBox::logicalBottom):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::computeBlockDirectionOverflow):
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::setInlineDirectionOverflowPositions):
+        (WebCore::InlineFlowBox::setBlockDirectionOverflowPositions):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::layoutInlineChildren):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::blockDirectionOverflow):
+        * rendering/RenderBox.h:
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::addHighlightOverflow):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::getTextShadowBlockDirectionExtent):
+        (WebCore::InheritedFlags::getBoxShadowBlockDirectionExtent):
+        (WebCore::InheritedFlags::getShadowBlockDirectionExtent):
+
 2010-10-22  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h
index 38a7805..bed2dc7 100644
--- a/WebCore/rendering/InlineBox.h
+++ b/WebCore/rendering/InlineBox.h
@@ -229,6 +229,7 @@ public:
 
     // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
     int logicalTop() const { return !m_isVertical ? m_y : m_x; }
+    int logicalBottom() const { return logicalTop() + logicalHeight(); }
     void setLogicalTop(int top)
     {
         if (!m_isVertical)
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index 0cab658..9aca3e1 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -562,12 +562,14 @@ void InlineFlowBox::flipLinesInBlockDirection(int lineTop, int lineBottom)
 
 void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
 {
+    bool isFlippedLine = renderer()->style(m_firstLine)->isFlippedLinesWritingMode();
+
     int boxHeight = logicalHeight();
 
     // Any spillage outside of the line top and bottom is not considered overflow.  We just ignore this, since it only happens
     // from the "your ascent/descent don't affect the line" quirk.
-    int topOverflow = max(y(), lineTop);
-    int bottomOverflow = min(y() + boxHeight, lineBottom);
+    int topOverflow = max(logicalTop(), lineTop);
+    int bottomOverflow = min(logicalTop() + boxHeight, lineBottom);
     
     int topLayoutOverflow = topOverflow;
     int bottomLayoutOverflow = bottomOverflow;
@@ -579,10 +581,10 @@ void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, b
     if (parent()) {
         int boxShadowTop;
         int boxShadowBottom;
-        renderer()->style(m_firstLine)->getBoxShadowVerticalExtent(boxShadowTop, boxShadowBottom);
+        renderer()->style(m_firstLine)->getBoxShadowBlockDirectionExtent(boxShadowTop, boxShadowBottom);
         
-        topVisualOverflow = min(y() + boxShadowTop, topVisualOverflow);
-        bottomVisualOverflow = max(y() + boxHeight + boxShadowBottom, bottomVisualOverflow);
+        topVisualOverflow = min(logicalTop() + boxShadowTop, topVisualOverflow);
+        bottomVisualOverflow = max(logicalTop() + boxHeight + boxShadowBottom, bottomVisualOverflow);
     }
 
     for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
@@ -600,18 +602,21 @@ void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, b
             GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(curr));
             GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->second.second;
 
-            int topGlyphOverflow = -strokeOverflow - (glyphOverflow ? glyphOverflow->top : 0);
-            int bottomGlyphOverflow = strokeOverflow + (glyphOverflow ? glyphOverflow->bottom : 0);
+            int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom : glyphOverflow->top) : 0;
+            int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top : glyphOverflow->bottom) : 0;
 
-            int childOverflowTop = topGlyphOverflow;
-            int childOverflowBottom = bottomGlyphOverflow;
-            for (const ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next()) {
-                childOverflowTop = min(childOverflowTop, shadow->y() - shadow->blur() + topGlyphOverflow);
-                childOverflowBottom = max(childOverflowBottom, shadow->y() + shadow->blur() + bottomGlyphOverflow);
-            }
-            
-            topVisualOverflow = min(curr->y() + childOverflowTop, topVisualOverflow);
-            bottomVisualOverflow = max(curr->y() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow);
+            int topGlyphOverflow = -strokeOverflow - topGlyphEdge;
+            int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge;
+
+            int textShadowTop;
+            int textShadowBottom;
+            curr->renderer()->style(m_firstLine)->getTextShadowBlockDirectionExtent(textShadowTop, textShadowBottom);
+        
+            int childOverflowTop = min(textShadowTop, topGlyphOverflow);
+            int childOverflowBottom = max(textShadowBottom, bottomGlyphOverflow);
+    
+            topVisualOverflow = min(curr->logicalTop() + childOverflowTop, topVisualOverflow);
+            bottomVisualOverflow = max(curr->logicalTop() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow);
         } else  if (curr->renderer()->isRenderInline()) {
             InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
             flow->computeBlockDirectionOverflow(lineTop, lineBottom, strictMode, textBoxDataMap);
@@ -621,18 +626,24 @@ void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, b
             bottomVisualOverflow = max(bottomVisualOverflow, flow->bottomVisualOverflow());
         } else if (!curr->boxModelObject()->hasSelfPaintingLayer()){
             // Only include overflow from replaced inlines if they do not paint themselves.
+            int boxLogicalTop = curr->logicalTop();
+            int childTopLayoutOverflow;
+            int childBottomLayoutOverflow;
+            int childTopVisualOverflow;
+            int childBottomVisualOverflow;
+            
             RenderBox* box = toRenderBox(curr->renderer());
-            int boxY = curr->y();
-            int childTopOverflow = box->hasOverflowClip() ? 0 : box->topLayoutOverflow();
-            int childBottomOverflow = box->hasOverflowClip() ? curr->logicalHeight() : box->bottomLayoutOverflow();
-            topLayoutOverflow = min(boxY + childTopOverflow, topLayoutOverflow);
-            bottomLayoutOverflow = max(boxY + childBottomOverflow, bottomLayoutOverflow);
-            topVisualOverflow = min(boxY + box->topVisualOverflow(), topVisualOverflow);
-            bottomVisualOverflow = max(boxY + box->bottomVisualOverflow(), bottomVisualOverflow);
+            box->blockDirectionOverflow(isVertical(), isFlippedLine, childTopLayoutOverflow, childBottomLayoutOverflow,
+                                        childTopVisualOverflow, childBottomVisualOverflow);
+            
+            topLayoutOverflow = min(boxLogicalTop + childTopLayoutOverflow, topLayoutOverflow);
+            bottomLayoutOverflow = max(boxLogicalTop + childBottomLayoutOverflow, bottomLayoutOverflow);
+            topVisualOverflow = min(boxLogicalTop + childTopVisualOverflow, topVisualOverflow);
+            bottomVisualOverflow = max(boxLogicalTop + childBottomVisualOverflow, bottomVisualOverflow);
         }
     }
     
-    setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow, boxHeight);
+    setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow);
 }
 
 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty)
diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h
index d8b976f..5a779d1 100644
--- a/WebCore/rendering/InlineFlowBox.h
+++ b/WebCore/rendering/InlineFlowBox.h
@@ -199,7 +199,7 @@ public:
     void setInlineDirectionOverflowPositions(int logicalLeftLayoutOverflow, int logicalRightLayoutOverflow,
                                              int logicalLeftVisualOverflow, int logicalRightVisualOverflow);
     void setBlockDirectionOverflowPositions(int logicalTopLayoutOverflow, int logicalBottomLayoutOverflow,
-                                            int logicalTopVisualOverflow, int logicalBottomVisualOverflow, int boxLogicalHeight);
+                                            int logicalTopVisualOverflow, int logicalBottomVisualOverflow);
 
 protected:
     OwnPtr<RenderOverflow> m_overflow;
@@ -229,8 +229,8 @@ inline void InlineFlowBox::setInlineDirectionOverflowPositions(int logicalLeftLa
             && logicalLeftVisualOverflow == logicalLeft() && logicalRightVisualOverflow == logicalRight())
             return;
         
-        int width = isVertical() ? m_renderer->style(m_firstLine)->font().height() : logicalWidth();
-        int height = isVertical() ? logicalWidth() : m_renderer->style(m_firstLine)->font().height();
+        int width = isVertical() ? logicalHeight() : logicalWidth();
+        int height = isVertical() ? logicalWidth() : logicalHeight();
         
         m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));   
     }
@@ -248,18 +248,31 @@ inline void InlineFlowBox::setInlineDirectionOverflowPositions(int logicalLeftLa
     }
 }
 
-inline void InlineFlowBox::setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight)
+inline void InlineFlowBox::setBlockDirectionOverflowPositions(int logicalTopLayoutOverflow, int logicalBottomLayoutOverflow,
+                                                              int logicalTopVisualOverflow, int logicalBottomVisualOverflow)
 {
     if (!m_overflow) {
-        if (topLayoutOverflow == m_y && bottomLayoutOverflow == m_y + boxHeight && topVisualOverflow == m_y && bottomVisualOverflow == m_y + boxHeight)
+        if (logicalTopLayoutOverflow == logicalTop() && logicalBottomLayoutOverflow == logicalBottom()
+            && logicalTopVisualOverflow == logicalTop() && logicalBottomVisualOverflow == logicalBottom())
             return;
-        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, boxHeight)));
+            
+        int width = isVertical() ? logicalHeight() : logicalWidth();
+        int height = isVertical() ? logicalWidth() : logicalHeight();
+        
+        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));
     }
 
-    m_overflow->setTopLayoutOverflow(topLayoutOverflow);
-    m_overflow->setBottomLayoutOverflow(bottomLayoutOverflow);
-    m_overflow->setTopVisualOverflow(topVisualOverflow); 
-    m_overflow->setBottomVisualOverflow(bottomVisualOverflow);  
+    if (!isVertical()) {
+        m_overflow->setTopLayoutOverflow(logicalTopLayoutOverflow);
+        m_overflow->setBottomLayoutOverflow(logicalBottomLayoutOverflow);
+        m_overflow->setTopVisualOverflow(logicalTopVisualOverflow); 
+        m_overflow->setBottomVisualOverflow(logicalBottomVisualOverflow);  
+    } else {
+        m_overflow->setLeftLayoutOverflow(logicalTopLayoutOverflow);
+        m_overflow->setRightLayoutOverflow(logicalBottomLayoutOverflow);
+        m_overflow->setLeftVisualOverflow(logicalTopVisualOverflow); 
+        m_overflow->setRightVisualOverflow(logicalBottomVisualOverflow);
+    }
 }
 
 #ifdef NDEBUG
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 96a21ee..22dc73d 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -878,7 +878,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintLogica
                 trailingFloatsLineBox->setConstructed();
                 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
                 trailingFloatsLineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap);
-                trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow, 0);
+                trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow);
                 trailingFloatsLineBox->setBlockLogicalHeight(logicalHeight());
             }
             if (lastFloat) {
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 22f81d4..7a7c5a6 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -3172,4 +3172,34 @@ int RenderBox::baselinePosition(bool /*firstLine*/, LineDirectionMode direction,
     return 0;
 }
 
+void RenderBox::blockDirectionOverflow(bool isLineVertical, bool isFlippedLine, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
+                                       int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow)
+{
+    if (isLineVertical) {
+        if (isFlippedLine) {
+            logicalTopLayoutOverflow = leftLayoutOverflow();
+            logicalBottomLayoutOverflow = rightLayoutOverflow();
+            logicalTopVisualOverflow = leftVisualOverflow();
+            logicalBottomVisualOverflow = rightVisualOverflow();
+        } else {
+            logicalTopLayoutOverflow = rightLayoutOverflow();
+            logicalBottomLayoutOverflow = leftLayoutOverflow();
+            logicalTopVisualOverflow = rightVisualOverflow();
+            logicalBottomVisualOverflow = leftVisualOverflow();
+        } 
+    } else {
+        if (isFlippedLine) {
+            logicalTopLayoutOverflow = bottomLayoutOverflow();
+            logicalBottomLayoutOverflow = topLayoutOverflow();
+            logicalTopVisualOverflow = bottomVisualOverflow();
+            logicalBottomVisualOverflow = topVisualOverflow();
+        } else {
+            logicalTopLayoutOverflow = topLayoutOverflow();
+            logicalBottomLayoutOverflow = bottomLayoutOverflow();
+            logicalTopVisualOverflow = topVisualOverflow();
+            logicalBottomVisualOverflow = bottomVisualOverflow();
+        }
+    }
+}
+
 } // namespace WebCore
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index 7ee6b72..6b5923b 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -155,6 +155,9 @@ public:
     void addOverflowFromChild(RenderBox* child, const IntSize& delta);
     void clearLayoutOverflow();
 
+    void blockDirectionOverflow(bool isLineVertical, bool isFlippedLine, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
+                                int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow);
+
     int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
     int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
     int contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index c7fcaeb..178b1ad 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -149,7 +149,7 @@ void RootInlineBox::addHighlightOverflow()
     FloatRect rootRect(0, selectionTop(), logicalWidth(), selectionHeight());
     IntRect inflatedRect = enclosingIntRect(page->chrome()->client()->customHighlightRect(renderer()->node(), renderer()->style()->highlight(), rootRect));
     setInlineDirectionOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right()));
-    setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), logicalHeight());
+    setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()));
 }
 
 void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType)
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index cd40173..7056b1d 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -641,6 +641,7 @@ public:
     void getTextShadowHorizontalExtent(int& left, int& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
     void getTextShadowVerticalExtent(int& top, int& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
     void getTextShadowInlineDirectionExtent(int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
+    void getTextShadowBlockDirectionExtent(int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
 
     float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
     ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
@@ -660,6 +661,7 @@ public:
     void getBoxShadowHorizontalExtent(int& left, int& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
     void getBoxShadowVerticalExtent(int& top, int& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
     void getBoxShadowInlineDirectionExtent(int& logicalLeft, int& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
+    void getBoxShadowBlockDirectionExtent(int& logicalTop, int& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
 
     StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
     EBoxSizing boxSizing() const { return m_box->boxSizing(); }
@@ -1277,6 +1279,10 @@ private:
     {
         return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
     }
+    void getShadowBlockDirectionExtent(const ShadowData* shadow, int& logicalTop, int& logicalBottom) const
+    {
+        return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
+    }
 
     // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
     const Color& borderLeftColor() const { return surround->border.left().color(); }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list