Skip to content
Permalink
Browse files
[LFC][IFC] Cleanup InlineFormattingContext::LineLayout class.
https://bugs.webkit.org/show_bug.cgi?id=199702
<rdar://problem/52931733>

Reviewed by Sam Weinig.

Move some structs to .cpp. They don't need to pollute the class declaration.

* layout/inlineformatting/InlineFormattingContext.h:
(WebCore::Layout::InlineFormattingContext::LineLayout::layoutState const):
(): Deleted.
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::LineInput::HorizontalConstraint::HorizontalConstraint):
(WebCore::Layout::LineInput::LineInput):
(WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const):
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::HorizontalConstraint::HorizontalConstraint): Deleted.
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput): Deleted.


Canonical link: https://commits.webkit.org/213586@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Jul 11, 2019
1 parent 01a5a04 commit 7a30ee264526205f565c54420841bc3dbbc1fc1b
Showing 3 changed files with 52 additions and 30 deletions.
@@ -1,3 +1,23 @@
2019-07-11 Zalan Bujtas <zalan@apple.com>

[LFC][IFC] Cleanup InlineFormattingContext::LineLayout class.
https://bugs.webkit.org/show_bug.cgi?id=199702
<rdar://problem/52931733>

Reviewed by Sam Weinig.

Move some structs to .cpp. They don't need to pollute the class declaration.

* layout/inlineformatting/InlineFormattingContext.h:
(WebCore::Layout::InlineFormattingContext::LineLayout::layoutState const):
(): Deleted.
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::LineInput::HorizontalConstraint::HorizontalConstraint):
(WebCore::Layout::LineInput::LineInput):
(WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const):
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::HorizontalConstraint::HorizontalConstraint): Deleted.
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput): Deleted.

2019-07-11 Joanmarie Diggs <jdiggs@igalia.com>

AX: Implement support for ARIA roles insertion, deletion, subscript, superscript, and time
@@ -38,6 +38,8 @@ namespace Layout {

class FloatingState;
class InlineContainer;
struct LineContent;
struct LineInput;

// This class implements the layout logic for inline formatting contexts.
// https://www.w3.org/TR/CSS22/visuren.html#inline-formatting
@@ -58,33 +60,6 @@ class InlineFormattingContext : public FormattingContext {

private:
LayoutState& layoutState() const { return m_layoutState; }

struct InlineIndexAndSplitPosition {
unsigned index { 0 };
Optional<unsigned> splitPosition;
};

struct LineInput {
LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems&);
struct HorizontalConstraint {
HorizontalConstraint(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth);

LayoutPoint logicalTopLeft;
LayoutUnit availableLogicalWidth;
};
HorizontalConstraint horizontalConstraint;
// FIXME Alternatively we could just have a second pass with vertical positioning (preferred width computation opts out)
Line::SkipVerticalAligment skipVerticalAligment;
InlineIndexAndSplitPosition firstInlineItem;
const InlineItems& inlineItems;
Optional<LayoutUnit> floatMinimumLogicalBottom;
};

struct LineContent {
Optional<InlineIndexAndSplitPosition> lastCommitted;
Vector<WeakPtr<InlineItem>> floats;
std::unique_ptr<Line::Content> runs;
};
LineContent placeInlineItems(const LineInput&) const;
void createDisplayRuns(const Line::Content&, const Vector<WeakPtr<InlineItem>>& floats, LayoutUnit widthConstraint) const;
void alignRuns(TextAlignMode, InlineRuns&, unsigned firstRunIndex, LayoutUnit availableWidth) const;
@@ -41,6 +41,33 @@
namespace WebCore {
namespace Layout {

struct InlineIndexAndSplitPosition {
unsigned index { 0 };
Optional<unsigned> splitPosition;
};

struct LineInput {
LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems&);
struct HorizontalConstraint {
HorizontalConstraint(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth);

LayoutPoint logicalTopLeft;
LayoutUnit availableLogicalWidth;
};
HorizontalConstraint horizontalConstraint;
// FIXME Alternatively we could just have a second pass with vertical positioning (preferred width computation opts out)
Line::SkipVerticalAligment skipVerticalAligment;
InlineIndexAndSplitPosition firstInlineItem;
const InlineItems& inlineItems;
Optional<LayoutUnit> floatMinimumLogicalBottom;
};

struct LineContent {
Optional<InlineIndexAndSplitPosition> lastCommitted;
Vector<WeakPtr<InlineItem>> floats;
std::unique_ptr<Line::Content> runs;
};

struct UncommittedContent {
struct Run {
const InlineItem& inlineItem;
@@ -72,13 +99,13 @@ void UncommittedContent::reset()
m_width = 0;
}

InlineFormattingContext::LineLayout::LineInput::HorizontalConstraint::HorizontalConstraint(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth)
LineInput::HorizontalConstraint::HorizontalConstraint(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth)
: logicalTopLeft(logicalTopLeft)
, availableLogicalWidth(availableLogicalWidth)
{
}

InlineFormattingContext::LineLayout::LineInput::LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment skipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems& inlineItems)
LineInput::LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment skipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems& inlineItems)
: horizontalConstraint(logicalTopLeft, availableLogicalWidth)
, skipVerticalAligment(skipVerticalAligment)
, firstInlineItem(firstToProcess)
@@ -123,7 +150,7 @@ static LayoutUnit inlineItemWidth(const LayoutState& layoutState, const InlineIt
return displayBox.width();
}

InlineFormattingContext::LineLayout::LineContent InlineFormattingContext::LineLayout::placeInlineItems(const LineInput& lineInput) const
LineContent InlineFormattingContext::LineLayout::placeInlineItems(const LineInput& lineInput) const
{
auto initialLineConstraints = Line::InitialConstraints {
lineInput.horizontalConstraint.logicalTopLeft,

0 comments on commit 7a30ee2

Please sign in to comment.