Chromium Code Reviews| 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; |