Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0ab3bf3720f8d9731de8874ddd62328563cac1c0
      
https://github.com/WebKit/WebKit/commit/0ab3bf3720f8d9731de8874ddd62328563cac1c0
  Author: Joanne Pan <[email protected]>
  Date:   2026-03-04 (Wed, 04 Mar 2026)

  Changed paths:
    A 
LayoutTests/editing/pasteboard/copy-multiparagraph-with-background-color-expected.txt
    A 
LayoutTests/editing/pasteboard/copy-multiparagraph-with-background-color.html
    M 
LayoutTests/editing/pasteboard/data-transfer-get-data-on-drop-rich-text-expected.txt
    M LayoutTests/fast/events/input-events-paste-rich-datatransfer-expected.txt
    M 
LayoutTests/platform/glib/fast/events/input-events-paste-rich-datatransfer-expected.txt
    M Source/WebCore/editing/EditingStyle.cpp

  Log Message:
  -----------
  Clipboard copy serialization does not preserve background-color for 
multi-paragraph selections
https://bugs.webkit.org/show_bug.cgi?id=308854
rdar://171391621

Reviewed by Ryosuke Niwa.

removeStyleConflictingWithStyleOfNode used copyPropertiesFromComputedStyle for 
the
parent style but EditingStyle::create for the node style. These compute 
background-color
differently: the former reads the raw computed value (transparent for most 
elements),
while the latter calls backgroundColorInEffect which walks up ancestors to find 
the
nearest non-transparent value. The mismatch caused background-color to be 
incorrectly
treated as a conflict and stripped from the wrapping style during 
multi-paragraph copy.

This is fixed by using EditingStyle::create for both parent and node, so both 
go through
backgroundColorInEffect and produce matching values.

Test: editing/pasteboard/copy-multiparagraph-with-background-color.html

* 
LayoutTests/editing/pasteboard/copy-multiparagraph-with-background-color-expected.txt:
 Added.
* 
LayoutTests/editing/pasteboard/copy-multiparagraph-with-background-color.html: 
Added.
* 
LayoutTests/editing/pasteboard/data-transfer-get-data-on-drop-rich-text-expected.txt:
* LayoutTests/fast/events/input-events-paste-rich-datatransfer-expected.txt:
* Source/WebCore/editing/EditingStyle.cpp:
(WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
(WebCore::EditingStyle::wrappingStyleForSerialization):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to