Bug 23370 - Style removal can remove too much
Summary: Style removal can remove too much
Status: RESOLVED DUPLICATE of bug 23496
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2009-01-15 17:15 PST by Justin Garcia
Modified: 2009-07-27 11:46 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Garcia 2009-01-15 17:15:16 PST
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
Comment 1 Eric Seidel (no email) 2009-01-15 17:27:59 PST
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)
Comment 2 Ryosuke Niwa 2009-07-27 11:46:59 PDT

*** This bug has been marked as a duplicate of bug 23496 ***