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

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: 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
« 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: 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..ca6467be27552fa88fcc9491c38f31fa0744100c 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -794,14 +794,28 @@ static void removeHeadContents(ReplacementFragment& fragment)
}
}
+static bool isListItemStyle(const HTMLElement& element)
yosin_UTC9 2016/07/12 01:30:36 Can make |isListItem()| in "EditingUtilitis.h" to
joone 2016/07/12 23:08:54 Done.
+{
+ if (element.computedStyle() && element.computedStyle()->display() == LIST_ITEM)
yosin_UTC9 2016/07/12 01:30:36 nit: We should avoid to use |return true| with |re
joone 2016/07/12 23:08:54 Done.
+ return true;
+ return false;
+}
+
+static bool isTableCellStyle(const HTMLElement& element)
yosin_UTC9 2016/07/12 01:30:36 Can make |isTableCell()| in "EditingUtilitis.h" to
joone 2016/07/12 23:08:54 Done.
+{
+ if (element.computedStyle() && element.computedStyle()->display() == TABLE_CELL)
yosin_UTC9 2016/07/12 01:30:36 nit: We should avoid to use |return true| with |re
joone 2016/07/12 23:08:54 Done.
+ return true;
+ return false;
+}
+
static bool followBlockElementStyle(const Node* node)
{
if (!node->isHTMLElement())
return false;
yosin_UTC9 2016/07/12 01:30:36 I think computedStyle() should not be return nullp
joone 2016/07/12 23:08:54 We can use isInline() function defined in EditingU
const HTMLElement& element = toHTMLElement(*node);
- return element.computedStyle()->display() == LIST_ITEM
- || element.computedStyle()->display() == TABLE_CELL
+ return isListItemStyle(element)
+ || isTableCellStyle(element)
|| element.hasTagName(preTag)
|| element.hasTagName(h1Tag)
|| element.hasTagName(h2Tag)
« 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