Title: [281308] trunk/Source/WebCore
Revision
281308
Author
[email protected]
Date
2021-08-20 05:49:48 -0700 (Fri, 20 Aug 2021)

Log Message

[LFC][Integration] line-clamp is an unsupported CSS property
https://bugs.webkit.org/show_bug.cgi?id=228794

Reviewed by Simon Fraser.

Let's bail out on -webkit-line-clamp instead of the presence of a deprecated flex box. While line clamping requires legacy line layout, regular flex item content is fine with either line layout codepaths.

* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
* layout/integration/LayoutIntegrationCoverage.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281307 => 281308)


--- trunk/Source/WebCore/ChangeLog	2021-08-20 12:44:29 UTC (rev 281307)
+++ trunk/Source/WebCore/ChangeLog	2021-08-20 12:49:48 UTC (rev 281308)
@@ -1,5 +1,19 @@
 2021-08-20  Alan Bujtas  <[email protected]>
 
+        [LFC][Integration] line-clamp is an unsupported CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=228794
+
+        Reviewed by Simon Fraser.
+
+        Let's bail out on -webkit-line-clamp instead of the presence of a deprecated flex box. While line clamping requires legacy line layout, regular flex item content is fine with either line layout codepaths. 
+
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::printReason):
+        (WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
+        * layout/integration/LayoutIntegrationCoverage.h:
+
+2021-08-20  Alan Bujtas  <[email protected]>
+
         [IFC][Integration] Enable non-auto line-break values
         https://bugs.webkit.org/show_bug.cgi?id=228842
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (281307 => 281308)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-08-20 12:44:29 UTC (rev 281307)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-08-20 12:49:48 UTC (rev 281308)
@@ -108,8 +108,8 @@
     case AvoidanceReason::FlowHasTextOverflow:
         stream << "text-overflow";
         break;
-    case AvoidanceReason::FlowIsDepricatedFlexBox:
-        stream << "depricatedFlexBox";
+    case AvoidanceReason::FlowHasLineClamp:
+        stream << "-webkit-line-clamp";
         break;
     case AvoidanceReason::FlowParentIsPlaceholderElement:
         stream << "placeholder element";
@@ -780,8 +780,8 @@
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasPseudoFirstLine, reasons, includeReasons);
     if (flow.isAnonymousBlock() && flow.parent()->style().textOverflow() == TextOverflow::Ellipsis)
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasTextOverflow, reasons, includeReasons);
-    if (flow.parent()->isDeprecatedFlexibleBox())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowIsDepricatedFlexBox, reasons, includeReasons);
+    if (!flow.parent()->style().lineClamp().isNone())
+        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineClamp, reasons, includeReasons);
     // FIXME: Placeholders do something strange.
     if (is<RenderTextControl>(*flow.parent()) && downcast<RenderTextControl>(*flow.parent()).textFormControlElement().placeholderElement())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowParentIsPlaceholderElement, reasons, includeReasons);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (281307 => 281308)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-08-20 12:44:29 UTC (rev 281307)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-08-20 12:49:48 UTC (rev 281308)
@@ -43,7 +43,7 @@
     ContentIsRuby                                = 1LLU  << 3,
     FlowIsPaginated                              = 1LLU  << 4,
     FlowHasTextOverflow                          = 1LLU  << 5,
-    FlowIsDepricatedFlexBox                      = 1LLU  << 6,
+    FlowHasLineClamp                             = 1LLU  << 6,
     FlowParentIsPlaceholderElement               = 1LLU  << 7,
     FlowParentIsTextAreaWithWrapping             = 1LLU  << 8,
     FlowHasNonSupportedChild                     = 1LLU  << 9,

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (281307 => 281308)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-08-20 12:44:29 UTC (rev 281307)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-08-20 12:49:48 UTC (rev 281308)
@@ -42,6 +42,7 @@
 #include "LegacyLineLayout.h"
 #include "Logging.h"
 #include "RenderCombineText.h"
+#include "RenderDeprecatedFlexibleBox.h"
 #include "RenderFlexibleBox.h"
 #include "RenderInline.h"
 #include "RenderIterator.h"
@@ -3802,7 +3803,32 @@
     } else
         legacyLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
 
-    updateLogicalHeight();
+    {
+        struct DeprecatedBoxStrechingScope {
+            DeprecatedBoxStrechingScope(RenderElement& parent)
+            {
+                if (is<RenderDeprecatedFlexibleBox>(parent) && parent.style().boxAlign() == BoxAlignment::Stretch) {
+                    // While modern flex box's uses override height to stretch its children, deprecated flex box
+                    // uses a flag which is consulted at updateLogicalHeight().
+                    // This scope class ensures that we don't collapse flex items while swapping the line structures.
+                    // see RenderBox::computeLogicalHeight where isStretchingChildren() is consulted.
+                    strechingRenderer = makeWeakPtr(downcast<RenderDeprecatedFlexibleBox>(parent));
+                    strechingRenderer->setIsStretchingChildren(true);
+                }
+            }
+
+            ~DeprecatedBoxStrechingScope()
+            {
+                if (strechingRenderer)
+                    strechingRenderer->setIsStretchingChildren(false);
+            }
+
+            WeakPtr<RenderDeprecatedFlexibleBox> strechingRenderer;
+
+        };
+        auto deprecatedBoxStrechingScope = DeprecatedBoxStrechingScope(*parent());
+        updateLogicalHeight();
+    }
     ASSERT(didNeedLayout || ceilf(logicalHeight()) == ceilf(oldHeight));
 
     if (!didNeedLayout)

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h (281307 => 281308)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2021-08-20 12:44:29 UTC (rev 281307)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h	2021-08-20 12:49:48 UTC (rev 281308)
@@ -45,6 +45,7 @@
     void layoutVerticalBox(bool relayoutChildren);
 
     bool isStretchingChildren() const { return m_stretchingChildren; }
+    void setIsStretchingChildren(bool isStretching) { m_stretchingChildren = isStretching; }
 
     bool avoidsFloats() const override { return true; }
     bool canDropAnonymousBlockChild() const override { return false; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to