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

Side by Side Diff: Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1265853003: CSSValue Immediates: Immediates from all CSSPrimitiveValue constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tagged_ptrs_base
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
141 list->append(cssValuePool().createValue(xRepeat)); 141 list->append(cssValuePool().createValue(xRepeat));
142 list->append(cssValuePool().createValue(yRepeat)); 142 list->append(cssValuePool().createValue(yRepeat));
143 return list.release(); 143 return list.release();
144 } 144 }
145 145
146 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t ype) 146 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t ype)
147 { 147 {
148 switch (type) { 148 switch (type) {
149 case MaskAlpha: 149 case MaskAlpha:
150 return cssValuePool().createValue(CSSValueAlpha); 150 return cssValuePool().createIdentifierValue(CSSValueAlpha);
151 case MaskLuminance: 151 case MaskLuminance:
152 return cssValuePool().createValue(CSSValueLuminance); 152 return cssValuePool().createIdentifierValue(CSSValueLuminance);
153 } 153 }
154 154
155 ASSERT_NOT_REACHED(); 155 ASSERT_NOT_REACHED();
156 156
157 return nullptr; 157 return nullptr;
158 } 158 }
159 159
160 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty le& style, CSSPropertyID propertyID, const LayoutObject* layoutObject) 160 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty le& style, CSSPropertyID propertyID, const LayoutObject* layoutObject)
161 { 161 {
162 Length offset; 162 Length offset;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (position != ItemPositionAuto) 387 if (position != ItemPositionAuto)
388 return position; 388 return position;
389 389
390 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart; 390 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart;
391 } 391 }
392 392
393 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType) 393 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType)
394 { 394 {
395 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); 395 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
396 if (positionType == LegacyPosition) 396 if (positionType == LegacyPosition)
397 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); 397 result->append(CSSPrimitiveValue::create(CSSValueLegacy));
398 result->append(CSSPrimitiveValue::create(itemPosition)); 398 result->append(CSSPrimitiveValue::create(itemPosition));
399 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) 399 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault)
400 result->append(CSSPrimitiveValue::create(overflowAlignment)); 400 result->append(CSSPrimitiveValue::create(overflowAlignment));
401 ASSERT(result->length() <= 2); 401 ASSERT(result->length() <= 2);
402 return result.release(); 402 return result.release();
403 } 403 }
404 404
405 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo utObject, Node* styledNode, bool allowVisitedStyle) 405 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo utObject, Node* styledNode, bool allowVisitedStyle)
406 { 406 {
407 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 407 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 case GO_270DEG: 1169 case GO_270DEG:
1170 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); 1170 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG);
1171 default: 1171 default:
1172 return nullptr; 1172 return nullptr;
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD ashArray& dashes, const ComputedStyle& style) 1176 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD ashArray& dashes, const ComputedStyle& style)
1177 { 1177 {
1178 if (dashes.isEmpty()) 1178 if (dashes.isEmpty())
1179 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1179 return CSSPrimitiveValue::create(CSSValueNone);
1180 1180
1181 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1181 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1182 for (const Length& dashLength : dashes.vector()) 1182 for (const Length& dashLength : dashes.vector())
1183 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); 1183 list->append(zoomAdjustedPixelValueForLength(dashLength, style));
1184 1184
1185 return list.release(); 1185 return list.release();
1186 } 1186 }
1187 1187
1188 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai ntorder) 1188 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai ntorder)
1189 { 1189 {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 return cssValuePool().createIdentifierValue(CSSValueNone); 1747 return cssValuePool().createIdentifierValue(CSSValueNone);
1748 return cssValuePool().createValue(style.highlight(), CSSPrimitiveValue:: CSS_STRING); 1748 return cssValuePool().createValue(style.highlight(), CSSPrimitiveValue:: CSS_STRING);
1749 case CSSPropertyWebkitHyphenateCharacter: 1749 case CSSPropertyWebkitHyphenateCharacter:
1750 if (style.hyphenationString().isNull()) 1750 if (style.hyphenationString().isNull())
1751 return cssValuePool().createIdentifierValue(CSSValueAuto); 1751 return cssValuePool().createIdentifierValue(CSSValueAuto);
1752 return cssValuePool().createValue(style.hyphenationString(), CSSPrimitiv eValue::CSS_STRING); 1752 return cssValuePool().createValue(style.hyphenationString(), CSSPrimitiv eValue::CSS_STRING);
1753 case CSSPropertyImageRendering: 1753 case CSSPropertyImageRendering:
1754 return CSSPrimitiveValue::create(style.imageRendering()); 1754 return CSSPrimitiveValue::create(style.imageRendering());
1755 case CSSPropertyImageOrientation: 1755 case CSSPropertyImageOrientation:
1756 if (style.respectImageOrientation() == RespectImageOrientation) 1756 if (style.respectImageOrientation() == RespectImageOrientation)
1757 return cssValuePool().createValue(CSSValueFromImage); 1757 return cssValuePool().createIdentifierValue(CSSValueFromImage);
1758 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_DEG); 1758 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_DEG);
1759 case CSSPropertyIsolation: 1759 case CSSPropertyIsolation:
1760 return cssValuePool().createValue(style.isolation()); 1760 return cssValuePool().createValue(style.isolation());
1761 case CSSPropertyJustifyItems: 1761 case CSSPropertyJustifyItems:
1762 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifyItemsPosition(), styledNode), style.justifyItemsOverflowAlignment(), style.justifyItemsPositionType()); 1762 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifyItemsPosition(), styledNode), style.justifyItemsOverflowAlignment(), style.justifyItemsPositionType());
1763 case CSSPropertyJustifySelf: 1763 case CSSPropertyJustifySelf:
1764 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifySelfPosition(), styledNode->parentNode()), style.justifySelfOverflowA lignment(), NonLegacyPosition); 1764 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifySelfPosition(), styledNode->parentNode()), style.justifySelfOverflowA lignment(), NonLegacyPosition);
1765 case CSSPropertyLeft: 1765 case CSSPropertyLeft:
1766 return valueForPositionOffset(style, CSSPropertyLeft, layoutObject); 1766 return valueForPositionOffset(style, CSSPropertyLeft, layoutObject);
1767 case CSSPropertyLetterSpacing: 1767 case CSSPropertyLetterSpacing:
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 return CSSPrimitiveValue::create(svgStyle.alignmentBaseline()); 2555 return CSSPrimitiveValue::create(svgStyle.alignmentBaseline());
2556 case CSSPropertyDominantBaseline: 2556 case CSSPropertyDominantBaseline:
2557 return CSSPrimitiveValue::create(svgStyle.dominantBaseline()); 2557 return CSSPrimitiveValue::create(svgStyle.dominantBaseline());
2558 case CSSPropertyTextAnchor: 2558 case CSSPropertyTextAnchor:
2559 return CSSPrimitiveValue::create(svgStyle.textAnchor()); 2559 return CSSPrimitiveValue::create(svgStyle.textAnchor());
2560 case CSSPropertyWritingMode: 2560 case CSSPropertyWritingMode:
2561 return CSSPrimitiveValue::create(svgStyle.writingMode()); 2561 return CSSPrimitiveValue::create(svgStyle.writingMode());
2562 case CSSPropertyClipPath: 2562 case CSSPropertyClipPath:
2563 if (!svgStyle.clipperResource().isEmpty()) 2563 if (!svgStyle.clipperResource().isEmpty())
2564 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.clipperResource()), CSSPrimitiveValue::CSS_URI); 2564 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.clipperResource()), CSSPrimitiveValue::CSS_URI);
2565 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2565 return CSSPrimitiveValue::create(CSSValueNone);
2566 case CSSPropertyMask: 2566 case CSSPropertyMask:
2567 if (!svgStyle.maskerResource().isEmpty()) 2567 if (!svgStyle.maskerResource().isEmpty())
2568 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.maskerResource()), CSSPrimitiveValue::CSS_URI); 2568 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.maskerResource()), CSSPrimitiveValue::CSS_URI);
2569 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2569 return CSSPrimitiveValue::create(CSSValueNone);
2570 case CSSPropertyFilter: 2570 case CSSPropertyFilter:
2571 if (!svgStyle.filterResource().isEmpty()) 2571 if (!svgStyle.filterResource().isEmpty())
2572 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.filterResource()), CSSPrimitiveValue::CSS_URI); 2572 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.filterResource()), CSSPrimitiveValue::CSS_URI);
2573 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2573 return CSSPrimitiveValue::create(CSSValueNone);
2574 case CSSPropertyFloodColor: 2574 case CSSPropertyFloodColor:
2575 return currentColorOrValidColor(style, svgStyle.floodColor()); 2575 return currentColorOrValidColor(style, svgStyle.floodColor());
2576 case CSSPropertyLightingColor: 2576 case CSSPropertyLightingColor:
2577 return currentColorOrValidColor(style, svgStyle.lightingColor()); 2577 return currentColorOrValidColor(style, svgStyle.lightingColor());
2578 case CSSPropertyStopColor: 2578 case CSSPropertyStopColor:
2579 return currentColorOrValidColor(style, svgStyle.stopColor()); 2579 return currentColorOrValidColor(style, svgStyle.stopColor());
2580 case CSSPropertyFill: 2580 case CSSPropertyFill:
2581 return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle. fillPaintUri(), svgStyle.fillPaintColor(), style.color()); 2581 return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle. fillPaintUri(), svgStyle.fillPaintColor(), style.color());
2582 case CSSPropertyMarkerEnd: 2582 case CSSPropertyMarkerEnd:
2583 if (!svgStyle.markerEndResource().isEmpty()) 2583 if (!svgStyle.markerEndResource().isEmpty())
2584 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerEndResource()), CSSPrimitiveValue::CSS_URI); 2584 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerEndResource()), CSSPrimitiveValue::CSS_URI);
2585 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2585 return CSSPrimitiveValue::create(CSSValueNone);
2586 case CSSPropertyMarkerMid: 2586 case CSSPropertyMarkerMid:
2587 if (!svgStyle.markerMidResource().isEmpty()) 2587 if (!svgStyle.markerMidResource().isEmpty())
2588 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerMidResource()), CSSPrimitiveValue::CSS_URI); 2588 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerMidResource()), CSSPrimitiveValue::CSS_URI);
2589 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2589 return CSSPrimitiveValue::create(CSSValueNone);
2590 case CSSPropertyMarkerStart: 2590 case CSSPropertyMarkerStart:
2591 if (!svgStyle.markerStartResource().isEmpty()) 2591 if (!svgStyle.markerStartResource().isEmpty())
2592 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerStartResource()), CSSPrimitiveValue::CSS_URI); 2592 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerStartResource()), CSSPrimitiveValue::CSS_URI);
2593 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2593 return CSSPrimitiveValue::create(CSSValueNone);
2594 case CSSPropertyStroke: 2594 case CSSPropertyStroke:
2595 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color()); 2595 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color());
2596 case CSSPropertyStrokeDasharray: 2596 case CSSPropertyStrokeDasharray:
2597 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ; 2597 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ;
2598 case CSSPropertyStrokeDashoffset: 2598 case CSSPropertyStrokeDashoffset:
2599 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e); 2599 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e);
2600 case CSSPropertyStrokeWidth: 2600 case CSSPropertyStrokeWidth:
2601 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style); 2601 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style);
2602 case CSSPropertyBaselineShift: { 2602 case CSSPropertyBaselineShift: {
2603 switch (svgStyle.baselineShift()) { 2603 switch (svgStyle.baselineShift()) {
2604 case BS_SUPER: 2604 case BS_SUPER:
2605 return CSSPrimitiveValue::createIdentifier(CSSValueSuper); 2605 return CSSPrimitiveValue::create(CSSValueSuper);
2606 case BS_SUB: 2606 case BS_SUB:
2607 return CSSPrimitiveValue::createIdentifier(CSSValueSub); 2607 return CSSPrimitiveValue::create(CSSValueSub);
2608 case BS_LENGTH: 2608 case BS_LENGTH:
2609 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style); 2609 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style);
2610 } 2610 }
2611 ASSERT_NOT_REACHED(); 2611 ASSERT_NOT_REACHED();
2612 return nullptr; 2612 return nullptr;
2613 } 2613 }
2614 case CSSPropertyBufferedRendering: 2614 case CSSPropertyBufferedRendering:
2615 return CSSPrimitiveValue::create(svgStyle.bufferedRendering()); 2615 return CSSPrimitiveValue::create(svgStyle.bufferedRendering());
2616 case CSSPropertyGlyphOrientationHorizontal: 2616 case CSSPropertyGlyphOrientationHorizontal:
2617 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal()); 2617 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal());
2618 case CSSPropertyGlyphOrientationVertical: { 2618 case CSSPropertyGlyphOrientationVertical: {
2619 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical())) 2619 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical()))
2620 return value.release(); 2620 return value.release();
2621 if (svgStyle.glyphOrientationVertical() == GO_AUTO) 2621 if (svgStyle.glyphOrientationVertical() == GO_AUTO)
2622 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2622 return CSSPrimitiveValue::create(CSSValueAuto);
2623 return nullptr; 2623 return nullptr;
2624 } 2624 }
2625 case CSSPropertyPaintOrder: 2625 case CSSPropertyPaintOrder:
2626 return paintOrderToCSSValueList(svgStyle.paintOrder()); 2626 return paintOrderToCSSValueList(svgStyle.paintOrder());
2627 case CSSPropertyVectorEffect: 2627 case CSSPropertyVectorEffect:
2628 return CSSPrimitiveValue::create(svgStyle.vectorEffect()); 2628 return CSSPrimitiveValue::create(svgStyle.vectorEffect());
2629 case CSSPropertyMaskType: 2629 case CSSPropertyMaskType:
2630 return CSSPrimitiveValue::create(svgStyle.maskType()); 2630 return CSSPrimitiveValue::create(svgStyle.maskType());
2631 case CSSPropertyMarker: 2631 case CSSPropertyMarker:
2632 case CSSPropertyEnableBackground: 2632 case CSSPropertyEnableBackground:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 case CSSPropertyAll: 2709 case CSSPropertyAll:
2710 return nullptr; 2710 return nullptr;
2711 default: 2711 default:
2712 break; 2712 break;
2713 } 2713 }
2714 ASSERT_NOT_REACHED(); 2714 ASSERT_NOT_REACHED();
2715 return nullptr; 2715 return nullptr;
2716 } 2716 }
2717 2717
2718 } 2718 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698