WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
101682
RemoveFormat command doesn't remove background color
https://bugs.webkit.org/show_bug.cgi?id=101682
Summary
RemoveFormat command doesn't remove background color
Ryosuke Niwa
Reported
2012-11-08 18:24:52 PST
Steps to reproduce the problem: 1. create js node 'some <span style="color: black; background-color: #ff0000;">red text</span> here' element 2. call execCommand with removeFormat on the created node What is the expected behavior? 'some <span>red text</span> here' ie: Background colour is removed What went wrong? 'some <span style="background-color: #ff0000;">red text</span> here' ie: Background colour is not removed
http://code.google.com/p/chromium/issues/detail?id=159407
Attachments
Fixes the bug
(3.66 KB, patch)
2012-11-08 21:25 PST
,
Ryosuke Niwa
tony
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2012-11-08 18:25:10 PST
<
rdar://problem/12668350
>
Ryosuke Niwa
Comment 2
2012-11-08 21:25:24 PST
Created
attachment 173196
[details]
Fixes the bug
Tony Chang
Comment 3
2012-11-09 09:52:27 PST
Comment on
attachment 173196
[details]
Fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=173196&action=review
> LayoutTests/editing/execCommand/remove-format-background-color-expected.txt:3 > +This tests removing format on text that has background color. There should be no span or inline style below: > + > +hello world WebKit.
Should we use something other than a dumpAsText test? I think a script test that uses getComputedStyle or a reftest would be better for checking the background color.
Ryosuke Niwa
Comment 4
2012-11-09 11:33:23 PST
(In reply to
comment #3
)
> (From update of
attachment 173196
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=173196&action=review
> > > LayoutTests/editing/execCommand/remove-format-background-color-expected.txt:3 > > +This tests removing format on text that has background color. There should be no span or inline style below: > > + > > +hello world WebKit. > > Should we use something other than a dumpAsText test? I think a script test that uses getComputedStyle or a reftest would be better for checking the background color.
I’m dumping HTML here. We don’t want to leave a span. It’s important the markup we generate is as concise as possible.
Tony Chang
Comment 5
2012-11-09 11:49:54 PST
Comment on
attachment 173196
[details]
Fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=173196&action=review
> Source/WebCore/editing/RemoveFormatCommand.cpp:92 > + defaultStyle->style()->setProperty(CSSPropertyBackgroundColor, "transparent");
Can we pass in CSSValueTransparent instead of "transparent"? Looks like that would avoid having to run the CSS parser.
>>> LayoutTests/editing/execCommand/remove-format-background-color-expected.txt:3 >>> +hello world WebKit. >> >> Should we use something other than a dumpAsText test? I think a script test that uses getComputedStyle or a reftest would be better for checking the background color. > > I’m dumping HTML here. We don’t want to leave a span. It’s important the markup we generate is as concise as possible.
Ah, I see. Using dump-as-markup.js would be more clear. Should there be a test case with background-color: transparent?
Ryosuke Niwa
Comment 6
2012-11-09 11:55:54 PST
Comment on
attachment 173196
[details]
Fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=173196&action=review
>> Source/WebCore/editing/RemoveFormatCommand.cpp:92 >> + defaultStyle->style()->setProperty(CSSPropertyBackgroundColor, "transparent"); > > Can we pass in CSSValueTransparent instead of "transparent"? Looks like that would avoid having to run the CSS parser.
Oh, you’re right. We’re talking to StylePropertySet here.
>>>> LayoutTests/editing/execCommand/remove-format-background-color-expected.txt:3 >>>> +hello world WebKit. >>> >>> Should we use something other than a dumpAsText test? I think a script test that uses getComputedStyle or a reftest would be better for checking the background color. >> >> I’m dumping HTML here. We don’t want to leave a span. It’s important the markup we generate is as concise as possible. > > Ah, I see. Using dump-as-markup.js would be more clear. Should there be a test case with background-color: transparent?
No… I think we should be removing background-color: transparent as well in the future. We just don’t have a way to tell ApplyStyleCommand that it should remove a property regardless of its value.
Ryosuke Niwa
Comment 7
2012-11-09 12:10:50 PST
Committed
r134096
: <
http://trac.webkit.org/changeset/134096
>
Tony Chang
Comment 8
2012-11-09 13:19:57 PST
(In reply to
comment #6
)
> > Should there be a test case with background-color: transparent? > > No… I think we should be removing background-color: transparent as well in the future. We just don’t have a way to tell ApplyStyleCommand that it should remove a property regardless of its value.
That's fine, you could check in a failing test case for that. It would make it clear what the desired result is.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug