Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 18074004: RefPtr Node since it can be blown away in load event. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/ApplyStyleCommand.cpp
diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
index 03c0b16754b8470c1bfac2ab0a2eb53109c7a861..d8810b17c319c64841afc050686c1262947f9c8c 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -1098,16 +1098,17 @@ void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
Position s = start.isNull() || start.isOrphan() ? pushDownStart : start;
Position e = end.isNull() || end.isOrphan() ? pushDownEnd : end;
- Node* node = start.deprecatedNode();
+ RefPtr<Node> node = start.deprecatedNode();
while (node) {
RefPtr<Node> next;
- if (editingIgnoresContent(node)) {
+ if (editingIgnoresContent(node.get())) {
ASSERT(node == end.deprecatedNode() || !node->contains(end.deprecatedNode()));
- next = NodeTraversal::nextSkippingChildren(node);
- } else
- next = NodeTraversal::next(node);
- if (node->isHTMLElement() && nodeFullySelected(node, start, end)) {
- RefPtr<HTMLElement> elem = toHTMLElement(node);
+ next = NodeTraversal::nextSkippingChildren(node.get());
+ } else {
+ next = NodeTraversal::next(node.get());
+ }
+ if (node->isHTMLElement() && nodeFullySelected(node.get(), start, end)) {
+ RefPtr<HTMLElement> elem = toHTMLElement(node.get());
RefPtr<Node> prev = NodeTraversal::previousPostOrder(elem.get());
RefPtr<Node> next = NodeTraversal::next(elem.get());
RefPtr<EditingStyle> styleToPushDown;
@@ -1141,7 +1142,7 @@ void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
}
if (node == end.deprecatedNode())
break;
- node = next.get();
+ node = next;
}
updateStartEnd(s, e);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698