Title: [235777] trunk/Source/WebCore
Revision
235777
Author
[email protected]
Date
2018-09-06 21:24:38 -0700 (Thu, 06 Sep 2018)

Log Message

[LFC] Inline replaced height calculation should use "used value"
https://bugs.webkit.org/show_bug.cgi?id=189395

Reviewed by Antti Koivisto.

Use the already assigned width value (aka used value) instead of the computed value when computing the inline's height.
see https://www.w3.org/TR/CSS22/cascade.html#value-stages for "used" and "computed" value.

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235776 => 235777)


--- trunk/Source/WebCore/ChangeLog	2018-09-07 04:24:19 UTC (rev 235776)
+++ trunk/Source/WebCore/ChangeLog	2018-09-07 04:24:38 UTC (rev 235777)
@@ -1,3 +1,16 @@
+2018-09-06  Zalan Bujtas  <[email protected]>
+
+        [LFC] Inline replaced height calculation should use "used value"
+        https://bugs.webkit.org/show_bug.cgi?id=189395
+
+        Reviewed by Antti Koivisto.
+
+        Use the already assigned width value (aka used value) instead of the computed value when computing the inline's height.
+        see https://www.w3.org/TR/CSS22/cascade.html#value-stages for "used" and "computed" value.
+
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+
 2018-09-06  Wenson Hsieh  <[email protected]>
 
         Refactor WebCore::EditAction to be an 8-bit enum class

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (235776 => 235777)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-09-07 04:24:19 UTC (rev 235776)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-09-07 04:24:38 UTC (rev 235777)
@@ -788,22 +788,21 @@
 
     auto& style = layoutBox.style();
     auto replaced = layoutBox.replaced();
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
-    auto containingBlockWidth = containingBlockDisplayBox.width();
 
     auto height = fixedValue(precomputedHeight ? Length { precomputedHeight.value(), Fixed } : style.logicalHeight());
-    auto heightIsAuto = style.logicalHeight().isAuto();
-    auto width = computedValueIfNotAuto(style.logicalWidth(), containingBlockWidth);
+    auto heightIsAuto = !precomputedHeight && style.logicalHeight().isAuto();
+    auto widthIsAuto = style.logicalWidth().isAuto();
 
     if (!height && !heightIsAuto)
         ASSERT_NOT_IMPLEMENTED_YET();
 
-    if (heightIsAuto && !width && replaced->hasIntrinsicHeight()) {
+    if (heightIsAuto && widthIsAuto && replaced->hasIntrinsicHeight()) {
         // #2
         height = replaced->intrinsicHeight();
     } else if (heightIsAuto && replaced->hasIntrinsicRatio()) {
         // #3
-        height = *width / replaced->intrinsicRatio();
+        auto usedWidth = layoutContext.displayBoxForLayoutBox(layoutBox).width();
+        height = usedWidth / replaced->intrinsicRatio();
     } else if (heightIsAuto && replaced->hasIntrinsicHeight()) {
         // #4
         height = replaced->intrinsicHeight();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to