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

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

Issue 651303003: Splitting text can leave |start| and |end| Positions without renderers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 2 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 | « LayoutTests/platform/linux/editing/apply-inline-style-to-element-with-no-renderer-crash-expected.txt ('k') | 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 d85ecf489f3bbf09b591dfc237b91521935a775f..6e9bdf1523b7a2ce510ad339078aad8be8ce0fce 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -583,6 +583,8 @@ void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
splitTextAtStart(start, end);
start = startPosition();
end = endPosition();
+ if (start.isNull() || end.isNull())
+ return;
startDummySpanAncestor = dummySpanAncestorForNode(start.deprecatedNode());
}
@@ -595,6 +597,8 @@ void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
splitTextAtEnd(start, end);
start = startPosition();
end = endPosition();
+ if (start.isNull() || end.isNull())
+ return;
endDummySpanAncestor = dummySpanAncestorForNode(end.deprecatedNode());
}
@@ -1265,6 +1269,8 @@ bool ApplyStyleCommand::shouldSplitTextElement(Element* element, EditingStyle* s
bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position)
{
+ ASSERT(position.isNotNull());
+
Node* node = position.containerNode();
if (position.anchorType() != Position::PositionIsOffsetInAnchor || !node->isTextNode())
return false;
« no previous file with comments | « LayoutTests/platform/linux/editing/apply-inline-style-to-element-with-no-renderer-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698