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

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

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 Rebase Created 5 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
« no previous file with comments | « no previous file | Source/core/editing/EditingUtilities.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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 return style; 1346 return style;
1347 } 1347 }
1348 1348
1349 WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection& selection, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings) 1349 WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection& selection, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings)
1350 { 1350 {
1351 hasNestedOrMultipleEmbeddings = true; 1351 hasNestedOrMultipleEmbeddings = true;
1352 1352
1353 if (selection.isNone()) 1353 if (selection.isNone())
1354 return NaturalWritingDirection; 1354 return NaturalWritingDirection;
1355 1355
1356 Position position = selection.start().downstream(); 1356 Position position = mostForwardCaretPosition(selection.start());
1357 1357
1358 Node* node = position.anchorNode(); 1358 Node* node = position.anchorNode();
1359 if (!node) 1359 if (!node)
1360 return NaturalWritingDirection; 1360 return NaturalWritingDirection;
1361 1361
1362 Position end; 1362 Position end;
1363 if (selection.isRange()) { 1363 if (selection.isRange()) {
1364 end = selection.end().upstream(); 1364 end = mostBackwardCaretPosition(selection.end());
1365 1365
1366 ASSERT(end.document()); 1366 ASSERT(end.document());
1367 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); 1367 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE quivalent(), end.parentAnchoredEquivalent())->pastLastNode();
1368 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { 1368 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) {
1369 if (!n->isStyledElement()) 1369 if (!n->isStyledElement())
1370 continue; 1370 continue;
1371 1371
1372 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedS tyleDeclaration::create(n); 1372 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedS tyleDeclaration::create(n);
1373 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValu e(CSSPropertyUnicodeBidi); 1373 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValu e(CSSPropertyUnicodeBidi);
1374 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) 1374 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 { 1718 {
1719 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1719 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1720 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); 1720 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor);
1721 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1721 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1722 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1722 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1723 } 1723 }
1724 return nullptr; 1724 return nullptr;
1725 } 1725 }
1726 1726
1727 } 1727 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/EditingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698