WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-298895-20250915134649.patch (text/plain), 7.81 KB, created by
alan
on 2025-09-15 13:46:50 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
alan
Created:
2025-09-15 13:46:50 PDT
Size:
7.81 KB
patch
obsolete
>From 308e46b2b22441d53f8e01f51ebafc6e0843347e Mon Sep 17 00:00:00 2001 >From: Alan Baradlay <zalan@apple.com> >Date: Mon, 15 Sep 2025 13:45:17 -0700 >Subject: [PATCH] [text shaping] Add 'enable/disable text shaping across inline > boxes' to settings https://bugs.webkit.org/show_bug.cgi?id=298895 > >Reviewed by NOBODY (OOPS!). > >Disabled by default. > >* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: >* Source/WebCore/layout/LayoutState.cpp: >(WebCore::Layout::LayoutState::LayoutState): >* Source/WebCore/layout/LayoutState.h: >(WebCore::Layout::LayoutState::isTextShapingAcrossInlineBoxesEnabled const): >* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp: >(WebCore::Layout::InlineFormattingContext::initializeInlineLayoutState): >* Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h: >(WebCore::Layout::InlineLayoutState::setShouldShapeTextAcrossInlineBoxes): >(WebCore::Layout::InlineLayoutState::shouldShapeTextAcrossInlineBoxes const): >* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp: >(WebCore::Layout::LineBuilder::applyShapingIfNeeded): >(WebCore::Layout::LineBuilder::commitCandidateContent): >--- > .../Scripts/Preferences/UnifiedWebPreferences.yaml | 14 ++++++++++++++ > Source/WebCore/layout/LayoutState.cpp | 2 ++ > Source/WebCore/layout/LayoutState.h | 2 ++ > .../inline/InlineFormattingContext.cpp | 2 ++ > .../formattingContexts/inline/InlineLayoutState.h | 4 ++++ > .../inline/InlineLineBuilder.cpp | 6 ++++++ > 6 files changed, 30 insertions(+) > >diff --git a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml >index 0dda8ddc76b4..a8ea608befe3 100644 >--- a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml >+++ b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml >@@ -7803,6 +7803,20 @@ TextRecognitionInVideosEnabled: > sharedPreferenceForWebProcess: true > mediaPlaybackRelated: true > >+TextShapingAcrossInlineBoxes: >+ type: bool >+ status: unstable >+ category: css >+ humanReadableName: "Text Shaping Across Inline Boxes" >+ humanReadableDescription: "Enable Text Shaping Across Inline Boxes" >+ defaultValue: >+ WebCore: >+ default: false >+ WebKitLegacy: >+ default: false >+ WebKit: >+ default: false >+ > TextTracksInMSEEnabled: > type: bool > status: testable >diff --git a/Source/WebCore/layout/LayoutState.cpp b/Source/WebCore/layout/LayoutState.cpp >index 7da88c5aed63..00bd7785fe78 100644 >--- a/Source/WebCore/layout/LayoutState.cpp >+++ b/Source/WebCore/layout/LayoutState.cpp >@@ -34,6 +34,7 @@ > #include "LayoutElementBox.h" > #include "LayoutInitialContainingBlock.h" > #include "RenderBox.h" >+#include "Settings.h" > #include "TableFormattingState.h" > #include <wtf/TZoneMallocInlines.h> > >@@ -44,6 +45,7 @@ WTF_MAKE_TZONE_OR_ISO_ALLOCATED_IMPL(LayoutState); > > LayoutState::LayoutState(const Document& document, const ElementBox& rootContainer, Type type, FormattingContextLayoutFunction&& formattingContextLayoutFunction, FormattingContextLogicalWidthFunction&& formattingContextLogicalWidthFunction , FormattingContextLogicalHeightFunction&& formattingContextLogicalHeightFunction) > : m_type(type) >+ , m_isTextShapingAcrossInlineBoxesEnabled(document.settings().textShapingAcrossInlineBoxes()) > , m_rootContainer(rootContainer) > , m_securityOrigin(document.securityOrigin()) > , m_formattingContextLayoutFunction(WTFMove(formattingContextLayoutFunction)) >diff --git a/Source/WebCore/layout/LayoutState.h b/Source/WebCore/layout/LayoutState.h >index cc8e10103532..2b0cd1fe6fca 100644 >--- a/Source/WebCore/layout/LayoutState.h >+++ b/Source/WebCore/layout/LayoutState.h >@@ -110,6 +110,7 @@ public: > bool inLimitedQuirksMode() const { return m_quirksMode == QuirksMode::Limited; } > bool inStandardsMode() const { return m_quirksMode == QuirksMode::No; } > const SecurityOrigin& securityOrigin() const { return m_securityOrigin.get(); } >+ bool isTextShapingAcrossInlineBoxesEnabled() const { return m_isTextShapingAcrossInlineBoxesEnabled; } > > const ElementBox& root() const { return m_rootContainer; } > >@@ -133,6 +134,7 @@ private: > #endif > HashMap<const Box*, std::unique_ptr<BoxGeometry>> m_layoutBoxToBoxGeometry; > QuirksMode m_quirksMode { QuirksMode::No }; >+ bool m_isTextShapingAcrossInlineBoxesEnabled { false }; > > const CheckedRef<const ElementBox> m_rootContainer; > const Ref<SecurityOrigin> m_securityOrigin; >diff --git a/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp b/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp >index caf8d80c8017..f134a3188db2 100644 >--- a/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp >@@ -522,6 +522,8 @@ void InlineFormattingContext::initializeInlineLayoutState(const LayoutState& glo > inlineLayoutState.setShouldNotSynthesizeInlineBlockBaseline(); > if (globalLayoutState.inStandardsMode()) > inlineLayoutState.setInStandardsMode(); >+ if (globalLayoutState.isTextShapingAcrossInlineBoxesEnabled()) >+ inlineLayoutState.setShouldShapeTextAcrossInlineBoxes(); > } > > #if ASSERT_ENABLED >diff --git a/Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h b/Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h >index d8c3ce4ff248..9f5a72cf32d3 100644 >--- a/Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h >+++ b/Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h >@@ -64,6 +64,9 @@ public: > void setInStandardsMode() { m_inStandardsMode = true; } > bool inStandardsMode() const { return m_inStandardsMode; } > >+ void setShouldShapeTextAcrossInlineBoxes() { m_shouldShapeTextAcrossInlineBoxes = true; } >+ bool shouldShapeTextAcrossInlineBoxes() const { return m_shouldShapeTextAcrossInlineBoxes; } >+ > // Integration codepath > void setNestedListMarkerOffsets(HashMap<const ElementBox*, LayoutUnit>&& nestedListMarkerOffsets) { m_nestedListMarkerOffsets = WTFMove(nestedListMarkerOffsets); } > LayoutUnit nestedListMarkerOffset(const ElementBox& listMarkerBox) const { return m_nestedListMarkerOffsets.get(&listMarkerBox); } >@@ -83,6 +86,7 @@ private: > AvailableLineWidthOverride m_availableLineWidthOverride; > bool m_shouldNotSynthesizeInlineBlockBaseline { false }; > bool m_inStandardsMode { false }; >+ bool m_shouldShapeTextAcrossInlineBoxes { false }; > }; > > inline InlineLayoutState::InlineLayoutState(BlockLayoutState& parentBlockLayoutState) >diff --git a/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp b/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp >index 12cdf97e8dae..2b8703594e94 100644 >--- a/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp >+++ b/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp >@@ -819,6 +819,9 @@ Vector<std::pair<size_t, size_t>> LineBuilder::collectShapingRanges(const LineCa > > void LineBuilder::applyShapingIfNeeded(LineCandidate& lineCandidate) > { >+ if (!layoutState().shouldShapeTextAcrossInlineBoxes()) >+ return; >+ > if (!lineCandidate.inlineContent.isShapingCandidateByContent()) > return; > >@@ -1394,6 +1397,9 @@ void LineBuilder::commitCandidateContent(const LineCandidate& lineCandidate, std > > if (auto* inlineTextItem = dynamicDowncast<InlineTextItem>(inlineItem)) { > auto shapingBoundary = [&]() -> std::optional<Line::ShapingBoundary> { >+ if (!layoutState().shouldShapeTextAcrossInlineBoxes()) >+ return { }; >+ > // Special case trailing partial run as shaping end. > if (shapingBoundaryStart && partialTrailingContent && partialTrailingContent->trailingRunIndex == index) > return { Line::ShapingBoundary::End };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 298895
:
476741
|
476765