Title: [269645] trunk/Source/WebCore
- Revision
- 269645
- Author
- [email protected]
- Date
- 2020-11-10 13:27:37 -0800 (Tue, 10 Nov 2020)
Log Message
[LFC][IFC] Add support for replaced element baseline
https://bugs.webkit.org/show_bug.cgi?id=218767
Reviewed by Antti Koivisto.
Replaced elements can have set baselines.
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
* layout/layouttree/LayoutReplacedBox.h:
(WebCore::Layout::ReplacedBox::setBaseline):
(WebCore::Layout::ReplacedBox::baseline const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (269644 => 269645)
--- trunk/Source/WebCore/ChangeLog 2020-11-10 21:17:29 UTC (rev 269644)
+++ trunk/Source/WebCore/ChangeLog 2020-11-10 21:27:37 UTC (rev 269645)
@@ -1,3 +1,18 @@
+2020-11-10 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Add support for replaced element baseline
+ https://bugs.webkit.org/show_bug.cgi?id=218767
+
+ Reviewed by Antti Koivisto.
+
+ Replaced elements can have set baselines.
+
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ * layout/layouttree/LayoutReplacedBox.h:
+ (WebCore::Layout::ReplacedBox::setBaseline):
+ (WebCore::Layout::ReplacedBox::baseline const):
+
2020-11-10 Youenn Fablet <[email protected]> and Victor M Jaquez <[email protected]>
Update WebRTC liwebrtc to M87
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (269644 => 269645)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-11-10 21:17:29 UTC (rev 269644)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-11-10 21:27:37 UTC (rev 269645)
@@ -254,19 +254,21 @@
auto logicalLeft = horizontalAligmentOffset + run.logicalLeft();
if (run.isBox()) {
auto& inlineLevelBoxGeometry = formattingContext().geometryForBox(layoutBox);
- auto logicalHeight = inlineLevelBoxGeometry.marginBoxHeight();
- auto ascent = logicalHeight;
+ auto marginBoxHeight = inlineLevelBoxGeometry.marginBoxHeight();
+ auto ascent = InlineLayoutUnit { };
if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
auto& lastLine = formattingState.lines().last();
auto inlineBlockBaseline = lastLine.logicalTop() + lastLine.baseline();
ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
- }
- auto atomicInlineLevelBox = LineBox::InlineLevelBox::createAtomicInlineLevelBox(layoutBox, logicalLeft, { run.logicalWidth(), logicalHeight });
+ } else if (layoutBox.isReplacedBox())
+ ascent = downcast<ReplacedBox>(layoutBox).baseline().valueOr(marginBoxHeight);
+ else
+ ascent = marginBoxHeight;
+ auto atomicInlineLevelBox = LineBox::InlineLevelBox::createAtomicInlineLevelBox(layoutBox, logicalLeft, { run.logicalWidth(), marginBoxHeight });
atomicInlineLevelBox->setBaseline(ascent);
- ASSERT(logicalHeight >= ascent);
- atomicInlineLevelBox->setLayoutBounds(LineBox::InlineLevelBox::LayoutBounds { ascent, logicalHeight - ascent });
- if (logicalHeight)
+ atomicInlineLevelBox->setLayoutBounds(LineBox::InlineLevelBox::LayoutBounds { ascent, marginBoxHeight - ascent });
+ if (marginBoxHeight)
atomicInlineLevelBox->setIsNonEmpty();
lineBox.addInlineLevelBox(WTFMove(atomicInlineLevelBox));
} else if (run.isInlineBoxStart()) {
Modified: trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.h (269644 => 269645)
--- trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.h 2020-11-10 21:17:29 UTC (rev 269644)
+++ trunk/Source/WebCore/layout/layouttree/LayoutReplacedBox.h 2020-11-10 21:27:37 UTC (rev 269645)
@@ -60,6 +60,9 @@
LayoutUnit intrinsicHeight() const;
LayoutUnit intrinsicRatio() const;
+ void setBaseline(LayoutUnit baseline) { m_baseline = baseline; }
+ Optional<LayoutUnit> baseline() const { return m_baseline; }
+
private:
bool hasAspectRatio() const;
@@ -66,6 +69,7 @@
Optional<LayoutSize> m_intrinsicSize;
Optional<LayoutUnit> m_intrinsicRatio;
Optional<LayoutSize> m_contentSizeForIntegration;
+ Optional<LayoutUnit> m_baseline;
CachedImage* m_cachedImage { nullptr };
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes