[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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@281308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index c3f81fa..50b889c 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,19 @@
2021-08-20 Alan Bujtas <zalan@apple.com>
+ [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 <zalan@apple.com>
+
[IFC][Integration] Enable non-auto line-break values
https://bugs.webkit.org/show_bug.cgi?id=228842
diff --git a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
index aea5302..2ff9a28 100644
--- a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
+++ b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
@@ -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);
diff --git a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
index 85f2856..e913c37 100644
--- a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
+++ b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
@@ -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,
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 1fc78c4..d8ec87d 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -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)
diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
index 9013a46..ce8c0da 100644
--- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
+++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
@@ -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; }