Fix the line truncation function for Emerson so that at the far left setting of...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Aug 2004 22:03:28 +0000 (22:03 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Aug 2004 22:03:28 +0000 (22:03 +0000)
is visible.

        Reviewed by darin

        * khtml/rendering/render_block.cpp:
        (khtml::getHeightForLineCount):
        * khtml/rendering/render_flexbox.cpp:
        (khtml::RenderFlexibleBox::layoutVerticalBox):

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

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

index e53014a..d7ed73e 100644 (file)
@@ -1,3 +1,15 @@
+2004-08-17  David Hyatt  <hyatt@apple.com>
+
+       Fix the line truncation function for Emerson so that at the far left setting of the slider, only the header
+       is visible.
+       
+        Reviewed by darin
+
+        * khtml/rendering/render_block.cpp:
+        (khtml::getHeightForLineCount):
+        * khtml/rendering/render_flexbox.cpp:
+        (khtml::RenderFlexibleBox::layoutVerticalBox):
+
 2004-08-17  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Hyatt
index b3a7a23..e58860a 100644 (file)
@@ -2881,13 +2881,19 @@ int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom, int& co
             }
         }
         else {
+            RenderObject* normalFlowChildWithoutLines = 0;
             for (RenderObject* obj = block->firstChild(); obj; obj = obj->nextSibling()) {
                 if (shouldCheckLines(obj)) {
                     int result = getHeightForLineCount(static_cast<RenderBlock*>(obj), l, false, count);
                     if (result != -1)
                         return result + obj->yPos() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : 0);
                 }
+                else if (!obj->isFloatingOrPositioned() && !obj->isCompact() && !obj->isRunIn())
+                    normalFlowChildWithoutLines = obj;
             }
+            if (normalFlowChildWithoutLines && l == 0)
+                return normalFlowChildWithoutLines->yPos() + normalFlowChildWithoutLines->height() + 
+                    (includeBottom ? (block->borderBottom() + block->paddingBottom()) : 0);
         }
     }
     
index fed151b..138f79d 100644 (file)
@@ -695,7 +695,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
     // really part of the XUL box model.
     bool haveLineClamp = style()->lineClamp() >= 0 && style()->lineClamp() <= 100;
     if (haveLineClamp) {
-        int maxLineCount = 1;
+        int maxLineCount = 0;
         child = iterator.first();
         while (child) {
             if (!child->isPositioned()) {
@@ -716,7 +716,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
         
         // Get the # of lines and then alter all block flow children with auto height to use the
         // specified height.
-        int numVisibleLines = int(maxLineCount*style()->lineClamp()/100.0 + 1.0);
+        int numVisibleLines = int((maxLineCount+1)*style()->lineClamp()/100.0);
         if (numVisibleLines < maxLineCount) {
             for (child = iterator.first(); child; child = iterator.next()) {
                 if (child->isPositioned() || !child->style()->height().isVariable() || !child->isBlockFlow())