Fix for 3791146, make sure all lines are checked when computing overflow.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Oct 2004 21:34:01 +0000 (21:34 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Oct 2004 21:34:01 +0000 (21:34 +0000)
        Reviewed by kocienda

        * khtml/rendering/bidi.cpp:
        (khtml::RenderBlock::computeHorizontalPositionsForLine):
        (khtml::RenderBlock::layoutInlineChildren):
        (khtml::RenderBlock::findNextLineBreak):
        (khtml::RenderBlock::checkLinesForOverflow):
        * khtml/rendering/render_block.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/bidi.cpp
WebCore/khtml/rendering/render_block.h

index afee5f59f6aad5b76a64bc051cfb6d26cb8da781..8445bbdf5197977c20c323cde8ed0ced3214d20d 100644 (file)
@@ -1,3 +1,16 @@
+2004-10-20  David Hyatt  <hyatt@apple.com>
+
+       Fix for 3791146, make sure all lines are checked when computing overflow.
+       
+        Reviewed by kocienda
+
+        * khtml/rendering/bidi.cpp:
+        (khtml::RenderBlock::computeHorizontalPositionsForLine):
+        (khtml::RenderBlock::layoutInlineChildren):
+        (khtml::RenderBlock::findNextLineBreak):
+        (khtml::RenderBlock::checkLinesForOverflow):
+        * khtml/rendering/render_block.h:
+
 2004-10-20  David Hyatt  <hyatt@apple.com>
 
        Fix for 3790936, make the unicode-breaking on the layout tests match Panther.
index 62a2e663d624f5001c557c75d1b31dc492db22be..2babdfc05d5fd3bf2188cb37478651a33d34c866 100644 (file)
@@ -816,9 +816,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
     
     // The widths of all runs are now known.  We can now place every inline box (and
     // compute accurate widths for the inline flow boxes).
-    int rightPos = lineBox->placeBoxesHorizontally(x);
-    if (rightPos > m_overflowWidth)
-        m_overflowWidth = rightPos; // FIXME: Work for rtl overflow also.
+    lineBox->placeBoxesHorizontally(x);
 }
 
 void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox)
@@ -1581,6 +1579,9 @@ QRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
     // Always make sure this is at least our height.
     m_overflowHeight = kMax(m_height, m_overflowHeight);
     
+    // See if any lines spill out of the block.  If so, we need to update our overflow width.
+    checkLinesForOverflow();
+
     if (useRepaintRect) {
         repaintRect.setWidth(kMax((int)m_width, m_overflowWidth));
         if (repaintRect.height() == 0)
@@ -1589,9 +1590,8 @@ QRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
     
     setLinesAppended(false);
     
-    if (!firstLineBox() && element() && element()->isContentEditable() && element()->rootEditableElement() == element()) {
+    if (!firstLineBox() && element() && element()->isContentEditable() && element()->rootEditableElement() == element())
         m_height += lineHeight(true);
-    }
 
     // See if we have any lines that spill out of our block.  If we do, then we will possibly need to
     // truncate text.
@@ -2309,6 +2309,18 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
     return lBreak;
 }
 
+void RenderBlock::checkLinesForOverflow()
+{
+    // FIXME: Work for left overflow also.
+    // FIXME: Inline blocks can have overflow.  Need to understand when those objects are present on a line
+    // and factor that in somehow.
+    m_overflowWidth = m_width;
+    for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
+        int rightPos = curr->xPos() + curr->width();
+        m_overflowWidth = kMax(rightPos, m_overflowWidth);
+    }
+}
+
 void RenderBlock::deleteEllipsisLineBoxes()
 {
     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
index e2b71be25989483fef5c765f1681a849811b141a..7e934d5754f15e6302d90d4362a2fd89c406ee13 100644 (file)
@@ -127,6 +127,7 @@ public:
     InlineFlowBox* createLineBoxes(RenderObject* obj);
     void computeHorizontalPositionsForLine(RootInlineBox* lineBox, BidiState &bidi);
     void computeVerticalPositionsForLine(RootInlineBox* lineBox);
+    void checkLinesForOverflow();
     void deleteEllipsisLineBoxes();
     void checkLinesForTextOverflow();
     // end bidi.cpp functions