- Revision
- 266062
- Author
- za...@apple.com
- Date
- 2020-08-24 09:22:06 -0700 (Mon, 24 Aug 2020)
Log Message
[LFC][IFC] Rename LineBox::baseline to alignment baseline
https://bugs.webkit.org/show_bug.cgi?id=214784
Reviewed by Antti Koivisto.
See https://www.w3.org/TR/css-inline-3/#alignment-baseline
Use the spec term. This helps to tell the dominant and the alignment baselines apart during line building.
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
* layout/inlineformatting/InlineLineBox.h:
(WebCore::Layout::LineBox::LineBox):
(WebCore::Layout::LineBox::setAlignmentBaselineIfGreater):
(WebCore::Layout::LineBox::setAscentIfGreater):
(WebCore::Layout::LineBox::alignmentBaseline const):
(WebCore::Layout::LineBox::resetAlignmentBaseline):
(WebCore::Layout::LineBox::setBaselineIfGreater): Deleted.
(WebCore::Layout::LineBox::baseline const): Deleted.
(WebCore::Layout::LineBox::resetBaseline): Deleted.
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):
(WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight):
* layout/inlineformatting/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::baseline const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (266061 => 266062)
--- trunk/Source/WebCore/ChangeLog 2020-08-24 15:50:22 UTC (rev 266061)
+++ trunk/Source/WebCore/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
@@ -1,3 +1,30 @@
+2020-08-24 Zalan Bujtas <za...@apple.com>
+
+ [LFC][IFC] Rename LineBox::baseline to alignment baseline
+ https://bugs.webkit.org/show_bug.cgi?id=214784
+
+ Reviewed by Antti Koivisto.
+
+ See https://www.w3.org/TR/css-inline-3/#alignment-baseline
+ Use the spec term. This helps to tell the dominant and the alignment baselines apart during line building.
+
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
+ * layout/inlineformatting/InlineLineBox.h:
+ (WebCore::Layout::LineBox::LineBox):
+ (WebCore::Layout::LineBox::setAlignmentBaselineIfGreater):
+ (WebCore::Layout::LineBox::setAscentIfGreater):
+ (WebCore::Layout::LineBox::alignmentBaseline const):
+ (WebCore::Layout::LineBox::resetAlignmentBaseline):
+ (WebCore::Layout::LineBox::setBaselineIfGreater): Deleted.
+ (WebCore::Layout::LineBox::baseline const): Deleted.
+ (WebCore::Layout::LineBox::resetBaseline): Deleted.
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::close):
+ (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight):
+ * layout/inlineformatting/InlineLineBuilder.h:
+ (WebCore::Layout::LineBuilder::baseline const):
+
2020-08-24 Adrian Perez de Castro <ape...@igalia.com>
Non-unified build fixes, late August 2020 edition
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (266061 => 266062)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-08-24 15:50:22 UTC (rev 266061)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-08-24 16:22:06 UTC (rev 266062)
@@ -569,7 +569,7 @@
ASSERT_NOT_REACHED();
}
// FIXME: This is where the logical to physical translate should happen.
- inlineContent.lineBoxes.append({ lineBox.logicalRect(), lineBox.scrollableOverflow(), lineInkOverflow, lineBox.baseline() });
+ inlineContent.lineBoxes.append({ lineBox.logicalRect(), lineBox.scrollableOverflow(), lineInkOverflow, lineBox.alignmentBaseline() });
}
void InlineFormattingContext::invalidateFormattingState(const InvalidationState&)
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h (266061 => 266062)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2020-08-24 15:50:22 UTC (rev 266061)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2020-08-24 16:22:06 UTC (rev 266062)
@@ -50,7 +50,7 @@
AscentAndDescent ascentAndDescent;
};
- LineBox(const Display::InlineRect&, const AscentAndDescent&, InlineLayoutUnit baseline);
+ LineBox(const Display::InlineRect&, const AscentAndDescent&, InlineLayoutUnit alignmentBaseline);
LineBox() = default;
const Display::InlineRect& logicalRect() const { return m_rect; }
@@ -64,12 +64,12 @@
InlineLayoutUnit logicalWidth() const { return m_rect.width(); }
InlineLayoutUnit logicalHeight() const { return m_rect.height(); }
- // Baseline from line logical top. Note that the baseline does not necessarily equal to ascent.
+ // Aligment baseline from line logical top.
//
// ------------------- line logical top ------------------- (top align)
// ^ ^
// | ^ |
- // ^ | baseline | | baseline
+ // ^ | alignment baseline | | alignment baseline
// | | | |
// | ascent | | ascent |
// | | v v
@@ -79,14 +79,14 @@
// | descent v
// v
// ------------------- line logical bottom -------------------
- InlineLayoutUnit baseline() const;
+ InlineLayoutUnit alignmentBaseline() const;
const AscentAndDescent& ascentAndDescent() const { return m_rootInlineBox.ascentAndDescent; }
- void setBaselineIfGreater(InlineLayoutUnit);
+ void setAlignmentBaselineIfGreater(InlineLayoutUnit);
void setAscentIfGreater(InlineLayoutUnit);
void setDescentIfGreater(InlineLayoutUnit);
- void resetBaseline();
+ void resetAlignmentBaseline();
void resetDescent() { m_rootInlineBox.ascentAndDescent.descent = { }; }
void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_rect.setHeight(logicalHeight); }
@@ -116,22 +116,22 @@
private:
#if ASSERT_ENABLED
- bool m_hasValidBaseline { false };
+ bool m_hasValidAlignmentBaseline { false };
#endif
Display::InlineRect m_rect;
Display::InlineRect m_scrollableOverflow;
- InlineLayoutUnit m_baseline { 0 };
+ InlineLayoutUnit m_alignmentBaseline { 0 };
bool m_isConsideredEmpty { true };
InlineBox m_rootInlineBox;
};
-inline LineBox::LineBox(const Display::InlineRect& rect, const AscentAndDescent& ascentAndDescent, InlineLayoutUnit baseline)
+inline LineBox::LineBox(const Display::InlineRect& rect, const AscentAndDescent& ascentAndDescent, InlineLayoutUnit alignmentBaseline)
: m_rect(rect)
- , m_baseline(baseline)
+ , m_alignmentBaseline(alignmentBaseline)
, m_rootInlineBox(ascentAndDescent)
{
#if ASSERT_ENABLED
- m_hasValidBaseline = true;
+ m_hasValidAlignmentBaseline = true;
#endif
}
@@ -147,12 +147,12 @@
m_rect.setHeight(logicalHeight);
}
-inline void LineBox::setBaselineIfGreater(InlineLayoutUnit baseline)
+inline void LineBox::setAlignmentBaselineIfGreater(InlineLayoutUnit alignmentBaseline)
{
#if ASSERT_ENABLED
- m_hasValidBaseline = true;
+ m_hasValidAlignmentBaseline = true;
#endif
- m_baseline = std::max(baseline, m_baseline);
+ m_alignmentBaseline = std::max(alignmentBaseline, m_alignmentBaseline);
}
inline void LineBox::setAscentIfGreater(InlineLayoutUnit ascent)
@@ -159,7 +159,7 @@
{
if (ascent < m_rootInlineBox.ascentAndDescent.ascent)
return;
- setBaselineIfGreater(ascent);
+ setAlignmentBaselineIfGreater(ascent);
m_rootInlineBox.ascentAndDescent.ascent = ascent;
}
@@ -170,18 +170,18 @@
m_rootInlineBox.ascentAndDescent.descent = descent;
}
-inline InlineLayoutUnit LineBox::baseline() const
+inline InlineLayoutUnit LineBox::alignmentBaseline() const
{
- ASSERT(m_hasValidBaseline);
- return m_baseline;
+ ASSERT(m_hasValidAlignmentBaseline);
+ return m_alignmentBaseline;
}
-inline void LineBox::resetBaseline()
+inline void LineBox::resetAlignmentBaseline()
{
#if ASSERT_ENABLED
- m_hasValidBaseline = true;
+ m_hasValidAlignmentBaseline = true;
#endif
- m_baseline = 0_lu;
+ m_alignmentBaseline = 0_lu;
m_rootInlineBox.ascentAndDescent.descent = { };
m_rootInlineBox.ascentAndDescent.ascent = { };
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (266061 => 266062)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-08-24 15:50:22 UTC (rev 266061)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-08-24 16:22:06 UTC (rev 266062)
@@ -120,7 +120,7 @@
auto hangingContent = collectHangingContent(isLastLineWithInlineContent);
adjustBaselineAndLineHeight();
if (isVisuallyEmpty()) {
- m_lineBox.resetBaseline();
+ m_lineBox.resetAlignmentBaseline();
m_lineBox.setLogicalHeight({ });
}
// Remove descent when all content is baseline aligned but none of them have descent.
@@ -620,7 +620,7 @@
// There has to be at least one line -even if it is empty.
auto& lastLineBox = formattingState.displayInlineContent()->lineBoxes.last();
auto beforeHeight = boxGeometry.marginBefore() + boxGeometry.borderTop() + boxGeometry.paddingTop().valueOr(0);
- m_lineBox.setBaselineIfGreater(beforeHeight + lastLineBox.baseline());
+ m_lineBox.setAlignmentBaselineIfGreater(beforeHeight + lastLineBox.baseline());
m_lineBox.setLogicalHeightIfGreater(marginBoxHeight);
} else {
// Non inline-block boxes sit on the baseline (including their bottom margin).
@@ -639,7 +639,7 @@
auto lineLogicalHeight = m_lineBox.logicalHeight();
if (marginBoxHeight > lineLogicalHeight) {
m_lineBox.setLogicalHeightIfGreater(marginBoxHeight);
- m_lineBox.setBaselineIfGreater(m_lineBox.baseline() + (marginBoxHeight - lineLogicalHeight));
+ m_lineBox.setAlignmentBaselineIfGreater(m_lineBox.alignmentBaseline() + (marginBoxHeight - lineLogicalHeight));
}
break;
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (266061 => 266062)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-08-24 15:50:22 UTC (rev 266061)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2020-08-24 16:22:06 UTC (rev 266062)
@@ -162,7 +162,7 @@
InlineLayoutUnit contentLogicalWidth() const { return m_lineBox.logicalWidth(); }
InlineLayoutUnit contentLogicalRight() const { return m_lineBox.logicalRight(); }
- InlineLayoutUnit baseline() const { return m_lineBox.baseline(); }
+ InlineLayoutUnit baseline() const { return m_lineBox.alignmentBaseline(); }
struct InlineRunDetails {
InlineLayoutUnit logicalWidth { 0 };