ApplyStyleCommand::applyBlockStyle and ApplyStyleCommand::applyInlineStyle should take EditingStyle* instead of CSSMutableStyleDeclaration* and they should also use EditingStyle's methods.
Created attachment 81464 [details] Patch
Could someone review this patch?
Comment on attachment 81464 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=81464&action=review > Source/WebCore/ChangeLog:21 > + (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Allows style to be null; exit early instead. Is this because of the changes to removeInlineStyle() at ApplyStyleCommand.cpp:917,921? > Source/WebCore/editing/ApplyStyleCommand.cpp:895 > + style->textDirection(textDirection); Nit: Do you need to check the return value here?
Comment on attachment 81464 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=81464&action=review Thanks for the review, Tony. >> Source/WebCore/ChangeLog:21 >> + (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Allows style to be null; exit early instead. > > Is this because of the changes to removeInlineStyle() at ApplyStyleCommand.cpp:917,921? Not really. The reason is that EditingStyle::style() can return a null-pointer, and these functions previously assumed that the style is always not null. >> Source/WebCore/editing/ApplyStyleCommand.cpp:895 >> + style->textDirection(textDirection); > > Nit: Do you need to check the return value here? Oops, I must have done: ASSERT(style->textDirection(textDirection));
(In reply to comment #4) > > Is this because of the changes to removeInlineStyle() at ApplyStyleCommand.cpp:917,921? > > Not really. The reason is that EditingStyle::style() can return a null-pointer, and these functions previously assumed that the style is always not null. I think the change is fine, but it would be nice if you had a test case that showed this possibility.
(In reply to comment #5) > (In reply to comment #4) > > > Is this because of the changes to removeInlineStyle() at ApplyStyleCommand.cpp:917,921? > > > > Not really. The reason is that EditingStyle::style() can return a null-pointer, and these functions previously assumed that the style is always not null. > > I think the change is fine, but it would be nice if you had a test case that showed this possibility. Oh, indeed some existing tests crash without this change because any test that inserts anchor element has null style pointer.
Committed r78417: <http://trac.webkit.org/changeset/78417>