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

Unified Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2530753002: Ensure active document for hasEditableLevel (Closed)
Patch Set: Created 4 years, 1 month 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/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index c60529f6442a21faa144533b8a4f3d4ffc73941d..60ef9c2598a6be301ff403ab218034e448a039c1 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -272,8 +272,10 @@ int comparePositions(const VisiblePosition& a, const VisiblePosition& b) {
enum EditableLevel { Editable, RichlyEditable };
static bool hasEditableLevel(const Node& node, EditableLevel editableLevel) {
- // TODO(yoichio): We should have this check.
- // DCHECK(!needsLayoutTreeUpdate(node));
+ DCHECK(node.document().isActive());
+ // TODO(editing-dev): We should have this check:
+ // DCHECK_GE(node.document().lifecycle().state(),
+ // DocumentLifecycle::StyleClean);
if (node.isPseudoElement())
return false;
@@ -301,10 +303,24 @@ static bool hasEditableLevel(const Node& node, EditableLevel editableLevel) {
}
bool hasEditableStyle(const Node& node) {
+ // TODO(editing-dev): We shouldn't check editable style in inactive documents.
+ // We should hoist this check in the call stack, replace it by a DCHECK of
+ // active document and ultimately cleanup the code paths with inactive
+ // documents. See crbug.com/667681
+ if (!node.document().isActive())
+ return false;
+
return hasEditableLevel(node, Editable);
}
bool hasRichlyEditableStyle(const Node& node) {
+ // TODO(editing-dev): We shouldn't check editable style in inactive documents.
+ // We should hoist this check in the call stack, replace it by a DCHECK of
+ // active document and ultimately cleanup the code paths with inactive
+ // documents. See crbug.com/667681
+ if (!node.document().isActive())
+ return false;
+
return hasEditableLevel(node, RichlyEditable);
}
« 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