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

Unified Diff: Source/core/editing/VisibleUnits.cpp

Issue 95493004: Editing - Code refactoring to avoid several calls to rendererIsEditable() in loop (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bgColorIssue
Patch Set: Renaming to startNodeIsEditable Created 7 years 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: Source/core/editing/VisibleUnits.cpp
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
index 600242cd26b837263d61518265d3375ef641610c..1f39b48d9d9bc44bf89374b07bfa8b4bac500915 100644
--- a/Source/core/editing/VisibleUnits.cpp
+++ b/Source/core/editing/VisibleUnits.cpp
@@ -1110,11 +1110,12 @@ VisiblePosition startOfParagraph(const VisiblePosition& c, EditingBoundaryCrossi
Position::AnchorType type = p.anchorType();
Node* n = startNode;
+ bool startNodeIsEditable = startNode->rendererIsEditable();
while (n) {
- if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNodeIsEditable)
break;
if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
- while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
+ while (n && n->rendererIsEditable() != startNodeIsEditable)
n = NodeTraversal::previousPostOrder(*n, startBlock);
if (!n || !n->isDescendantOf(highestRoot))
break;
@@ -1187,11 +1188,12 @@ VisiblePosition endOfParagraph(const VisiblePosition &c, EditingBoundaryCrossing
Position::AnchorType type = p.anchorType();
Node* n = startNode;
+ bool startNodeIsEditable = startNode->rendererIsEditable();
while (n) {
- if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNodeIsEditable)
break;
if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
- while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
+ while (n && n->rendererIsEditable() != startNodeIsEditable)
n = NodeTraversal::next(*n, stayInsideBlock);
if (!n || !n->isDescendantOf(highestRoot))
break;
« 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