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

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

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: (Hopefully) Builds with oilpan now Created 5 years, 6 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 loadPendingResources(state); 665 loadPendingResources(state);
666 666
667 didAccess(); 667 didAccess();
668 668
669 return state.takeStyle(); 669 return state.takeStyle();
670 } 670 }
671 671
672 // This function is used by the WebAnimations JavaScript API method animate(). 672 // This function is used by the WebAnimations JavaScript API method animate().
673 // FIXME: Remove this when animate() switches away from resolution-dependent par sing. 673 // FIXME: Remove this when animate() switches away from resolution-dependent par sing.
674 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, C SSValue* value) 674 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, N ullableCSSValue value)
675 { 675 {
676 StyleResolverState state(element.document(), &element); 676 StyleResolverState state(element.document(), &element);
677 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle: :create()); 677 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle: :create());
678 return createAnimatableValueSnapshot(state, property, value); 678 return createAnimatableValueSnapshot(state, property, value);
679 } 679 }
680 680
681 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue* value) 681 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, NullableCSSValue value)
682 { 682 {
683 if (value) { 683 if (value) {
684 StyleBuilder::applyProperty(property, state, value); 684 StyleBuilder::applyProperty(property, state, *value);
685 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef()); 685 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef());
686 } 686 }
687 return CSSAnimatableValueFactory::create(property, *state.style()); 687 return CSSAnimatableValueFactory::create(property, *state.style());
688 } 688 }
689 689
690 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) 690 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId)
691 { 691 {
692 if (pseudoId == FIRST_LETTER) 692 if (pseudoId == FIRST_LETTER)
693 return FirstLetterPseudoElement::create(parent); 693 return FirstLetterPseudoElement::create(parent);
694 return PseudoElement::create(parent, pseudoId); 694 return PseudoElement::create(parent, pseudoId);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 || !settings->textTrackTextColor().isEmpty() 1178 || !settings->textTrackTextColor().isEmpty()
1179 || !settings->textTrackTextShadow().isEmpty() 1179 || !settings->textTrackTextShadow().isEmpty()
1180 || !settings->textTrackTextSize().isEmpty()) 1180 || !settings->textTrackTextSize().isEmpty())
1181 return true; 1181 return true;
1182 return false; 1182 return false;
1183 } 1183 }
1184 1184
1185 // This method expands the 'all' shorthand property to longhand properties 1185 // This method expands the 'all' shorthand property to longhand properties
1186 // and applies the expanded longhand properties. 1186 // and applies the expanded longhand properties.
1187 template <CSSPropertyPriority priority> 1187 template <CSSPropertyPriority priority>
1188 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal ue, bool inheritedOnly) 1188 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue allValu e, bool inheritedOnly)
1189 { 1189 {
1190 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); 1190 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first();
1191 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); 1191 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last();
1192 1192
1193 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { 1193 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) {
1194 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); 1194 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i);
1195 1195
1196 // StyleBuilder does not allow any expanded shorthands. 1196 // StyleBuilder does not allow any expanded shorthands.
1197 if (isShorthandProperty(propertyId)) 1197 if (isShorthandProperty(propertyId))
1198 continue; 1198 continue;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStylePr operty(property) || shouldIgnoreTextTrackAuthorStyle(document()))) 1233 if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStylePr operty(property) || shouldIgnoreTextTrackAuthorStyle(document())))
1234 continue; 1234 continue;
1235 1235
1236 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property)) 1236 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir stLetterStyleProperty(property))
1237 continue; 1237 continue;
1238 1238
1239 if (inheritedOnly && !current.isInherited()) { 1239 if (inheritedOnly && !current.isInherited()) {
1240 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1240 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1241 // as they might override the value inherited here. For this reason we don't allow declarations with 1241 // as they might override the value inherited here. For this reason we don't allow declarations with
1242 // explicitly inherited properties to be cached. 1242 // explicitly inherited properties to be cached.
1243 ASSERT(!current.value()->isInheritedValue()); 1243 ASSERT(!current.value().isInheritedValue());
1244 continue; 1244 continue;
1245 } 1245 }
1246 1246
1247 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) 1247 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property))
1248 continue; 1248 continue;
1249 1249
1250 StyleBuilder::applyProperty(current.id(), state, current.value()); 1250 StyleBuilder::applyProperty(current.id(), state, current.value());
1251 } 1251 }
1252 } 1252 }
1253 1253
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 CSSPropertyLineHeight, 1427 CSSPropertyLineHeight,
1428 }; 1428 };
1429 1429
1430 // TODO(timloh): This is weird, the style is being used as its own parent 1430 // TODO(timloh): This is weird, the style is being used as its own parent
1431 StyleResolverState state(document(), document().documentElement(), style); 1431 StyleResolverState state(document(), document().documentElement(), style);
1432 state.setStyle(style); 1432 state.setStyle(style);
1433 1433
1434 for (CSSPropertyID property : properties) { 1434 for (CSSPropertyID property : properties) {
1435 if (property == CSSPropertyLineHeight) 1435 if (property == CSSPropertyLineHeight)
1436 updateFont(state); 1436 updateFont(state);
1437 StyleBuilder::applyProperty(property, state, propertySet.getPropertyCSSV alue(property).get()); 1437 StyleBuilder::applyProperty(property, state, *propertySet.getPropertyCSS Value(property));
1438 } 1438 }
1439 } 1439 }
1440 1440
1441 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) 1441 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list)
1442 { 1442 {
1443 for (size_t i = 0; i < list.size(); ++i) 1443 for (size_t i = 0; i < list.size(); ++i)
1444 m_viewportDependentMediaQueryResults.append(list[i]); 1444 m_viewportDependentMediaQueryResults.append(list[i]);
1445 } 1445 }
1446 1446
1447 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1447 bool StyleResolver::mediaQueryAffectedByViewportChange() const
(...skipping 18 matching lines...) Expand all
1466 visitor->trace(m_watchedSelectorsRules); 1466 visitor->trace(m_watchedSelectorsRules);
1467 visitor->trace(m_treeBoundaryCrossingRules); 1467 visitor->trace(m_treeBoundaryCrossingRules);
1468 visitor->trace(m_styleResourceLoader); 1468 visitor->trace(m_styleResourceLoader);
1469 visitor->trace(m_styleSharingLists); 1469 visitor->trace(m_styleSharingLists);
1470 visitor->trace(m_pendingStyleSheets); 1470 visitor->trace(m_pendingStyleSheets);
1471 visitor->trace(m_document); 1471 visitor->trace(m_document);
1472 #endif 1472 #endif
1473 } 1473 }
1474 1474
1475 } // namespace blink 1475 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698