+2018-09-06 Zalan Bujtas <zalan@apple.com>
+
+ [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 <wenson_hsieh@apple.com>
Refactor WebCore::EditAction to be an 8-bit enum class
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();