| 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 return 0; | 1236 return 0; |
| 1237 | 1237 |
| 1238 RefPtr<EditingStyle> style = EditingStyle::create(element, EditingStyle::All
Properties); | 1238 RefPtr<EditingStyle> style = EditingStyle::create(element, EditingStyle::All
Properties); |
| 1239 style->mergeTypingStyle(element->document()); | 1239 style->mergeTypingStyle(element->document()); |
| 1240 | 1240 |
| 1241 // If background color is transparent, traverse parent nodes until we hit a
different value or document root | 1241 // If background color is transparent, traverse parent nodes until we hit a
different value or document root |
| 1242 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, | 1242 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, |
| 1243 // and find the background color of the common ancestor. | 1243 // and find the background color of the common ancestor. |
| 1244 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { | 1244 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { |
| 1245 RefPtr<Range> range(selection.toNormalizedRange()); | 1245 RefPtr<Range> range(selection.toNormalizedRange()); |
| 1246 if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAn
cestorContainer(IGNORE_EXCEPTION_STATE))) | 1246 if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAn
cestorContainer(IGNORE_EXCEPTION))) |
| 1247 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); | 1247 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 return style; | 1250 return style; |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
selection, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings) | 1253 WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
selection, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings) |
| 1254 { | 1254 { |
| 1255 hasNestedOrMultipleEmbeddings = true; | 1255 hasNestedOrMultipleEmbeddings = true; |
| 1256 | 1256 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 { | 1621 { |
| 1622 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1622 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1623 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1623 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
| 1624 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1624 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1625 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1625 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1626 } | 1626 } |
| 1627 return 0; | 1627 return 0; |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 } | 1630 } |
| OLD | NEW |