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

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

Issue 18311002: Partial implementation of CSSVariablesMap for CSS Variables CSSOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed unused IDL callback definition Created 7 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 | Annotate | Revision Log
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 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 2336
2337 knownExpressions.append(expression); 2337 knownExpressions.append(expression);
2338 2338
2339 // FIXME: It would be faster not to re-parse from strings, but for now CSS p roperty validation lives inside the parser so we do it there. 2339 // FIXME: It would be faster not to re-parse from strings, but for now CSS p roperty validation lives inside the parser so we do it there.
2340 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( ); 2340 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( );
2341 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument())) 2341 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument()))
2342 return; // expression failed to parse. 2342 return; // expression failed to parse.
2343 2343
2344 for (unsigned i = 0; i < resultSet->propertyCount(); i++) { 2344 for (unsigned i = 0; i < resultSet->propertyCount(); i++) {
2345 StylePropertySet::PropertyReference property = resultSet->propertyAt(i); 2345 StylePropertySet::PropertyReference property = resultSet->propertyAt(i);
2346 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) 2346 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) {
2347 resolveVariables(property.id(), property.value(), knownExpressions); 2347 resolveVariables(property.id(), property.value(), knownExpressions);
2348 else 2348 } else {
2349 applyProperty(property.id(), property.value()); 2349 applyProperty(property.id(), property.value());
2350 // All properties become dependent their parent style when they use variables.
2351 m_state.style()->setHasExplicitlyInheritedProperties();
2352 }
2350 } 2353 }
2351 } 2354 }
2352 2355
2353 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) 2356 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
2354 { 2357 {
2355 if (id != CSSPropertyVariable && hasVariableReference(value)) { 2358 if (id != CSSPropertyVariable && hasVariableReference(value)) {
2356 Vector<std::pair<CSSPropertyID, String> > knownExpressions; 2359 Vector<std::pair<CSSPropertyID, String> > knownExpressions;
2357 resolveVariables(id, value, knownExpressions); 2360 resolveVariables(id, value, knownExpressions);
2358 return; 2361 return;
2359 } 2362 }
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 info.addMember(m_state, "state"); 3675 info.addMember(m_state, "state");
3673 3676
3674 // FIXME: move this to a place where it would be called only once? 3677 // FIXME: move this to a place where it would be called only once?
3675 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3678 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3676 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3679 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3677 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3680 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3678 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3681 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3679 } 3682 }
3680 3683
3681 } // namespace WebCore 3684 } // namespace WebCore
OLDNEW
« Source/core/css/CSSVariablesMap.idl ('K') | « Source/core/css/StylePropertySet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698