Changeset 183404 in webkit
- Timestamp:
- Apr 27, 2015 11:42:29 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183399 r183404 1 2015-04-27 Yoav Weiss <yoav@yoav.ws> 2 3 Fix viewport units in Media Queries 4 https://bugs.webkit.org/show_bug.cgi?id=144260 5 6 Reviewed by Darin Adler. 7 8 These tests make sure that viewport units are working as expected inside of Media Queries. 9 10 * fast/media/mq-viewport-units-expected.txt: Added. 11 * fast/media/mq-viewport-units.html: Added. 12 1 13 2015-04-27 Javier Fernandez <jfernandez@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r183399 r183404 1 2015-04-27 Yoav Weiss <yoav@yoav.ws> 2 3 Fix viewport units in Media Queries 4 https://bugs.webkit.org/show_bug.cgi?id=144260 5 6 Reviewed by Darin Adler. 7 8 This patch makes sure that viewport units are considered "length units" 9 in the context of Media Queries, by having MediaQueryExp use the unit logic 10 that is in CSSPrimitiveValue. 11 It does that by turning the relevant methods in CSSPrimitiveValue into static. 12 13 It also makes sure that the logic for "resolution units" is not maintained separately 14 in MediaQueryExp, to avoid similiar issues in the future with resolution units. 15 16 Test: fast/media/mq-viewport-units.html 17 18 * css/CSSPrimitiveValue.h: 19 (WebCore::CSSPrimitiveValue::isViewportPercentageLength): Added a static variant. 20 (WebCore::CSSPrimitiveValue::isLength): Added a static variant. 21 (WebCore::CSSPrimitiveValue::isResolution): Added a static variant. 22 * css/MediaQueryExp.cpp: 23 (WebCore::featureWithValidPositiveLenghtOrNumber): Call CSSPrimitiveValue's length unit logic. 24 (WebCore::featureWithValidDensity): Call CSSPrimitiveValue's resolution unit logic. 25 1 26 2015-04-27 Javier Fernandez <jfernandez@igalia.com> 2 27 -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r182364 r183404 189 189 || m_primitiveUnitType == CSS_CHS; 190 190 } 191 bool isLength() const 192 { 193 unsigned short type = primitiveType(); 194 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength(); 195 } 191 192 static bool isViewportPercentageLength(unsigned short type) { return type >= CSS_VW && type <= CSS_VMAX; } 193 bool isViewportPercentageLength() const { return isViewportPercentageLength(m_primitiveUnitType); } 194 195 static bool isLength(unsigned short type) 196 { 197 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength(type); 198 } 199 200 bool isLength() const { return isLength(primitiveType()); } 196 201 bool isNumber() const { return primitiveType() == CSS_NUMBER; } 197 202 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } … … 213 218 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } 214 219 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } 215 bool isResolution() const 216 {217 unsigned short type = primitiveType();220 221 static bool isResolution(unsigned short type) 222 { 218 223 return type >= CSS_DPPX && type <= CSS_DPCM; 219 224 } 220 225 221 bool is ViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMAX; }226 bool isResolution() const { return isResolution(primitiveType()); } 222 227 bool isViewportPercentageWidth() const { return m_primitiveUnitType == CSS_VW; } 223 228 bool isViewportPercentageHeight() const { return m_primitiveUnitType == CSS_VH; } -
trunk/Source/WebCore/css/MediaQueryExp.cpp
r179476 r183404 55 55 static inline bool featureWithValidPositiveLenghtOrNumber(const AtomicString& mediaFeature, const CSSParserValue* value) 56 56 { 57 if (!( ((value->unit >= CSSPrimitiveValue::CSS_EMS && value->unit <= CSSPrimitiveValue::CSS_PC) || value->unit == CSSPrimitiveValue::CSS_REMS) || value->unit == CSSPrimitiveValue::CSS_NUMBER) || value->fValue < 0)57 if (!(CSSPrimitiveValue::isLength(value->unit) || value->unit == CSSPrimitiveValue::CSS_NUMBER) || value->fValue < 0) 58 58 return false; 59 59 … … 74 74 static inline bool featureWithValidDensity(const AtomicString& mediaFeature, const CSSParserValue* value) 75 75 { 76 if ( (value->unit != CSSPrimitiveValue::CSS_DPPX && value->unit != CSSPrimitiveValue::CSS_DPI && value->unit != CSSPrimitiveValue::CSS_DPCM) || value->fValue <= 0)76 if (!CSSPrimitiveValue::isResolution(value->unit) || value->fValue <= 0) 77 77 return false; 78 78
Note: See TracChangeset
for help on using the changeset viewer.