[LFC][Coverage] Add missing not-yet-modern-line-layout reasons
https://bugs.webkit.org/show_bug.cgi?id=222488

Reviewed by Sam Weinig.

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


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@273626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b69cd26..877a84e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2021-02-27  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][Coverage] Add missing not-yet-modern-line-layout reasons
+        https://bugs.webkit.org/show_bug.cgi?id=222488
+
+        Reviewed by Sam Weinig.
+
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::printReason):
+        (WebCore::LayoutIntegration::canUseForChild):
+        (WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
+        * layout/integration/LayoutIntegrationCoverage.h:
+
 2021-02-27  Antoine Quint  <graouts@webkit.org>
 
         border-image-slice blending does not account for the fill keyword
diff --git a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
index 3284214..b45654c 100644
--- a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
+++ b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
@@ -93,10 +93,10 @@
     case AvoidanceReason::FlowHasHorizonalWritingMode:
         stream << "horizontal writing mode";
         break;
-    case AvoidanceReason::FlowHasOutline:
+    case AvoidanceReason::ContentHasOutline:
         stream << "outline";
         break;
-    case AvoidanceReason::FlowIsRuby:
+    case AvoidanceReason::ContentIsRuby:
         stream << "ruby";
         break;
     case AvoidanceReason::FlowHasHangingPunctuation:
@@ -118,7 +118,7 @@
         stream << "wrapping textarea";
         break;
     case AvoidanceReason::FlowHasNonSupportedChild:
-        stream << "nested renderers";
+        stream << "unsupported child renderer";
         break;
     case AvoidanceReason::FlowHasUnsupportedFloat:
         stream << "complicated float";
@@ -196,16 +196,16 @@
         stream << "text is combine";
         break;
     case AvoidanceReason::FlowTextIsRenderCounter:
-        stream << "unsupported RenderCounter";
+        stream << "RenderCounter";
         break;
     case AvoidanceReason::FlowTextIsRenderQuote:
-        stream << "unsupported RenderQuote";
+        stream << "RenderQuote";
         break;
     case AvoidanceReason::FlowTextIsTextFragment:
-        stream << "unsupported TextFragment";
+        stream << "TextFragment";
         break;
     case AvoidanceReason::FlowTextIsSVGInlineText:
-        stream << "unsupported SVGInlineText";
+        stream << "SVGInlineText";
         break;
     case AvoidanceReason::FlowHasComplexFontCodePath:
         stream << "text with complex font codepath";
@@ -246,6 +246,33 @@
     case AvoidanceReason::FlowDoesNotEstablishInlineFormattingContext:
         stream << "flow does not establishes inline formatting context";
         break;
+    case AvoidanceReason::UnsupportedFieldset:
+        stream << "fieldset box";
+        break;
+    case AvoidanceReason::ChildBoxIsFloatingOrPositioned:
+        stream << "child box is floating or positioned";
+        break;
+    case AvoidanceReason::ContentIsSVG:
+        stream << "SVG content";
+        break;
+    case AvoidanceReason::ChildBoxHasUnsupportedStyle:
+        stream << "child box has unsupported style";
+        break;
+    case AvoidanceReason::UnsupportedImageMap:
+        stream << "image map";
+        break;
+    case AvoidanceReason::InlineBoxNeedsLayer:
+        stream << "inline box needs layer";
+        break;
+    case AvoidanceReason::InlineBoxHasBorderOrBorderImage:
+        stream << "inline box has border or border image";
+        break;
+    case AvoidanceReason::InlineBoxHasBackground:
+        stream << "inline box has background";
+        break;
+    case AvoidanceReason::InlineBoxHasMarginOrPadding:
+        stream << "inline box has margin or padding";
+        break;
     default:
         break;
     }
@@ -590,7 +617,7 @@
 
     if (child.isFieldset()) {
         // Fieldsets don't follow the standard CSS box model. They require special handling.
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+        SET_REASON_AND_RETURN_IF_NEEDED(UnsupportedFieldset, reasons, includeReasons)
     }
 
 #if ALLOW_IMAGES || ALLOW_ALL_REPLACED || ALLOW_INLINE_BLOCK
@@ -610,18 +637,18 @@
     if (is<RenderReplaced>(child)) {
         auto& replaced = downcast<RenderReplaced>(child);
         if (replaced.isFloating() || replaced.isPositioned())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons)
 
         if (replaced.isSVGRoot())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
 
         if (!isSupportedStyle(replaced.style()))
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons);
 
         if (is<RenderImage>(replaced)) {
             auto& image = downcast<RenderImage>(replaced);
             if (image.imageMap())
-                SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+                SET_REASON_AND_RETURN_IF_NEEDED(UnsupportedImageMap, reasons, includeReasons);
             return reasons;
         }
 #if !ALLOW_ALL_REPLACED
@@ -637,15 +664,15 @@
         if (!block.isReplaced() || !block.isInline())
             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
         if (block.isFloating() || block.isPositioned())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons)
         if (block.isRubyRun())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
 
         auto& style = block.style();
         if (!isSupportedStyle(style))
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
         if (style.display() != DisplayType::InlineBlock)
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
 
         return reasons;
     }
@@ -654,31 +681,29 @@
 #if ALLOW_INLINES
     if (is<RenderInline>(child)) {
         auto& renderInline = downcast<RenderInline>(child);
-        if (renderInline.isRubyInline() || renderInline.isQuote() || renderInline.isSVGInline())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
-
+        if (renderInline.isSVGInline())
+            SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
+        if (renderInline.isRubyInline() || renderInline.isQuote())
+            SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
         if (renderInline.requiresLayer())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+            SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxNeedsLayer, reasons, includeReasons)
 
         auto& style = renderInline.style();
         if (!isSupportedStyle(style))
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
-        if (style.hasBorder())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
-        if (style.borderImage().hasImage())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
+        if (style.hasBorder() || style.borderImage().hasImage())
+            SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBorderOrBorderImage, reasons, includeReasons);
         if (style.hasBackground())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackground, reasons, includeReasons);
         if (style.hasOutline())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
-        if (renderInline.marginLeft() < 0 || renderInline.marginRight() < 0 || renderInline.marginTop() < 0 || renderInline.marginBottom() < 0)
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
-        if (renderInline.paddingLeft() < 0 || renderInline.paddingRight() < 0 || renderInline.paddingTop() < 0 || renderInline.paddingBottom() < 0)
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
+        if (renderInline.marginLeft() < 0 || renderInline.marginRight() < 0 || renderInline.marginTop() < 0 || renderInline.marginBottom() < 0
+            || renderInline.paddingLeft() < 0 || renderInline.paddingRight() < 0 || renderInline.paddingTop() < 0 || renderInline.paddingBottom() < 0)
+            SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasMarginOrPadding, reasons, includeReasons);
         if (renderInline.isInFlowPositioned())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons);
         if (renderInline.containingBlock()->style().lineBoxContain() != RenderStyle::initialLineBoxContain())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
         auto fontAndTextReasons = canUseForFontAndText(downcast<RenderInline>(child), includeReasons);
         if (fontAndTextReasons)
             ADD_REASONS_AND_RETURN_IF_NEEDED(fontAndTextReasons, reasons, includeReasons);
@@ -741,9 +766,9 @@
     if (!flow.isHorizontalWritingMode())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasHorizonalWritingMode, reasons, includeReasons);
     if (flow.hasOutline())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasOutline, reasons, includeReasons);
+        SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
     if (flow.isRubyText() || flow.isRubyBase())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowIsRuby, reasons, includeReasons);
+        SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
     if (!flow.style().hangingPunctuation().isEmpty())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasHangingPunctuation, reasons, includeReasons);
 
diff --git a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
index e9fe9e0..6f8e55c 100644
--- a/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
+++ b/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
@@ -39,8 +39,8 @@
 enum class AvoidanceReason : uint64_t {
     FlowIsInsideANonMultiColumnThread            = 1LLU  << 0,
     FlowHasHorizonalWritingMode                  = 1LLU  << 1,
-    FlowHasOutline                               = 1LLU  << 2,
-    FlowIsRuby                                   = 1LLU  << 3,
+    ContentHasOutline                            = 1LLU  << 2,
+    ContentIsRuby                                = 1LLU  << 3,
     FlowIsPaginated                              = 1LLU  << 4,
     FlowHasTextOverflow                          = 1LLU  << 5,
     FlowIsDepricatedFlexBox                      = 1LLU  << 6,
@@ -91,7 +91,16 @@
     FlowIncludesDocumentMarkers                  = 1LLU  << 51,
     FlowIncludesHighlights                       = 1LLU  << 52,
     FlowHasJustifiedNonBreakingSpace             = 1LLU  << 53,
-    EndOfReasons                                 = 1LLU  << 54
+    UnsupportedFieldset                          = 1LLU  << 54,
+    ChildBoxIsFloatingOrPositioned               = 1LLU  << 55,
+    ContentIsSVG                                 = 1LLU  << 56,
+    ChildBoxHasUnsupportedStyle                  = 1LLU  << 57,
+    UnsupportedImageMap                          = 1LLU  << 58,
+    InlineBoxNeedsLayer                          = 1LLU  << 59,
+    InlineBoxHasBorderOrBorderImage              = 1LLU  << 60,
+    InlineBoxHasBackground                       = 1LLU  << 61,
+    InlineBoxHasMarginOrPadding                  = 1LLU  << 62,
+    EndOfReasons                                 = 1LLU  << 63
 };
 
 bool canUseForLineLayout(const RenderBlockFlow&);