Title: [286123] trunk
- Revision
- 286123
- Author
- mmaxfi...@apple.com
- Date
- 2021-11-22 17:46:15 -0800 (Mon, 22 Nov 2021)
Log Message
rem in media queries should be calculated using font-size:initial, not root element font-size
https://bugs.webkit.org/show_bug.cgi?id=156684
<rdar://problem/25778616>
Reviewed by Antti Koivisto.
Source/WebCore:
The CSS spec says:
> Relative units in media queries are based on the initial value, which means that units are never based on results of declarations.
Tests: imported/w3c/web-platform-tests/css/mediaqueries/relative-units-001.html
imported/w3c/web-platform-tests/css/mediaqueries/mq-calc-005.html
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::evaluate const):
LayoutTests:
* TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (286122 => 286123)
--- trunk/LayoutTests/ChangeLog 2021-11-23 00:51:53 UTC (rev 286122)
+++ trunk/LayoutTests/ChangeLog 2021-11-23 01:46:15 UTC (rev 286123)
@@ -1,3 +1,13 @@
+2021-11-22 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ rem in media queries should be calculated using font-size:initial, not root element font-size
+ https://bugs.webkit.org/show_bug.cgi?id=156684
+ <rdar://problem/25778616>
+
+ Reviewed by Antti Koivisto.
+
+ * TestExpectations:
+
2021-11-22 Chris Fleizach <cfleiz...@apple.com>
AX: WebKit: need a method to get visible text and frame of an element on screen
Modified: trunk/LayoutTests/TestExpectations (286122 => 286123)
--- trunk/LayoutTests/TestExpectations 2021-11-23 00:51:53 UTC (rev 286122)
+++ trunk/LayoutTests/TestExpectations 2021-11-23 01:46:15 UTC (rev 286123)
@@ -1485,9 +1485,6 @@
imported/w3c/web-platform-tests/css/mediaqueries/device-aspect-ratio-001.html [ Skip ]
imported/w3c/web-platform-tests/css/mediaqueries/device-aspect-ratio-005.html [ Skip ]
-webkit.org/b/156684 imported/w3c/web-platform-tests/css/mediaqueries/relative-units-001.html [ ImageOnlyFailure ]
-webkit.org/b/156684 imported/w3c/web-platform-tests/css/mediaqueries/mq-calc-005.html [ ImageOnlyFailure ]
-
# nth-child tests takes long time and Debug build sometimes timeouts because there are many test cases.
webkit.org/b/137149 fast/selectors/nth-child-of-basics.html [ Slow ]
Modified: trunk/Source/WebCore/ChangeLog (286122 => 286123)
--- trunk/Source/WebCore/ChangeLog 2021-11-23 00:51:53 UTC (rev 286122)
+++ trunk/Source/WebCore/ChangeLog 2021-11-23 01:46:15 UTC (rev 286123)
@@ -1,3 +1,20 @@
+2021-11-22 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ rem in media queries should be calculated using font-size:initial, not root element font-size
+ https://bugs.webkit.org/show_bug.cgi?id=156684
+ <rdar://problem/25778616>
+
+ Reviewed by Antti Koivisto.
+
+ The CSS spec says:
+ > Relative units in media queries are based on the initial value, which means that units are never based on results of declarations.
+
+ Tests: imported/w3c/web-platform-tests/css/mediaqueries/relative-units-001.html
+ imported/w3c/web-platform-tests/css/mediaqueries/mq-calc-005.html
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::MediaQueryEvaluator::evaluate const):
+
2021-11-22 Cameron McCormack <hey...@apple.com>
Fix some license find/replace errors
Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (286122 => 286123)
--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2021-11-23 00:51:53 UTC (rev 286122)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2021-11-23 01:46:15 UTC (rev 286123)
@@ -49,6 +49,7 @@
#include "RenderStyle.h"
#include "RenderView.h"
#include "Settings.h"
+#include "StyleFontSizeFunctions.h"
#include "Theme.h"
#include <wtf/HashMap.h>
#include <wtf/text/StringConcatenateNumbers.h>
@@ -926,9 +927,17 @@
if (!document.documentElement())
return false;
+
+ auto defaultStyle = RenderStyle::create();
+ auto fontDescription = defaultStyle.fontDescription();
+ auto size = Style::fontSizeForKeyword(CSSValueMedium, false, document);
+ fontDescription.setComputedSize(size);
+ fontDescription.setSpecifiedSize(size);
+ defaultStyle.setFontDescription(WTFMove(fontDescription));
+ defaultStyle.fontCascade().update();
// Pass `nullptr` for `parentStyle` because we are in the context of a media query.
- return function(_expression_.value(), { m_style, document.documentElement()->renderStyle(), nullptr, document.renderView(), 1, std::nullopt }, *frame, NoPrefix);
+ return function(_expression_.value(), { m_style, &defaultStyle, nullptr, document.renderView(), 1, std::nullopt }, *frame, NoPrefix);
}
bool MediaQueryEvaluator::mediaAttributeMatches(Document& document, const String& attributeValue)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes