Title: [268924] trunk/Source/WebCore
Revision
268924
Author
[email protected]
Date
2020-10-23 07:40:16 -0700 (Fri, 23 Oct 2020)

Log Message

[LFC][IFC] Add initial support for vertical-align: <length> and <percentage>
https://bugs.webkit.org/show_bug.cgi?id=218109

Reviewed by Antti Koivisto.

Raise (positive value) or lower (negative value) the box by this distance.
It fixes css2.1/20110323/vertical-align-boxes-001.htm.

* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::alignInlineLevelBoxesVerticallyAndComputeLineBoxHeight):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268923 => 268924)


--- trunk/Source/WebCore/ChangeLog	2020-10-23 12:53:42 UTC (rev 268923)
+++ trunk/Source/WebCore/ChangeLog	2020-10-23 14:40:16 UTC (rev 268924)
@@ -1,3 +1,16 @@
+2020-10-23  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Add initial support for vertical-align: <length> and <percentage>
+        https://bugs.webkit.org/show_bug.cgi?id=218109
+
+        Reviewed by Antti Koivisto.
+
+        Raise (positive value) or lower (negative value) the box by this distance.
+        It fixes css2.1/20110323/vertical-align-boxes-001.htm.
+
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::LineBoxBuilder::alignInlineLevelBoxesVerticallyAndComputeLineBoxHeight):
+
 2020-10-23  Miguel Gomez  <[email protected]>
 
         [GTK][WPE] Implement antialiased rounded rectangle clipping in TextureMapper

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (268923 => 268924)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-10-23 12:53:42 UTC (rev 268923)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-10-23 14:40:16 UTC (rev 268924)
@@ -318,7 +318,6 @@
         // with non-line box relative alignment.
         for (auto& inlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
             auto& layoutBox = inlineLevelBox->layoutBox();
-            auto verticalAlignment = layoutBox.style().verticalAlign();
             if (inlineLevelBox->hasLineBoxRelativeAlignment()) {
                 lineBoxRelativeInlineLevelBoxes.append(inlineLevelBox.get());
                 continue;
@@ -326,7 +325,7 @@
             auto& parentInlineBox = lineBox.inlineLevelBoxForLayoutBox(layoutBox.parent());
             auto logicalTop = InlineLayoutUnit { };
             auto offsetFromParentInlineBoxBaseline = InlineLayoutUnit { };
-            switch (verticalAlignment) {
+            switch (inlineLevelBox->verticalAlign()) {
             case VerticalAlign::Baseline:
                 offsetFromParentInlineBoxBaseline = inlineLevelBox->layoutBounds().ascent;
                 logicalTop = parentInlineBox.baseline() - offsetFromParentInlineBoxBaseline;
@@ -352,6 +351,12 @@
                 offsetFromParentInlineBoxBaseline = (inlineLevelBox->layoutBounds().height() / 2 + parentInlineBox.fontMetrics().xHeight() / 2);
                 logicalTop = parentInlineBox.baseline() - offsetFromParentInlineBoxBaseline;
                 break;
+            case VerticalAlign::Length: {
+                auto& style = layoutBox.style();
+                offsetFromParentInlineBoxBaseline = floatValueForLength(style.verticalAlignLength(), style.computedLineHeight());
+                logicalTop = parentInlineBox.baseline() - offsetFromParentInlineBoxBaseline - inlineLevelBox->logicalHeight();
+                break;
+            }
             default:
                 ASSERT_NOT_IMPLEMENTED_YET();
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to