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

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

Issue 2330963002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in VisiblePositionTemplate::create (Closed)
Patch Set: Created 4 years, 3 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/VisiblePosition.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisiblePosition.cpp b/third_party/WebKit/Source/core/editing/VisiblePosition.cpp
index efe277be9972a9c7953cca7536689b38654a22b8..0a1e0b021db3acc4760e51da963cd9eef17918e8 100644
--- a/third_party/WebKit/Source/core/editing/VisiblePosition.cpp
+++ b/third_party/WebKit/Source/core/editing/VisiblePosition.cpp
@@ -62,11 +62,7 @@ VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::create(cons
DCHECK(positionWithAffinity.position().isConnected()) << positionWithAffinity;
Document& document = *positionWithAffinity.position().document();
-
- // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
- // needs to be audited. See http://crbug.com/590369 for more details.
- document.updateStyleAndLayoutIgnorePendingStylesheets();
-
+ DCHECK(!document.needsLayoutTreeUpdate());
yosin_UTC9 2016/09/13 02:25:32 Good job! I've never thought we can do this.
DocumentLifecycle::DisallowTransitionScope disallowTransition(document.lifecycle());
const PositionTemplate<Strategy> deepPosition = canonicalPositionOf(positionWithAffinity.position());
@@ -87,36 +83,64 @@ VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::create(cons
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::afterNode(Node* node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (node)
+ node->document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::afterNode(node)));
}
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::beforeNode(Node* node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (node)
+ node->document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::beforeNode(node)));
}
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::firstPositionInNode(Node* node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (node)
+ node->document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::firstPositionInNode(node)));
}
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::inParentAfterNode(const Node& node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ node.document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::inParentAfterNode(node)));
}
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::inParentBeforeNode(const Node& node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ node.document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::inParentBeforeNode(node)));
}
template <typename Strategy>
VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::lastPositionInNode(Node* node)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (node)
+ node->document().updateStyleAndLayoutIgnorePendingStylesheets();
+
return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strategy>::lastPositionInNode(node)));
}
@@ -127,6 +151,11 @@ VisiblePosition createVisiblePosition(const Position& position, TextAffinity aff
VisiblePosition createVisiblePosition(const PositionWithAffinity& positionWithAffinity)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (positionWithAffinity.isNotNull())
+ positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
return VisiblePosition::create(positionWithAffinity);
}
@@ -137,6 +166,11 @@ VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTree& positi
VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTreeWithAffinity& positionWithAffinity)
{
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ if (positionWithAffinity.isNotNull())
+ positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
return VisiblePositionInFlatTree::create(positionWithAffinity);
}
« 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