Diff
Modified: trunk/Source/WebCore/ChangeLog (253258 => 253259)
--- trunk/Source/WebCore/ChangeLog 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/ChangeLog 2019-12-07 19:53:13 UTC (rev 253259)
@@ -1,5 +1,29 @@
2019-12-07 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Initialize InlineLayoutUnit variables to 0
+ https://bugs.webkit.org/show_bug.cgi?id=204989
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for using float based types in IFC. See webkit.org/b/204986 for more info.
+
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
+ * layout/inlineformatting/InlineLineBreaker.cpp:
+ (WebCore::Layout::LineBreaker::wordBreakingBehavior const):
+ * layout/inlineformatting/InlineLineBreaker.h:
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::initialize):
+ (WebCore::Layout::LineBuilder::alignContentVertically):
+ (WebCore::Layout::LineBuilder::justifyRuns const):
+ (WebCore::Layout::LineBuilder::TrimmableContent::append):
+ (WebCore::Layout::LineBuilder::TrimmableContent::trim):
+ (WebCore::Layout::LineBuilder::TrimmableContent::trimTrailingRun):
+ * layout/inlineformatting/InlineLineBuilder.h:
+ * layout/inlineformatting/text/TextUtil.h:
+
+2019-12-07 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Introduce InlineRect
https://bugs.webkit.org/show_bug.cgi?id=204988
<rdar://problem/57729049>
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-12-07 19:53:13 UTC (rev 253259)
@@ -231,7 +231,7 @@
InlineLayoutUnit InlineFormattingContext::computedIntrinsicWidthForConstraint(const UsedHorizontalValues& usedHorizontalValues) const
{
auto& inlineItems = formattingState().inlineItems();
- InlineLayoutUnit maximumLineWidth;
+ InlineLayoutUnit maximumLineWidth = 0;
unsigned leadingInlineItemIndex = 0;
auto lineBuilder = LineBuilder { *this, root().style().textAlign(), LineBuilder::SkipAlignment::Yes };
auto lineLayoutContext = LineLayoutContext { *this, root(), inlineItems };
@@ -241,7 +241,7 @@
auto lineContent = lineLayoutContext.layoutLine(lineBuilder, leadingInlineItemIndex, { });
leadingInlineItemIndex = *lineContent.trailingInlineItemIndex + 1;
- InlineLayoutUnit floatsWidth;
+ InlineLayoutUnit floatsWidth = 0;
for (auto& floatItem : lineContent.floats)
floatsWidth += geometryForBox(floatItem->layoutBox()).marginBoxWidth();
maximumLineWidth = std::max(maximumLineWidth, floatsWidth + lineContent.lineBox.logicalWidth());
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-07 19:53:13 UTC (rev 253259)
@@ -102,7 +102,7 @@
{
// Check where the overflow occurs and use the corresponding style to figure out the breaking behaviour.
// <span style="word-break: normal">first</span><span style="word-break: break-all">second</span><span style="word-break: normal">third</span>
- InlineLayoutUnit accumulatedRunWidth;
+ InlineLayoutUnit accumulatedRunWidth = 0;
unsigned index = 0;
while (index < runs.size()) {
auto& run = runs[index];
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-07 19:53:13 UTC (rev 253259)
@@ -47,7 +47,7 @@
struct PartialTrailingContent {
unsigned runIndex { 0 };
unsigned length { 0 };
- InlineLayoutUnit logicalWidth;
+ InlineLayoutUnit logicalWidth { 0 };
bool needsHyphen { false };
};
Optional<PartialTrailingContent> partialTrailingContent;
@@ -71,7 +71,7 @@
struct Run {
const InlineItem& inlineItem;
- InlineLayoutUnit logicalWidth;
+ InlineLayoutUnit logicalWidth { 0 };
};
using RunList = Vector<Run, 30>;
@@ -93,17 +93,17 @@
void reset();
bool isFullyTrimmable { false };
- InlineLayoutUnit width;
+ InlineLayoutUnit width { 0 };
};
TrailingTrimmableContent m_trailingTrimmableContent;
- InlineLayoutUnit m_width;
+ InlineLayoutUnit m_width { 0 };
};
struct LineStatus {
- InlineLayoutUnit availableWidth;
- InlineLayoutUnit trimmableWidth;
- bool lineHasFullyTrimmableTrailingRun;
- bool lineIsEmpty;
+ InlineLayoutUnit availableWidth { 0 };
+ InlineLayoutUnit trimmableWidth { 0 };
+ bool lineHasFullyTrimmableTrailingRun { false };
+ bool lineIsEmpty { true };
};
BreakingContext breakingContextForInlineContent(const Content& candidateRuns, const LineStatus&);
bool shouldWrapFloatBox(InlineLayoutUnit floatLogicalWidth, InlineLayoutUnit availableWidth, bool lineIsEmpty);
@@ -114,7 +114,7 @@
Optional<BreakingContext::PartialTrailingContent> wordBreakingBehavior(const Content::RunList&, InlineLayoutUnit availableWidth) const;
struct LeftSide {
unsigned length { 0 };
- InlineLayoutUnit logicalWidth;
+ InlineLayoutUnit logicalWidth { 0 };
bool needsHyphen { false };
};
Optional<LeftSide> tryBreakingTextRun(const Content::Run& overflowRun, InlineLayoutUnit availableWidth) const;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2019-12-07 19:53:13 UTC (rev 253259)
@@ -50,7 +50,7 @@
const InlineItemRun& m_initialInlineRun;
const bool m_textIsAlignJustify { false };
unsigned m_expandedLength { 0 };
- InlineLayoutUnit m_expandedWidth;
+ InlineLayoutUnit m_expandedWidth { 0 };
bool m_trailingRunCanBeExpanded { false };
bool m_hasTrailingExpansionOpportunity { false };
unsigned m_expansionOpportunityCount { 0 };
@@ -168,8 +168,8 @@
{
ASSERT(m_skipAlignment || constraints.heightAndBaseline);
- InlineLayoutUnit initialLineHeight;
- InlineLayoutUnit initialBaselineOffset;
+ InlineLayoutUnit initialLineHeight = 0;
+ InlineLayoutUnit initialBaselineOffset = 0;
if (constraints.heightAndBaseline) {
m_initialStrut = constraints.heightAndBaseline->strut;
initialLineHeight = constraints.heightAndBaseline->height;
@@ -238,7 +238,7 @@
{
ASSERT(!m_skipAlignment);
for (auto& run : runList) {
- InlineLayoutUnit logicalTop;
+ InlineLayoutUnit logicalTop = 0;
auto& layoutBox = run.layoutBox();
auto verticalAlign = layoutBox.style().verticalAlign();
auto ascent = layoutBox.style().fontMetrics().ascent();
@@ -306,7 +306,7 @@
return;
// Distribute the extra space.
auto expansionToDistribute = availableWidth() / expansionOpportunityCount;
- InlineLayoutUnit accumulatedExpansion;
+ InlineLayoutUnit accumulatedExpansion = 0;
for (auto& run : runList) {
// Expand and moves runs by the accumulated expansion.
if (!run.hasExpansionOpportunity()) {
@@ -707,7 +707,7 @@
void LineBuilder::TrimmableContent::append(size_t runIndex)
{
auto& trimmableRun = m_inlineitemRunList[runIndex];
- InlineLayoutUnit trimmableWidth;
+ InlineLayoutUnit trimmableWidth = 0;
auto isFullyTrimmable = trimmableRun.isTrimmableWhitespace();
if (isFullyTrimmable)
trimmableWidth = trimmableRun.logicalWidth();
@@ -734,7 +734,7 @@
// <span> </span><span></span> ->
// [whitespace][container end][container start][container end]
// Trim the whitespace run and move the trailing inline container runs to the left.
- InlineLayoutUnit accumulatedTrimmedWidth;
+ InlineLayoutUnit accumulatedTrimmedWidth = 0;
for (auto index = *m_firstRunIndex; index < m_inlineitemRunList.size(); ++index) {
auto& run = m_inlineitemRunList[index];
run.moveHorizontally(-accumulatedTrimmedWidth);
@@ -771,7 +771,7 @@
ASSERT(run.isContainerStart() || run.isContainerEnd());
continue;
}
- InlineLayoutUnit trimmedWidth;
+ InlineLayoutUnit trimmedWidth = 0;
if (run.isWhitespace()) {
trimmedWidth = run.logicalWidth();
run.setCollapsesToZeroAdvanceWidth();
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h 2019-12-07 19:53:13 UTC (rev 253259)
@@ -43,12 +43,12 @@
public:
struct Constraints {
- LayoutPoint logicalTopLeft;
- InlineLayoutUnit availableLogicalWidth;
+ InlineLayoutPoint logicalTopLeft;
+ InlineLayoutUnit availableLogicalWidth { 0 };
bool lineIsConstrainedByFloat { false };
struct HeightAndBaseline {
- InlineLayoutUnit height;
- InlineLayoutUnit baselineOffset;
+ InlineLayoutUnit height { 0 };
+ InlineLayoutUnit baselineOffset { 0 };
Optional<Display::LineBox::Baseline> strut;
};
Optional<HeightAndBaseline> heightAndBaseline;
@@ -192,8 +192,8 @@
private:
const InlineItem& m_inlineItem;
- InlineLayoutUnit m_logicalLeft;
- InlineLayoutUnit m_logicalWidth;
+ InlineLayoutUnit m_logicalLeft { 0 };
+ InlineLayoutUnit m_logicalWidth { 0 };
const Optional<Display::Run::TextContext> m_textContext;
bool m_isCollapsed { false };
bool m_collapsedToZeroAdvanceWidth { false };
@@ -218,7 +218,7 @@
private:
InlineItemRunList& m_inlineitemRunList;
Optional<size_t> m_firstRunIndex;
- InlineLayoutUnit m_width;
+ InlineLayoutUnit m_width { 0 };
bool m_lastRunIsFullyTrimmable { false };
};
@@ -226,7 +226,7 @@
InlineItemRunList m_inlineItemRuns;
TrimmableContent m_trimmableContent;
Optional<Display::LineBox::Baseline> m_initialStrut;
- InlineLayoutUnit m_lineLogicalWidth;
+ InlineLayoutUnit m_lineLogicalWidth { 0 };
Optional<TextAlignMode> m_horizontalAlignment;
bool m_skipAlignment { false };
bool m_hasIntrusiveFloat { false };
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h (253258 => 253259)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2019-12-07 19:04:39 UTC (rev 253258)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2019-12-07 19:53:13 UTC (rev 253259)
@@ -37,12 +37,12 @@
class TextUtil {
public:
- static InlineLayoutUnit width(const Box&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft = 0_lu);
+ static InlineLayoutUnit width(const Box&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft = 0);
static Optional<unsigned> hyphenPositionBefore(const InlineItem&, unsigned from, unsigned length);
struct SplitData {
unsigned start { 0 };
unsigned length { 0 };
- InlineLayoutUnit logicalWidth;
+ InlineLayoutUnit logicalWidth { 0 };
};
static SplitData split(const Box&, unsigned startPosition, unsigned length, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft);
static bool shouldPreserveTrailingWhitespace(const RenderStyle&);