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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp

Issue 1858753003: Remove RawPtr from core/css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 static String serializePositionOffset(const CSSValuePair& offset, const CSSValue Pair& other) 63 static String serializePositionOffset(const CSSValuePair& offset, const CSSValue Pair& other)
64 { 64 {
65 if ((toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueLeft && toC SSPrimitiveValue(other.first()).getValueID() == CSSValueTop) 65 if ((toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueLeft && toC SSPrimitiveValue(other.first()).getValueID() == CSSValueTop)
66 || (toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueTop && t oCSSPrimitiveValue(other.first()).getValueID() == CSSValueLeft)) 66 || (toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueTop && t oCSSPrimitiveValue(other.first()).getValueID() == CSSValueLeft))
67 return offset.second().cssText(); 67 return offset.second().cssText();
68 return offset.cssText(); 68 return offset.cssText();
69 } 69 }
70 70
71 static RawPtr<CSSValuePair> buildSerializablePositionOffset(RawPtr<CSSValue> off set, CSSValueID defaultSide) 71 static CSSValuePair* buildSerializablePositionOffset(CSSValue* offset, CSSValueI D defaultSide)
72 { 72 {
73 CSSValueID side = defaultSide; 73 CSSValueID side = defaultSide;
74 RawPtr<CSSPrimitiveValue> amount = nullptr; 74 CSSPrimitiveValue* amount = nullptr;
75 75
76 if (!offset) { 76 if (!offset) {
77 side = CSSValueCenter; 77 side = CSSValueCenter;
78 } else if (offset->isPrimitiveValue() && toCSSPrimitiveValue(offset.get())-> isValueID()) { 78 } else if (offset->isPrimitiveValue() && toCSSPrimitiveValue(offset)->isValu eID()) {
79 side = toCSSPrimitiveValue(offset.get())->getValueID(); 79 side = toCSSPrimitiveValue(offset)->getValueID();
80 } else if (offset->isValuePair()) { 80 } else if (offset->isValuePair()) {
81 side = toCSSPrimitiveValue(toCSSValuePair(*offset).first()).getValueID() ; 81 side = toCSSPrimitiveValue(toCSSValuePair(*offset).first()).getValueID() ;
82 amount = &toCSSPrimitiveValue(toCSSValuePair(*offset).second()); 82 amount = &toCSSPrimitiveValue(toCSSValuePair(*offset).second());
83 if ((side == CSSValueRight || side == CSSValueBottom) && amount->isPerce ntage()) { 83 if ((side == CSSValueRight || side == CSSValueBottom) && amount->isPerce ntage()) {
84 side = defaultSide; 84 side = defaultSide;
85 amount = cssValuePool().createValue(100 - amount->getFloatValue(), C SSPrimitiveValue::UnitType::Percentage); 85 amount = cssValuePool().createValue(100 - amount->getFloatValue(), C SSPrimitiveValue::UnitType::Percentage);
86 } 86 }
87 } else { 87 } else {
88 amount = toCSSPrimitiveValue(offset.get()); 88 amount = toCSSPrimitiveValue(offset);
89 } 89 }
90 90
91 if (side == CSSValueCenter) { 91 if (side == CSSValueCenter) {
92 side = defaultSide; 92 side = defaultSide;
93 amount = cssValuePool().createValue(50, CSSPrimitiveValue::UnitType::Per centage); 93 amount = cssValuePool().createValue(50, CSSPrimitiveValue::UnitType::Per centage);
94 } else if (!amount || (amount->isLength() && !amount->getFloatValue())) { 94 } else if (!amount || (amount->isLength() && !amount->getFloatValue())) {
95 if (side == CSSValueRight || side == CSSValueBottom) 95 if (side == CSSValueRight || side == CSSValueBottom)
96 amount = cssValuePool().createValue(100, CSSPrimitiveValue::UnitType ::Percentage); 96 amount = cssValuePool().createValue(100, CSSPrimitiveValue::UnitType ::Percentage);
97 else 97 else
98 amount = cssValuePool().createValue(0, CSSPrimitiveValue::UnitType:: Percentage); 98 amount = cssValuePool().createValue(0, CSSPrimitiveValue::UnitType:: Percentage);
99 side = defaultSide; 99 side = defaultSide;
100 } 100 }
101 101
102 return CSSValuePair::create(cssValuePool().createIdentifierValue(side), amou nt.release(), CSSValuePair::KeepIdenticalValues); 102 return CSSValuePair::create(cssValuePool().createIdentifierValue(side), amou nt, CSSValuePair::KeepIdenticalValues);
103 } 103 }
104 104
105 String CSSBasicShapeCircleValue::customCSSText() const 105 String CSSBasicShapeCircleValue::customCSSText() const
106 { 106 {
107 RawPtr<CSSValuePair> normalizedCX = buildSerializablePositionOffset(m_center X, CSSValueLeft); 107 CSSValuePair* normalizedCX = buildSerializablePositionOffset(m_centerX, CSSV alueLeft);
108 RawPtr<CSSValuePair> normalizedCY = buildSerializablePositionOffset(m_center Y, CSSValueTop); 108 CSSValuePair* normalizedCY = buildSerializablePositionOffset(m_centerY, CSSV alueTop);
109 109
110 String radius; 110 String radius;
111 if (m_radius && m_radius->getValueID() != CSSValueClosestSide) 111 if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
112 radius = m_radius->cssText(); 112 radius = m_radius->cssText();
113 113
114 return buildCircleString(radius, 114 return buildCircleString(radius,
115 serializePositionOffset(*normalizedCX, *normalizedCY), 115 serializePositionOffset(*normalizedCX, *normalizedCY),
116 serializePositionOffset(*normalizedCY, *normalizedCX)); 116 serializePositionOffset(*normalizedCY, *normalizedCX));
117 } 117 }
118 118
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 result.append(centerX); 157 result.append(centerX);
158 result.appendLiteral(separator); 158 result.appendLiteral(separator);
159 result.append(centerY); 159 result.append(centerY);
160 } 160 }
161 result.append(')'); 161 result.append(')');
162 return result.toString(); 162 return result.toString();
163 } 163 }
164 164
165 String CSSBasicShapeEllipseValue::customCSSText() const 165 String CSSBasicShapeEllipseValue::customCSSText() const
166 { 166 {
167 RawPtr<CSSValuePair> normalizedCX = buildSerializablePositionOffset(m_center X, CSSValueLeft); 167 CSSValuePair* normalizedCX = buildSerializablePositionOffset(m_centerX, CSSV alueLeft);
168 RawPtr<CSSValuePair> normalizedCY = buildSerializablePositionOffset(m_center Y, CSSValueTop); 168 CSSValuePair* normalizedCY = buildSerializablePositionOffset(m_centerY, CSSV alueTop);
169 169
170 String radiusX; 170 String radiusX;
171 String radiusY; 171 String radiusY;
172 if (m_radiusX) { 172 if (m_radiusX) {
173 bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueCl osestSide; 173 bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueCl osestSide;
174 bool shouldSerializeRadiusYValue = false; 174 bool shouldSerializeRadiusYValue = false;
175 175
176 if (m_radiusY) { 176 if (m_radiusY) {
177 shouldSerializeRadiusYValue = m_radiusY->getValueID() != CSSValueClo sestSide; 177 shouldSerializeRadiusYValue = m_radiusY->getValueID() != CSSValueClo sestSide;
178 if (shouldSerializeRadiusYValue) 178 if (shouldSerializeRadiusYValue)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 visitor->trace(m_left); 398 visitor->trace(m_left);
399 visitor->trace(m_topLeftRadius); 399 visitor->trace(m_topLeftRadius);
400 visitor->trace(m_topRightRadius); 400 visitor->trace(m_topRightRadius);
401 visitor->trace(m_bottomRightRadius); 401 visitor->trace(m_bottomRightRadius);
402 visitor->trace(m_bottomLeftRadius); 402 visitor->trace(m_bottomLeftRadius);
403 CSSValue::traceAfterDispatch(visitor); 403 CSSValue::traceAfterDispatch(visitor);
404 } 404 }
405 405
406 } // namespace blink 406 } // namespace blink
407 407
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSBasicShapeValues.h ('k') | third_party/WebKit/Source/core/css/CSSBorderImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698