Title: [119643] branches/chromium/1132

Diff

Copied: branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html (from rev 119227, trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html) (0 => 119643)


--- branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html	                        (rev 0)
+++ branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html	2012-06-07 00:10:39 UTC (rev 119643)
@@ -0,0 +1,10 @@
+<div id="target" style="
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    overflow: hidden;
+    width: 100px;
+">
+    <div>
+        Unless this sentence is truncated after two lines, PASS.
+    </div>
+</div>

Copied: branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html (from rev 119227, trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html) (0 => 119643)


--- branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html	                        (rev 0)
+++ branches/chromium/1132/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html	2012-06-07 00:10:39 UTC (rev 119643)
@@ -0,0 +1,15 @@
+<div id="target" style="
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    overflow: hidden;
+    -webkit-line-clamp: 2;
+    width: 100px;
+">
+    <div>
+        Unless this sentence is truncated after two lines, PASS.
+    </div>
+</div>
+<script>
+    document.body.offsetTop;
+    target.style.removeProperty("-webkit-line-clamp");
+</script>

Modified: branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (119642 => 119643)


--- branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-06-07 00:09:29 UTC (rev 119642)
+++ branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-06-07 00:10:39 UTC (rev 119643)
@@ -150,6 +150,15 @@
     return child->isPositioned() || child->style()->visibility() == COLLAPSE;
 }
 
+void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
+{
+    RenderStyle* oldStyle = style();
+    if (oldStyle && !oldStyle->lineClamp().isNone() && newStyle->lineClamp().isNone())
+        clearLineClamp();
+
+    RenderBlock::styleWillChange(diff, newStyle);
+}
+
 void RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths()
 {
     for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
@@ -975,6 +984,25 @@
     }
 }
 
+void RenderDeprecatedFlexibleBox::clearLineClamp()
+{
+    FlexBoxIterator iterator(this);
+    for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+        if (childDoesNotAffectWidthOrFlexing(child))
+            continue;
+
+        if ((child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))
+            || (child->style()->height().isAuto() && child->isBlockFlow())) {
+            child->setChildNeedsLayout(true);
+
+            if (child->isRenderBlock()) {
+                toRenderBlock(child)->markPositionedObjectsForLayout();
+                toRenderBlock(child)->clearTruncation();
+            }
+        }
+    }
+}
+
 void RenderDeprecatedFlexibleBox::placeChild(RenderBox* child, const LayoutPoint& location)
 {
     LayoutRect oldRect = child->frameRect();

Modified: branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h (119642 => 119643)


--- branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2012-06-07 00:09:29 UTC (rev 119642)
+++ branches/chromium/1132/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2012-06-07 00:10:39 UTC (rev 119643)
@@ -40,6 +40,8 @@
     void calcHorizontalPrefWidths();
     void calcVerticalPrefWidths();
 
+    virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle) OVERRIDE;
+
     virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0);
     void layoutHorizontalBox(bool relayoutChildren);
     void layoutVerticalBox(bool relayoutChildren);
@@ -65,6 +67,7 @@
 
 private:
     void applyLineClamp(FlexBoxIterator&, bool relayoutChildren);
+    void clearLineClamp();
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to