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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1159833003: New SELECT Popup: Recalc style when a web font is loaded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 { 96 {
97 } 97 }
98 98
99 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant, 99 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant,
100 CSSParserValueList* valueList, const CSSParserContext& context, 100 CSSParserValueList* valueList, const CSSParserContext& context,
101 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy pe) 101 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy pe)
102 { 102 {
103 int parsedPropertiesSize = parsedProperties.size(); 103 int parsedPropertiesSize = parsedProperties.size();
104 104
105 CSSPropertyParser parser(valueList, context, parsedProperties, ruleType); 105 CSSPropertyParser parser(valueList, context, parsedProperties, ruleType);
106 bool parseSuccess = parser.parseValue(unresolvedProperty, important); 106 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
107 bool parseSuccess;
108
109 if (ruleType == StyleRule::Viewport) {
tkent 2015/05/29 05:41:03 Why do you need to move the code from parseValue(2
keishi 2015/05/29 07:30:51 Sorry, changes to this file got mixed in by mistak
110 parseSuccess = (RuntimeEnabledFeatures::cssViewportEnabled() || isUAShee tBehavior(context.mode()))
111 && parser.parseViewportProperty(resolvedProperty, important);
112 } else if (ruleType == StyleRule::FontFace) {
113 parseSuccess = !important && parser.parseFontFaceDescriptor(resolvedProp erty);
114 } else {
115 parseSuccess = parser.parseValue(unresolvedProperty, important);
116 }
107 117
108 // This doesn't count UA style sheets 118 // This doesn't count UA style sheets
109 if (parseSuccess && context.useCounter()) 119 if (parseSuccess && context.useCounter())
110 context.useCounter()->count(context, unresolvedProperty); 120 context.useCounter()->count(context, unresolvedProperty);
111 121
112 if (!parseSuccess) 122 if (!parseSuccess)
113 parser.rollbackLastProperties(parsedProperties.size() - parsedProperties Size); 123 parser.rollbackLastProperties(parsedProperties.size() - parsedProperties Size);
114 124
115 return parseSuccess; 125 return parseSuccess;
116 } 126 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ShorthandScope scope(this, propId); 412 ShorthandScope scope(this, propId);
403 const CSSPropertyID* longhands = shorthand.properties(); 413 const CSSPropertyID* longhands = shorthand.properties();
404 for (unsigned i = 0; i < shorthandLength; ++i) 414 for (unsigned i = 0; i < shorthandLength; ++i)
405 addProperty(longhands[i], value, important); 415 addProperty(longhands[i], value, important);
406 } 416 }
407 417
408 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant) 418 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant)
409 { 419 {
410 CSSPropertyID propId = resolveCSSPropertyID(unresolvedProperty); 420 CSSPropertyID propId = resolveCSSPropertyID(unresolvedProperty);
411 421
412 if (!m_valueList)
413 return false;
414
415 CSSParserValue* value = m_valueList->current(); 422 CSSParserValue* value = m_valueList->current();
416 423
417 if (!value)
418 return false;
419
420 if (m_ruleType == StyleRule::Viewport) {
421 // Allow @viewport rules from UA stylesheets even if the feature is disa bled.
422 if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior( m_context.mode()))
423 return false;
424
425 return parseViewportProperty(propId, important);
426 }
427 if (m_ruleType == StyleRule::FontFace) {
428 if (important)
429 return false;
430 return parseFontFaceDescriptor(propId);
431 }
432
433 // Note: m_parsedCalculation is used to pass the calc value to validUnit and then cleared at the end of this function. 424 // Note: m_parsedCalculation is used to pass the calc value to validUnit and then cleared at the end of this function.
434 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller s. 425 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller s.
435 ASSERT(!m_parsedCalculation); 426 ASSERT(!m_parsedCalculation);
436 427
437 CSSValueID id = value->id; 428 CSSValueID id = value->id;
438 429
439 if (id == CSSValueInherit) { 430 if (id == CSSValueInherit) {
440 if (m_valueList->size() != 1) 431 if (m_valueList->size() != 1)
441 return false; 432 return false;
442 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue( ), important); 433 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue( ), important);
(...skipping 7973 matching lines...) Expand 10 before | Expand all | Expand 10 after
8416 } 8407 }
8417 } 8408 }
8418 8409
8419 if (!list->length()) 8410 if (!list->length())
8420 return nullptr; 8411 return nullptr;
8421 8412
8422 return list.release(); 8413 return list.release();
8423 } 8414 }
8424 8415
8425 } // namespace blink 8416 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698