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

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

Issue 1314713004: Make EditingStyle to use VisibleSelection::toNormalizedEphemeralRange() instead of toNormalizedRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T15:32:50 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 | no next file » | 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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 if (!element) 1331 if (!element)
1332 return nullptr; 1332 return nullptr;
1333 1333
1334 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(element, Editi ngStyle::AllProperties); 1334 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(element, Editi ngStyle::AllProperties);
1335 style->mergeTypingStyle(&element->document()); 1335 style->mergeTypingStyle(&element->document());
1336 1336
1337 // If background color is transparent, traverse parent nodes until we hit a different value or document root 1337 // If background color is transparent, traverse parent nodes until we hit a different value or document root
1338 // Also, if the selection is a range, ignore the background color at the sta rt of selection, 1338 // Also, if the selection is a range, ignore the background color at the sta rt of selection,
1339 // and find the background color of the common ancestor. 1339 // and find the background color of the common ancestor.
1340 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare ntBackgroundColor(style->m_mutableStyle.get()))) { 1340 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare ntBackgroundColor(style->m_mutableStyle.get()))) {
1341 RefPtrWillBeRawPtr<Range> range(selection.toNormalizedRange()); 1341 const EphemeralRange range(selection.toNormalizedEphemeralRange());
1342 if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(ran ge->commonAncestorContainer())) 1342 if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(Ran ge::commonAncestorContainer(range.startPosition().computeContainerNode(), range. endPosition().computeContainerNode())))
1343 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); 1343 style->setProperty(CSSPropertyBackgroundColor, value->cssText());
1344 } 1344 }
1345 1345
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
(...skipping 365 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698