| OLD | NEW |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/css/CSSGridTemplateAreasValue.h" | 48 #include "core/css/CSSGridTemplateAreasValue.h" |
| 49 #include "core/css/CSSImageSetValue.h" | 49 #include "core/css/CSSImageSetValue.h" |
| 50 #include "core/css/CSSImageValue.h" | 50 #include "core/css/CSSImageValue.h" |
| 51 #include "core/css/CSSInheritedValue.h" | 51 #include "core/css/CSSInheritedValue.h" |
| 52 #include "core/css/CSSInitialValue.h" | 52 #include "core/css/CSSInitialValue.h" |
| 53 #include "core/css/CSSKeyframeRule.h" | 53 #include "core/css/CSSKeyframeRule.h" |
| 54 #include "core/css/CSSKeyframesRule.h" | 54 #include "core/css/CSSKeyframesRule.h" |
| 55 #include "core/css/CSSLineBoxContainValue.h" | 55 #include "core/css/CSSLineBoxContainValue.h" |
| 56 #include "core/css/CSSParserValues.h" | 56 #include "core/css/CSSParserValues.h" |
| 57 #include "core/css/CSSPrimitiveValue.h" | 57 #include "core/css/CSSPrimitiveValue.h" |
| 58 #include "core/css/CSSPrimitiveValueMappings.h" |
| 58 #include "core/css/CSSPropertySourceData.h" | 59 #include "core/css/CSSPropertySourceData.h" |
| 59 #include "core/css/CSSReflectValue.h" | 60 #include "core/css/CSSReflectValue.h" |
| 60 #include "core/css/CSSSVGDocumentValue.h" | 61 #include "core/css/CSSSVGDocumentValue.h" |
| 61 #include "core/css/CSSSelector.h" | 62 #include "core/css/CSSSelector.h" |
| 62 #include "core/css/CSSShadowValue.h" | 63 #include "core/css/CSSShadowValue.h" |
| 63 #include "core/css/CSSTimingFunctionValue.h" | 64 #include "core/css/CSSTimingFunctionValue.h" |
| 64 #include "core/css/CSSTransformValue.h" | 65 #include "core/css/CSSTransformValue.h" |
| 65 #include "core/css/CSSUnicodeRangeValue.h" | 66 #include "core/css/CSSUnicodeRangeValue.h" |
| 66 #include "core/css/CSSValueList.h" | 67 #include "core/css/CSSValueList.h" |
| 67 #include "core/css/CSSValuePool.h" | 68 #include "core/css/CSSValuePool.h" |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 // <margin-width>{1,4} | inherit | 1407 // <margin-width>{1,4} | inherit |
| 1407 return parse4Values(propId, marginShorthand().properties(), important); | 1408 return parse4Values(propId, marginShorthand().properties(), important); |
| 1408 case CSSPropertyPadding: | 1409 case CSSPropertyPadding: |
| 1409 // <padding-width>{1,4} | inherit | 1410 // <padding-width>{1,4} | inherit |
| 1410 return parse4Values(propId, paddingShorthand().properties(), important); | 1411 return parse4Values(propId, paddingShorthand().properties(), important); |
| 1411 case CSSPropertyFlexFlow: | 1412 case CSSPropertyFlexFlow: |
| 1412 return parseShorthand(propId, flexFlowShorthand(), important); | 1413 return parseShorthand(propId, flexFlowShorthand(), important); |
| 1413 case CSSPropertyFont: | 1414 case CSSPropertyFont: |
| 1414 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? | 1415 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? |
| 1415 // 'font-family' ] | caption | icon | menu | message-box | small-caption
| status-bar | inherit | 1416 // 'font-family' ] | caption | icon | menu | message-box | small-caption
| status-bar | inherit |
| 1416 if (id >= CSSValueCaption && id <= CSSValueStatusBar) | 1417 if (num == 1 && id >= CSSValueCaption && id <= CSSValueStatusBar) |
| 1417 validPrimitive = true; | 1418 return parseKeywordBasedFont(important); |
| 1418 else | 1419 return parseFont(important); |
| 1419 return parseFont(important); | |
| 1420 break; | |
| 1421 case CSSPropertyListStyle: | 1420 case CSSPropertyListStyle: |
| 1422 return parseShorthand(propId, listStyleShorthand(), important); | 1421 return parseShorthand(propId, listStyleShorthand(), important); |
| 1423 case CSSPropertyWebkitColumns: | 1422 case CSSPropertyWebkitColumns: |
| 1424 return parseColumnsShorthand(important); | 1423 return parseColumnsShorthand(important); |
| 1425 case CSSPropertyWebkitColumnRule: | 1424 case CSSPropertyWebkitColumnRule: |
| 1426 return parseShorthand(propId, webkitColumnRuleShorthand(), important); | 1425 return parseShorthand(propId, webkitColumnRuleShorthand(), important); |
| 1427 case CSSPropertyWebkitTextStroke: | 1426 case CSSPropertyWebkitTextStroke: |
| 1428 return parseShorthand(propId, webkitTextStrokeShorthand(), important); | 1427 return parseShorthand(propId, webkitTextStrokeShorthand(), important); |
| 1429 case CSSPropertyAnimation: | 1428 case CSSPropertyAnimation: |
| 1430 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 1429 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
| (...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4512 shape = parseBasicShapeInset(args); | 4511 shape = parseBasicShapeInset(args); |
| 4513 | 4512 |
| 4514 if (!shape) | 4513 if (!shape) |
| 4515 return nullptr; | 4514 return nullptr; |
| 4516 | 4515 |
| 4517 m_valueList->next(); | 4516 m_valueList->next(); |
| 4518 | 4517 |
| 4519 return cssValuePool().createValue(shape.release()); | 4518 return cssValuePool().createValue(shape.release()); |
| 4520 } | 4519 } |
| 4521 | 4520 |
| 4521 // [ 'caption' | 'icon' | 'menu' | 'message-box' | 'small-caption' | 'status-bar
' | '-webkit-mini-control' | '-webkit-small-control' | '-webkit-control' ] |
| 4522 bool CSSPropertyParser::parseKeywordBasedFont(bool important) |
| 4523 { |
| 4524 ASSERT(m_valueList->size() == 1); |
| 4525 |
| 4526 CSSParserValue* value = m_valueList->valueAt(0); |
| 4527 CSSValueID id = value->id; |
| 4528 ASSERT(id >= CSSValueCaption && id <= CSSValueStatusBar); |
| 4529 |
| 4530 FontDescription fontDescription; |
| 4531 RenderTheme::theme().systemFont(id, fontDescription); |
| 4532 RefPtr<CSSValueList> familyList = CSSValueList::createCommaSeparated(); |
| 4533 familyList->append(cssValuePool().createFontFamilyValue(fontDescription.firs
tFamily().family())); |
| 4534 |
| 4535 ShorthandScope scope(this, CSSPropertyFont); |
| 4536 addProperty(CSSPropertyFontFamily, familyList, important, false); |
| 4537 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(fontD
escription.style() == FontStyleItalic ? CSSValueItalic : CSSValueNormal), import
ant, false); |
| 4538 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(fon
tDescription.variant() == FontVariantSmallCaps ? CSSValueSmallCaps : CSSValueNor
mal), important, false); |
| 4539 addProperty(CSSPropertyFontWeight, cssValuePool().createValue(fontDescriptio
n.weight()), important, false); |
| 4540 CSSParserValue fontSizeValue; |
| 4541 fontSizeValue.setFromNumber(fontDescription.specifiedSize(), CSSPrimitiveVal
ue::CSS_PX); |
| 4542 addProperty(CSSPropertyFontSize, parseValidPrimitive(fontSizeValue.id, &font
SizeValue), important, false); |
| 4543 addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(CSSV
alueNormal), important, false); |
| 4544 |
| 4545 return true; |
| 4546 } |
| 4547 |
| 4522 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-he
ight' ]? 'font-family' | 4548 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-he
ight' ]? 'font-family' |
| 4523 bool CSSPropertyParser::parseFont(bool important) | 4549 bool CSSPropertyParser::parseFont(bool important) |
| 4524 { | 4550 { |
| 4525 // Let's check if there is an inherit or initial somewhere in the shorthand. | 4551 // Let's check if there is an inherit or initial somewhere in the shorthand. |
| 4526 for (unsigned i = 0; i < m_valueList->size(); ++i) { | 4552 for (unsigned i = 0; i < m_valueList->size(); ++i) { |
| 4527 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) | 4553 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) |
| 4528 return false; | 4554 return false; |
| 4529 } | 4555 } |
| 4530 | 4556 |
| 4531 ShorthandScope scope(this, CSSPropertyFont); | 4557 ShorthandScope scope(this, CSSPropertyFont); |
| (...skipping 3921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8453 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8479 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8454 if (!seenStroke) | 8480 if (!seenStroke) |
| 8455 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8481 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
| 8456 if (!seenMarkers) | 8482 if (!seenMarkers) |
| 8457 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8483 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
| 8458 | 8484 |
| 8459 return parsedValues.release(); | 8485 return parsedValues.release(); |
| 8460 } | 8486 } |
| 8461 | 8487 |
| 8462 } // namespace WebCore | 8488 } // namespace WebCore |
| OLD | NEW |