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

Side by Side Diff: Source/core/editing/EditingStyle.cpp

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.cpp ('k') | Source/core/editing/Editor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const 705 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
706 { 706 {
707 if (!selection.isCaretOrRange()) 707 if (!selection.isCaretOrRange())
708 return FalseTriState; 708 return FalseTriState;
709 709
710 if (selection.isCaret()) 710 if (selection.isCaret())
711 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge t()); 711 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge t());
712 712
713 TriState state = FalseTriState; 713 TriState state = FalseTriState;
714 bool nodeIsStart = true; 714 bool nodeIsStart = true;
715 for (Node* node = selection.start().deprecatedNode(); node; node = NodeTrave rsal::next(node)) { 715 for (Node* node = selection.start().deprecatedNode(); node; node = NodeTrave rsal::next(*node)) {
716 if (node->renderer() && node->rendererIsEditable()) { 716 if (node->renderer() && node->rendererIsEditable()) {
717 RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDecl aration::create(node); 717 RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDecl aration::create(node);
718 if (nodeStyle) { 718 if (nodeStyle) {
719 TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTe xtNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTex tOnlyProperties); 719 TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTe xtNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTex tOnlyProperties);
720 if (nodeIsStart) { 720 if (nodeIsStart) {
721 state = nodeState; 721 state = nodeState;
722 nodeIsStart = false; 722 nodeIsStart = false;
723 } else if (state != nodeState && node->isTextNode()) { 723 } else if (state != nodeState && node->isTextNode()) {
724 state = MixedTriState; 724 state = MixedTriState;
725 break; 725 break;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 Node* node = position.deprecatedNode(); 1293 Node* node = position.deprecatedNode();
1294 if (!node) 1294 if (!node)
1295 return NaturalWritingDirection; 1295 return NaturalWritingDirection;
1296 1296
1297 Position end; 1297 Position end;
1298 if (selection.isRange()) { 1298 if (selection.isRange()) {
1299 end = selection.end().upstream(); 1299 end = selection.end().upstream();
1300 1300
1301 ASSERT(end.document()); 1301 ASSERT(end.document());
1302 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); 1302 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE quivalent(), end.parentAnchoredEquivalent())->pastLastNode();
1303 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(n)) { 1303 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) {
1304 if (!n->isStyledElement()) 1304 if (!n->isStyledElement())
1305 continue; 1305 continue;
1306 1306
1307 RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclarat ion::create(n); 1307 RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclarat ion::create(n);
1308 RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropert yUnicodeBidi); 1308 RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropert yUnicodeBidi);
1309 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) 1309 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
1310 continue; 1310 continue;
1311 1311
1312 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get()) ->getValueID(); 1312 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get()) ->getValueID();
1313 if (unicodeBidiValue == CSSValueEmbed || unicodeBidiValue == CSSValu eBidiOverride) 1313 if (unicodeBidiValue == CSSValueEmbed || unicodeBidiValue == CSSValu eBidiOverride)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 { 1650 {
1651 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1651 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1652 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor); 1652 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor);
1653 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1653 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1654 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1654 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1655 } 1655 }
1656 return 0; 1656 return 0;
1657 } 1657 }
1658 1658
1659 } 1659 }
OLDNEW
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.cpp ('k') | Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698