Bug 23370
| Summary: | Style removal can remove too much | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Justin Garcia <justin.garcia> |
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | eric, harrison, rniwa |
| Priority: | P3 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Justin Garcia
Load attached reduction.html
Select the word "one"
Command-I to de-italicize the word
"one is de-italicized, but it's also de-underlined.
<rdar://problem/4438963> Style removal removes too much style
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
I've not seen the test case yet. But I assume this is just caused by this function:
void ApplyStyleCommand::removeHTMLStyleNode(HTMLElement *elem)
{
// This node can be removed.
// EDIT FIXME: This does not handle the case where the node
// has attributes. But how often do people add attributes to <B> tags?
// Not so often I think.
ASSERT(elem);
removeNodePreservingChildren(elem);
}
The check which is made before calling that function is this one:
bool ApplyStyleCommand::isHTMLStyleNode(CSSMutableStyleDeclaration *style, HTMLElement *elem)
{
CSSMutableStyleDeclaration::const_iterator end = style->end();
for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) {
switch ((*it).id()) {
case CSSPropertyFontWeight:
if (elem->hasLocalName(bTag))
return true;
break;
case CSSPropertyFontStyle:
if (elem->hasLocalName(iTag))
return true;
}
}
return false;
}
(which I intend to expand to include other tag types soon)
Ryosuke Niwa
*** This bug has been marked as a duplicate of bug 23496 ***