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

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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 1 month 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 | Annotate | Revision Log
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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1126 }
1127 1127
1128 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) 1128 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value))
1129 m_mutableStyle->setProperty(property.id(), property.value()->cssText (), property.isImportant()); 1129 m_mutableStyle->setProperty(property.id(), property.value()->cssText (), property.isImportant());
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme nt* element, unsigned rulesToInclude) 1133 static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme nt* element, unsigned rulesToInclude)
1134 { 1134 {
1135 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); 1135 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create();
1136 RefPtr<StyleRuleList> matchedRules = element->document().styleResolver()->st yleRulesForElement(element, rulesToInclude); 1136 StyleResolver* styleResolver = element->document().styleResolver();
1137 appendPendingStyleSheetsIfNeeded(styleResolver);
1138 RefPtr<StyleRuleList> matchedRules = styleResolver->styleRulesForElement(ele ment, rulesToInclude);
1137 if (matchedRules) { 1139 if (matchedRules) {
1138 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) 1140 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i)
1139 style->mergeAndOverrideOnConflict(matchedRules->m_list[i]->propertie s()); 1141 style->mergeAndOverrideOnConflict(matchedRules->m_list[i]->propertie s());
1140 } 1142 }
1141 return style.release(); 1143 return style.release();
1142 } 1144 }
1143 1145
1144 void EditingStyle::mergeStyleFromRules(Element* element) 1146 void EditingStyle::mergeStyleFromRules(Element* element)
1145 { 1147 {
1146 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule sForElement(element, 1148 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule sForElement(element,
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 { 1652 {
1651 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1653 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1652 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor); 1654 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor);
1653 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1655 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1654 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1656 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1655 } 1657 }
1656 return 0; 1658 return 0;
1657 } 1659 }
1658 1660
1659 } 1661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698