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

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
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()) {
yosin_UTC9 2017/03/16 02:30:05 Good catch! Please move this shortcut in another
yoichio 2017/03/16 04:10:59 This is core of this CL and needs for performance
+ 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();
m_cacheIsDirty = false;
}

Powered by Google App Engine
This is Rietveld 408576698