Title: [273805] trunk/Source/WebCore
- Revision
- 273805
- Author
- [email protected]
- Date
- 2021-03-02 20:29:26 -0800 (Tue, 02 Mar 2021)
Log Message
[LFC][IFC] Enable simplified vertical alignment for hard line breaks
https://bugs.webkit.org/show_bug.cgi?id=222606
Reviewed by Antti Koivisto.
This patch enables the simplified vertical alignment for cases when the line ends with a non-stretching hard line break.
e.g.
<div>text<br>content</div>
<div>text<span><br></span>content</div>
but not when
<div>text<span style="font-size: 100px;"><br></span>content</div>
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::canUseSimplifiedAlignment):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::align):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (273804 => 273805)
--- trunk/Source/WebCore/ChangeLog 2021-03-03 03:09:26 UTC (rev 273804)
+++ trunk/Source/WebCore/ChangeLog 2021-03-03 04:29:26 UTC (rev 273805)
@@ -1,3 +1,22 @@
+2021-03-02 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Enable simplified vertical alignment for hard line breaks
+ https://bugs.webkit.org/show_bug.cgi?id=222606
+
+ Reviewed by Antti Koivisto.
+
+ This patch enables the simplified vertical alignment for cases when the line ends with a non-stretching hard line break.
+ e.g.
+ <div>text<br>content</div>
+ <div>text<span><br></span>content</div>
+ but not when
+ <div>text<span style="font-size: 100px;"><br></span>content</div>
+
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
+ (WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::canUseSimplifiedAlignment):
+ (WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::align):
+
2021-03-02 Yusuke Suzuki <[email protected]>
[JSC] Remove ImpureProxyType
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (273804 => 273805)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-03-03 03:09:26 UTC (rev 273804)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-03-03 04:29:26 UTC (rev 273805)
@@ -364,8 +364,8 @@
if (run.isHardLineBreak()) {
auto lineBreakBox = LineBox::InlineLevelBox::createLineBreakBox(layoutBox, logicalLeft);
setVerticalGeometryForInlineBox(*lineBreakBox);
+ simplifiedAlignVerticallyIfApplicable(*lineBreakBox, formattingContext().geometryForBox(layoutBox));
lineBox.addInlineLevelBox(WTFMove(lineBreakBox));
- simplifiedVerticalAlignment.setEnabled(false);
continue;
}
if (run.isWordBreakOpportunity()) {
@@ -636,12 +636,18 @@
&& !inlineLevelBoxGeometry.marginAfter()
&& inlineLevelBoxGeometry.marginBoxHeight() <= rootInlineBox.baseline();
}
+ if (inlineLevelBox.isLineBreakBox()) {
+ // Baseline aligned, non-stretchy line breaks e.g. <div><span><br></span></div> but not <div><span style="font-size: 100px;"><br></span></div>.
+ auto& layoutBox = inlineLevelBox.layoutBox();
+ return layoutBox.style().verticalAlign() == VerticalAlign::Baseline
+ && inlineLevelBox.baseline() <= rootInlineBox.baseline();
+ }
return false;
}
void LineBoxBuilder::SimplifiedVerticalAlignment::align(LineBox::InlineLevelBox& inlineLevelBox)
{
- if (inlineLevelBox.isAtomicInlineLevelBox()) {
+ if (inlineLevelBox.isAtomicInlineLevelBox() || inlineLevelBox.isLineBreakBox()) {
// Only baseline alignment for now.
inlineLevelBox.setLogicalTop(m_rootInlineBox.baseline() - inlineLevelBox.baseline());
adjust(inlineLevelBox);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes