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

Range APIs do not construct / move trees in tree order (observable by custom elements) #9730

Merged
merged 1 commit into from Feb 8, 2023

Conversation

rniwa
Copy link
Member

@rniwa rniwa commented Feb 7, 2023

fa5a06a

Range APIs do not construct / move trees in tree order (observable by custom elements)
https://bugs.webkit.org/show_bug.cgi?id=188279

Reviewed by Chris Dumez.

In order to match the spec'ed upgrade order, create a nested custom element reaction stack
which is used as a holding tank of upgrade reactions during Range::processContents.

At the end, we traverse the document fragment top-down and re-enqueue each element to the real
custom element reaction stack in the tree order.

* LayoutTests/imported/w3c/web-platform-tests/custom-elements/range-and-constructors-expected.txt:
* Source/WebCore/dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementQueue::takeElements): Added.
(WebCore::CustomElementReactionQueue::enqueueElementsOnAppropriateElementQueue): Added.
(WebCore::CustomElementReactionStack::takeElements): Added.
* Source/WebCore/dom/CustomElementReactionQueue.h:
* Source/WebCore/dom/Range.cpp:
(WebCore::Range::processContents):

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

fcd1be1

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe   πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2   πŸ§ͺ api-mac   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  watch-sim
βœ… πŸ›  πŸ§ͺ unsafe-merge

@rniwa rniwa requested a review from cdumez as a code owner February 7, 2023 02:12
@rniwa rniwa self-assigned this Feb 7, 2023
@rniwa rniwa added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Feb 7, 2023
Copy link
Contributor

@cdumez cdumez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few nits.

Source/WebCore/dom/CustomElementReactionQueue.cpp Outdated Show resolved Hide resolved
RangeBoundaryPoint originalEnd(m_end);

// what is the highest node that partially selects the start / end of the range?
RefPtr<Node> partialStart = highestAncestorUnderCommonRoot(&originalStart.container(), commonRoot.get());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would RefPtr suffice instead of RefPtr<Node>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Outdated Show resolved Hide resolved
Source/WebCore/dom/Range.cpp Show resolved Hide resolved
@rniwa rniwa added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Feb 8, 2023
… custom elements)

https://bugs.webkit.org/show_bug.cgi?id=188279

Reviewed by Chris Dumez.

In order to match the spec'ed upgrade order, create a nested custom element reaction stack
which is used as a holding tank of upgrade reactions during Range::processContents.

At the end, we traverse the document fragment top-down and re-enqueue each element to the real
custom element reaction stack in the tree order.

* LayoutTests/imported/w3c/web-platform-tests/custom-elements/range-and-constructors-expected.txt:
* Source/WebCore/dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementQueue::takeElements): Added.
(WebCore::CustomElementReactionQueue::enqueueElementsOnAppropriateElementQueue): Added.
(WebCore::CustomElementReactionStack::takeElements): Added.
* Source/WebCore/dom/CustomElementReactionQueue.h:
* Source/WebCore/dom/Range.cpp:
(WebCore::Range::processContents):

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

Committed 259987@main (fa5a06a): https://commits.webkit.org/259987@main

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

@webkit-early-warning-system webkit-early-warning-system merged commit fa5a06a into WebKit:main Feb 8, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Feb 8, 2023
@rniwa rniwa deleted the fix188279 branch February 8, 2023 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
4 participants