Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. | 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. |
| 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 | 1393 |
| 1394 Node* node = position.anchorNode(); | 1394 Node* node = position.anchorNode(); |
| 1395 if (!node) | 1395 if (!node) |
| 1396 return NaturalWritingDirection; | 1396 return NaturalWritingDirection; |
| 1397 | 1397 |
| 1398 Position end; | 1398 Position end; |
| 1399 if (selection.isRange()) { | 1399 if (selection.isRange()) { |
| 1400 end = mostBackwardCaretPosition(selection.end()); | 1400 end = mostBackwardCaretPosition(selection.end()); |
| 1401 | 1401 |
| 1402 DCHECK(end.document()); | 1402 DCHECK(end.document()); |
| 1403 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); | 1403 for (Node& n : inRange(position.parentAnchoredEquivalent(), end.parentAn choredEquivalent())) { |
|
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
| |
| 1404 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { | 1404 if (!n.isStyledElement()) |
|
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.
| |
| 1405 if (!n->isStyledElement()) | |
| 1406 continue; | 1405 continue; |
| 1407 | 1406 |
| 1408 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr eate(n); | 1407 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr eate(&n); |
| 1409 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSProperty UnicodeBidi); | 1408 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSProperty UnicodeBidi); |
| 1410 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1409 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
| 1411 continue; | 1410 continue; |
| 1412 | 1411 |
| 1413 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV alueID(); | 1412 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV alueID(); |
| 1414 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) | 1413 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) |
| 1415 return NaturalWritingDirection; | 1414 return NaturalWritingDirection; |
| 1416 } | 1415 } |
| 1417 } | 1416 } |
| 1418 | 1417 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1757 { | 1756 { |
| 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1757 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor); | 1758 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor); |
| 1760 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1759 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); | 1760 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); |
| 1762 } | 1761 } |
| 1763 return nullptr; | 1762 return nullptr; |
| 1764 } | 1763 } |
| 1765 | 1764 |
| 1766 } // namespace blink | 1765 } // namespace blink |
| OLD | NEW |