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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1129 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
1130 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1130 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
1131 } | 1131 } |
1132 } | 1132 } |
1133 | 1133 |
1134 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRulesForE
lement(Element* element, unsigned rulesToInclude) | 1134 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRulesForE
lement(Element* element, unsigned rulesToInclude) |
1135 { | 1135 { |
1136 RefPtrWillBeRawPtr<MutableStylePropertySet> style = MutableStylePropertySet:
:create(); | 1136 RefPtrWillBeRawPtr<MutableStylePropertySet> style = MutableStylePropertySet:
:create(); |
1137 RefPtrWillBeRawPtr<StyleRuleList> matchedRules = element->document().ensureS
tyleResolver().styleRulesForElement(element, rulesToInclude); | 1137 RefPtrWillBeRawPtr<StyleRuleList> matchedRules = element->document().ensureS
tyleResolver().styleRulesForElement(element, rulesToInclude); |
1138 if (matchedRules) { | 1138 if (matchedRules) { |
1139 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) | 1139 for (unsigned i = 0; i < matchedRules->size(); ++i) |
1140 style->mergeAndOverrideOnConflict(&matchedRules->m_list[i]->properti
es()); | 1140 style->mergeAndOverrideOnConflict(&matchedRules->at(i)->properties()
); |
1141 } | 1141 } |
1142 return style.release(); | 1142 return style.release(); |
1143 } | 1143 } |
1144 | 1144 |
1145 void EditingStyle::mergeStyleFromRules(Element* element) | 1145 void EditingStyle::mergeStyleFromRules(Element* element) |
1146 { | 1146 { |
1147 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, | 1147 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, |
1148 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); | 1148 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); |
1149 // Styles from the inline style declaration, held in the variable "style", t
ake precedence | 1149 // Styles from the inline style declaration, held in the variable "style", t
ake precedence |
1150 // over those from matched rules. | 1150 // over those from matched rules. |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 { | 1678 { |
1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1683 } | 1683 } |
1684 return nullptr; | 1684 return nullptr; |
1685 } | 1685 } |
1686 | 1686 |
1687 } | 1687 } |
OLD | NEW |