| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 | 142 |
| 143 // If background color is transparent, traverse parent nodes until we hit a | 143 // If background color is transparent, traverse parent nodes until we hit a |
| 144 // different value or document root Also, if the selection is a range, ignore | 144 // different value or document root Also, if the selection is a range, ignore |
| 145 // the background color at the start of selection, and find the background | 145 // the background color at the start of selection, and find the background |
| 146 // color of the common ancestor. | 146 // color of the common ancestor. |
| 147 if (shouldUseBackgroundColorInEffect && | 147 if (shouldUseBackgroundColorInEffect && |
| 148 (selection.isRange() || hasTransparentBackgroundColor(style->style()))) { | 148 (selection.isRange() || hasTransparentBackgroundColor(style->style()))) { |
| 149 const EphemeralRange range(selection.toNormalizedEphemeralRange()); | 149 const EphemeralRange range(selection.toNormalizedEphemeralRange()); |
| 150 if (const CSSValue* value = | 150 if (const CSSValue* value = |
| 151 backgroundColorValueInEffect(Range::commonAncestorContainer( | 151 backgroundColorValueInEffect(range.commonAncestorContainer())) |
| 152 range.startPosition().computeContainerNode(), | |
| 153 range.endPosition().computeContainerNode()))) | |
| 154 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); | 152 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); |
| 155 } | 153 } |
| 156 | 154 |
| 157 return style; | 155 return style; |
| 158 } | 156 } |
| 159 | 157 |
| 160 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) { | 158 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) { |
| 161 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride || | 159 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride || |
| 162 valueID == CSSValueWebkitIsolate || | 160 valueID == CSSValueWebkitIsolate || |
| 163 valueID == CSSValueWebkitIsolateOverride || | 161 valueID == CSSValueWebkitIsolateOverride || |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 295 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 298 CSSComputedStyleDeclaration* ancestorStyle = | 296 CSSComputedStyleDeclaration* ancestorStyle = |
| 299 CSSComputedStyleDeclaration::create(ancestor); | 297 CSSComputedStyleDeclaration::create(ancestor); |
| 300 if (!hasTransparentBackgroundColor(ancestorStyle)) | 298 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 301 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); | 299 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); |
| 302 } | 300 } |
| 303 return nullptr; | 301 return nullptr; |
| 304 } | 302 } |
| 305 | 303 |
| 306 } // namespace blink | 304 } // namespace blink |
| OLD | NEW |