Diff
Modified: trunk/Source/WebCore/ChangeLog (294190 => 294191)
--- trunk/Source/WebCore/ChangeLog 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/ChangeLog 2022-05-14 13:19:52 UTC (rev 294191)
@@ -1,3 +1,42 @@
+2022-05-14 Alan Bujtas <za...@apple.com>
+
+ [LFC] LayoutState should track the integration formatting context type
+ https://bugs.webkit.org/show_bug.cgi?id=240411
+
+ Reviewed by Antti Koivisto.
+
+ Let's not use RuntimeEnabledFeatures to check wheter the integration codepath is enabled as
+ the new FCs (e.g. flex) don't even have such flags.
+
+ * layout/LayoutContext.cpp:
+ * layout/LayoutState.cpp:
+ (WebCore::Layout::LayoutState::LayoutState):
+ (WebCore::Layout::LayoutState::formattingStateForFormattingContext const):
+ (WebCore::Layout::LayoutState::formattingStateForInlineFormattingContext const):
+ (WebCore::Layout::LayoutState::formattingStateForFlexFormattingContext const):
+ (WebCore::Layout::LayoutState::ensureInlineFormattingState):
+ (WebCore::Layout::LayoutState::ensureFlexFormattingState):
+ (WebCore::Layout::LayoutState::setViewportSize):
+ (WebCore::Layout::LayoutState::viewportSize const):
+ (WebCore::Layout::LayoutState::setIsIntegratedRootBoxFirstChild):
+ (WebCore::Layout::LayoutState::shouldIgnoreTrailingLetterSpacing const):
+ (WebCore::Layout::LayoutState::shouldNotSynthesizeInlineBlockBaseline const):
+ * layout/LayoutState.h:
+ (WebCore::Layout::LayoutState::isInlineFormattingContextIntegration const):
+ (WebCore::Layout::LayoutState::isFlexFormattingContextIntegration const):
+ * layout/floats/FloatingState.cpp:
+ * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+ * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::close):
+ * layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
+ * layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+ (WebCore::LayoutIntegration::FlexLayout::FlexLayout):
+ * layout/integration/inline/LayoutIntegrationInlineContent.cpp:
+ * layout/integration/inline/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::LineLayout):
+ (WebCore::LayoutIntegration::LineLayout::releaseCaches):
+
2022-05-13 Tim Horton <timothy_hor...@apple.com>
ApplePayLogoSystemImage needlessly loads PassKit in WebKit child processes on iOS
Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/LayoutContext.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -41,7 +41,6 @@
#include "LayoutTreeBuilder.h"
#include "RenderStyleConstants.h"
#include "RenderView.h"
-#include "RuntimeEnabledFeatures.h"
#include "TableFormattingContext.h"
#include "TableFormattingState.h"
#include "TableWrapperBlockFormattingContext.h"
Modified: trunk/Source/WebCore/layout/LayoutState.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/LayoutState.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/LayoutState.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -36,7 +36,6 @@
#include "LayoutBoxGeometry.h"
#include "LayoutContainerBox.h"
#include "RenderBox.h"
-#include "RuntimeEnabledFeatures.h"
#include "TableFormattingState.h"
#include <wtf/IsoMallocInlines.h>
@@ -45,8 +44,9 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutState);
-LayoutState::LayoutState(const Document& document, const ContainerBox& rootContainer)
+LayoutState::LayoutState(const Document& document, const ContainerBox& rootContainer, std::optional<FormattingContextIntegrationType> formattingContextIntegrationType)
: m_rootContainer(rootContainer)
+ , m_formattingContextIntegrationType(formattingContextIntegrationType)
{
// It makes absolutely no sense to construct a dedicated layout state for a non-formatting context root (layout would be a no-op).
ASSERT(root().establishesFormattingContext());
@@ -100,11 +100,17 @@
FormattingState& LayoutState::formattingStateForFormattingContext(const ContainerBox& formattingContextRoot) const
{
ASSERT(formattingContextRoot.establishesFormattingContext());
- if (RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled()) {
+
+ if (isInlineFormattingContextIntegration()) {
ASSERT(&formattingContextRoot == m_rootContainer.ptr());
return *m_rootInlineFormattingStateForIntegration;
}
+ if (isFlexFormattingContextIntegration()) {
+ ASSERT(&formattingContextRoot == m_rootContainer.ptr());
+ return *m_rootFlexFormattingStateForIntegration;
+ }
+
if (formattingContextRoot.establishesInlineFormattingContext())
return formattingStateForInlineFormattingContext(formattingContextRoot);
@@ -124,7 +130,7 @@
{
ASSERT(inlineFormattingContextRoot.establishesInlineFormattingContext());
- if (RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled()) {
+ if (isInlineFormattingContextIntegration()) {
ASSERT(&inlineFormattingContextRoot == m_rootContainer.ptr());
return *m_rootInlineFormattingStateForIntegration;
}
@@ -147,6 +153,12 @@
FlexFormattingState& LayoutState::formattingStateForFlexFormattingContext(const ContainerBox& flexFormattingContextRoot) const
{
ASSERT(flexFormattingContextRoot.establishesFlexFormattingContext());
+
+ if (isFlexFormattingContextIntegration()) {
+ ASSERT(&flexFormattingContextRoot == m_rootContainer.ptr());
+ return *m_rootFlexFormattingStateForIntegration;
+ }
+
return *m_flexFormattingStates.get(&flexFormattingContextRoot);
}
@@ -169,7 +181,7 @@
return makeUnique<InlineFormattingState>(parentFloatingState, *this);
};
- if (RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled()) {
+ if (isInlineFormattingContextIntegration()) {
if (!m_rootInlineFormattingStateForIntegration) {
ASSERT(&formattingContextRoot == m_rootContainer.ptr());
m_rootInlineFormattingStateForIntegration = create();
@@ -212,35 +224,43 @@
return makeUnique<FlexFormattingState>(FloatingState::create(*this, formattingContextRoot), *this);
};
+ if (isFlexFormattingContextIntegration()) {
+ if (!m_rootFlexFormattingStateForIntegration) {
+ ASSERT(&formattingContextRoot == m_rootContainer.ptr());
+ m_rootFlexFormattingStateForIntegration = create();
+ }
+ return *m_rootFlexFormattingStateForIntegration;
+ }
+
return *m_flexFormattingStates.ensure(&formattingContextRoot, create).iterator->value;
}
void LayoutState::setViewportSize(const LayoutSize& viewportSize)
{
- ASSERT(RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled());
+ ASSERT(isInlineFormattingContextIntegration());
m_viewportSize = viewportSize;
}
LayoutSize LayoutState::viewportSize() const
{
- ASSERT(RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled());
+ ASSERT(isInlineFormattingContextIntegration());
return m_viewportSize;
}
void LayoutState::setIsIntegratedRootBoxFirstChild(bool value)
{
- ASSERT(RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled());
+ ASSERT(isInlineFormattingContextIntegration());
m_isIntegratedRootBoxFirstChild = value ? IsIntegratedRootBoxFirstChild::Yes : IsIntegratedRootBoxFirstChild::No;
}
bool LayoutState::shouldIgnoreTrailingLetterSpacing() const
{
- return RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled();
+ return isInlineFormattingContextIntegration();
}
bool LayoutState::shouldNotSynthesizeInlineBlockBaseline() const
{
- return RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled();
+ return isInlineFormattingContextIntegration();
}
}
Modified: trunk/Source/WebCore/layout/LayoutState.h (294190 => 294191)
--- trunk/Source/WebCore/layout/LayoutState.h 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/LayoutState.h 2022-05-14 13:19:52 UTC (rev 294191)
@@ -49,7 +49,11 @@
WTF_MAKE_NONCOPYABLE(LayoutState);
WTF_MAKE_ISO_ALLOCATED(LayoutState);
public:
- LayoutState(const Document&, const ContainerBox& rootContainer);
+ enum class FormattingContextIntegrationType {
+ Inline,
+ Flex
+ };
+ LayoutState(const Document&, const ContainerBox& rootContainer, std::optional<FormattingContextIntegrationType> = std::nullopt);
~LayoutState();
InlineFormattingState& ensureInlineFormattingState(const ContainerBox& formattingContextRoot);
@@ -87,6 +91,9 @@
const ContainerBox& root() const { return m_rootContainer; }
// LFC integration only. Full LFC has proper ICB access.
+ bool isInlineFormattingContextIntegration() const { return m_formattingContextIntegrationType && *m_formattingContextIntegrationType == FormattingContextIntegrationType::Inline; }
+ bool isFlexFormattingContextIntegration() const { return m_formattingContextIntegrationType && *m_formattingContextIntegrationType == FormattingContextIntegrationType::Flex; }
+
void setViewportSize(const LayoutSize&);
LayoutSize viewportSize() const;
enum IsIntegratedRootBoxFirstChild { Yes, No, NotApplicable };
@@ -105,6 +112,7 @@
HashMap<const ContainerBox*, std::unique_ptr<FlexFormattingState>> m_flexFormattingStates;
std::unique_ptr<InlineFormattingState> m_rootInlineFormattingStateForIntegration;
+ std::unique_ptr<FlexFormattingState> m_rootFlexFormattingStateForIntegration;
#ifndef NDEBUG
HashSet<const FormattingContext*> m_formattingContextList;
@@ -115,6 +123,7 @@
CheckedRef<const ContainerBox> m_rootContainer;
// LFC integration only.
+ std::optional<FormattingContextIntegrationType> m_formattingContextIntegrationType;
LayoutSize m_viewportSize;
IsIntegratedRootBoxFirstChild m_isIntegratedRootBoxFirstChild { IsIntegratedRootBoxFirstChild::NotApplicable };
};
Modified: trunk/Source/WebCore/layout/floats/FloatingState.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/floats/FloatingState.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/floats/FloatingState.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -32,7 +32,6 @@
#include "LayoutBox.h"
#include "LayoutContainerBox.h"
#include "LayoutState.h"
-#include "RuntimeEnabledFeatures.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -48,7 +48,6 @@
#include "LayoutReplacedBox.h"
#include "LayoutState.h"
#include "Logging.h"
-#include "RuntimeEnabledFeatures.h"
#include "TextUtil.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/text/TextStream.h>
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -34,7 +34,6 @@
#include "LayoutBox.h"
#include "LayoutBoxGeometry.h"
#include "LayoutState.h"
-#include "RuntimeEnabledFeatures.h"
#include "TextUtil.h"
#include <wtf/unicode/CharacterNames.h>
@@ -547,7 +546,7 @@
// Legacy line layout quirk: keep the trailing whitespace around when it is followed by a line break, unless the content overflows the line.
// This quirk however should not be applied when running intrinsic width computation.
// FIXME: webkit.org/b/233261
- auto shouldApplyTrailingWhiteSpaceFollowedByBRQuirk = isInIntrinsicWidthMode || !RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled()
+ auto shouldApplyTrailingWhiteSpaceFollowedByBRQuirk = isInIntrinsicWidthMode || !layoutState().isInlineFormattingContextIntegration()
? Line::ShouldApplyTrailingWhiteSpaceFollowedByBRQuirk::No
: Line::ShouldApplyTrailingWhiteSpaceFollowedByBRQuirk::Yes;
m_line.removeTrailingTrimmableContent(shouldApplyTrailingWhiteSpaceFollowedByBRQuirk);
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -31,7 +31,6 @@
#include "FontCascade.h"
#include "LayoutBoxGeometry.h"
#include "LayoutInitialContainingBlock.h"
-#include "RuntimeEnabledFeatures.h"
#include "TextUtil.h"
#include <wtf/ListHashSet.h>
#include <wtf/Range.h>
@@ -145,7 +144,7 @@
auto& style = !m_lineIndex ? layoutBox.firstLineStyle() : layoutBox.style();
auto inkOverflow = [&] {
- auto initialContaingBlockSize = RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled()
+ auto initialContaingBlockSize = formattingState().layoutState().isInlineFormattingContextIntegration()
? formattingState().layoutState().viewportSize()
: formattingState().layoutState().geometryForBox(layoutBox.initialContainingBlock()).contentBox().size();
auto strokeOverflow = ceilf(style.computedStrokeWidth(ceiledIntSize(initialContaingBlockSize)));
Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -40,7 +40,7 @@
FlexLayout::FlexLayout(RenderFlexibleBox& flexBoxRenderer)
: m_boxTree(flexBoxRenderer)
- , m_layoutState(flexBoxRenderer.document(), rootLayoutBox())
+ , m_layoutState(flexBoxRenderer.document(), rootLayoutBox(), Layout::LayoutState::FormattingContextIntegrationType::Flex)
, m_flexFormattingState(m_layoutState.ensureFlexFormattingState(rootLayoutBox()))
{
}
Modified: trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -30,7 +30,6 @@
#include "InlineIteratorBox.h"
#include "LayoutIntegrationLineLayout.h"
-#include "RuntimeEnabledFeatures.h"
#include "TextPainter.h"
namespace WebCore {
Modified: trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp (294190 => 294191)
--- trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp 2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp 2022-05-14 13:19:52 UTC (rev 294191)
@@ -71,7 +71,7 @@
LineLayout::LineLayout(RenderBlockFlow& flow)
: m_boxTree(flow)
- , m_layoutState(flow.document(), rootLayoutBox())
+ , m_layoutState(flow.document(), rootLayoutBox(), Layout::LayoutState::FormattingContextIntegrationType::Inline)
, m_inlineFormattingState(m_layoutState.ensureInlineFormattingState(rootLayoutBox()))
{
m_layoutState.setIsIntegratedRootBoxFirstChild(flow.parent()->firstChild() == &flow);
@@ -867,7 +867,7 @@
void LineLayout::releaseCaches(RenderView& view)
{
- if (!RuntimeEnabledFeatures::sharedFeatures().inlineFormattingContextIntegrationEnabled())
+ if (!isEnabled())
return;
for (auto& renderer : descendantsOfType<RenderBlockFlow>(view)) {