Bug 23389 - Clean up ApplyStyleCommand and deploy a bit more PassRefPtr
Summary: Clean up ApplyStyleCommand and deploy a bit more PassRefPtr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-16 14:30 PST by Eric Seidel (no email)
Modified: 2009-01-16 16:35 PST (History)
1 user (show)

See Also:


Attachments
Small cleanups (16.61 KB, patch)
2009-01-16 14:34 PST, Eric Seidel (no email)
justin.garcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-01-16 14:30:21 PST
Clean up ApplyStyleCommand and deploy a bit more PassRefPtr

Patch coming...
Comment 1 Eric Seidel (no email) 2009-01-16 14:34:48 PST
Created attachment 26807 [details]
Small cleanups

 WebCore/ChangeLog                                  |   37 ++++++++++++++++++++
 WebCore/editing/ApplyStyleCommand.cpp              |   35 ++++++-------------
 WebCore/editing/ApplyStyleCommand.h                |    2 +-
 WebCore/editing/CompositeEditCommand.cpp           |    7 ++--
 WebCore/editing/IndentOutdentCommand.cpp           |    4 +-
 WebCore/editing/InsertLineBreakCommand.cpp         |    8 ++--
 .../editing/InsertParagraphSeparatorCommand.cpp    |    2 +-
 WebCore/editing/InsertTextCommand.cpp              |    2 +-
 WebCore/editing/ModifySelectionListLevel.cpp       |    4 +-
 WebCore/editing/ReplaceSelectionCommand.cpp        |   24 ++++++------
 WebCore/editing/ReplaceSelectionCommand.h          |    6 ++--
 11 files changed, 77 insertions(+), 54 deletions(-)
Comment 2 Justin Garcia 2009-01-16 14:43:21 PST
Comment on attachment 26807 [details]
Small cleanups

-    if (styleChange.applyBold()) {
-        RefPtr<Element> boldElement = document()->createElementNS(xhtmlNamespaceURI, "b", ec);
-        ASSERT(ec == 0);
-        insertNodeBefore(boldElement.get(), startNode);
-        surroundNodeRangeWithElement(startNode, endNode, boldElement.get());
-    }
+    if (styleChange.applyBold())
+        surroundNodeRangeWithElement(startNode, endNode, document()->createElementNS(xhtmlNamespaceURI, "b", ec));

You no longer ASSERT that createElementNS completed without error, I suppose if it encounters an error it will return 0 and that will be caught by surroundNodeRangeWithElement, ya?

r=me
Comment 3 Eric Seidel (no email) 2009-01-16 16:35:22 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/editing/ApplyStyleCommand.cpp
	M	WebCore/editing/ApplyStyleCommand.h
	M	WebCore/editing/CompositeEditCommand.cpp
	M	WebCore/editing/IndentOutdentCommand.cpp
	M	WebCore/editing/InsertLineBreakCommand.cpp
	M	WebCore/editing/InsertParagraphSeparatorCommand.cpp
	M	WebCore/editing/InsertTextCommand.cpp
	M	WebCore/editing/ModifySelectionListLevel.cpp
	M	WebCore/editing/ReplaceSelectionCommand.cpp
	M	WebCore/editing/ReplaceSelectionCommand.h
Committed r39997

Yeah, the ASSERT was unnecessary.  Thanks for the review!