Title: [293169] trunk/Source/WebCore
- Revision
- 293169
- Author
- [email protected]
- Date
- 2022-04-21 08:21:53 -0700 (Thu, 21 Apr 2022)
Log Message
[LFC][Integration] Add direct style accessor to inline iterator
https://bugs.webkit.org/show_bug.cgi?id=239593
Reviewed by Alan Bujtas.
The current implementation fetches the line and the renderer and is pretty expensive.
* layout/integration/inline/InlineIteratorBox.cpp:
(WebCore::InlineIterator::Box::style const): Deleted.
* layout/integration/inline/InlineIteratorBox.h:
(WebCore::InlineIterator::Box::style const):
* layout/integration/inline/InlineIteratorBoxLegacyPath.h:
(WebCore::InlineIterator::BoxLegacyPath::style const):
* layout/integration/inline/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::style const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (293168 => 293169)
--- trunk/Source/WebCore/ChangeLog 2022-04-21 14:46:19 UTC (rev 293168)
+++ trunk/Source/WebCore/ChangeLog 2022-04-21 15:21:53 UTC (rev 293169)
@@ -1,3 +1,21 @@
+2022-04-21 Antti Koivisto <[email protected]>
+
+ [LFC][Integration] Add direct style accessor to inline iterator
+ https://bugs.webkit.org/show_bug.cgi?id=239593
+
+ Reviewed by Alan Bujtas.
+
+ The current implementation fetches the line and the renderer and is pretty expensive.
+
+ * layout/integration/inline/InlineIteratorBox.cpp:
+ (WebCore::InlineIterator::Box::style const): Deleted.
+ * layout/integration/inline/InlineIteratorBox.h:
+ (WebCore::InlineIterator::Box::style const):
+ * layout/integration/inline/InlineIteratorBoxLegacyPath.h:
+ (WebCore::InlineIterator::BoxLegacyPath::style const):
+ * layout/integration/inline/InlineIteratorBoxModernPath.h:
+ (WebCore::InlineIterator::BoxModernPath::style const):
+
2022-04-21 Tim Nguyen <[email protected]>
Small cleanups to StyleBuilderCustom.cpp
Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.cpp (293168 => 293169)
--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.cpp 2022-04-21 14:46:19 UTC (rev 293168)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.cpp 2022-04-21 15:21:53 UTC (rev 293169)
@@ -94,11 +94,6 @@
);
}
-const RenderStyle& Box::style() const
-{
- return lineBox()->isFirst() ? renderer().firstLineStyle() : renderer().style();
-}
-
RenderObject::HighlightState Box::selectionState() const
{
if (isText()) {
Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.h (293168 => 293169)
--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.h 2022-04-21 14:46:19 UTC (rev 293168)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorBox.h 2022-04-21 15:21:53 UTC (rev 293169)
@@ -246,6 +246,13 @@
});
}
+inline const RenderStyle& Box::style() const
+{
+ return WTF::switchOn(m_pathVariant, [](auto& path) -> const RenderStyle& {
+ return path.style();
+ });
+}
+
inline const LegacyInlineBox* Box::legacyInlineBox() const
{
if (!std::holds_alternative<BoxLegacyPath>(m_pathVariant))
Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxLegacyPath.h (293168 => 293169)
--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxLegacyPath.h 2022-04-21 14:46:19 UTC (rev 293168)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxLegacyPath.h 2022-04-21 15:21:53 UTC (rev 293169)
@@ -76,6 +76,11 @@
return m_inlineBox->renderer();
}
+ const RenderStyle& style() const
+ {
+ return m_inlineBox->lineStyle();
+ }
+
void traverseNextTextBox() { m_inlineBox = inlineTextBox()->nextTextBox(); }
void traverseNextOnLine()
Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h (293168 => 293169)
--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h 2022-04-21 14:46:19 UTC (rev 293168)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h 2022-04-21 15:21:53 UTC (rev 293169)
@@ -103,6 +103,11 @@
return m_inlineContent->rendererForLayoutBox(box().layoutBox());
}
+ const RenderStyle& style() const
+ {
+ return box().style();
+ }
+
void traverseNextTextBox()
{
ASSERT(!atEnd());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes