Revert 84311 - REGRESSION(r55762): Highlight color can't be copied in gmail.
Reviewed by Ryosuke Niwa.
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.
(WebCore::Editor::hasTransparentBackgroundColor): Now is a static method of the class.
(WebCore::isElementPresentational): Modified to use hasTransparentBackgroundColor.
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.