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

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

Issue 2251703002: Introduce EphemeralRange::nodes() helper to traverse over a range. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/EditingStyle.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
index 163cbfb17e46d3197edc3447aae00c755f919209..97eafe7b080c205cda674070257641a30292078f 100644
--- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -1400,12 +1400,11 @@ WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
end = mostBackwardCaretPosition(selection.end());
DCHECK(end.document());
- Node* pastLast = Range::create(*end.document(), position.parentAnchoredEquivalent(), end.parentAnchoredEquivalent())->pastLastNode();
Andrey Kraynov 2016/08/16 10:02:11 This is an example how we can avoid creating Range
yosin_UTC9 2016/08/17 01:45:31 ACK We should avoid to use |Position::compouteCon
- for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) {
Andrey Kraynov 2016/08/16 10:02:11 I have a question about check |n && n != pastLast|
yosin_UTC9 2016/08/17 01:45:31 Please add |DCHECK(n)| just in case. |n| should no
Andrey Kraynov 2016/08/17 09:58:15 Done.
- if (!n->isStyledElement())
+ for (Node& n : inRange(position.parentAnchoredEquivalent(), end.parentAnchoredEquivalent())) {
+ if (!n.isStyledElement())
continue;
- CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::create(n);
+ CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::create(&n);
const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnicodeBidi);
if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
continue;

Powered by Google App Engine
This is Rietveld 408576698