Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Release assert in Document::updateLayout() via HTMLTextAreaElement::c…
…hildrenChanged https://bugs.webkit.org/show_bug.cgi?id=224471 Reviewed by Ryosuke Niwa. This patch is based on a set of patches made by Sergio Villar Senin and Gabriel Nava Marino. Executing some editing commands in a text area might force the recomputation of things like caret or the visible selection position and extent. Under some circumstances (like when the text area has no content and children) we might end up trying to update layout when it is not safe as a side effect of updating the caret. In order to fix that, we can switch to a model in which we update the selection asynchronously in the case of having a non-user triggered change. That way we don't do it inside a restricted layout scope. The App Highlight restoration code had to be tuned as well (when restoring and scrolling to reveal a Quick Note on iOS MacOS). It uses TemporarySelectionChange to select and scroll to reveal the highlight range; the code assumed that this scrolling happens synchronously, since it reverts the selection to the original range at the end of `AppHighlightStorage::attemptToRestoreHighlightAndScroll` when the TemporarySelectionChange falls out of scope. That is however no longer the case. Actually no scrolling happened after this patch because we end up only scheduling the appearance update timer before setting the selection back to the original state with `SelectionRevealMode::DoNotReveal`. Since this only happens when the user interacts in the Notes app, it seems sensible to consider it as a user triggered event. Layout Tests Moved some tests out of the text-based-repaint.js model because selection is now updated and revealed asynchronously in the case of non-user triggered changes. The problem is that by the time the repaint rects are queried the update has not happened yet. That's why the tests were modified so that we wait until the repaint happens. Same situation for other tests that do not involve repaint rects but trigger accesibility tree updates. We must ensure that we let the notification be thrown before checking whether or not has been emited. As it's done asynchronously we must let the main thread run before checking. Last but not least, some of the tests are using setTimeout() instead of requestAnimationFrame() because the results with the latter were not as reliable under stress/debug conditions. * Source/WebCore/Modules/highlight/AppHighlightStorage.cpp: (WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll): * Source/WebCore/editing/Editor.cpp: (WebCore::TemporarySelectionChange::setSelection): * Source/WebCore/editing/Editor.h: * Source/WebCore/editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelection): (WebCore::FrameSelection::updateSelectionAppearanceNow): (WebCore::FrameSelection::absoluteCaretBounds): (WebCore::FrameSelection::setCaretVisibility): (WebCore::FrameSelection::selectionBounds): (WebCore::FrameSelection::revealSelection): (WebCore::updateSelectionByUpdatingLayoutOrStyle): Deleted. (WebCore::FrameSelection::selectionBounds const): Deleted. * Source/WebCore/editing/FrameSelection.h: * Source/WebCore/page/EventHandler.cpp: (WebCore::setSelectionIfNeeded): * Source/WebCore/page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): * LayoutTests/accessibility/mac/selection-boundary-userinfo.html: * LayoutTests/accessibility/mac/selection-change-userinfo.html: * LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox.html: * LayoutTests/editing/selection-with-absolute-positioned-empty-content.html: * LayoutTests/fast/forms/textarea-scrolled-endline-caret.html: * LayoutTests/fast/repaint/selection-gap-absolute-child-expected.txt: * LayoutTests/fast/repaint/selection-gap-absolute-child.html: * LayoutTests/fast/repaint/selection-gap-fixed-child.html: * LayoutTests/fast/repaint/selection-gap-flipped-absolute-child-expected.txt: * LayoutTests/fast/repaint/selection-gap-flipped-absolute-child.html: * LayoutTests/fast/repaint/selection-gap-transformed-absolute-child-expected.txt: * LayoutTests/fast/repaint/selection-gap-transformed-absolute-child.html: * LayoutTests/fast/repaint/selection-gap-transformed-fixed-child-expected.txt: * LayoutTests/fast/repaint/selection-gap-transformed-fixed-child.html: * LayoutTests/fast/repaint/selection-paint-invalidation-expected.txt: * LayoutTests/fast/repaint/selection-ruby-rl-expected.txt: * LayoutTests/fast/repaint/selection-ruby-rl.html: * LayoutTests/fast/repaint/text-selection-overflow-hidden-expected.txt: * LayoutTests/fast/repaint/text-selection-overflow-hidden.html: * LayoutTests/fast/text/incorrect-deselection-across-multiple-elements.html: * LayoutTests/platform/gtk/TestExpectations: * LayoutTests/platform/gtk/fast/repaint/selection-ruby-rl-expected.txt: Copied from LayoutTests/fast/repaint/selection-ruby-rl-expected.txt. * LayoutTests/platform/gtk/fast/repaint/text-selection-overflow-hidden-expected.txt: * LayoutTests/platform/mac-wk1/TestExpectations: * LayoutTests/platform/mac-wk1/accessibility/mac/focus-setting-selection-syncronizing-not-clearing-expected.txt: Added. * LayoutTests/platform/mac-wk1/fast/repaint/4776765-expected.txt: Added. * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005-expected.txt: * LayoutTests/platform/mac/TestExpectations: * LayoutTests/platform/win/fast/repaint/4776765-expected.txt: Added. * LayoutTests/platform/win/fast/repaint/selection-ruby-rl-expected.txt: * LayoutTests/platform/win/fast/repaint/text-selection-overflow-hidden-expected.txt: Canonical link: https://commits.webkit.org/250778@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information