Bug 61466 - WebKit duplicates styles from css rules on copy and paste
Summary: WebKit duplicates styles from css rules on copy and paste
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Enhancement
Assignee: Ryosuke Niwa
Depends on:
Blocks: 12319 34564
  Show dependency treegraph
Reported: 2011-05-25 13:50 PDT by Ryosuke Niwa
Modified: 2011-05-26 10:49 PDT (History)
11 users (show)

See Also:

fixes the bug (31.16 KB, patch)
2011-05-25 17:44 PDT, Ryosuke Niwa
enrica: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
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 Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 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.
Comment 1 Ryosuke Niwa 2011-05-25 17:44:49 PDT
Created attachment 94890 [details]
fixes the bug
Comment 2 Ryosuke Niwa 2011-05-25 17:45:49 PDT
This is possibly the most exciting patch I'm submitting this month.
Comment 3 Levi Weintraub 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!
Comment 4 WebKit Review Bot 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:
Comment 5 WebKit Review Bot 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
Comment 6 Ryosuke Niwa 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.
Comment 7 Enrica Casucci 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.
Comment 8 Ryosuke Niwa 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
Comment 9 Ryosuke Niwa 2011-05-26 10:49:42 PDT
Committed r87400: <http://trac.webkit.org/changeset/87400>