The semantics of nsIStyleSet::ClearStyleData are ugly. The first part of the function should be a separate function for clearing inline style that would be used by the one caller that passes a non-null style context (although that caller doesn't always have a style context, which can make things very inefficient).
See also bug 158230.
Is this still relevant? This function has changed a lot...
Well, like bug 149203, this was fixed by some combination of bug 188803, bug 386640, and maybe other things.