Title: [184101] releases/WebKitGTK/webkit-2.8
- Revision
- 184101
- Author
- [email protected]
- Date
- 2015-05-11 08:30:55 -0700 (Mon, 11 May 2015)
Log Message
Merge r183404 - Fix viewport units in Media Queries
https://bugs.webkit.org/show_bug.cgi?id=144260
Reviewed by Darin Adler.
Source/WebCore:
This patch makes sure that viewport units are considered "length units"
in the context of Media Queries, by having MediaQueryExp use the unit logic
that is in CSSPrimitiveValue.
It does that by turning the relevant methods in CSSPrimitiveValue into static.
It also makes sure that the logic for "resolution units" is not maintained separately
in MediaQueryExp, to avoid similiar issues in the future with resolution units.
Test: fast/media/mq-viewport-units.html
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isViewportPercentageLength): Added a static variant.
(WebCore::CSSPrimitiveValue::isLength): Added a static variant.
(WebCore::CSSPrimitiveValue::isResolution): Added a static variant.
* css/MediaQueryExp.cpp:
(WebCore::featureWithValidPositiveLenghtOrNumber): Call CSSPrimitiveValue's length unit logic.
(WebCore::featureWithValidDensity): Call CSSPrimitiveValue's resolution unit logic.
LayoutTests:
These tests make sure that viewport units are working as expected inside of Media Queries.
* fast/media/mq-viewport-units-expected.txt: Added.
* fast/media/mq-viewport-units.html: Added.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (184100 => 184101)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog 2015-05-11 15:18:07 UTC (rev 184100)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog 2015-05-11 15:30:55 UTC (rev 184101)
@@ -1,3 +1,15 @@
+2015-04-27 Yoav Weiss <[email protected]>
+
+ Fix viewport units in Media Queries
+ https://bugs.webkit.org/show_bug.cgi?id=144260
+
+ Reviewed by Darin Adler.
+
+ These tests make sure that viewport units are working as expected inside of Media Queries.
+
+ * fast/media/mq-viewport-units-expected.txt: Added.
+ * fast/media/mq-viewport-units.html: Added.
+
2015-04-24 Brady Eidson <[email protected]>
Origin header is preserved on cross-origin redirects.
Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units-expected.txt (0 => 184101)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units-expected.txt 2015-05-11 15:30:55 UTC (rev 184101)
@@ -0,0 +1,10 @@
+Description
+
+This tests validates that the viewport units work in media queries.
+
+
+PASS vw unit sanity check
+PASS vh unit sanity check
+PASS vmax unit sanity check
+PASS vmin unit sanity check
+
Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units.html (0 => 184101)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units.html (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/media/mq-viewport-units.html 2015-05-11 15:30:55 UTC (rev 184101)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Media Queries - viewport units support</title>
+ <script src=""
+ <script src=""
+ <script>
+ test(function(){
+ assert_true(matchMedia('(max-width: 100vw)').matches);
+ }, "vw unit sanity check");
+ test(function(){
+ assert_true(matchMedia('(max-height: 100vh)').matches);
+ }, "vh unit sanity check");
+ test(function(){
+ assert_true(matchMedia('(max-width: 100vmax)').matches);
+ }, "vmax unit sanity check");
+ test(function(){
+ assert_true(matchMedia('(max-height: 100vmin)').matches);
+ }, "vmin unit sanity check");
+ </script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>This tests validates that the viewport units work in media queries.</p>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184100 => 184101)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-05-11 15:18:07 UTC (rev 184100)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-05-11 15:30:55 UTC (rev 184101)
@@ -1,3 +1,28 @@
+2015-04-27 Yoav Weiss <[email protected]>
+
+ Fix viewport units in Media Queries
+ https://bugs.webkit.org/show_bug.cgi?id=144260
+
+ Reviewed by Darin Adler.
+
+ This patch makes sure that viewport units are considered "length units"
+ in the context of Media Queries, by having MediaQueryExp use the unit logic
+ that is in CSSPrimitiveValue.
+ It does that by turning the relevant methods in CSSPrimitiveValue into static.
+
+ It also makes sure that the logic for "resolution units" is not maintained separately
+ in MediaQueryExp, to avoid similiar issues in the future with resolution units.
+
+ Test: fast/media/mq-viewport-units.html
+
+ * css/CSSPrimitiveValue.h:
+ (WebCore::CSSPrimitiveValue::isViewportPercentageLength): Added a static variant.
+ (WebCore::CSSPrimitiveValue::isLength): Added a static variant.
+ (WebCore::CSSPrimitiveValue::isResolution): Added a static variant.
+ * css/MediaQueryExp.cpp:
+ (WebCore::featureWithValidPositiveLenghtOrNumber): Call CSSPrimitiveValue's length unit logic.
+ (WebCore::featureWithValidDensity): Call CSSPrimitiveValue's resolution unit logic.
+
2015-05-01 Martin Robinson <[email protected]>
[GTK] New CORS tests from r183280 fail on WebKitGTK+
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSPrimitiveValue.h (184100 => 184101)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSPrimitiveValue.h 2015-05-11 15:18:07 UTC (rev 184100)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/css/CSSPrimitiveValue.h 2015-05-11 15:30:55 UTC (rev 184101)
@@ -189,11 +189,16 @@
|| m_primitiveUnitType == CSS_REMS
|| m_primitiveUnitType == CSS_CHS;
}
- bool isLength() const
+
+ static bool isViewportPercentageLength(unsigned short type) { return type >= CSS_VW && type <= CSS_VMAX; }
+ bool isViewportPercentageLength() const { return isViewportPercentageLength(m_primitiveUnitType); }
+
+ static bool isLength(unsigned short type)
{
- unsigned short type = primitiveType();
- return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength();
+ return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength(type);
}
+
+ bool isLength() const { return isLength(primitiveType()); }
bool isNumber() const { return primitiveType() == CSS_NUMBER; }
bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
bool isPx() const { return primitiveType() == CSS_PX; }
@@ -213,13 +218,13 @@
bool isDotsPerInch() const { return primitiveType() == CSS_DPI; }
bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; }
bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; }
- bool isResolution() const
+
+ static bool isResolution(unsigned short type)
{
- unsigned short type = primitiveType();
return type >= CSS_DPPX && type <= CSS_DPCM;
}
- bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMAX; }
+ bool isResolution() const { return isResolution(primitiveType()); }
bool isViewportPercentageWidth() const { return m_primitiveUnitType == CSS_VW; }
bool isViewportPercentageHeight() const { return m_primitiveUnitType == CSS_VH; }
bool isViewportPercentageMax() const { return m_primitiveUnitType == CSS_VMAX; }
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/css/MediaQueryExp.cpp (184100 => 184101)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/css/MediaQueryExp.cpp 2015-05-11 15:18:07 UTC (rev 184100)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/css/MediaQueryExp.cpp 2015-05-11 15:30:55 UTC (rev 184101)
@@ -54,7 +54,7 @@
static inline bool featureWithValidPositiveLenghtOrNumber(const AtomicString& mediaFeature, const CSSParserValue* value)
{
- if (!(((value->unit >= CSSPrimitiveValue::CSS_EMS && value->unit <= CSSPrimitiveValue::CSS_PC) || value->unit == CSSPrimitiveValue::CSS_REMS) || value->unit == CSSPrimitiveValue::CSS_NUMBER) || value->fValue < 0)
+ if (!(CSSPrimitiveValue::isLength(value->unit) || value->unit == CSSPrimitiveValue::CSS_NUMBER) || value->fValue < 0)
return false;
return mediaFeature == MediaFeatureNames::heightMediaFeature
@@ -73,7 +73,7 @@
static inline bool featureWithValidDensity(const AtomicString& mediaFeature, const CSSParserValue* value)
{
- if ((value->unit != CSSPrimitiveValue::CSS_DPPX && value->unit != CSSPrimitiveValue::CSS_DPI && value->unit != CSSPrimitiveValue::CSS_DPCM) || value->fValue <= 0)
+ if (!CSSPrimitiveValue::isResolution(value->unit) || value->fValue <= 0)
return false;
return mediaFeature == MediaFeatureNames::resolutionMediaFeature
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes