[webkit-changes] [WebKit/WebKit] 383761: user-select: initial content within user-select: n...
Ryosuke Niwa
noreply at github.com
Sat Dec 17 13:15:28 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3837614ab70da684405b3f6f704694b6a5ff6bf5
https://github.com/WebKit/WebKit/commit/3837614ab70da684405b3f6f704694b6a5ff6bf5
Author: Ryosuke Niwa <rniwa at webkit.org>
Date: 2022-12-17 (Sat, 17 Dec 2022)
Changed paths:
M LayoutTests/editing/pasteboard/copy-content-with-user-select-none-expected.txt
M LayoutTests/editing/pasteboard/copy-content-with-user-select-none.html
M Source/WebCore/editing/TextIterator.cpp
M Source/WebCore/editing/cocoa/HTMLConverter.mm
M Source/WebCore/editing/markup.cpp
M Source/WebCore/editing/markup.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyRTF.mm
Log Message:
-----------
user-select: initial content within user-select: none should be copied
https://bugs.webkit.org/show_bug.cgi?id=249507
Reviewed by Darin Adler.
Allow content inside user-select: none to be copyable if it's not user-select: none.
The fix is simple for TextIterator where we can set m_handledChildren to be false when
ignoring user-select: none content so that if there is any visible content we won't skip.
The fix is more involved for StyledMarkupAccumulator (for HTML) and HTMLConverter (RTFD).
These classes need to decide whether the whole element should be skipped or not based on
if an element with user-select: none contains any content that is not user-select: none or not.
If it does, then we need to traverse through these elements with appropriate block/paragraph
styling and emit string for those content that is not user-select: none.
* LayoutTests/editing/pasteboard/copy-content-with-user-select-none-expected.txt:
* LayoutTests/editing/pasteboard/copy-content-with-user-select-none.html:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::advance):
* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(HTMLConverter::HTMLConverter):
(HTMLConverter::_enterElement):
(HTMLConverter::_processText):
* Source/WebCore/editing/markup.cpp:
(WebCore::UserSelectNoneStateCache::UserSelectNoneStateCache): Added.
(WebCore::UserSelectNoneStateCache::parentNode): Added.
(WebCore::UserSelectNoneStateCache::firstChild): Added.
(WebCore::UserSelectNoneStateCache::nextSibling): Added.
(WebCore::UserSelectNoneStateCache::computeState): Added.
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
* Source/WebCore/editing/markup.h:
(WebCore::UserSelectNoneStateCache::nodeOnlyContainsUserSelectNone): Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyRTF.mm:
(CopyRTF.StripsUserSelectNone):
Canonical link: https://commits.webkit.org/258054@main
More information about the webkit-changes
mailing list