[webkit-changes] [WebKit/WebKit] 8e911d: The effect of writing-mode property remains after ...

Antti Koivisto noreply at github.com
Sat Nov 5 05:25:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e911dbafcc6bed972bfcd522a93f1bf343c00b6
      https://github.com/WebKit/WebKit/commit/8e911dbafcc6bed972bfcd522a93f1bf343c00b6
  Author: Antti Koivisto <antti at apple.com>
  Date:   2022-11-05 (Sat, 05 Nov 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/writing-mode/writing-mode-body-expected.html
    A LayoutTests/fast/writing-mode/writing-mode-body.html
    A LayoutTests/fast/writing-mode/writing-mode-document-element-expected.html
    A LayoutTests/fast/writing-mode/writing-mode-document-element.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-root-expected.txt
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/RenderView.h
    M Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
    M Source/WebCore/rendering/updating/RenderTreeUpdater.h
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebCore/style/StyleAdjuster.h
    M Source/WebCore/style/StyleResolveForDocument.cpp
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h
    M Source/WebCore/style/StyleUpdate.h

  Log Message:
  -----------
  The effect of writing-mode property remains after the property is removed (on the root element)
https://bugs.webkit.org/show_bug.cgi?id=185729
rdar://97091990

Reviewed by Alan Baradlay.

There is a style cycle where the root writing-mode may depend on the document element writing-mode which
in turn may depend on the body's (computed during previous style update). These can then get inherited back
to the body style. The resulting confusion causes various issues.

This patch ensures we do style resolution using clean root styles without writing-mode/direction mutations.
The propagation upwards is done at the end of the resolution. This replaces the old propagation code in
render tree.

* LayoutTests/TestExpectations:
* LayoutTests/fast/writing-mode/writing-mode-body-expected.html: Added.
* LayoutTests/fast/writing-mode/writing-mode-body.html: Added.
* LayoutTests/fast/writing-mode/writing-mode-document-element-expected.html: Added.
* LayoutTests/fast/writing-mode/writing-mode-document-element.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-root-expected.txt:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
* Source/WebCore/dom/Document.h:
(WebCore::Document::rootStyle const):

Maintain clean root style.

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):

Remove style mutating propagation code.

* Source/WebCore/rendering/RenderView.cpp:

Handle view invalidation for writing-mode/direction. This is moved from RenderBox::styleDidChange.

(WebCore::RenderView::styleDidChange):
* Source/WebCore/rendering/RenderView.h:
* Source/WebCore/rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::commit):

Update the view style first.

(WebCore::RenderTreeUpdater::updateRenderViewStyle):
* Source/WebCore/rendering/updating/RenderTreeUpdater.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::propagateToDocumentElementAndInitialContainingBlock):

Do the propagation at end of the style resolution.

(WebCore::Style::Adjuster::restoreUsedDocumentElementStyleToComputed):
* Source/WebCore/style/StyleAdjuster.h:
* Source/WebCore/style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

Remove the adjustments based on descendant styles. This was not correct as these values are from the previous round of style resolution.

* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::State::State):
(WebCore::Style::Resolver::Resolver):
(WebCore::Style::Resolver::styleForPage):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Parent::Parent):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolveComposedTree):

Save and clean up document element style when traversing through.

(WebCore::Style::TreeResolver::resolve):
* Source/WebCore/style/StyleUpdate.h:
(WebCore::Style::Update::initialContainingBlockUpdate const):
(WebCore::Style::Update::addInitialContainingBlockUpdate):

Pass the new root style via style update.

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




More information about the webkit-changes mailing list