Title: [251851] trunk/Source/WebCore
- Revision
- 251851
- Author
- [email protected]
- Date
- 2019-10-31 09:01:25 -0700 (Thu, 31 Oct 2019)
Log Message
[LFC][IFC] Line::Run should not hold a reference to InlineItem
https://bugs.webkit.org/show_bug.cgi?id=203660
<rdar://problem/56770286>
Reviewed by Antti Koivisto.
When Line::Runs are merged ([content][ ] -> [content ]) they end up with multiple InlineItems. Let's cache some values from
the InlineItems instead.
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Run::Run):
(WebCore::Layout::Line::close):
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::Run::layoutBox const):
(WebCore::Layout::Line::Run::isText const):
(WebCore::Layout::Line::Run::isBox const):
(WebCore::Layout::Line::Run::isForcedLineBreak const):
(WebCore::Layout::Line::Run::isContainerStart const):
(WebCore::Layout::Line::Run::isContainerEnd const):
(WebCore::Layout::Line::Run::isCollapsible const):
(WebCore::Layout::Line::Run::isWhitespace const):
(WebCore::Layout::Line::Run::expand):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (251850 => 251851)
--- trunk/Source/WebCore/ChangeLog 2019-10-31 15:44:21 UTC (rev 251850)
+++ trunk/Source/WebCore/ChangeLog 2019-10-31 16:01:25 UTC (rev 251851)
@@ -1,3 +1,28 @@
+2019-10-31 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Line::Run should not hold a reference to InlineItem
+ https://bugs.webkit.org/show_bug.cgi?id=203660
+ <rdar://problem/56770286>
+
+ Reviewed by Antti Koivisto.
+
+ When Line::Runs are merged ([content][ ] -> [content ]) they end up with multiple InlineItems. Let's cache some values from
+ the InlineItems instead.
+
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::Run::Run):
+ (WebCore::Layout::Line::close):
+ * layout/inlineformatting/InlineLine.h:
+ (WebCore::Layout::Line::Run::layoutBox const):
+ (WebCore::Layout::Line::Run::isText const):
+ (WebCore::Layout::Line::Run::isBox const):
+ (WebCore::Layout::Line::Run::isForcedLineBreak const):
+ (WebCore::Layout::Line::Run::isContainerStart const):
+ (WebCore::Layout::Line::Run::isContainerEnd const):
+ (WebCore::Layout::Line::Run::isCollapsible const):
+ (WebCore::Layout::Line::Run::isWhitespace const):
+ (WebCore::Layout::Line::Run::expand):
+
2019-10-31 Wenson Hsieh <[email protected]>
Unreviewed, update DerivedSources-output.xcfilelist after r251841
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (251850 => 251851)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-10-31 15:44:21 UTC (rev 251850)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-10-31 16:01:25 UTC (rev 251851)
@@ -38,8 +38,11 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(Line);
Line::Run::Run(const InlineItem& inlineItem, const Display::Run& displayRun)
- : m_inlineItem(inlineItem)
+ : m_layoutBox(inlineItem.layoutBox())
, m_displayRun(displayRun)
+ , m_type(inlineItem.type())
+ , m_isWhitespace(is<InlineTextItem>(inlineItem) && downcast<InlineTextItem>(inlineItem).isWhitespace())
+ , m_isCollapsible(is<InlineTextItem>(inlineItem) && downcast<InlineTextItem>(inlineItem).isCollapsible())
{
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (251850 => 251851)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-10-31 15:44:21 UTC (rev 251850)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2019-10-31 16:01:25 UTC (rev 251851)
@@ -70,17 +70,17 @@
Run(const InlineItem&, const Display::Run&);
const Display::Run& displayRun() const { return m_displayRun; }
- const Box& layoutBox() const { return m_inlineItem.layoutBox(); }
+ const Box& layoutBox() const { return m_layoutBox; }
const Display::Rect& logicalRect() const { return m_displayRun.logicalRect(); }
bool isCollapsedToZeroAdvanceWidth() const;
bool isCollapsed() const { return m_isCollapsed; }
- bool isText() const { return m_inlineItem.isText() && !isForcedLineBreak(); }
- bool isBox() const { return m_inlineItem.isBox(); }
- bool isForcedLineBreak() const { return m_inlineItem.isForcedLineBreak(); }
- bool isContainerStart() const { return m_inlineItem.isContainerStart(); }
- bool isContainerEnd() const { return m_inlineItem.isContainerEnd(); }
+ bool isText() const { return m_type == InlineItem::Type::Text; }
+ bool isBox() const { return m_type == InlineItem::Type::Box; }
+ bool isForcedLineBreak() const { return m_type == InlineItem::Type::ForcedLineBreak; }
+ bool isContainerStart() const { return m_type == InlineItem::Type::ContainerStart; }
+ bool isContainerEnd() const { return m_type == InlineItem::Type::ContainerEnd; }
private:
friend class Line;
@@ -93,12 +93,15 @@
void setIsCollapsed();
void setCollapsesToZeroAdvanceWidth();
- bool isCollapsible() const { return m_inlineItem.isText() && downcast<InlineTextItem>(m_inlineItem).isCollapsible(); }
+ bool isCollapsible() const { return m_isCollapsible; }
bool hasTrailingCollapsedContent() const { return m_hasTrailingCollapsedContent; }
- bool isWhitespace() const;
+ bool isWhitespace() const { return m_isWhitespace; }
- const InlineItem& m_inlineItem;
+ const Box& m_layoutBox;
Display::Run m_displayRun;
+ const InlineItem::Type m_type;
+ bool m_isWhitespace { false };
+ bool m_isCollapsible { false };
bool m_isCollapsed { false };
bool m_collapsedToZeroAdvanceWidth { false };
bool m_hasTrailingCollapsedContent { false };
@@ -157,19 +160,16 @@
ASSERT(isText());
ASSERT(other.isText());
ASSERT(!isCollapsedToZeroAdvanceWidth());
- ASSERT(!m_hasTrailingCollapsedContent);
+ ASSERT(!hasTrailingCollapsedContent());
auto& otherDisplayRun = other.displayRun();
m_displayRun.expandHorizontally(otherDisplayRun.logicalWidth());
m_displayRun.textContext()->expand(*otherDisplayRun.textContext());
m_hasTrailingCollapsedContent = other.isCollapsed();
+ m_isWhitespace &= other.isWhitespace();
+ m_isCollapsible = false;
}
-inline bool Line::Run::isWhitespace() const
-{
- return isText() && downcast<InlineTextItem>(m_inlineItem).isWhitespace();
-}
-
inline void Line::Run::setIsCollapsed()
{
ASSERT(isWhitespace());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes