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

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

Issue 64293008: Wrap CSS length conversion arguments in an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: erm.. use DEFINE_STATIC_REF Created 7 years 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) 2012-2013 Intel Corporation. All rights reserved. 2 * Copyright (C) 2012-2013 Intel Corporation. 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 13 matching lines...) Expand all
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/css/resolver/ViewportStyleResolver.h" 31 #include "core/css/resolver/ViewportStyleResolver.h"
32 32
33 #include "CSSValueKeywords.h" 33 #include "CSSValueKeywords.h"
34 #include "core/css/CSSToLengthConversionData.h"
34 #include "core/css/StylePropertySet.h" 35 #include "core/css/StylePropertySet.h"
35 #include "core/css/StyleRule.h" 36 #include "core/css/StyleRule.h"
36 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
37 #include "core/dom/NodeRenderStyle.h" 38 #include "core/dom/NodeRenderStyle.h"
38 #include "core/dom/ViewportDescription.h" 39 #include "core/dom/ViewportDescription.h"
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 ViewportStyleResolver::ViewportStyleResolver(Document* document) 43 ViewportStyleResolver::ViewportStyleResolver(Document* document)
43 : m_document(document), 44 : m_document(document),
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 || id == CSSPropertyMaxWidth 177 || id == CSSPropertyMaxWidth
177 || id == CSSPropertyMinWidth); 178 || id == CSSPropertyMinWidth);
178 179
179 RefPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); 180 RefPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id);
180 if (!value || !value->isPrimitiveValue()) 181 if (!value || !value->isPrimitiveValue())
181 return Length(); // auto 182 return Length(); // auto
182 183
183 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); 184 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
184 185
185 if (primitiveValue->isLength()) 186 if (primitiveValue->isLength())
186 return primitiveValue->computeLength<Length>(m_document->renderStyle(), m_document->renderStyle()); 187 return primitiveValue->computeLength<Length>(CSSToLengthConversionData(m _document->renderStyle(), m_document->renderStyle(), 1));
Julien - ping for review 2013/11/26 05:31:07 1.0f <- let's avoid implicit conversion.
Timothy Loh 2013/11/27 05:44:51 The style guide says not to append .0f... but afte
187 188
188 if (primitiveValue->isViewportPercentageLength()) 189 if (primitiveValue->isViewportPercentageLength())
189 return primitiveValue->viewportPercentageLength(); 190 return primitiveValue->viewportPercentageLength();
190 191
191 if (primitiveValue->isPercentage()) 192 if (primitiveValue->isPercentage())
192 return Length(primitiveValue->getFloatValue(), Percent); 193 return Length(primitiveValue->getFloatValue(), Percent);
193 194
194 switch (primitiveValue->getValueID()) { 195 switch (primitiveValue->getValueID()) {
195 case CSSValueInternalExtendToZoom: 196 case CSSValueInternalExtendToZoom:
196 return Length(ExtendToZoom); 197 return Length(ExtendToZoom);
197 case CSSValueAuto: 198 case CSSValueAuto:
198 return Length(); 199 return Length();
199 default: 200 default:
200 // Unrecognized keyword. 201 // Unrecognized keyword.
201 ASSERT_NOT_REACHED(); 202 ASSERT_NOT_REACHED();
202 return Length(0, Fixed); 203 return Length(0, Fixed);
203 } 204 }
204 } 205 }
205 206
206 } // namespace WebCore 207 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698