[LFC][Integration] Call SimpleLineLayout::canUseFor only once
https://bugs.webkit.org/show_bug.cgi?id=206281
Reviewed by Sam Weinig.
It can be somewhat costly.
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::canUseFor):
* layout/integration/LayoutIntegrationLineLayout.h:
(WebCore::LayoutIntegration::LineLayout::canUseFor):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInlineChildren):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@254568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 64a38ee..b820aa7 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -669,12 +669,14 @@
void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
{
auto computeLineLayoutPath = [&] {
+ bool canUseSimpleLines = SimpleLineLayout::canUseFor(*this);
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (LayoutIntegration::LineLayout::canUseFor(*this))
+ if (LayoutIntegration::LineLayout::canUseFor(*this, canUseSimpleLines))
return LayoutFormattingContextPath;
#endif
- if (SimpleLineLayout::canUseFor(*this))
+ if (canUseSimpleLines)
return SimpleLinesPath;
+
return LineBoxesPath;
};