haikuwebkit/LayoutTests/fast/media/mq-any-hover-invalid.html

33 lines
907 B
HTML
Raw Permalink Normal View History

Add pointer/hover media queries https://bugs.webkit.org/show_bug.cgi?id=134822 Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-01-23 Reviewed by Antti Koivisto. Source/WebCore: Media Queries Level 4 introduces two types of Interaction Media Features: "pointer" and "hover". Those media features are useful for adapting the design to the type of input: http://dev.w3.org/csswg/mediaqueries-4/#mf-interaction This implementation is trivial: just #ifdef the return value depending on the support for touch events. In the future we should move that to a client interface but let's start easy for now. Tests: fast/media/mq-any-hover-cssom.html fast/media/mq-any-hover-invalid.html fast/media/mq-any-hover-matchMedia.html fast/media/mq-any-hover-styling.html fast/media/mq-any-pointer-cssom.html fast/media/mq-any-pointer-invalid.html fast/media/mq-any-pointer-matchMedia.html fast/media/mq-any-pointer-styling.html fast/media/mq-hover-cssom.html fast/media/mq-hover-invalid.html fast/media/mq-hover-matchMedia.html fast/media/mq-hover-styling.html fast/media/mq-pointer-cssom.html fast/media/mq-pointer-invalid.html fast/media/mq-pointer-matchMedia.html fast/media/mq-pointer-styling.html * css/CSSValueKeywords.in: * css/MediaFeatureNames.h: * css/MediaQueryEvaluator.cpp: (WebCore::hoverMediaFeatureEval): (WebCore::any_hoverMediaFeatureEval): (WebCore::pointerMediaFeatureEval): (WebCore::any_pointerMediaFeatureEval): (WebCore::leastCapablePrimaryPointerDeviceType): Deleted. * css/MediaQueryExp.cpp: (WebCore::featureWithCSSValueID): (WebCore::featureWithZeroOrOne): (WebCore::featureWithoutValue): * page/EventHandler.cpp: (WebCore::EventHandler::dispatchFakeMouseMoveEventSoon): (WebCore::EventHandler::fakeMouseMoveEventTimerFired): * page/Settings.in: LayoutTests: * fast/media/mq-any-hover-cssom-expected.txt: Added. * fast/media/mq-any-hover-cssom.html: Added. * fast/media/mq-any-hover-invalid-expected.txt: Added. * fast/media/mq-any-hover-invalid.html: Added. * fast/media/mq-any-hover-matchMedia-expected.txt: Added. * fast/media/mq-any-hover-matchMedia.html: Added. * fast/media/mq-any-hover-styling-expected.txt: Added. * fast/media/mq-any-hover-styling.html: Added. * fast/media/mq-any-pointer-cssom-expected.txt: Added. * fast/media/mq-any-pointer-cssom.html: Added. * fast/media/mq-any-pointer-invalid-expected.txt: Added. * fast/media/mq-any-pointer-invalid.html: Added. * fast/media/mq-any-pointer-matchMedia-expected.txt: Added. * fast/media/mq-any-pointer-matchMedia.html: Added. * fast/media/mq-any-pointer-styling-expected.txt: Added. * fast/media/mq-any-pointer-styling.html: Added. * fast/media/mq-hover-cssom-expected.txt: Added. * fast/media/mq-hover-cssom.html: Added. * fast/media/mq-hover-invalid-expected.txt: Added. * fast/media/mq-hover-invalid.html: Added. * fast/media/mq-hover-matchMedia-expected.txt: Added. * fast/media/mq-hover-matchMedia.html: Added. * fast/media/mq-hover-styling-expected.txt: Added. * fast/media/mq-hover-styling.html: Added. * fast/media/mq-pointer-cssom-expected.txt: Added. * fast/media/mq-pointer-cssom.html: Added. * fast/media/mq-pointer-expected.txt: * fast/media/mq-pointer-invalid-expected.txt: Added. * fast/media/mq-pointer-invalid.html: Added. * fast/media/mq-pointer-matchMedia-expected.txt: Added. * fast/media/mq-pointer-matchMedia.html: Added. * fast/media/mq-pointer-styling-expected.txt: Added. * fast/media/mq-pointer-styling.html: Added. * fast/media/mq-pointer.html: * platform/ios-simulator/fast/media/mq-any-hover-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-hover-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-pointer-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-pointer-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-hover-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-hover-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-styling-expected.txt: Added. Canonical link: https://commits.webkit.org/158838@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-24 04:15:56 +00:00
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<style id="target-style"></style>
<script>
description("Test invalid input with the any-hover media feature.")
var testCases = [
"any-hover:",
"any-hover: ",
"any-hover: WebKit",
"any-hover: fine",
"any-hover: portrait",
"any-hover: \\\"None\\\"",
"any-hover: 'None'",
];
var targetStyle = document.getElementById('target-style');
for (var testCase of testCases) {
var testString = 'window.matchMedia("(' + testCase + ')").matches';
shouldBeFalse('window.matchMedia("(' + testCase + ')").matches');
targetStyle.innerText = "@media " + testCase + " { }";
shouldBe("document.styleSheets[1].cssRules[0].media.length", "1");
Add pointer/hover media queries https://bugs.webkit.org/show_bug.cgi?id=134822 Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-01-23 Reviewed by Antti Koivisto. Source/WebCore: Media Queries Level 4 introduces two types of Interaction Media Features: "pointer" and "hover". Those media features are useful for adapting the design to the type of input: http://dev.w3.org/csswg/mediaqueries-4/#mf-interaction This implementation is trivial: just #ifdef the return value depending on the support for touch events. In the future we should move that to a client interface but let's start easy for now. Tests: fast/media/mq-any-hover-cssom.html fast/media/mq-any-hover-invalid.html fast/media/mq-any-hover-matchMedia.html fast/media/mq-any-hover-styling.html fast/media/mq-any-pointer-cssom.html fast/media/mq-any-pointer-invalid.html fast/media/mq-any-pointer-matchMedia.html fast/media/mq-any-pointer-styling.html fast/media/mq-hover-cssom.html fast/media/mq-hover-invalid.html fast/media/mq-hover-matchMedia.html fast/media/mq-hover-styling.html fast/media/mq-pointer-cssom.html fast/media/mq-pointer-invalid.html fast/media/mq-pointer-matchMedia.html fast/media/mq-pointer-styling.html * css/CSSValueKeywords.in: * css/MediaFeatureNames.h: * css/MediaQueryEvaluator.cpp: (WebCore::hoverMediaFeatureEval): (WebCore::any_hoverMediaFeatureEval): (WebCore::pointerMediaFeatureEval): (WebCore::any_pointerMediaFeatureEval): (WebCore::leastCapablePrimaryPointerDeviceType): Deleted. * css/MediaQueryExp.cpp: (WebCore::featureWithCSSValueID): (WebCore::featureWithZeroOrOne): (WebCore::featureWithoutValue): * page/EventHandler.cpp: (WebCore::EventHandler::dispatchFakeMouseMoveEventSoon): (WebCore::EventHandler::fakeMouseMoveEventTimerFired): * page/Settings.in: LayoutTests: * fast/media/mq-any-hover-cssom-expected.txt: Added. * fast/media/mq-any-hover-cssom.html: Added. * fast/media/mq-any-hover-invalid-expected.txt: Added. * fast/media/mq-any-hover-invalid.html: Added. * fast/media/mq-any-hover-matchMedia-expected.txt: Added. * fast/media/mq-any-hover-matchMedia.html: Added. * fast/media/mq-any-hover-styling-expected.txt: Added. * fast/media/mq-any-hover-styling.html: Added. * fast/media/mq-any-pointer-cssom-expected.txt: Added. * fast/media/mq-any-pointer-cssom.html: Added. * fast/media/mq-any-pointer-invalid-expected.txt: Added. * fast/media/mq-any-pointer-invalid.html: Added. * fast/media/mq-any-pointer-matchMedia-expected.txt: Added. * fast/media/mq-any-pointer-matchMedia.html: Added. * fast/media/mq-any-pointer-styling-expected.txt: Added. * fast/media/mq-any-pointer-styling.html: Added. * fast/media/mq-hover-cssom-expected.txt: Added. * fast/media/mq-hover-cssom.html: Added. * fast/media/mq-hover-invalid-expected.txt: Added. * fast/media/mq-hover-invalid.html: Added. * fast/media/mq-hover-matchMedia-expected.txt: Added. * fast/media/mq-hover-matchMedia.html: Added. * fast/media/mq-hover-styling-expected.txt: Added. * fast/media/mq-hover-styling.html: Added. * fast/media/mq-pointer-cssom-expected.txt: Added. * fast/media/mq-pointer-cssom.html: Added. * fast/media/mq-pointer-expected.txt: * fast/media/mq-pointer-invalid-expected.txt: Added. * fast/media/mq-pointer-invalid.html: Added. * fast/media/mq-pointer-matchMedia-expected.txt: Added. * fast/media/mq-pointer-matchMedia.html: Added. * fast/media/mq-pointer-styling-expected.txt: Added. * fast/media/mq-pointer-styling.html: Added. * fast/media/mq-pointer.html: * platform/ios-simulator/fast/media/mq-any-hover-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-hover-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-pointer-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-any-pointer-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-hover-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-hover-styling-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-matchMedia-expected.txt: Added. * platform/ios-simulator/fast/media/mq-pointer-styling-expected.txt: Added. Canonical link: https://commits.webkit.org/158838@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-24 04:15:56 +00:00
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>