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

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: Rebased webexposed tests 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 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 2327
2328 knownExpressions.append(expression); 2328 knownExpressions.append(expression);
2329 2329
2330 // 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. 2330 // 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.
2331 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( ); 2331 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( );
2332 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument())) 2332 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument()))
2333 return; // expression failed to parse. 2333 return; // expression failed to parse.
2334 2334
2335 for (unsigned i = 0; i < resultSet->propertyCount(); i++) { 2335 for (unsigned i = 0; i < resultSet->propertyCount(); i++) {
2336 StylePropertySet::PropertyReference property = resultSet->propertyAt(i); 2336 StylePropertySet::PropertyReference property = resultSet->propertyAt(i);
2337 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) 2337 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) {
2338 resolveVariables(property.id(), property.value(), knownExpressions); 2338 resolveVariables(property.id(), property.value(), knownExpressions);
2339 else 2339 } else {
2340 applyProperty(property.id(), property.value()); 2340 applyProperty(property.id(), property.value());
2341 // All properties become dependent their parent style when they use variables.
2342 m_state.style()->setHasExplicitlyInheritedProperties();
esprehn 2013/07/04 02:48:52 This doesn't seem related to the patch?
alancutter (OOO until 2018) 2013/07/04 06:18:14 This fixes a bug which is only observable when CSS
2343 }
2341 } 2344 }
2342 } 2345 }
2343 2346
2344 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) 2347 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
2345 { 2348 {
2346 if (id != CSSPropertyVariable && hasVariableReference(value)) { 2349 if (id != CSSPropertyVariable && hasVariableReference(value)) {
2347 Vector<std::pair<CSSPropertyID, String> > knownExpressions; 2350 Vector<std::pair<CSSPropertyID, String> > knownExpressions;
2348 resolveVariables(id, value, knownExpressions); 2351 resolveVariables(id, value, knownExpressions);
2349 return; 2352 return;
2350 } 2353 }
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 info.addMember(m_state, "state"); 3440 info.addMember(m_state, "state");
3438 3441
3439 // FIXME: move this to a place where it would be called only once? 3442 // FIXME: move this to a place where it would be called only once?
3440 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3443 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3441 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3444 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3442 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3445 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3443 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3446 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3444 } 3447 }
3445 3448
3446 } // namespace WebCore 3449 } // namespace WebCore
OLDNEW
« Source/core/css/StylePropertySet.cpp ('K') | « Source/core/css/StylePropertySet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698