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

Unified Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 2135993003: Add null check to fix crash in blink::ComputedStyle::display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use of the short form for running the insertHTML command Created 4 years, 5 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
Index: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index 2e6cbfa271035e812a5830f1702a98365fe032e6..0c3d434bcfce5bd72d11d30cf468a575b0d960ce 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -800,8 +800,8 @@ static bool followBlockElementStyle(const Node* node)
return false;
const HTMLElement& element = toHTMLElement(*node);
- return element.computedStyle()->display() == LIST_ITEM
- || element.computedStyle()->display() == TABLE_CELL
+ return isListItem(node)
+ || isTableCell(node)
|| element.hasTagName(preTag)
|| element.hasTagName(h1Tag)
|| element.hasTagName(h2Tag)
@@ -831,7 +831,7 @@ static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const
// |node| can be an inline element like <br> under <li>
// e.g.) editing/execCommand/switch-list-type.html
// editing/deleting/backspace-merge-into-block.html
- if (node->computedStyle()->display() == INLINE) {
+ if (isInline(node)) {
node = enclosingBlock(insertionPos.anchorNode());
if (!node)
return false;

Powered by Google App Engine
This is Rietveld 408576698