Bug 61466

Summary: WebKit duplicates styles from css rules on copy and paste
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Enhancement CC: darin, dglazkov, enrica, eric, jparent, justin.garcia, leviw, ojan, sullivan, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 12319, 34564    
Attachments:
Description Flags
fixes the bug
enrica: review+, webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-03 none

Ryosuke Niwa
Reported 2011-05-25 13:50:48 PDT
When an element has style applied by CSS rules, WebKit duplicates that style in inline style declaration when the element is copied and pasted in the same document. We should remove inline styles that duplicates CSS rules on paste to reduce the markup size.
Attachments
fixes the bug (31.16 KB, patch)
2011-05-25 17:44 PDT, Ryosuke Niwa
enrica: review+
webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-03 (1.18 MB, application/zip)
2011-05-26 01:33 PDT, WebKit Review Bot
no flags
Ryosuke Niwa
Comment 1 2011-05-25 17:44:49 PDT
Created attachment 94890 [details] fixes the bug
Ryosuke Niwa
Comment 2 2011-05-25 17:45:49 PDT
This is possibly the most exciting patch I'm submitting this month.
Levi Weintraub
Comment 3 2011-05-25 18:04:31 PDT
(In reply to comment #2) > This is possibly the most exciting patch I'm submitting this month. This really is exciting!
WebKit Review Bot
Comment 4 2011-05-26 01:33:21 PDT
Comment on attachment 94890 [details] fixes the bug Attachment 94890 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8736190 New failing tests: editing/pasteboard/5780697-2.html
WebKit Review Bot
Comment 5 2011-05-26 01:33:26 PDT
Created attachment 94940 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Ryosuke Niwa
Comment 6 2011-05-26 07:54:42 PDT
It seems like editing/pasteboard/5780697-2.html has a Chromium-specific expected results. Regardless, we just to rebaseline it.
Enrica Casucci
Comment 7 2011-05-26 10:11:08 PDT
Comment on attachment 94890 [details] fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=94890&action=review Looks good to me. > Source/WebCore/editing/ReplaceSelectionCommand.cpp:479 > +void ReplaceSelectionCommand::negateStyleRulesThatAffectAppearanceAndRemoveRedundantInlineStyleDecl() That is an insanely long method name! :-). I guess it is very descriptive.
Ryosuke Niwa
Comment 8 2011-05-26 10:28:18 PDT
Thanks for the review, Enrica! Per IRC discussion I'll rename negateStyleRulesThatAffectAppearanceAndRemoveRedundantInlineStyleDecl to removeRedundantStylesAndKeepStyleSpanInline before landing it. Also, I'll include the rebaseline for platform/chromium-win/editing/pasteboard/5780697-2-expected.txt. I'll still have to rebaseline GTK & Qt as they also have separate expected results for 5780697-2.html
Ryosuke Niwa
Comment 9 2011-05-26 10:49:42 PDT
Note You need to log in before you can comment on or make changes to this bug.