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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/StyleCalcLength.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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/cssom/StyleCalcLength.h" 5 #include "core/css/cssom/StyleCalcLength.h"
6 6
7 #include "core/css/CSSCalculationValue.h" 7 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/cssom/CalcDictionary.h" 9 #include "core/css/cssom/CalcDictionary.h"
10 #include "core/css/cssom/SimpleLength.h" 10 #include "core/css/cssom/SimpleLength.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 { 116 {
117 StyleCalcLength* result = StyleCalcLength::create(this, exceptionState); 117 StyleCalcLength* result = StyleCalcLength::create(this, exceptionState);
118 for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) { 118 for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
119 if (hasAtIndex(i)) { 119 if (hasAtIndex(i)) {
120 result->setAtIndex(getAtIndex(i) / x, i); 120 result->setAtIndex(getAtIndex(i) / x, i);
121 } 121 }
122 } 122 }
123 return result; 123 return result;
124 } 124 }
125 125
126 RawPtr<CSSValue> StyleCalcLength::toCSSValue() const 126 CSSValue* StyleCalcLength::toCSSValue() const
127 { 127 {
128 // Create a CSS Calc Value, then put it into a CSSPrimitiveValue 128 // Create a CSS Calc Value, then put it into a CSSPrimitiveValue
129 RawPtr<CSSCalcExpressionNode> node = nullptr; 129 CSSCalcExpressionNode* node = nullptr;
130 for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) { 130 for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
131 if (!hasAtIndex(i)) 131 if (!hasAtIndex(i))
132 continue; 132 continue;
133 double value = getAtIndex(i); 133 double value = getAtIndex(i);
134 if (node) { 134 if (node) {
135 node = CSSCalcValue::createExpressionNode( 135 node = CSSCalcValue::createExpressionNode(
136 node, 136 node,
137 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(std ::abs(value), unitFromIndex(i))), 137 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(std ::abs(value), unitFromIndex(i))),
138 value >= 0 ? CalcAdd : CalcSubtract); 138 value >= 0 ? CalcAdd : CalcSubtract);
139 } else { 139 } else {
140 node = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create( value, unitFromIndex(i))); 140 node = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create( value, unitFromIndex(i)));
141 } 141 }
142 } 142 }
143 return CSSPrimitiveValue::create(CSSCalcValue::create(node)); 143 return CSSPrimitiveValue::create(CSSCalcValue::create(node));
144 } 144 }
145 145
146 int StyleCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit) 146 int StyleCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit)
147 { 147 {
148 return (static_cast<int>(unit) - static_cast<int>(CSSPrimitiveValue::UnitTyp e::Percentage)); 148 return (static_cast<int>(unit) - static_cast<int>(CSSPrimitiveValue::UnitTyp e::Percentage));
149 } 149 }
150 150
151 } // namespace blink 151 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h ('k') | third_party/WebKit/Source/core/css/cssom/StyleValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698