Title: [289712] trunk/Source/WebCore
Revision
289712
Author
za...@apple.com
Date
2022-02-13 06:56:52 -0800 (Sun, 13 Feb 2022)

Log Message

[LFC][Integration] Introduce Box::ElementType::IntegrationInlineBlock
https://bugs.webkit.org/show_bug.cgi?id=236554

Reviewed by Antti Koivisto.

This is in preparation for adding vertical baseline support for inline-block boxes with alphabetic baseline.
The integration tree builder constructs Replaced layout boxes for both inline-block and replaced types.
In LineBoxBuilder we need to be able to tell whether a particular inline level box is really a replaced
box or just an inline-block in order to assign the correct type of baseline (alphabetic/ideographic).

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::BoxTree):
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::Box): Let's use the ElementType for the integration root too.
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isIntegrationBlockContainer const):
(WebCore::Layout::Box::isIntegrationInlineBlock const):
(WebCore::Layout::Box::setIsAnonymous):
(WebCore::Layout::Box::setIsIntegrationBlockContainer): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289711 => 289712)


--- trunk/Source/WebCore/ChangeLog	2022-02-13 14:55:10 UTC (rev 289711)
+++ trunk/Source/WebCore/ChangeLog	2022-02-13 14:56:52 UTC (rev 289712)
@@ -1,5 +1,28 @@
 2022-02-13  Alan Bujtas  <za...@apple.com>
 
+        [LFC][Integration] Introduce Box::ElementType::IntegrationInlineBlock
+        https://bugs.webkit.org/show_bug.cgi?id=236554
+
+        Reviewed by Antti Koivisto.
+
+        This is in preparation for adding vertical baseline support for inline-block boxes with alphabetic baseline.
+        The integration tree builder constructs Replaced layout boxes for both inline-block and replaced types.
+        In LineBoxBuilder we need to be able to tell whether a particular inline level box is really a replaced
+        box or just an inline-block in order to assign the correct type of baseline (alphabetic/ideographic).
+
+        * layout/integration/LayoutIntegrationBoxTree.cpp:
+        (WebCore::LayoutIntegration::BoxTree::BoxTree):
+        (WebCore::LayoutIntegration::BoxTree::buildTree):
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::Box): Let's use the ElementType for the integration root too.
+        * layout/layouttree/LayoutBox.h:
+        (WebCore::Layout::Box::isIntegrationBlockContainer const):
+        (WebCore::Layout::Box::isIntegrationInlineBlock const):
+        (WebCore::Layout::Box::setIsAnonymous):
+        (WebCore::Layout::Box::setIsIntegrationBlockContainer): Deleted.
+
+2022-02-13  Alan Bujtas  <za...@apple.com>
+
         [LFC][IFC] Pass in the correct LineDirectionMode value to RenderBoxModelObject::baselinePosition
         https://bugs.webkit.org/show_bug.cgi?id=236552
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (289711 => 289712)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-02-13 14:55:10 UTC (rev 289711)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-02-13 14:56:52 UTC (rev 289712)
@@ -75,10 +75,8 @@
 
 BoxTree::BoxTree(RenderBlockFlow& flow)
     : m_flow(flow)
-    , m_root(Layout::Box::ElementAttributes { }, rootBoxStyle(flow.style()), rootBoxFirstLineStyle(flow))
+    , m_root(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, rootBoxStyle(flow.style()), rootBoxFirstLineStyle(flow))
 {
-    m_root.setIsIntegrationBlockContainer();
-
     if (flow.isAnonymous())
         m_root.setIsAnonymous();
 
@@ -119,7 +117,7 @@
             return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { is<RenderImage>(childRenderer) ? Layout::Box::ElementType::Image : Layout::Box::ElementType::GenericElement }, WTFMove(style), WTFMove(firstLineStyle));
 
         if (is<RenderBlock>(childRenderer))
-            return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style), WTFMove(firstLineStyle));
+            return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationInlineBlock }, WTFMove(style), WTFMove(firstLineStyle));
 
         if (is<RenderInline>(childRenderer)) {
             // This looks like continuation renderer.

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (289711 => 289712)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2022-02-13 14:55:10 UTC (rev 289711)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2022-02-13 14:56:52 UTC (rev 289712)
@@ -48,7 +48,6 @@
     , m_baseTypeFlags(baseTypeFlags.toRaw())
     , m_hasRareData(false)
     , m_isAnonymous(false)
-    , m_isIntegrationBlockContainer(false)
 {
     if (firstLineStyle)
         ensureRareData().firstLineStyle = WTFMove(firstLineStyle);

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (289711 => 289712)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2022-02-13 14:55:10 UTC (rev 289711)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2022-02-13 14:56:52 UTC (rev 289712)
@@ -52,6 +52,8 @@
         TableBox, // The table box is a block-level box that contains the table's internal table boxes.
         Image,
         IFrame,
+        IntegrationBlockContainer,
+        IntegrationInlineBlock, // Integration sets up inline-block boxes as replaced boxes.
         GenericElement
     };
 
@@ -138,8 +140,9 @@
     bool isIFrame() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::IFrame; }
     bool isImage() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Image; }
     bool isInternalRubyBox() const { return false; }
-    bool isIntegrationBlockContainer() const { return m_isIntegrationBlockContainer; }
+    bool isIntegrationBlockContainer() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::IntegrationBlockContainer; }
     bool isIntegrationRoot() const { return isIntegrationBlockContainer() && !m_parent; }
+    bool isIntegrationInlineBlock() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::IntegrationInlineBlock; }
 
     const ContainerBox& parent() const { return *m_parent; }
     const Box* nextSibling() const { return m_nextSibling.get(); }
@@ -176,7 +179,6 @@
     std::optional<LayoutUnit> columnWidth() const;
 
     void setIsAnonymous() { m_isAnonymous = true; }
-    void setIsIntegrationBlockContainer() { m_isIntegrationBlockContainer = true; }
 
     bool canCacheForLayoutState(const LayoutState&) const;
     BoxGeometry* cachedGeometryForLayoutState(const LayoutState&) const;
@@ -228,7 +230,6 @@
     unsigned m_baseTypeFlags : 6; // OptionSet<BaseTypeFlag>
     bool m_hasRareData : 1;
     bool m_isAnonymous : 1;
-    bool m_isIntegrationBlockContainer : 1;
 };
 
 inline bool Box::isContainingBlockForInFlow() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to