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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/resolver/StyleResourceLoader.cpp ('k') | Source/core/dom/CSSSelectorWatch.h » ('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) 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 20 matching lines...) Expand all
31 #include "core/css/resolver/ViewportStyleResolver.h" 31 #include "core/css/resolver/ViewportStyleResolver.h"
32 32
33 #include "core/CSSValueKeywords.h" 33 #include "core/CSSValueKeywords.h"
34 #include "core/css/CSSDefaultStyleSheets.h" 34 #include "core/css/CSSDefaultStyleSheets.h"
35 #include "core/css/CSSPrimitiveValueMappings.h" 35 #include "core/css/CSSPrimitiveValueMappings.h"
36 #include "core/css/CSSToLengthConversionData.h" 36 #include "core/css/CSSToLengthConversionData.h"
37 #include "core/css/StylePropertySet.h" 37 #include "core/css/StylePropertySet.h"
38 #include "core/css/StyleRule.h" 38 #include "core/css/StyleRule.h"
39 #include "core/css/resolver/ScopedStyleResolver.h" 39 #include "core/css/resolver/ScopedStyleResolver.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/dom/NodeLayoutStyle.h" 41 #include "core/dom/NodeComputedStyle.h"
42 #include "core/dom/ViewportDescription.h" 42 #include "core/dom/ViewportDescription.h"
43 #include "core/frame/FrameView.h" 43 #include "core/frame/FrameView.h"
44 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); 48 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver);
49 49
50 ViewportStyleResolver::ViewportStyleResolver(Document* document) 50 ViewportStyleResolver::ViewportStyleResolver(Document* document)
51 : m_document(document) 51 : m_document(document)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); 140 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id);
141 if (!value || !value->isPrimitiveValue()) 141 if (!value || !value->isPrimitiveValue())
142 return defaultValue; 142 return defaultValue;
143 143
144 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); 144 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
145 145
146 if (primitiveValue->isNumber() || primitiveValue->isPx()) 146 if (primitiveValue->isNumber() || primitiveValue->isPx())
147 return primitiveValue->getFloatValue(); 147 return primitiveValue->getFloatValue();
148 148
149 if (primitiveValue->isFontRelativeLength()) 149 if (primitiveValue->isFontRelativeLength())
150 return primitiveValue->getFloatValue() * m_document->layoutStyle()->font Description().computedSize(); 150 return primitiveValue->getFloatValue() * m_document->computedStyle()->fo ntDescription().computedSize();
151 151
152 if (primitiveValue->isPercentage()) { 152 if (primitiveValue->isPercentage()) {
153 float percentValue = primitiveValue->getFloatValue() / 100.0f; 153 float percentValue = primitiveValue->getFloatValue() / 100.0f;
154 switch (id) { 154 switch (id) {
155 case CSSPropertyMaxZoom: 155 case CSSPropertyMaxZoom:
156 case CSSPropertyMinZoom: 156 case CSSPropertyMinZoom:
157 case CSSPropertyZoom: 157 case CSSPropertyZoom:
158 return percentValue; 158 return percentValue;
159 default: 159 default:
160 ASSERT_NOT_REACHED(); 160 ASSERT_NOT_REACHED();
(...skipping 28 matching lines...) Expand all
189 189
190 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); 190 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id);
191 if (!value || !value->isPrimitiveValue()) 191 if (!value || !value->isPrimitiveValue())
192 return Length(); // auto 192 return Length(); // auto
193 193
194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
195 195
196 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) 196 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom)
197 return Length(ExtendToZoom); 197 return Length(ExtendToZoom);
198 198
199 LayoutStyle* documentStyle = m_document->mutableLayoutStyle(); 199 ComputedStyle* documentStyle = m_document->mutableComputedStyle();
200 200
201 // If we have viewport units the conversion will mark the document style as having viewport units. 201 // If we have viewport units the conversion will mark the document style as having viewport units.
202 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); 202 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits();
203 documentStyle->setHasViewportUnits(false); 203 documentStyle->setHasViewportUnits(false);
204 204
205 FrameView* view = m_document->view(); 205 FrameView* view = m_document->view();
206 float width = view ? view->width() : 0; 206 float width = view ? view->width() : 0;
207 float height = view ? view->height() : 0; 207 float height = view ? view->height() : 0;
208 208
209 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ; 209 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ;
(...skipping 10 matching lines...) Expand all
220 return result; 220 return result;
221 } 221 }
222 222
223 DEFINE_TRACE(ViewportStyleResolver) 223 DEFINE_TRACE(ViewportStyleResolver)
224 { 224 {
225 visitor->trace(m_propertySet); 225 visitor->trace(m_propertySet);
226 visitor->trace(m_document); 226 visitor->trace(m_document);
227 } 227 }
228 228
229 } // namespace blink 229 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResourceLoader.cpp ('k') | Source/core/dom/CSSSelectorWatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698