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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 2044023005: Make PropertyReference value() return a const CSSValue& (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_remove_style_property_set_mutable_overload
Patch Set: Rebase Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bool ruleSetsCustomProperty = false; 110 bool ruleSetsCustomProperty = false;
111 if (!state.style()->variables()) 111 if (!state.style()->variables())
112 return false; 112 return false;
113 for (const auto& matchedProperties : range) { 113 for (const auto& matchedProperties : range) {
114 const StylePropertySet& properties = *matchedProperties.properties; 114 const StylePropertySet& properties = *matchedProperties.properties;
115 unsigned propertyCount = properties.propertyCount(); 115 unsigned propertyCount = properties.propertyCount();
116 for (unsigned i = 0; i < propertyCount; ++i) { 116 for (unsigned i = 0; i < propertyCount; ++i) {
117 StylePropertySet::PropertyReference current = properties.propertyAt( i); 117 StylePropertySet::PropertyReference current = properties.propertyAt( i);
118 if (current.id() != CSSPropertyApplyAtRule) 118 if (current.id() != CSSPropertyApplyAtRule)
119 continue; 119 continue;
120 AtomicString name(toCSSCustomIdentValue(current.value())->value()); 120 AtomicString name(toCSSCustomIdentValue(current.value()).value());
121 CSSVariableData* variableData = state.style()->variables()->getVaria ble(name); 121 CSSVariableData* variableData = state.style()->variables()->getVaria ble(name);
122 if (!variableData) 122 if (!variableData)
123 continue; 123 continue;
124 StylePropertySet* customPropertySet = variableData->propertySet(); 124 StylePropertySet* customPropertySet = variableData->propertySet();
125 if (!customPropertySet) 125 if (!customPropertySet)
126 continue; 126 continue;
127 if (customPropertySet->findPropertyIndex(CSSPropertyVariable) != -1) 127 if (customPropertySet->findPropertyIndex(CSSPropertyVariable) != -1)
128 ruleSetsCustomProperty = true; 128 ruleSetsCustomProperty = true;
129 state.setCustomPropertySetForApplyAtRule(name, customPropertySet); 129 state.setCustomPropertySetForApplyAtRule(name, customPropertySet);
130 } 130 }
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 if (propertyWhitelistType == PropertyWhitelistCue) 1388 if (propertyWhitelistType == PropertyWhitelistCue)
1389 return isValidCueStyleProperty(property) && !shouldIgnoreTextTrackAuthor Style(document); 1389 return isValidCueStyleProperty(property) && !shouldIgnoreTextTrackAuthor Style(document);
1390 1390
1391 ASSERT_NOT_REACHED(); 1391 ASSERT_NOT_REACHED();
1392 return true; 1392 return true;
1393 } 1393 }
1394 1394
1395 // This method expands the 'all' shorthand property to longhand properties 1395 // This method expands the 'all' shorthand property to longhand properties
1396 // and applies the expanded longhand properties. 1396 // and applies the expanded longhand properties.
1397 template <CSSPropertyPriority priority> 1397 template <CSSPropertyPriority priority>
1398 void StyleResolver::applyAllProperty(StyleResolverState& state, const CSSValue* allValue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) 1398 void StyleResolver::applyAllProperty(StyleResolverState& state, const CSSValue& allValue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
1399 { 1399 {
1400 // The 'all' property doesn't apply to variables: 1400 // The 'all' property doesn't apply to variables:
1401 // https://drafts.csswg.org/css-variables/#defining-variables 1401 // https://drafts.csswg.org/css-variables/#defining-variables
1402 if (priority == ResolveVariables) 1402 if (priority == ResolveVariables)
1403 return; 1403 return;
1404 1404
1405 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); 1405 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first();
1406 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); 1406 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last();
1407 1407
1408 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { 1408 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) {
(...skipping 13 matching lines...) Expand all
1422 continue; 1422 continue;
1423 1423
1424 if (!isPropertyInWhitelist(propertyWhitelistType, propertyId, document() )) 1424 if (!isPropertyInWhitelist(propertyWhitelistType, propertyId, document() ))
1425 continue; 1425 continue;
1426 1426
1427 // When hitting matched properties' cache, only inherited properties wil l be 1427 // When hitting matched properties' cache, only inherited properties wil l be
1428 // applied. 1428 // applied.
1429 if (inheritedOnly && !CSSPropertyMetadata::isInheritedProperty(propertyI d)) 1429 if (inheritedOnly && !CSSPropertyMetadata::isInheritedProperty(propertyI d))
1430 continue; 1430 continue;
1431 1431
1432 StyleBuilder::applyProperty(propertyId, state, *allValue); 1432 StyleBuilder::applyProperty(propertyId, state, allValue);
1433 } 1433 }
1434 } 1434 }
1435 1435
1436 template <CSSPropertyPriority priority> 1436 template <CSSPropertyPriority priority>
1437 void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, con st CSSValue* value, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) 1437 void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, con st CSSValue& value, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
1438 { 1438 {
1439 if (!state.style()->variables()) 1439 if (!state.style()->variables())
1440 return; 1440 return;
1441 const String& name = toCSSCustomIdentValue(value)->value(); 1441 const String& name = toCSSCustomIdentValue(value).value();
1442 const StylePropertySet* propertySet = state.customPropertySetForApplyAtRule( name); 1442 const StylePropertySet* propertySet = state.customPropertySetForApplyAtRule( name);
1443 if (propertySet) 1443 if (propertySet)
1444 applyProperties<priority>(state, propertySet, isImportant, inheritedOnly , propertyWhitelistType); 1444 applyProperties<priority>(state, propertySet, isImportant, inheritedOnly , propertyWhitelistType);
1445 } 1445 }
1446 1446
1447 template <CSSPropertyPriority priority> 1447 template <CSSPropertyPriority priority>
1448 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p ropertyWhitelistType) 1448 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p ropertyWhitelistType)
1449 { 1449 {
1450 unsigned propertyCount = properties->propertyCount(); 1450 unsigned propertyCount = properties->propertyCount();
1451 for (unsigned i = 0; i < propertyCount; ++i) { 1451 for (unsigned i = 0; i < propertyCount; ++i) {
(...skipping 13 matching lines...) Expand all
1465 continue; 1465 continue;
1466 } 1466 }
1467 1467
1468 if (!isPropertyInWhitelist(propertyWhitelistType, property, document())) 1468 if (!isPropertyInWhitelist(propertyWhitelistType, property, document()))
1469 continue; 1469 continue;
1470 1470
1471 if (inheritedOnly && !current.isInherited()) { 1471 if (inheritedOnly && !current.isInherited()) {
1472 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1472 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1473 // as they might override the value inherited here. For this reason we don't allow declarations with 1473 // as they might override the value inherited here. For this reason we don't allow declarations with
1474 // explicitly inherited properties to be cached. 1474 // explicitly inherited properties to be cached.
1475 ASSERT(!current.value()->isInheritedValue()); 1475 DCHECK(!current.value().isInheritedValue());
1476 continue; 1476 continue;
1477 } 1477 }
1478 1478
1479 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) 1479 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property))
1480 continue; 1480 continue;
1481 1481
1482 StyleBuilder::applyProperty(current.id(), state, *current.value()); 1482 StyleBuilder::applyProperty(current.id(), state, current.value());
1483 } 1483 }
1484 } 1484 }
1485 1485
1486 template <CSSPropertyPriority priority> 1486 template <CSSPropertyPriority priority>
1487 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc hedPropertiesRange& range, bool isImportant, bool inheritedOnly) 1487 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc hedPropertiesRange& range, bool isImportant, bool inheritedOnly)
1488 { 1488 {
1489 if (range.isEmpty()) 1489 if (range.isEmpty())
1490 return; 1490 return;
1491 1491
1492 if (state.style()->insideLink() != NotInsideLink) { 1492 if (state.style()->insideLink() != NotInsideLink) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 visitor->trace(m_siblingRuleSet); 1746 visitor->trace(m_siblingRuleSet);
1747 visitor->trace(m_uncommonAttributeRuleSet); 1747 visitor->trace(m_uncommonAttributeRuleSet);
1748 visitor->trace(m_watchedSelectorsRules); 1748 visitor->trace(m_watchedSelectorsRules);
1749 visitor->trace(m_treeBoundaryCrossingScopes); 1749 visitor->trace(m_treeBoundaryCrossingScopes);
1750 visitor->trace(m_styleSharingLists); 1750 visitor->trace(m_styleSharingLists);
1751 visitor->trace(m_pendingStyleSheets); 1751 visitor->trace(m_pendingStyleSheets);
1752 visitor->trace(m_document); 1752 visitor->trace(m_document);
1753 } 1753 }
1754 1754
1755 } // namespace blink 1755 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleResolver.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698