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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1111 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
1112 } | 1112 } |
1113 } | 1113 } |
1114 | 1114 |
1115 static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme
nt* element, unsigned rulesToInclude) | 1115 static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme
nt* element, unsigned rulesToInclude) |
1116 { | 1116 { |
1117 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 1117 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); |
1118 RefPtr<StyleRuleList> matchedRules = element->document().ensureStyleResolver
().styleRulesForElement(element, rulesToInclude); | 1118 RefPtr<StyleRuleList> matchedRules = element->document().ensureStyleResolver
().styleRulesForElement(element, rulesToInclude); |
1119 if (matchedRules) { | 1119 if (matchedRules) { |
1120 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) | 1120 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) |
1121 style->mergeAndOverrideOnConflict(matchedRules->m_list[i]->propertie
s()); | 1121 style->mergeAndOverrideOnConflict(&matchedRules->m_list[i]->properti
es()); |
1122 } | 1122 } |
1123 return style.release(); | 1123 return style.release(); |
1124 } | 1124 } |
1125 | 1125 |
1126 void EditingStyle::mergeStyleFromRules(Element* element) | 1126 void EditingStyle::mergeStyleFromRules(Element* element) |
1127 { | 1127 { |
1128 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, | 1128 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, |
1129 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); | 1129 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); |
1130 // Styles from the inline style declaration, held in the variable "style", t
ake precedence | 1130 // Styles from the inline style declaration, held in the variable "style", t
ake precedence |
1131 // over those from matched rules. | 1131 // over those from matched rules. |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 { | 1632 { |
1633 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1633 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1634 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1634 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1635 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1635 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1636 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1636 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1637 } | 1637 } |
1638 return nullptr; | 1638 return nullptr; |
1639 } | 1639 } |
1640 | 1640 |
1641 } | 1641 } |
OLD | NEW |