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

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

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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) 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale, 2230 // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale,
2231 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1 .0 for specific 2231 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1 .0 for specific
2232 // properties that are NOT allowed to scale within a zoomed SVG document (letter /word-spacing/font-size). 2232 // properties that are NOT allowed to scale within a zoomed SVG document (letter /word-spacing/font-size).
2233 bool StyleResolver::useSVGZoomRules() 2233 bool StyleResolver::useSVGZoomRules()
2234 { 2234 {
2235 return m_state.element() && m_state.element()->isSVGElement(); 2235 return m_state.element() && m_state.element()->isSVGElement();
2236 } 2236 }
2237 2237
2238 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const Styl eResolverState& state, GridLength& workingLength) 2238 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const Styl eResolverState& state, GridLength& workingLength)
2239 { 2239 {
2240 if (primitiveValue->getIdent() == CSSValueWebkitMinContent) { 2240 if (primitiveValue->getValueID() == CSSValueWebkitMinContent) {
2241 workingLength = Length(MinContent); 2241 workingLength = Length(MinContent);
2242 return true; 2242 return true;
2243 } 2243 }
2244 2244
2245 if (primitiveValue->getIdent() == CSSValueWebkitMaxContent) { 2245 if (primitiveValue->getValueID() == CSSValueWebkitMaxContent) {
2246 workingLength = Length(MaxContent); 2246 workingLength = Length(MaxContent);
2247 return true; 2247 return true;
2248 } 2248 }
2249 2249
2250 if (primitiveValue->isFlex()) { 2250 if (primitiveValue->isFlex()) {
2251 // Fractional unit. 2251 // Fractional unit.
2252 workingLength.setFlex(primitiveValue->getFloatValue()); 2252 workingLength.setFlex(primitiveValue->getFloatValue());
2253 return true; 2253 return true;
2254 } 2254 }
2255 2255
(...skipping 30 matching lines...) Expand all
2286 2286
2287 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); 2287 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth);
2288 return true; 2288 return true;
2289 } 2289 }
2290 2290
2291 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz es, NamedGridLinesMap& namedGridLines, const StyleResolverState& state) 2291 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz es, NamedGridLinesMap& namedGridLines, const StyleResolverState& state)
2292 { 2292 {
2293 // Handle 'none'. 2293 // Handle 'none'.
2294 if (value->isPrimitiveValue()) { 2294 if (value->isPrimitiveValue()) {
2295 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2295 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2296 return primitiveValue->getIdent() == CSSValueNone; 2296 return primitiveValue->getValueID() == CSSValueNone;
2297 } 2297 }
2298 2298
2299 if (!value->isValueList()) 2299 if (!value->isValueList())
2300 return false; 2300 return false;
2301 2301
2302 size_t currentNamedGridLine = 0; 2302 size_t currentNamedGridLine = 0;
2303 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 2303 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
2304 CSSValue* currValue = i.value(); 2304 CSSValue* currValue = i.value();
2305 if (currValue->isPrimitiveValue()) { 2305 if (currValue->isPrimitiveValue()) {
2306 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(currValue); 2306 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(currValue);
(...skipping 18 matching lines...) Expand all
2325 return true; 2325 return true;
2326 } 2326 }
2327 2327
2328 2328
2329 static bool createGridPosition(CSSValue* value, GridPosition& position) 2329 static bool createGridPosition(CSSValue* value, GridPosition& position)
2330 { 2330 {
2331 // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <in teger>? 2331 // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <in teger>?
2332 2332
2333 if (value->isPrimitiveValue()) { 2333 if (value->isPrimitiveValue()) {
2334 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2334 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2335 ASSERT(primitiveValue->getIdent() == CSSValueAuto); 2335 ASSERT(primitiveValue->getValueID() == CSSValueAuto);
2336 return true; 2336 return true;
2337 } 2337 }
2338 2338
2339 CSSValueList* values = toCSSValueList(value); 2339 CSSValueList* values = toCSSValueList(value);
2340 ASSERT(values->length()); 2340 ASSERT(values->length());
2341 2341
2342 bool isSpanPosition = false; 2342 bool isSpanPosition = false;
2343 // The specification makes the <integer> optional, in which case it default to '1'. 2343 // The specification makes the <integer> optional, in which case it default to '1'.
2344 int gridLineNumber = 1; 2344 int gridLineNumber = 1;
2345 String gridLineName; 2345 String gridLineName;
2346 2346
2347 CSSValueListIterator it = values; 2347 CSSValueListIterator it = values;
2348 CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value()); 2348 CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value());
2349 if (currentValue->getIdent() == CSSValueSpan) { 2349 if (currentValue->getValueID() == CSSValueSpan) {
2350 isSpanPosition = true; 2350 isSpanPosition = true;
2351 it.advance(); 2351 it.advance();
2352 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0; 2352 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
2353 } 2353 }
2354 2354
2355 if (currentValue && currentValue->isNumber()) { 2355 if (currentValue && currentValue->isNumber()) {
2356 gridLineNumber = currentValue->getIntValue(); 2356 gridLineNumber = currentValue->getIntValue();
2357 it.advance(); 2357 it.advance();
2358 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0; 2358 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
2359 } 2359 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 state.parentStyle()->setUnique(); 2530 state.parentStyle()->setUnique();
2531 QualifiedName attr(nullAtom, contentValue->getStringValue(). impl(), nullAtom); 2531 QualifiedName attr(nullAtom, contentValue->getStringValue(). impl(), nullAtom);
2532 const AtomicString& value = state.element()->getAttribute(at tr); 2532 const AtomicString& value = state.element()->getAttribute(at tr);
2533 state.style()->setContent(value.isNull() ? emptyAtom : value .impl(), didSet); 2533 state.style()->setContent(value.isNull() ? emptyAtom : value .impl(), didSet);
2534 didSet = true; 2534 didSet = true;
2535 // register the fact that the attribute value affects the st yle 2535 // register the fact that the attribute value affects the st yle
2536 m_features.attrsInRules.add(attr.localName().impl()); 2536 m_features.attrsInRules.add(attr.localName().impl());
2537 } else if (contentValue->isCounter()) { 2537 } else if (contentValue->isCounter()) {
2538 Counter* counterValue = contentValue->getCounterValue(); 2538 Counter* counterValue = contentValue->getCounterValue();
2539 EListStyleType listStyleType = NoneListStyle; 2539 EListStyleType listStyleType = NoneListStyle;
2540 int listStyleIdent = counterValue->listStyleIdent(); 2540 CSSValueID listStyleIdent = counterValue->listStyleIdent();
2541 if (listStyleIdent != CSSValueNone) 2541 if (listStyleIdent != CSSValueNone)
2542 listStyleType = static_cast<EListStyleType>(listStyleIde nt - CSSValueDisc); 2542 listStyleType = static_cast<EListStyleType>(listStyleIde nt - CSSValueDisc);
2543 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent (counterValue->identifier(), listStyleType, counterValue->separator())); 2543 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent (counterValue->identifier(), listStyleType, counterValue->separator()));
2544 state.style()->setContent(counter.release(), didSet); 2544 state.style()->setContent(counter.release(), didSet);
2545 didSet = true; 2545 didSet = true;
2546 } else { 2546 } else {
2547 switch (contentValue->getIdent()) { 2547 switch (contentValue->getValueID()) {
2548 case CSSValueOpenQuote: 2548 case CSSValueOpenQuote:
2549 state.style()->setContent(OPEN_QUOTE, didSet); 2549 state.style()->setContent(OPEN_QUOTE, didSet);
2550 didSet = true; 2550 didSet = true;
2551 break; 2551 break;
2552 case CSSValueCloseQuote: 2552 case CSSValueCloseQuote:
2553 state.style()->setContent(CLOSE_QUOTE, didSet); 2553 state.style()->setContent(CLOSE_QUOTE, didSet);
2554 didSet = true; 2554 didSet = true;
2555 break; 2555 break;
2556 case CSSValueNoOpenQuote: 2556 case CSSValueNoOpenQuote:
2557 state.style()->setContent(NO_OPEN_QUOTE, didSet); 2557 state.style()->setContent(NO_OPEN_QUOTE, didSet);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 if (!second) 2590 if (!second)
2591 continue; 2591 continue;
2592 String startQuote = toCSSPrimitiveValue(first)->getStringValue() ; 2592 String startQuote = toCSSPrimitiveValue(first)->getStringValue() ;
2593 String endQuote = toCSSPrimitiveValue(second)->getStringValue(); 2593 String endQuote = toCSSPrimitiveValue(second)->getStringValue();
2594 quotes->addPair(std::make_pair(startQuote, endQuote)); 2594 quotes->addPair(std::make_pair(startQuote, endQuote));
2595 } 2595 }
2596 state.style()->setQuotes(quotes); 2596 state.style()->setQuotes(quotes);
2597 return; 2597 return;
2598 } 2598 }
2599 if (primitiveValue) { 2599 if (primitiveValue) {
2600 if (primitiveValue->getIdent() == CSSValueNone) 2600 if (primitiveValue->getValueID() == CSSValueNone)
2601 state.style()->setQuotes(QuotesData::create()); 2601 state.style()->setQuotes(QuotesData::create());
2602 } 2602 }
2603 return; 2603 return;
2604 // Shorthand properties. 2604 // Shorthand properties.
2605 case CSSPropertyFont: 2605 case CSSPropertyFont:
2606 if (isInherit) { 2606 if (isInherit) {
2607 FontDescription fontDescription = state.parentStyle()->fontDescripti on(); 2607 FontDescription fontDescription = state.parentStyle()->fontDescripti on();
2608 state.style()->setLineHeight(state.parentStyle()->specifiedLineHeigh t()); 2608 state.style()->setLineHeight(state.parentStyle()->specifiedLineHeigh t());
2609 state.setLineHeightValue(0); 2609 state.setLineHeightValue(0);
2610 setFontDescription(fontDescription); 2610 setFontDescription(fontDescription);
2611 } else if (isInitial) { 2611 } else if (isInitial) {
2612 Settings* settings = documentSettings(); 2612 Settings* settings = documentSettings();
2613 ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings 2613 ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
2614 if (!settings) 2614 if (!settings)
2615 return; 2615 return;
2616 initializeFontStyle(settings); 2616 initializeFontStyle(settings);
2617 } else if (primitiveValue) { 2617 } else if (primitiveValue) {
2618 state.style()->setLineHeight(RenderStyle::initialLineHeight()); 2618 state.style()->setLineHeight(RenderStyle::initialLineHeight());
2619 state.setLineHeightValue(0); 2619 state.setLineHeightValue(0);
2620 2620
2621 FontDescription fontDescription; 2621 FontDescription fontDescription;
2622 RenderTheme::defaultTheme()->systemFont(primitiveValue->getIdent(), fontDescription); 2622 RenderTheme::defaultTheme()->systemFont(primitiveValue->getValueID() , fontDescription);
2623 2623
2624 // Double-check and see if the theme did anything. If not, don't bot her updating the font. 2624 // Double-check and see if the theme did anything. If not, don't bot her updating the font.
2625 if (fontDescription.isAbsoluteSize()) { 2625 if (fontDescription.isAbsoluteSize()) {
2626 // Make sure the rendering mode and printer font settings are up dated. 2626 // Make sure the rendering mode and printer font settings are up dated.
2627 Settings* settings = documentSettings(); 2627 Settings* settings = documentSettings();
2628 ASSERT(settings); // If we're doing style resolution, this docum ent should always be in a frame and thus have settings 2628 ASSERT(settings); // If we're doing style resolution, this docum ent should always be in a frame and thus have settings
2629 if (!settings) 2629 if (!settings)
2630 return; 2630 return;
2631 fontDescription.setRenderingMode(settings->fontRenderingMode()); 2631 fontDescription.setRenderingMode(settings->fontRenderingMode());
2632 fontDescription.setUsePrinterFont(document()->printing()); 2632 fontDescription.setUsePrinterFont(document()->printing());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2719
2720 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 2720 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
2721 CSSValue* currValue = i.value(); 2721 CSSValue* currValue = i.value();
2722 if (!currValue->isShadowValue()) 2722 if (!currValue->isShadowValue())
2723 continue; 2723 continue;
2724 ShadowValue* item = static_cast<ShadowValue*>(currValue); 2724 ShadowValue* item = static_cast<ShadowValue*>(currValue);
2725 int x = item->x->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor); 2725 int x = item->x->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor);
2726 int y = item->y->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor); 2726 int y = item->y->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor);
2727 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle(), zoomFactor) : 0; 2727 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle(), zoomFactor) : 0;
2728 int spread = item->spread ? item->spread->computeLength<int>(state.s tyle(), state.rootElementStyle(), zoomFactor) : 0; 2728 int spread = item->spread ? item->spread->computeLength<int>(state.s tyle(), state.rootElementStyle(), zoomFactor) : 0;
2729 ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal; 2729 ShadowStyle shadowStyle = item->style && item->style->getValueID() = = CSSValueInset ? Inset : Normal;
2730 Color color; 2730 Color color;
2731 if (item->color) 2731 if (item->color)
2732 color = m_state.colorFromPrimitiveValue(item->color.get()); 2732 color = m_state.colorFromPrimitiveValue(item->color.get());
2733 else if (state.style()) 2733 else if (state.style())
2734 color = state.style()->color(); 2734 color = state.style()->color();
2735 2735
2736 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, color.isValid() ? color : Color::transparent)); 2736 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, color.isValid() ? color : Color::transparent));
2737 if (id == CSSPropertyTextShadow) 2737 if (id == CSSPropertyTextShadow)
2738 state.style()->setTextShadow(shadowData.release(), i.index()); / / add to the list if this is not the first entry 2738 state.style()->setTextShadow(shadowData.release(), i.index()); / / add to the list if this is not the first entry
2739 else 2739 else
(...skipping 25 matching lines...) Expand all
2765 return; 2765 return;
2766 } 2766 }
2767 case CSSPropertySrc: // Only used in @font-face rules. 2767 case CSSPropertySrc: // Only used in @font-face rules.
2768 return; 2768 return;
2769 case CSSPropertyUnicodeRange: // Only used in @font-face rules. 2769 case CSSPropertyUnicodeRange: // Only used in @font-face rules.
2770 return; 2770 return;
2771 case CSSPropertyWebkitLocale: { 2771 case CSSPropertyWebkitLocale: {
2772 HANDLE_INHERIT_AND_INITIAL(locale, Locale); 2772 HANDLE_INHERIT_AND_INITIAL(locale, Locale);
2773 if (!primitiveValue) 2773 if (!primitiveValue)
2774 return; 2774 return;
2775 if (primitiveValue->getIdent() == CSSValueAuto) 2775 if (primitiveValue->getValueID() == CSSValueAuto)
2776 state.style()->setLocale(nullAtom); 2776 state.style()->setLocale(nullAtom);
2777 else 2777 else
2778 state.style()->setLocale(primitiveValue->getStringValue()); 2778 state.style()->setLocale(primitiveValue->getStringValue());
2779 FontDescription fontDescription = state.style()->fontDescription(); 2779 FontDescription fontDescription = state.style()->fontDescription();
2780 fontDescription.setScript(localeToScriptCodeForFontSelection(state.style ()->locale())); 2780 fontDescription.setScript(localeToScriptCodeForFontSelection(state.style ()->locale()));
2781 setFontDescription(fontDescription); 2781 setFontDescription(fontDescription);
2782 return; 2782 return;
2783 } 2783 }
2784 case CSSPropertyWebkitAppRegion: { 2784 case CSSPropertyWebkitAppRegion: {
2785 if (!primitiveValue || !primitiveValue->getIdent()) 2785 if (!primitiveValue || !primitiveValue->getValueID())
2786 return; 2786 return;
2787 state.style()->setDraggableRegionMode(primitiveValue->getIdent() == CSSV alueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); 2787 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CS SValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
2788 state.document()->setHasAnnotatedRegions(true); 2788 state.document()->setHasAnnotatedRegions(true);
2789 return; 2789 return;
2790 } 2790 }
2791 case CSSPropertyWebkitTextStrokeWidth: { 2791 case CSSPropertyWebkitTextStrokeWidth: {
2792 HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth) 2792 HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)
2793 float width = 0; 2793 float width = 0;
2794 switch (primitiveValue->getIdent()) { 2794 switch (primitiveValue->getValueID()) {
2795 case CSSValueThin: 2795 case CSSValueThin:
2796 case CSSValueMedium: 2796 case CSSValueMedium:
2797 case CSSValueThick: { 2797 case CSSValueThick: {
2798 double result = 1.0 / 48; 2798 double result = 1.0 / 48;
2799 if (primitiveValue->getIdent() == CSSValueMedium) 2799 if (primitiveValue->getValueID() == CSSValueMedium)
2800 result *= 3; 2800 result *= 3;
2801 else if (primitiveValue->getIdent() == CSSValueThick) 2801 else if (primitiveValue->getValueID() == CSSValueThick)
2802 result *= 5; 2802 result *= 5;
2803 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS )->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor); 2803 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS )->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
2804 break; 2804 break;
2805 } 2805 }
2806 default: 2806 default:
2807 width = primitiveValue->computeLength<float>(state.style(), state.ro otElementStyle(), zoomFactor); 2807 width = primitiveValue->computeLength<float>(state.style(), state.ro otElementStyle(), zoomFactor);
2808 break; 2808 break;
2809 } 2809 }
2810 state.style()->setTextStrokeWidth(width); 2810 state.style()->setTextStrokeWidth(width);
2811 return; 2811 return;
2812 } 2812 }
2813 case CSSPropertyWebkitTransform: { 2813 case CSSPropertyWebkitTransform: {
2814 HANDLE_INHERIT_AND_INITIAL(transform, Transform); 2814 HANDLE_INHERIT_AND_INITIAL(transform, Transform);
2815 TransformOperations operations; 2815 TransformOperations operations;
2816 TransformBuilder::createTransformOperations(value, state.style(), state. rootElementStyle(), operations); 2816 TransformBuilder::createTransformOperations(value, state.style(), state. rootElementStyle(), operations);
2817 state.style()->setTransform(operations); 2817 state.style()->setTransform(operations);
2818 return; 2818 return;
2819 } 2819 }
2820 case CSSPropertyWebkitPerspective: { 2820 case CSSPropertyWebkitPerspective: {
2821 HANDLE_INHERIT_AND_INITIAL(perspective, Perspective) 2821 HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
2822 2822
2823 if (!primitiveValue) 2823 if (!primitiveValue)
2824 return; 2824 return;
2825 2825
2826 if (primitiveValue->getIdent() == CSSValueNone) { 2826 if (primitiveValue->getValueID() == CSSValueNone) {
2827 state.style()->setPerspective(0); 2827 state.style()->setPerspective(0);
2828 return; 2828 return;
2829 } 2829 }
2830 2830
2831 float perspectiveValue; 2831 float perspectiveValue;
2832 if (primitiveValue->isLength()) 2832 if (primitiveValue->isLength())
2833 perspectiveValue = primitiveValue->computeLength<float>(state.style( ), state.rootElementStyle(), zoomFactor); 2833 perspectiveValue = primitiveValue->computeLength<float>(state.style( ), state.rootElementStyle(), zoomFactor);
2834 else if (primitiveValue->isNumber()) { 2834 else if (primitiveValue->isNumber()) {
2835 // For backward compatibility, treat valueless numbers as px. 2835 // For backward compatibility, treat valueless numbers as px.
2836 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoub leValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state .rootElementStyle(), zoomFactor); 2836 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoub leValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state .rootElementStyle(), zoomFactor);
(...skipping 11 matching lines...) Expand all
2848 2848
2849 Color col = m_state.colorFromPrimitiveValue(primitiveValue); 2849 Color col = m_state.colorFromPrimitiveValue(primitiveValue);
2850 state.style()->setTapHighlightColor(col); 2850 state.style()->setTapHighlightColor(col);
2851 return; 2851 return;
2852 } 2852 }
2853 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 2853 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
2854 case CSSPropertyWebkitOverflowScrolling: { 2854 case CSSPropertyWebkitOverflowScrolling: {
2855 HANDLE_INHERIT_AND_INITIAL(useTouchOverflowScrolling, UseTouchOverflowSc rolling); 2855 HANDLE_INHERIT_AND_INITIAL(useTouchOverflowScrolling, UseTouchOverflowSc rolling);
2856 if (!primitiveValue) 2856 if (!primitiveValue)
2857 break; 2857 break;
2858 state.style()->setUseTouchOverflowScrolling(primitiveValue->getIdent() = = CSSValueTouch); 2858 state.style()->setUseTouchOverflowScrolling(primitiveValue->getValueID() == CSSValueTouch);
2859 return; 2859 return;
2860 } 2860 }
2861 #endif 2861 #endif
2862 case CSSPropertyInvalid: 2862 case CSSPropertyInvalid:
2863 return; 2863 return;
2864 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch. 2864 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch.
2865 case CSSPropertyWebkitBorderEndColor: 2865 case CSSPropertyWebkitBorderEndColor:
2866 case CSSPropertyWebkitBorderEndStyle: 2866 case CSSPropertyWebkitBorderEndStyle:
2867 case CSSPropertyWebkitBorderEndWidth: 2867 case CSSPropertyWebkitBorderEndWidth:
2868 case CSSPropertyWebkitBorderStartColor: 2868 case CSSPropertyWebkitBorderStartColor:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 HANDLE_INHERIT_AND_INITIAL(textOrientation, TextOrientation); 2932 HANDLE_INHERIT_AND_INITIAL(textOrientation, TextOrientation);
2933 2933
2934 if (primitiveValue) 2934 if (primitiveValue)
2935 setTextOrientation(*primitiveValue); 2935 setTextOrientation(*primitiveValue);
2936 2936
2937 return; 2937 return;
2938 } 2938 }
2939 2939
2940 case CSSPropertyWebkitLineBoxContain: { 2940 case CSSPropertyWebkitLineBoxContain: {
2941 HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain) 2941 HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
2942 if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) { 2942 if (primitiveValue && primitiveValue->getValueID() == CSSValueNone) {
2943 state.style()->setLineBoxContain(LineBoxContainNone); 2943 state.style()->setLineBoxContain(LineBoxContainNone);
2944 return; 2944 return;
2945 } 2945 }
2946 2946
2947 if (!value->isCSSLineBoxContainValue()) 2947 if (!value->isCSSLineBoxContainValue())
2948 return; 2948 return;
2949 2949
2950 CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxCont ainValue*>(value); 2950 CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxCont ainValue*>(value);
2951 state.style()->setLineBoxContain(lineBoxContainValue->value()); 2951 state.style()->setLineBoxContain(lineBoxContainValue->value());
2952 return; 2952 return;
2953 } 2953 }
2954 2954
2955 // CSS Fonts Module Level 3 2955 // CSS Fonts Module Level 3
2956 case CSSPropertyWebkitFontFeatureSettings: { 2956 case CSSPropertyWebkitFontFeatureSettings: {
2957 if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) { 2957 if (primitiveValue && primitiveValue->getValueID() == CSSValueNormal) {
2958 setFontDescription(state.style()->fontDescription().makeNormalFeatur eSettings()); 2958 setFontDescription(state.style()->fontDescription().makeNormalFeatur eSettings());
2959 return; 2959 return;
2960 } 2960 }
2961 2961
2962 if (!value->isValueList()) 2962 if (!value->isValueList())
2963 return; 2963 return;
2964 2964
2965 FontDescription fontDescription = state.style()->fontDescription(); 2965 FontDescription fontDescription = state.style()->fontDescription();
2966 CSSValueList* list = toCSSValueList(value); 2966 CSSValueList* list = toCSSValueList(value);
2967 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); 2967 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 } 3458 }
3459 3459
3460 void StyleResolver::setFontSize(FontDescription& fontDescription, float size) 3460 void StyleResolver::setFontSize(FontDescription& fontDescription, float size)
3461 { 3461 {
3462 fontDescription.setSpecifiedSize(size); 3462 fontDescription.setSpecifiedSize(size);
3463 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_state.style(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules())); 3463 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), m_state.style(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules()));
3464 } 3464 }
3465 3465
3466 bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValu e* value) 3466 bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValu e* value)
3467 { 3467 {
3468 int ident = value->getIdent(); 3468 int ident = value->getValueID();
3469 switch (ident) { 3469 switch (ident) {
3470 case CSSValueWebkitText: 3470 case CSSValueWebkitText:
3471 case CSSValueWebkitLink: 3471 case CSSValueWebkitLink:
3472 case CSSValueWebkitActivelink: 3472 case CSSValueWebkitActivelink:
3473 case CSSValueCurrentcolor: 3473 case CSSValueCurrentcolor:
3474 return true; 3474 return true;
3475 default: 3475 default:
3476 return false; 3476 return false;
3477 } 3477 }
3478 } 3478 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 info.addMember(m_state, "state"); 3739 info.addMember(m_state, "state");
3740 3740
3741 // FIXME: move this to a place where it would be called only once? 3741 // FIXME: move this to a place where it would be called only once?
3742 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3742 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3743 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3743 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3744 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3744 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3745 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3745 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3746 } 3746 }
3747 3747
3748 } // namespace WebCore 3748 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/core/css/resolver/StyleResolverState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698