Title: [119227] trunk
Revision
119227
Author
[email protected]
Date
2012-06-01 07:14:07 -0700 (Fri, 01 Jun 2012)

Log Message

Layout not updated after setting -webkit-line-clamp to none
https://bugs.webkit.org/show_bug.cgi?id=88049

Reviewed by Abhishek Arya.

Source/WebCore: 

Test: fast/flexbox/line-clamp-removed-dynamically.html

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::styleWillChange): Added. Calls clearLineClamp if
line-clamp will change to none.
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp): Added. Marks possibly-clamped
children for layout and clears truncation from blocks.
* rendering/RenderDeprecatedFlexibleBox.h:

LayoutTests: 

* fast/flexbox/line-clamp-removed-dynamically-expected.html: Added.
* fast/flexbox/line-clamp-removed-dynamically.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119226 => 119227)


--- trunk/LayoutTests/ChangeLog	2012-06-01 13:53:48 UTC (rev 119226)
+++ trunk/LayoutTests/ChangeLog	2012-06-01 14:14:07 UTC (rev 119227)
@@ -1,3 +1,13 @@
+2012-06-01  Dan Bernstein  <[email protected]>
+
+        Layout not updated after setting -webkit-line-clamp to none
+        https://bugs.webkit.org/show_bug.cgi?id=88049
+
+        Reviewed by Abhishek Arya.
+
+        * fast/flexbox/line-clamp-removed-dynamically-expected.html: Added.
+        * fast/flexbox/line-clamp-removed-dynamically.html: Added.
+
 2012-06-01  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening, skip new failing and crashing tests.

Added: trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html (0 => 119227)


--- trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically-expected.html	2012-06-01 14:14:07 UTC (rev 119227)
@@ -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>

Added: trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html (0 => 119227)


--- trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/line-clamp-removed-dynamically.html	2012-06-01 14:14:07 UTC (rev 119227)
@@ -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: trunk/Source/WebCore/ChangeLog (119226 => 119227)


--- trunk/Source/WebCore/ChangeLog	2012-06-01 13:53:48 UTC (rev 119226)
+++ trunk/Source/WebCore/ChangeLog	2012-06-01 14:14:07 UTC (rev 119227)
@@ -1,3 +1,19 @@
+2012-06-01  Dan Bernstein  <[email protected]>
+
+        Layout not updated after setting -webkit-line-clamp to none
+        https://bugs.webkit.org/show_bug.cgi?id=88049
+
+        Reviewed by Abhishek Arya.
+
+        Test: fast/flexbox/line-clamp-removed-dynamically.html
+
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::styleWillChange): Added. Calls clearLineClamp if
+        line-clamp will change to none.
+        (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp): Added. Marks possibly-clamped
+        children for layout and clears truncation from blocks.
+        * rendering/RenderDeprecatedFlexibleBox.h:
+
 2012-06-01  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r119213.

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (119226 => 119227)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-06-01 13:53:48 UTC (rev 119226)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-06-01 14:14:07 UTC (rev 119227)
@@ -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: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h (119226 => 119227)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2012-06-01 13:53:48 UTC (rev 119226)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2012-06-01 14:14:07 UTC (rev 119227)
@@ -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);
@@ -64,6 +66,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