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

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

Issue 16826008: [css-device-adapt] Implemented spec changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected expectations for tests added after original upload. Created 7 years, 5 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) 2012 Intel Corporation. All rights reserved. 2 * Copyright (C) 2012 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return primitiveValue->getFloatValue(); 116 return primitiveValue->getFloatValue();
117 117
118 if (primitiveValue->isFontRelativeLength()) 118 if (primitiveValue->isFontRelativeLength())
119 return primitiveValue->getFloatValue() * m_document->renderStyle()->font Description().computedSize(); 119 return primitiveValue->getFloatValue() * m_document->renderStyle()->font Description().computedSize();
120 120
121 if (primitiveValue->isPercentage()) { 121 if (primitiveValue->isPercentage()) {
122 float percentValue = primitiveValue->getFloatValue() / 100.0f; 122 float percentValue = primitiveValue->getFloatValue() / 100.0f;
123 switch (id) { 123 switch (id) {
124 case CSSPropertyMaxHeight: 124 case CSSPropertyMaxHeight:
125 case CSSPropertyMinHeight: 125 case CSSPropertyMinHeight:
126 ASSERT(m_document->initialViewportSize().height() > 0);
127 return percentValue * m_document->initialViewportSize().height(); 126 return percentValue * m_document->initialViewportSize().height();
128 case CSSPropertyMaxWidth: 127 case CSSPropertyMaxWidth:
129 case CSSPropertyMinWidth: 128 case CSSPropertyMinWidth:
130 ASSERT(m_document->initialViewportSize().width() > 0);
131 return percentValue * m_document->initialViewportSize().width(); 129 return percentValue * m_document->initialViewportSize().width();
132 case CSSPropertyMaxZoom: 130 case CSSPropertyMaxZoom:
133 case CSSPropertyMinZoom: 131 case CSSPropertyMinZoom:
134 case CSSPropertyZoom: 132 case CSSPropertyZoom:
135 return percentValue; 133 return percentValue;
136 default: 134 default:
137 ASSERT_NOT_REACHED(); 135 ASSERT_NOT_REACHED();
138 break; 136 break;
139 } 137 }
140 } 138 }
141 139
142 switch (primitiveValue->getValueID()) { 140 switch (primitiveValue->getValueID()) {
143 case CSSValueAuto: 141 case CSSValueAuto:
144 return defaultValue; 142 return defaultValue;
145 case CSSValueLandscape: 143 case CSSValueLandscape:
146 return ViewportArguments::ValueLandscape; 144 return ViewportArguments::ValueLandscape;
147 case CSSValuePortrait: 145 case CSSValuePortrait:
148 return ViewportArguments::ValuePortrait; 146 return ViewportArguments::ValuePortrait;
149 case CSSValueZoom: 147 case CSSValueZoom:
150 return defaultValue; 148 return defaultValue;
151 case CSSValueFixed: 149 case CSSValueFixed:
152 return 0; 150 return 0;
153 default: 151 default:
154 return defaultValue; 152 return defaultValue;
155 } 153 }
156 } 154 }
157 155
158 } // namespace WebCore 156 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt ('k') | Source/core/dom/ViewportArguments.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698