Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-writing-modes] Initial implementation of sideways writing modes #16556

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

nt1m
Copy link
Member

@nt1m nt1m commented Aug 10, 2023

ccbff7d

[css-writing-modes] Initial implementation of sideways writing modes
https://bugs.webkit.org/show_bug.cgi?id=260012
rdar://113669284

Reviewed by Alan Baradlay.

This splits the WritingMode enum into BlockFlowDirection / TypographicMode. The WritingMode enum now reflects the CSS values directly.

There is a writingModeToBlockFlowDirection() method that does the conversion from WritingMode to BlockFlowDirection.

The new sideways writing modes are behind a preference, since the inline direction needs work.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-radius-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-shorthands-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-inset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-margin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-padding-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/writing-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/select-multiple-scrolling.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/select-size-scrolling-and-sizing.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/text-input-block-size.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/text-input-vertical-overflow-no-scroll-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/textarea-rows-cols-sizing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/writing-mode-parsing-sideways-lr-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/writing-mode-parsing-sideways-rl-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-lr-writing-mode-and-rtl-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-lr-writing-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-rl-writing-mode-and-rtl-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-rl-writing-mode-expected.txt:
* LayoutTests/platform/ios-wk2/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/css/CSSPrimitiveValueMappings.h:
(WebCore::toCSSValueID):
(WebCore::fromCSSValueID):
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::toScrollAlignmentForInlineDirection):
(WebCore::toScrollAlignmentForBlockDirection):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::flipVisualRectToLogicalForWritingMode):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::collectInkOverflowForTextDecorations):
(WebCore::Layout::InlineDisplayContentBuilder::flipLogicalRectToVisualForWritingModeWithinLine const):
(WebCore::Layout::InlineDisplayContentBuilder::flipRootInlineBoxRectToVisualForWritingMode const):
(WebCore::Layout::InlineDisplayContentBuilder::setLeftForWritingMode const):
(WebCore::Layout::InlineDisplayContentBuilder::setRightForWritingMode const):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::flipLogicalLineRectToVisualForWritingMode):
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::flexBoxLogicalBorder):
(WebCore::LayoutIntegration::flexBoxLogicalPadding):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::verticalLogicalMargin):
(WebCore::LayoutIntegration::logicalBorder):
(WebCore::LayoutIntegration::logicalPadding):
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineContentConstraints):
(WebCore::LayoutIntegration::LineLayout::physicalBaselineForLine const):
(WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::firstInlineBoxRect const):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::paginationModeForRenderStyle):
* Source/WebCore/platform/text/WritingMode.h:
(WebCore::writingModeToBlockFlowDirection):
(WebCore::makeTextFlowInitalizer):
(WebCore::makeTextFlow):
* Source/WebCore/rendering/BaselineAlignment.cpp:
(WebCore::BaselineGroup::BaselineGroup):
(WebCore::BaselineGroup::isOppositeBlockFlow const):
(WebCore::BaselineGroup::isOrthogonalBlockFlow const):
(WebCore::BaselineGroup::isCompatible const):
(WebCore::BaselineAlignmentState::findCompatibleSharedGroup):
* Source/WebCore/rendering/BaselineAlignment.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustBorderBoxRectForPainting):
(WebCore::RenderBlock::paintRectToClipOutFromBorder):
(WebCore::RenderBlock::borderTop const):
(WebCore::RenderBlock::borderLeft const):
(WebCore::RenderBlock::borderBottom const):
(WebCore::RenderBlock::borderRight const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::shouldFlipBeforeAfterMargins):
(WebCore::RenderBox::visualOverflowRectForPropagation const):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* Source/WebCore/rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::orientation const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::isLeftToRightFlow const):
(WebCore::RenderFlexibleBox::transformedBlockFlowDirection const):
(WebCore::RenderFlexibleBox::flowAwareBorderBefore const):
(WebCore::RenderFlexibleBox::flowAwareBorderAfter const):
(WebCore::RenderFlexibleBox::flowAwarePaddingBefore const):
(WebCore::RenderFlexibleBox::flowAwarePaddingAfter const):
(WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild const):
(WebCore::RenderFlexibleBox::marginBoxAscentForChild):
(WebCore::RenderFlexibleBox::transformedWritingMode const): Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::computeScrollOrigin):
* Source/WebCore/rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paddingTop const):
(WebCore::RenderTableCell::paddingBottom const):
(WebCore::RenderTableCell::paddingLeft const):
(WebCore::RenderTableCell::paddingRight const):
* Source/WebCore/rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
* Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::borderBeforeInWritingMode):
(WebCore::borderAndPaddingBeforeInWritingMode):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderBefore const):
(WebCore::RenderStyle::borderAfter const):
(WebCore::RenderStyle::borderBeforeWidth const):
(WebCore::RenderStyle::borderAfterWidth const):
(WebCore::RenderStyle::fontAndGlyphOrientation):
(WebCore::RenderStyle::shouldPlaceVerticalScrollbarOnLeft const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::initialWritingMode):
(WebCore::RenderStyle::blockFlowDirection const):
(WebCore::RenderStyle::typographicMode const):
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::adjustStyleForInterCharacterRuby):

Canonical link: https://commits.webkit.org/266775@main

97cce4a

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 🧪 gtk-wk2
🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 🧪 api-gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv 🧪 mac-AS-debug-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
✅ 🛠 🧪 merge ✅ 🛠 watch ✅ 🛠 jsc-mips
✅ 🛠 watch-sim ✅ 🧪 jsc-mips-tests

@nt1m nt1m requested review from cdumez and rniwa as code owners August 10, 2023 05:49
@nt1m nt1m self-assigned this Aug 10, 2023
@nt1m nt1m added the Layout and Rendering For bugs with layout and rendering of Web pages. label Aug 10, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 10, 2023
@nt1m nt1m removed request for rniwa and cdumez August 10, 2023 05:57
@nt1m nt1m removed the merging-blocked Applied to prevent a change from being merged label Aug 10, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 10, 2023
@nt1m nt1m removed the merging-blocked Applied to prevent a change from being merged label Aug 10, 2023
@nt1m nt1m force-pushed the sideways-wm branch 2 times, most recently from 2a1824c to d1c221e Compare August 10, 2023 16:27
@nt1m nt1m added the merge-queue Applied to send a pull request to merge-queue label Aug 10, 2023
https://bugs.webkit.org/show_bug.cgi?id=260012
rdar://113669284

Reviewed by Alan Baradlay.

This splits the WritingMode enum into BlockFlowDirection / TypographicMode. The WritingMode enum now reflects the CSS values directly.

There is a writingModeToBlockFlowDirection() method that does the conversion from WritingMode to BlockFlowDirection.

The new sideways writing modes are behind a preference, since the inline direction needs work.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-color-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-radius-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-shorthands-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-border-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-inset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-margin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-padding-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/writing-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/select-multiple-scrolling.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/select-size-scrolling-and-sizing.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/text-input-block-size.optional-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/text-input-vertical-overflow-no-scroll-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/textarea-rows-cols-sizing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/writing-mode-parsing-sideways-lr-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/writing-mode-parsing-sideways-rl-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-lr-writing-mode-and-rtl-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-lr-writing-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-rl-writing-mode-and-rtl-direction-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-sideways-rl-writing-mode-expected.txt:
* LayoutTests/platform/ios-wk2/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/css/CSSPrimitiveValueMappings.h:
(WebCore::toCSSValueID):
(WebCore::fromCSSValueID):
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::toScrollAlignmentForInlineDirection):
(WebCore::toScrollAlignmentForBlockDirection):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::flipVisualRectToLogicalForWritingMode):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::collectInkOverflowForTextDecorations):
(WebCore::Layout::InlineDisplayContentBuilder::flipLogicalRectToVisualForWritingModeWithinLine const):
(WebCore::Layout::InlineDisplayContentBuilder::flipRootInlineBoxRectToVisualForWritingMode const):
(WebCore::Layout::InlineDisplayContentBuilder::setLeftForWritingMode const):
(WebCore::Layout::InlineDisplayContentBuilder::setRightForWritingMode const):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::flipLogicalLineRectToVisualForWritingMode):
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::flexBoxLogicalBorder):
(WebCore::LayoutIntegration::flexBoxLogicalPadding):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::verticalLogicalMargin):
(WebCore::LayoutIntegration::logicalBorder):
(WebCore::LayoutIntegration::logicalPadding):
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineContentConstraints):
(WebCore::LayoutIntegration::LineLayout::physicalBaselineForLine const):
(WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::firstInlineBoxRect const):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::paginationModeForRenderStyle):
* Source/WebCore/platform/text/WritingMode.h:
(WebCore::writingModeToBlockFlowDirection):
(WebCore::makeTextFlowInitalizer):
(WebCore::makeTextFlow):
* Source/WebCore/rendering/BaselineAlignment.cpp:
(WebCore::BaselineGroup::BaselineGroup):
(WebCore::BaselineGroup::isOppositeBlockFlow const):
(WebCore::BaselineGroup::isOrthogonalBlockFlow const):
(WebCore::BaselineGroup::isCompatible const):
(WebCore::BaselineAlignmentState::findCompatibleSharedGroup):
* Source/WebCore/rendering/BaselineAlignment.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustBorderBoxRectForPainting):
(WebCore::RenderBlock::paintRectToClipOutFromBorder):
(WebCore::RenderBlock::borderTop const):
(WebCore::RenderBlock::borderLeft const):
(WebCore::RenderBlock::borderBottom const):
(WebCore::RenderBlock::borderRight const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::shouldFlipBeforeAfterMargins):
(WebCore::RenderBox::visualOverflowRectForPropagation const):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* Source/WebCore/rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::orientation const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::isLeftToRightFlow const):
(WebCore::RenderFlexibleBox::transformedBlockFlowDirection const):
(WebCore::RenderFlexibleBox::flowAwareBorderBefore const):
(WebCore::RenderFlexibleBox::flowAwareBorderAfter const):
(WebCore::RenderFlexibleBox::flowAwarePaddingBefore const):
(WebCore::RenderFlexibleBox::flowAwarePaddingAfter const):
(WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild const):
(WebCore::RenderFlexibleBox::marginBoxAscentForChild):
(WebCore::RenderFlexibleBox::transformedWritingMode const): Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::computeScrollOrigin):
* Source/WebCore/rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paddingTop const):
(WebCore::RenderTableCell::paddingBottom const):
(WebCore::RenderTableCell::paddingLeft const):
(WebCore::RenderTableCell::paddingRight const):
* Source/WebCore/rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
* Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::borderBeforeInWritingMode):
(WebCore::borderAndPaddingBeforeInWritingMode):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderBefore const):
(WebCore::RenderStyle::borderAfter const):
(WebCore::RenderStyle::borderBeforeWidth const):
(WebCore::RenderStyle::borderAfterWidth const):
(WebCore::RenderStyle::fontAndGlyphOrientation):
(WebCore::RenderStyle::shouldPlaceVerticalScrollbarOnLeft const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::initialWritingMode):
(WebCore::RenderStyle::blockFlowDirection const):
(WebCore::RenderStyle::typographicMode const):
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::adjustStyleForInterCharacterRuby):

Canonical link: https://commits.webkit.org/266775@main
@webkit-commit-queue
Copy link
Collaborator

Committed 266775@main (ccbff7d): https://commits.webkit.org/266775@main

Reviewed commits have been landed. Closing PR #16556 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit ccbff7d into WebKit:main Aug 10, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Aug 10, 2023
@nt1m nt1m deleted the sideways-wm branch August 10, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
5 participants