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

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

Issue 2741173002: Reduce canonicalization when dragging (Closed)
Patch Set: update Created 3 years, 9 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 | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | 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/SelectionEditor.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
index 14f7509c4de98e7fd4807ce221e35998cc3d7757..5624733f5cd04e17b5801f9c40ccfbc052d27265 100644
--- a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
@@ -371,15 +371,19 @@ void SelectionEditor::updateCachedVisibleSelectionIfNeeded() const {
return;
m_cachedVisibleSelectionInDOMTree = createVisibleSelection(m_selection);
- m_cachedVisibleSelectionInFlatTree = createVisibleSelection(
- SelectionInFlatTree::Builder()
- .setBaseAndExtent(toPositionInFlatTree(m_selection.base()),
- toPositionInFlatTree(m_selection.extent()))
- .setAffinity(m_selection.affinity())
- .setHasTrailingWhitespace(m_selection.hasTrailingWhitespace())
- .setGranularity(m_selection.granularity())
- .setIsDirectional(m_selection.isDirectional())
- .build());
+ if (m_cachedVisibleSelectionInDOMTree.isNone()) {
+ m_cachedVisibleSelectionInFlatTree = VisibleSelectionInFlatTree();
+ } else {
+ m_cachedVisibleSelectionInFlatTree = createVisibleSelection(
+ SelectionInFlatTree::Builder()
+ .setBaseAndExtent(toPositionInFlatTree(m_selection.base()),
+ toPositionInFlatTree(m_selection.extent()))
+ .setAffinity(m_selection.affinity())
+ .setHasTrailingWhitespace(m_selection.hasTrailingWhitespace())
+ .setGranularity(m_selection.granularity())
+ .setIsDirectional(m_selection.isDirectional())
+ .build());
+ }
m_styleVersion = document().styleVersion();
yosin_UTC9 2017/03/16 06:39:18 Could you move L387 and L388 to L373 and make L374
yoichio 2017/03/16 06:56:40 Done.
m_cacheIsDirty = false;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698