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

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: Minor optimisation to clearVariables 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 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 2362
2363 knownExpressions.append(expression); 2363 knownExpressions.append(expression);
2364 2364
2365 // 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. 2365 // 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.
2366 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( ); 2366 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create( );
2367 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument())) 2367 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do cument()))
2368 return; // expression failed to parse. 2368 return; // expression failed to parse.
2369 2369
2370 for (unsigned i = 0; i < resultSet->propertyCount(); i++) { 2370 for (unsigned i = 0; i < resultSet->propertyCount(); i++) {
2371 StylePropertySet::PropertyReference property = resultSet->propertyAt(i); 2371 StylePropertySet::PropertyReference property = resultSet->propertyAt(i);
2372 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) 2372 if (property.id() != CSSPropertyVariable && hasVariableReference(propert y.value())) {
2373 resolveVariables(property.id(), property.value(), knownExpressions); 2373 resolveVariables(property.id(), property.value(), knownExpressions);
2374 else 2374 } else {
2375 applyProperty(property.id(), property.value()); 2375 applyProperty(property.id(), property.value());
2376 // All properties become dependent their parent style when they use variables.
esprehn 2013/07/10 02:42:11 -> dependent on
alancutter (OOO until 2018) 2013/07/10 11:18:13 Done.
2377 m_state.style()->setHasExplicitlyInheritedProperties();
2378 }
2376 } 2379 }
2377 } 2380 }
2378 2381
2379 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) 2382 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
2380 { 2383 {
2381 if (id != CSSPropertyVariable && hasVariableReference(value)) { 2384 if (id != CSSPropertyVariable && hasVariableReference(value)) {
2382 Vector<std::pair<CSSPropertyID, String> > knownExpressions; 2385 Vector<std::pair<CSSPropertyID, String> > knownExpressions;
2383 resolveVariables(id, value, knownExpressions); 2386 resolveVariables(id, value, knownExpressions);
2384 return; 2387 return;
2385 } 2388 }
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
3472 info.addMember(m_state, "state"); 3475 info.addMember(m_state, "state");
3473 3476
3474 // FIXME: move this to a place where it would be called only once? 3477 // FIXME: move this to a place where it would be called only once?
3475 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3478 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3476 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3479 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3477 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3480 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3478 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3481 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3479 } 3482 }
3480 3483
3481 } // namespace WebCore 3484 } // 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