DescriptionRevert 84311 - REGRESSION(r55762): Highlight color can't be copied in gmail.
https://bugs.webkit.org/show_bug.cgi?id=58925
<rdar://problem/9253057>
Reviewed by Ryosuke Niwa.
Source/WebCore:
Test: editing/pasteboard/copy-text-with-backgroundcolor.html
The changes of r55762 uncovered the underlying issue here. The markup fragment
placed in the pasteboard does not contain the background color style.
This occurs only if the selection is limited to a single text node, whereas if the
selection spans across multiple nodes, the style is preserved correctly.
The fix consists in changing the logic that decides whether we should include the wrapping
node in the markup. That logic is based on the code in highestAncestorToWrapMarkup which relies
on isElementPresentational to choose candidates to be the wrapping node.
I've extended it to accept nodes that have non fully transparent background colors.
* editing/Editor.cpp:
(WebCore::Editor::hasTransparentBackgroundColor): Now is a static method of the class.
* editing/Editor.h:
* editing/markup.cpp:
(WebCore::isElementPresentational): Modified to use hasTransparentBackgroundColor.
LayoutTests:
The following test checks that when we copy a text node surrounded by an element that
has non transparent background color we preserve the background color as well.
* editing/pasteboard/copy-text-with-backgroundcolor-expected.txt: Added.
* editing/pasteboard/copy-text-with-backgroundcolor.html: Added.
TBR=enrica@apple.com
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=86685
Patch Set 1 #
Messages
Total messages: 1 (0 generated)
|