Skip to content
Permalink
Browse files
[css-grid] Add CSS Grid Layout runtime flag
https://bugs.webkit.org/show_bug.cgi?id=157134

Reviewed by Simon Fraser.

Source/WebCore:

Add CSS Grid Layout runtime flag enabled by default.
Disable parsing of CSS Grid Layout properties
if the runtime flag is not enabled.
Expose runtime flag through internals to verify that
it's working as expected.

Test: fast/css-grid-layout/grid-disable.html

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setCSSGridLayoutEnabled):
(WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseIntegerOrCustomIdentFromGridPosition):
(WebCore::CSSParser::parseGridPosition):
(WebCore::CSSParser::parseGridItemPositionShorthand):
(WebCore::CSSParser::parseGridGapShorthand):
(WebCore::CSSParser::parseGridTemplateColumns):
(WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
(WebCore::CSSParser::parseGridTemplateShorthand):
(WebCore::CSSParser::parseGridShorthand):
(WebCore::CSSParser::parseGridAreaShorthand):
(WebCore::CSSParser::parseSingleGridAreaLonghand):
(WebCore::CSSParser::parseGridLineNames):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseGridTrackRepeatFunction):
(WebCore::CSSParser::parseGridTrackSize):
(WebCore::CSSParser::parseGridBreadth):
(WebCore::CSSParser::parseGridAutoFlow):
(WebCore::CSSParser::parseGridTemplateAreasRow):
(WebCore::CSSParser::parseGridTemplateAreas):
(WebCore::CSSParser::iscSSGridLayoutEnabled):
* css/CSSParser.h:
* css/CSSParserMode.h:
* dom/Document.cpp:
(WebCore::Document::isCSSGridLayoutEnabled):
* dom/Document.h:
* testing/Internals.cpp:
(WebCore::Internals::setCSSGridLayoutEnabled):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/mac:

Add CSS Grid Layout runtime flag based on preferences,
enabled by default.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences isCSSGridLayoutEnabled]):
(-[WebPreferences setCSSGridLayoutEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add CSS Grid Layout runtime flag based on preferences,
enabled by default.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetCSSGridLayoutEnabled):
(WKPreferencesGetCSSGridLayoutEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

Add test to verify that CSS Grid Layout is disabled if the flag is off.

* fast/css-grid-layout/grid-disable-expected.txt: Added.
* fast/css-grid-layout/grid-disable.html: Added.


Canonical link: https://commits.webkit.org/175261@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mrego committed Apr 28, 2016
1 parent 43cef52 commit 414d14486fba83c350808caf7162d507aa023552
@@ -1,3 +1,15 @@
2016-04-28 Manuel Rego Casasnovas <rego@igalia.com>

[css-grid] Add CSS Grid Layout runtime flag
https://bugs.webkit.org/show_bug.cgi?id=157134

Reviewed by Simon Fraser.

Add test to verify that CSS Grid Layout is disabled if the flag is off.

* fast/css-grid-layout/grid-disable-expected.txt: Added.
* fast/css-grid-layout/grid-disable.html: Added.

2016-04-28 Chris Fleizach <cfleizach@apple.com>

AX: superscript content exposed as plain text; VoiceOver does not speak or pause to make this understandable
@@ -0,0 +1,11 @@
Verifies that CSS Grid Layout does not work if runtime feature is disabled.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS document.getElementById('grid').style.display is ''
PASS document.getElementById('inlinegrid').style.display is ''
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
if (window.internals)
window.internals.setCSSGridLayoutEnabled(false);
</script>

<div id="grid" style="display: -webkit-grid"></div>
<div id="inlinegrid" style="display: -webkit-inline-grid"></div>

<script src="../../resources/js-test-pre.js"></script>
<script>
description("Verifies that CSS Grid Layout does not work if runtime feature is disabled.");

shouldBe("document.getElementById('grid').style.display", "''");
shouldBe("document.getElementById('inlinegrid').style.display", "''");
</script>
<script src="../../resources/js-test-post.js"></script>
@@ -1,3 +1,57 @@
2016-04-28 Manuel Rego Casasnovas <rego@igalia.com>

[css-grid] Add CSS Grid Layout runtime flag
https://bugs.webkit.org/show_bug.cgi?id=157134

Reviewed by Simon Fraser.

Add CSS Grid Layout runtime flag enabled by default.
Disable parsing of CSS Grid Layout properties
if the runtime flag is not enabled.
Expose runtime flag through internals to verify that
it's working as expected.

Test: fast/css-grid-layout/grid-disable.html

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setCSSGridLayoutEnabled):
(WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseIntegerOrCustomIdentFromGridPosition):
(WebCore::CSSParser::parseGridPosition):
(WebCore::CSSParser::parseGridItemPositionShorthand):
(WebCore::CSSParser::parseGridGapShorthand):
(WebCore::CSSParser::parseGridTemplateColumns):
(WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
(WebCore::CSSParser::parseGridTemplateShorthand):
(WebCore::CSSParser::parseGridShorthand):
(WebCore::CSSParser::parseGridAreaShorthand):
(WebCore::CSSParser::parseSingleGridAreaLonghand):
(WebCore::CSSParser::parseGridLineNames):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseGridTrackRepeatFunction):
(WebCore::CSSParser::parseGridTrackSize):
(WebCore::CSSParser::parseGridBreadth):
(WebCore::CSSParser::parseGridAutoFlow):
(WebCore::CSSParser::parseGridTemplateAreasRow):
(WebCore::CSSParser::parseGridTemplateAreas):
(WebCore::CSSParser::iscSSGridLayoutEnabled):
* css/CSSParser.h:
* css/CSSParserMode.h:
* dom/Document.cpp:
(WebCore::Document::isCSSGridLayoutEnabled):
* dom/Document.h:
* testing/Internals.cpp:
(WebCore::Internals::setCSSGridLayoutEnabled):
* testing/Internals.h:
* testing/Internals.idl:

2016-04-28 Chris Fleizach <cfleizach@apple.com>

AX: superscript content exposed as plain text; VoiceOver does not speak or pause to make this understandable
@@ -113,6 +113,9 @@ RuntimeEnabledFeatures::RuntimeEnabledFeatures()
#if ENABLE(WEB_ANIMATIONS)
, m_areWebAnimationsEnabled(false)
#endif
#if ENABLE(CSS_GRID_LAYOUT)
, m_cssGridLayoutEnabled(true)
#endif
{
}

@@ -241,6 +241,11 @@ class RuntimeEnabledFeatures {
bool downloadAttributeEnabled() const { return m_isDownloadAttributeEnabled; }
#endif

#if ENABLE(CSS_GRID_LAYOUT)
void setCSSGridLayoutEnabled(bool isEnabled) { m_cssGridLayoutEnabled = isEnabled; }
bool isCSSGridLayoutEnabled() const { return m_cssGridLayoutEnabled; }
#endif

WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();

private:
@@ -354,6 +359,10 @@ class RuntimeEnabledFeatures {
bool m_isDownloadAttributeEnabled { false };
#endif

#if ENABLE(CSS_GRID_LAYOUT)
bool m_cssGridLayoutEnabled;
#endif

friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
};

0 comments on commit 414d144

Please sign in to comment.