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

Side by Side 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: Move default template to right place 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 unified diff | Download patch
OLDNEW
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
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 const EphemeralRange caretRange(position.parentAnchoredEquivalent(), end .parentAnchoredEquivalent());
1404 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { 1404 for (Node& n : caretRange.nodes()) {
1405 if (!n->isStyledElement()) 1405 if (!n.isStyledElement())
1406 continue; 1406 continue;
1407 1407
1408 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr eate(n); 1408 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr eate(&n);
1409 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSProperty UnicodeBidi); 1409 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSProperty UnicodeBidi);
1410 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) 1410 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
1411 continue; 1411 continue;
1412 1412
1413 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV alueID(); 1413 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV alueID();
1414 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) 1414 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue))
1415 return NaturalWritingDirection; 1415 return NaturalWritingDirection;
1416 } 1416 }
1417 } 1417 }
1418 1418
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 { 1757 {
1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor); 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor);
1760 if (!hasTransparentBackgroundColor(ancestorStyle)) 1760 if (!hasTransparentBackgroundColor(ancestorStyle))
1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1762 } 1762 }
1763 return nullptr; 1763 return nullptr;
1764 } 1764 }
1765 1765
1766 } // namespace blink 1766 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversal.h ('k') | third_party/WebKit/Source/core/editing/EphemeralRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698