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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 1162583002: Use begin/end istead of first/last for rule ranges. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index e5bb8a6b610b856fb63e4a73b7fcc483eac120e9..cd92129074c444eb8fe27fd60411c7dab5b8b7a6 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -655,13 +655,13 @@ PassRefPtr<ComputedStyle> StyleResolver::styleForKeyframe(Element& element, cons
// relevant one is animation-timing-function and we special-case that in
// CSSAnimations.cpp
bool inheritedOnly = false;
- applyMatchedProperties<HighPropertyPriority>(state, result, false, result.firstRule(), result.lastRule(), inheritedOnly);
+ applyMatchedProperties<HighPropertyPriority>(state, result, false, result.begin(), result.end(), inheritedOnly);
// If our font got dirtied, go ahead and update it now.
updateFont(state);
// Now do rest of the properties.
- applyMatchedProperties<LowPropertyPriority>(state, result, false, result.firstRule(), result.lastRule(), inheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, result, false, result.begin(), result.end(), inheritedOnly);
loadPendingResources(state);
@@ -850,12 +850,12 @@ PassRefPtr<ComputedStyle> StyleResolver::styleForPage(int pageIndex)
bool inheritedOnly = false;
const MatchResult& result = collector.matchedResult();
- applyMatchedProperties<HighPropertyPriority>(state, result, false, result.firstRule(), result.lastRule(), inheritedOnly);
+ applyMatchedProperties<HighPropertyPriority>(state, result, false, result.begin(), result.end(), inheritedOnly);
// If our font got dirtied, go ahead and update it now.
updateFont(state);
- applyMatchedProperties<LowPropertyPriority>(state, result, false, result.firstRule(), result.lastRule(), inheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, result, false, result.begin(), result.end(), inheritedOnly);
loadPendingResources(state);
@@ -1253,15 +1253,15 @@ void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
}
template <CSSPropertyPriority priority>
-void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inheritedOnly)
+void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult, bool isImportant, unsigned startIndex, unsigned endIndex, bool inheritedOnly)
{
- if (startIndex == -1)
+ if (startIndex == endIndex)
return;
- ASSERT(startIndex >= 0 && endIndex < static_cast<int>(matchResult.matchedProperties.size()));
+ ASSERT_WITH_SECURITY_IMPLICATION(endIndex <= matchResult.matchedProperties.size());
if (state.style()->insideLink() != NotInsideLink) {
- for (int i = startIndex; i <= endIndex; ++i) {
+ for (unsigned i = startIndex; i < endIndex; ++i) {
const MatchedProperties& matchedProperties = matchResult.matchedProperties[i];
unsigned linkMatchType = matchedProperties.m_types.linkMatchType;
// FIXME: It would be nicer to pass these as arguments but that requires changes in many places.
@@ -1274,7 +1274,7 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
state.setApplyPropertyToVisitedLinkStyle(false);
return;
}
- for (int i = startIndex; i <= endIndex; ++i) {
+ for (unsigned i = startIndex; i < endIndex; ++i) {
const MatchedProperties& matchedProperties = matchResult.matchedProperties[i];
applyProperties<priority>(state, matchedProperties.properties.get(), isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(matchedProperties.m_types.whitelistType));
}
@@ -1336,9 +1336,9 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
// high-priority properties first, i.e., those properties that other properties depend on.
// The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
// and (4) normal important.
- applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matchResult.firstRule(), matchResult.lastRule(), applyInheritedOnly);
- applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, matchResult.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly);
- applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, matchResult.firstUARule(), matchResult.lastUARule(), applyInheritedOnly);
+ applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matchResult.begin(), matchResult.end(), applyInheritedOnly);
+ applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly);
+ applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, matchResult.beginUA(), matchResult.endUA(), applyInheritedOnly);
if (UNLIKELY(isSVGForeignObjectElement(element))) {
// LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignObject content should not be scaled again.
@@ -1364,15 +1364,15 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
applyInheritedOnly = false;
// Now do the normal priority UA properties.
- applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.firstUARule(), matchResult.lastUARule(), applyInheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.beginUA(), matchResult.endUA(), applyInheritedOnly);
// Cache the UA properties to pass them to LayoutTheme in adjustComputedStyle.
state.cacheUserAgentBorderAndBackground();
// Now do the author and user normal priority properties and all the !important properties.
- applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly);
- applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.firstAuthorRule(), matchResult.lastAuthorRule(), applyInheritedOnly);
- applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.firstUARule(), matchResult.lastUARule(), applyInheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly);
+ applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.beginUA(), matchResult.endUA(), applyInheritedOnly);
loadPendingResources(state);
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698