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

Side by Side Diff: Source/core/html/HTMLMetaElement-in.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased.. 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 reportViewportWarning(TruncatedViewportArgumentValueError, valueString, keyString); 163 reportViewportWarning(TruncatedViewportArgumentValueError, valueString, keyString);
164 if (ok) 164 if (ok)
165 *ok = true; 165 *ok = true;
166 return value; 166 return value;
167 } 167 }
168 168
169 Length HTMLMetaElement::parseViewportValueAsLength(const String& keyString, cons t String& valueString) 169 Length HTMLMetaElement::parseViewportValueAsLength(const String& keyString, cons t String& valueString)
170 { 170 {
171 // 1) Non-negative number values are translated to px lengths. 171 // 1) Non-negative number values are translated to px lengths.
172 // 2) Negative number values are translated to auto. 172 // 2) Negative number values are translated to auto.
173 // 3) device-width and device-height are used as keywords. 173 // FIXME: We shouldn't abuse Lengths like this
174 // 3) device-width and device-height are translated to -1% and -2%
esprehn 2013/12/04 06:02:28 Woah.
174 // 4) Other keywords and unknown values translate to 0.0. 175 // 4) Other keywords and unknown values translate to 0.0.
175 176
176 unsigned length = valueString.length(); 177 unsigned length = valueString.length();
177 DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 13); 178 DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 13);
178 SWITCH(characters, length) { 179 SWITCH(characters, length) {
179 CASE("device-width") { 180 CASE("device-width") {
180 return Length(100, ViewportPercentageWidth); 181 return Length(-1, Percent);
181 } 182 }
182 CASE("device-height") { 183 CASE("device-height") {
183 return Length(100, ViewportPercentageHeight); 184 return Length(-2, Percent);
184 } 185 }
185 } 186 }
186 187
187 float value = parsePositiveNumber(keyString, valueString); 188 float value = parsePositiveNumber(keyString, valueString);
188 189
189 if (value < 0) 190 if (value < 0)
190 return Length(); // auto 191 return Length(); // auto
191 192
192 return Length(clampLengthValue(value), Fixed); 193 return Length(clampLengthValue(value), Fixed);
193 } 194 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 { 481 {
481 return getAttribute(http_equivAttr); 482 return getAttribute(http_equivAttr);
482 } 483 }
483 484
484 String HTMLMetaElement::name() const 485 String HTMLMetaElement::name() const
485 { 486 {
486 return getNameAttribute(); 487 return getNameAttribute();
487 } 488 }
488 489
489 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698