Title: [250412] trunk/Source/WebCore
- Revision
- 250412
- Author
- [email protected]
- Date
- 2019-09-26 20:43:54 -0700 (Thu, 26 Sep 2019)
Log Message
[LFC][IFC] Line::Run should have a reference to the associated InlineItem
https://bugs.webkit.org/show_bug.cgi?id=202288
<rdar://problem/55758112>
Reviewed by Antti Koivisto.
It makes it clearer where the type and the layout box come from.
* layout/inlineformatting/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Run::Run):
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::Run::layoutBox const):
(WebCore::Layout::Line::Run::textContext const):
(WebCore::Layout::Line::Run::isText const):
(WebCore::Layout::Line::Run::isBox const):
(WebCore::Layout::Line::Run::isLineBreak const):
(WebCore::Layout::Line::Run::isContainerStart const):
(WebCore::Layout::Line::Run::isContainerEnd const):
(WebCore::Layout::Line::Run::type const): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (250411 => 250412)
--- trunk/Source/WebCore/ChangeLog 2019-09-27 03:23:32 UTC (rev 250411)
+++ trunk/Source/WebCore/ChangeLog 2019-09-27 03:43:54 UTC (rev 250412)
@@ -1,5 +1,29 @@
2019-09-26 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Line::Run should have a reference to the associated InlineItem
+ https://bugs.webkit.org/show_bug.cgi?id=202288
+ <rdar://problem/55758112>
+
+ Reviewed by Antti Koivisto.
+
+ It makes it clearer where the type and the layout box come from.
+
+ * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
+ (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::Run::Run):
+ * layout/inlineformatting/InlineLine.h:
+ (WebCore::Layout::Line::Run::layoutBox const):
+ (WebCore::Layout::Line::Run::textContext const):
+ (WebCore::Layout::Line::Run::isText const):
+ (WebCore::Layout::Line::Run::isBox const):
+ (WebCore::Layout::Line::Run::isLineBreak const):
+ (WebCore::Layout::Line::Run::isContainerStart const):
+ (WebCore::Layout::Line::Run::isContainerEnd const):
+ (WebCore::Layout::Line::Run::type const): Deleted.
+
+2019-09-26 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Remove redundant Line::Content
https://bugs.webkit.org/show_bug.cgi?id=202284
<rdar://problem/55757187>
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp (250411 => 250412)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp 2019-09-27 03:23:32 UTC (rev 250411)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp 2019-09-27 03:43:54 UTC (rev 250412)
@@ -46,25 +46,23 @@
for (auto& run : runList) {
auto& layoutBox = run->layoutBox();
- if (layoutBox.style().verticalAlign() != VerticalAlign::Baseline)
+ if (run->isContainerEnd() || layoutBox.style().verticalAlign() != VerticalAlign::Baseline)
continue;
- switch (run->type()) {
- case InlineItem::Type::Text:
+ if (run->isLineBreak())
+ return false;
+ if (run->isText()) {
if (!run->textContext() || !run->textContext()->isCollapsed)
return false;
- break;
- case InlineItem::Type::HardLineBreak:
- return false;
- case InlineItem::Type::ContainerStart: {
+ continue;
+ }
+ if (run->isContainerStart()) {
auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
if (boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value()))
return false;
- break;
+ continue;
}
- case InlineItem::Type::ContainerEnd:
- break;
- case InlineItem::Type::Box: {
+ if (run->isBox()) {
if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
auto& formattingState = downcast<InlineFormattingState>(layoutState.establishedFormattingState(downcast<Container>(layoutBox)));
ASSERT(!formattingState.lineBoxes().isEmpty());
@@ -72,12 +70,9 @@
if (inlineBlockBaseline.descent())
return false;
}
- break;
+ continue;
}
- default:
- ASSERT_NOT_REACHED();
- break;
- }
+ ASSERT_NOT_REACHED();
}
return true;
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (250411 => 250412)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-09-27 03:23:32 UTC (rev 250411)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-09-27 03:43:54 UTC (rev 250412)
@@ -38,15 +38,13 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(Line);
Line::Run::Run(const InlineItem& inlineItem, const Display::Rect& logicalRect)
- : m_layoutBox(inlineItem.layoutBox())
- , m_type(inlineItem.type())
+ : m_inlineItem(inlineItem)
, m_logicalRect(logicalRect)
{
}
Line::Run::Run(const InlineItem& inlineItem, const TextContext& textContext, const Display::Rect& logicalRect)
- : m_layoutBox(inlineItem.layoutBox())
- , m_type(inlineItem.type())
+ : m_inlineItem(inlineItem)
, m_logicalRect(logicalRect)
, m_textContext(textContext)
{
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (250411 => 250412)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-09-27 03:23:32 UTC (rev 250411)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-09-27 03:43:54 UTC (rev 250412)
@@ -76,16 +76,15 @@
Run(const InlineItem&, const Display::Rect&);
Run(const InlineItem&, const TextContext&, const Display::Rect&);
- const Box& layoutBox() const { return m_layoutBox; }
+ const Box& layoutBox() const { return m_inlineItem.layoutBox(); }
const Display::Rect& logicalRect() const { return m_logicalRect; }
const Optional<TextContext> textContext() const { return m_textContext; }
- InlineItem::Type type() const { return m_type; }
- bool isText() const { return m_type == InlineItem::Type::Text; }
- bool isBox() const { return m_type == InlineItem::Type::Box; }
- bool isLineBreak() const { return m_type == InlineItem::Type::HardLineBreak; }
- bool isContainerStart() const { return m_type == InlineItem::Type::ContainerStart; }
- bool isContainerEnd() const { return m_type == InlineItem::Type::ContainerEnd; }
+ bool isText() const { return m_inlineItem.isText(); }
+ bool isBox() const { return m_inlineItem.isBox(); }
+ bool isLineBreak() const { return m_inlineItem.isLineBreak(); }
+ bool isContainerStart() const { return m_inlineItem.isContainerStart(); }
+ bool isContainerEnd() const { return m_inlineItem.isContainerEnd(); }
private:
friend class Line;
@@ -94,8 +93,7 @@
void moveHorizontally(LayoutUnit offset) { m_logicalRect.moveHorizontally(offset); }
void setTextIsCollapsed() { m_textContext->isCollapsed = true; }
- const Box& m_layoutBox;
- const InlineItem::Type m_type;
+ const InlineItem& m_inlineItem;
Display::Rect m_logicalRect;
Optional<TextContext> m_textContext;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes