Title: [250776] trunk/Source/WebCore
- Revision
- 250776
- Author
- za...@apple.com
- Date
- 2019-10-07 10:28:28 -0700 (Mon, 07 Oct 2019)
Log Message
[LFC] Add const version of LayoutState::displayBoxForLayoutBox
https://bugs.webkit.org/show_bug.cgi?id=202623
<rdar://problem/56025259>
Reviewed by Antti Koivisto.
* layout/LayoutState.cpp:
(WebCore::Layout::LayoutState::displayBoxForLayoutBox):
(WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
* layout/LayoutState.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputLayoutTree):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (250775 => 250776)
--- trunk/Source/WebCore/ChangeLog 2019-10-07 16:47:30 UTC (rev 250775)
+++ trunk/Source/WebCore/ChangeLog 2019-10-07 17:28:28 UTC (rev 250776)
@@ -1,3 +1,18 @@
+2019-10-07 Zalan Bujtas <za...@apple.com>
+
+ [LFC] Add const version of LayoutState::displayBoxForLayoutBox
+ https://bugs.webkit.org/show_bug.cgi?id=202623
+ <rdar://problem/56025259>
+
+ Reviewed by Antti Koivisto.
+
+ * layout/LayoutState.cpp:
+ (WebCore::Layout::LayoutState::displayBoxForLayoutBox):
+ (WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
+ * layout/LayoutState.h:
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::outputLayoutTree):
+
2019-10-07 youenn fablet <you...@apple.com>
[iOS] Unmuting capture of a page is not working
Modified: trunk/Source/WebCore/layout/LayoutState.cpp (250775 => 250776)
--- trunk/Source/WebCore/layout/LayoutState.cpp 2019-10-07 16:47:30 UTC (rev 250775)
+++ trunk/Source/WebCore/layout/LayoutState.cpp 2019-10-07 17:28:28 UTC (rev 250776)
@@ -45,7 +45,7 @@
ASSERT(root.establishesFormattingContext());
}
-Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
+Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox)
{
return *m_layoutToDisplayBox.ensure(&layoutBox, [&layoutBox] {
return makeUnique<Display::Box>(layoutBox.style());
@@ -52,6 +52,12 @@
}).iterator->value;
}
+const Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
+{
+ ASSERT(hasDisplayBox(layoutBox));
+ return *m_layoutToDisplayBox.get(&layoutBox);
+}
+
FormattingState& LayoutState::formattingStateForBox(const Box& layoutBox) const
{
auto& root = layoutBox.formattingContextRoot();
Modified: trunk/Source/WebCore/layout/LayoutState.h (250775 => 250776)
--- trunk/Source/WebCore/layout/LayoutState.h 2019-10-07 16:47:30 UTC (rev 250775)
+++ trunk/Source/WebCore/layout/LayoutState.h 2019-10-07 17:28:28 UTC (rev 250776)
@@ -60,7 +60,8 @@
void deregisterFormattingContext(const FormattingContext& formattingContext) { m_formattingContextList.remove(&formattingContext); }
#endif
- Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const;
+ Display::Box& displayBoxForLayoutBox(const Box& layoutBox);
+ const Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const;
bool hasDisplayBox(const Box& layoutBox) const { return m_layoutToDisplayBox.contains(&layoutBox); }
enum class QuirksMode { No, Limited, Yes };
@@ -77,7 +78,7 @@
#ifndef NDEBUG
HashSet<const FormattingContext*> m_formattingContextList;
#endif
- mutable HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
+ HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
QuirksMode m_quirksMode { QuirksMode::No };
};
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (250775 => 250776)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2019-10-07 16:47:30 UTC (rev 250775)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2019-10-07 17:28:28 UTC (rev 250776)
@@ -326,15 +326,15 @@
static void outputLayoutTree(const LayoutState* layoutState, TextStream& stream, const Container& rootContainer, unsigned depth)
{
for (auto& child : childrenOfType<Box>(rootContainer)) {
- Display::Box* displayBox = nullptr;
- // Not all boxes generate display boxes.
- if (layoutState && layoutState->hasDisplayBox(child))
- displayBox = &layoutState->displayBoxForLayoutBox(child);
+ if (layoutState) {
+ // Not all boxes generate display boxes.
+ if (layoutState->hasDisplayBox(child))
+ outputLayoutBox(stream, child, &layoutState->displayBoxForLayoutBox(child), depth);
+ if (child.establishesInlineFormattingContext())
+ outputInlineRuns(stream, *layoutState, downcast<Container>(child), depth + 1);
+ } else
+ outputLayoutBox(stream, child, nullptr, depth);
- outputLayoutBox(stream, child, displayBox, depth);
- if (layoutState && child.establishesInlineFormattingContext())
- outputInlineRuns(stream, *layoutState, downcast<Container>(child), depth + 1);
-
if (is<Container>(child))
outputLayoutTree(layoutState, stream, downcast<Container>(child), depth + 1);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes