Title: [200215] trunk
Revision
200215
Author
[email protected]
Date
2016-04-28 16:13:59 -0700 (Thu, 28 Apr 2016)

Log Message

[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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200214 => 200215)


--- trunk/LayoutTests/ChangeLog	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/LayoutTests/ChangeLog	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1,3 +1,15 @@
+2016-04-28  Manuel Rego Casasnovas  <[email protected]>
+
+        [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  <[email protected]>
 
         AX: superscript content exposed as plain text; VoiceOver does not speak or pause to make this understandable     

Added: trunk/LayoutTests/fast/css-grid-layout/grid-disable-expected.txt (0 => 200215)


--- trunk/LayoutTests/fast/css-grid-layout/grid-disable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-disable-expected.txt	2016-04-28 23:13:59 UTC (rev 200215)
@@ -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
+

Added: trunk/LayoutTests/fast/css-grid-layout/grid-disable.html (0 => 200215)


--- trunk/LayoutTests/fast/css-grid-layout/grid-disable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-disable.html	2016-04-28 23:13:59 UTC (rev 200215)
@@ -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=""
+<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=""

Modified: trunk/Source/WebCore/ChangeLog (200214 => 200215)


--- trunk/Source/WebCore/ChangeLog	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/ChangeLog	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1,3 +1,57 @@
+2016-04-28  Manuel Rego Casasnovas  <[email protected]>
+
+        [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  <[email protected]>
 
         AX: superscript content exposed as plain text; VoiceOver does not speak or pause to make this understandable

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp (200214 => 200215)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -113,6 +113,9 @@
 #if ENABLE(WEB_ANIMATIONS)
     , m_areWebAnimationsEnabled(false)
 #endif
+#if ENABLE(CSS_GRID_LAYOUT)
+    , m_cssGridLayoutEnabled(true)
+#endif
 {
 }
 

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (200214 => 200215)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -241,6 +241,11 @@
     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 @@
     bool m_isDownloadAttributeEnabled { false };
 #endif
 
+#if ENABLE(CSS_GRID_LAYOUT)
+    bool m_cssGridLayoutEnabled;
+#endif
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebCore/css/CSSParser.cpp (200214 => 200215)


--- trunk/Source/WebCore/css/CSSParser.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -248,6 +248,9 @@
     , isHTMLDocument(false)
     , isCSSRegionsEnabled(RuntimeEnabledFeatures::sharedFeatures().cssRegionsEnabled())
     , isCSSCompositingEnabled(RuntimeEnabledFeatures::sharedFeatures().cssCompositingEnabled())
+#if ENABLE(CSS_GRID_LAYOUT)
+    , cssGridLayoutEnabled(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled())
+#endif
     , needsSiteSpecificQuirks(false)
     , enforcesCSSMIMETypeInNoQuirksMode(true)
     , useLegacyBackgroundSizeShorthandBehavior(false)
@@ -267,6 +270,9 @@
     , isHTMLDocument(document.isHTMLDocument())
     , isCSSRegionsEnabled(document.cssRegionsEnabled())
     , isCSSCompositingEnabled(document.cssCompositingEnabled())
+#if ENABLE(CSS_GRID_LAYOUT)
+    , cssGridLayoutEnabled(document.isCSSGridLayoutEnabled())
+#endif
     , needsSiteSpecificQuirks(document.settings() ? document.settings()->needsSiteSpecificQuirks() : false)
     , enforcesCSSMIMETypeInNoQuirksMode(!document.settings() || document.settings()->enforceCSSMIMETypeInNoQuirksMode())
     , useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() : false)
@@ -287,6 +293,9 @@
         && a.isHTMLDocument == b.isHTMLDocument
         && a.isCSSRegionsEnabled == b.isCSSRegionsEnabled
         && a.isCSSCompositingEnabled == b.isCSSCompositingEnabled
+#if ENABLE(CSS_GRID_LAYOUT)
+        && a.cssGridLayoutEnabled == b.cssGridLayoutEnabled
+#endif
         && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks
         && a.enforcesCSSMIMETypeInNoQuirksMode == b.enforcesCSSMIMETypeInNoQuirksMode
         && a.useLegacyBackgroundSizeShorthandBehavior == b.useLegacyBackgroundSizeShorthandBehavior;
@@ -674,7 +683,7 @@
         if ((valueID >= CSSValueInline && valueID <= CSSValueContents) || valueID == CSSValueNone)
             return true;
 #if ENABLE(CSS_GRID_LAYOUT)
-        if (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid)
+        if (parserContext.cssGridLayoutEnabled && (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid))
             return true;
 #endif
         break;
@@ -2789,11 +2798,15 @@
 #if ENABLE(CSS_GRID_LAYOUT)
     case CSSPropertyWebkitGridAutoColumns:
     case CSSPropertyWebkitGridAutoRows:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         parsedValue = parseGridTrackSize(*m_valueList);
         break;
 
     case CSSPropertyWebkitGridTemplateColumns:
     case CSSPropertyWebkitGridTemplateRows:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         parsedValue = parseGridTrackList();
         break;
 
@@ -2801,35 +2814,52 @@
     case CSSPropertyWebkitGridColumnEnd:
     case CSSPropertyWebkitGridRowStart:
     case CSSPropertyWebkitGridRowEnd:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         parsedValue = parseGridPosition();
         break;
 
     case CSSPropertyWebkitGridColumnGap:
     case CSSPropertyWebkitGridRowGap:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         validPrimitive = validateUnit(valueWithCalculation, FLength | FNonNeg);
         break;
 
     case CSSPropertyWebkitGridGap:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         return parseGridGapShorthand(important);
 
     case CSSPropertyWebkitGridColumn:
-    case CSSPropertyWebkitGridRow: {
+    case CSSPropertyWebkitGridRow:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         return parseGridItemPositionShorthand(propId, important);
-    }
 
     case CSSPropertyWebkitGridTemplate:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         return parseGridTemplateShorthand(important);
 
     case CSSPropertyWebkitGrid:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         return parseGridShorthand(important);
 
     case CSSPropertyWebkitGridArea:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         return parseGridAreaShorthand(important);
 
     case CSSPropertyWebkitGridTemplateAreas:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         parsedValue = parseGridTemplateAreas();
         break;
     case CSSPropertyWebkitGridAutoFlow:
+        if (!isCSSGridLayoutEnabled())
+            return false;
         parsedValue = parseGridAutoFlow(*m_valueList);
         break;
 #endif /* ENABLE(CSS_GRID_LAYOUT) */
@@ -5422,6 +5452,8 @@
 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can be stand alone or with 'span').
 bool CSSParser::parseIntegerOrCustomIdentFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ValueWithCalculation valueWithCalculation(*m_valueList->current());
     if (validateUnit(valueWithCalculation, FInteger) && valueWithCalculation.value().fValue) {
         numericValue = createPrimitiveNumericValue(valueWithCalculation);
@@ -5450,6 +5482,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridPosition()
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     CSSParserValue* value = m_valueList->current();
     if (value->id == CSSValueAuto) {
         m_valueList->next();
@@ -5512,6 +5546,8 @@
 
 bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ShorthandScope scope(this, shorthandId);
     const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
     ASSERT(shorthand.length() == 2);
@@ -5541,6 +5577,8 @@
 
 bool CSSParser::parseGridGapShorthand(bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ShorthandScope scope(this, CSSPropertyWebkitGridGap);
     ASSERT(shorthandForProperty(CSSPropertyWebkitGridGap).length() == 2);
 
@@ -5578,6 +5616,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridTemplateColumns()
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     if (!(m_valueList->current() && isForwardSlashOperator(*m_valueList->current()) && m_valueList->next()))
         return nullptr;
     if (auto columnsValue = parseGridTrackList()) {
@@ -5591,6 +5631,8 @@
 
 bool CSSParser::parseGridTemplateRowsAndAreasAndColumns(bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     // At least template-areas strings must be defined.
     if (!m_valueList->current() || isForwardSlashOperator(*m_valueList->current()))
         return false;
@@ -5654,6 +5696,8 @@
 
 bool CSSParser::parseGridTemplateShorthand(bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ShorthandScope scope(this, CSSPropertyWebkitGridTemplate);
     ASSERT(shorthandForProperty(CSSPropertyWebkitGridTemplate).length() == 3);
 
@@ -5698,6 +5742,8 @@
 
 bool CSSParser::parseGridShorthand(bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ShorthandScope scope(this, CSSPropertyWebkitGrid);
     ASSERT(shorthandForProperty(CSSPropertyWebkitGrid).length() == 8);
 
@@ -5762,6 +5808,8 @@
 
 bool CSSParser::parseGridAreaShorthand(bool important)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     ShorthandScope scope(this, CSSPropertyWebkitGridArea);
     ASSERT(shorthandForProperty(CSSPropertyWebkitGridArea).length() == 4);
 
@@ -5799,6 +5847,8 @@
 
 bool CSSParser::parseSingleGridAreaLonghand(RefPtr<CSSValue>& property)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     if (!m_valueList->current())
         return true;
 
@@ -5814,6 +5864,7 @@
 
 bool CSSParser::parseGridLineNames(CSSParserValueList& inputList, CSSValueList& valueList, CSSGridLineNamesValue* previousNamedAreaTrailingLineNames)
 {
+    ASSERT(isCSSGridLayoutEnabled());
     ASSERT(inputList.current() && inputList.current()->unit == CSSParserValue::ValueList);
 
     CSSParserValueList& identList = *inputList.current()->valueList;
@@ -5865,6 +5916,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridTrackList()
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     CSSParserValue* value = m_valueList->current();
     if (value->id == CSSValueNone) {
         m_valueList->next();
@@ -5916,6 +5969,8 @@
 
 bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list, bool& isAutoRepeat)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     CSSParserValueList* arguments = m_valueList->current()->function->args.get();
     if (!arguments || arguments->size() < 3 || !isComma(arguments->valueAt(1)))
         return false;
@@ -5979,6 +6034,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList, TrackSizeRestriction restriction)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     CSSParserValue& currentValue = *inputList.current();
     inputList.next();
 
@@ -6010,6 +6067,8 @@
 
 RefPtr<CSSPrimitiveValue> CSSParser::parseGridBreadth(CSSParserValue& value, TrackSizeRestriction restriction)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     if (value.id == CSSValueWebkitMinContent || value.id == CSSValueWebkitMaxContent || value.id == CSSValueAuto) {
         if (restriction == FixedSizeOnly)
             return nullptr;
@@ -6043,6 +6102,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridAutoFlow(CSSParserValueList& inputList)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     // [ row | column ] || dense
     CSSParserValue* value = inputList.current();
     if (!value)
@@ -6263,6 +6324,8 @@
 
 bool CSSParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const unsigned rowCount, unsigned& columnCount)
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     CSSParserValue* currentValue = m_valueList->current();
     if (!currentValue || currentValue->unit != CSSPrimitiveValue::CSS_STRING)
         return false;
@@ -6324,6 +6387,8 @@
 
 RefPtr<CSSValue> CSSParser::parseGridTemplateAreas()
 {
+    ASSERT(isCSSGridLayoutEnabled());
+
     if (m_valueList->current() && m_valueList->current()->id == CSSValueNone) {
         m_valueList->next();
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
@@ -10212,6 +10277,13 @@
     return m_context.isCSSCompositingEnabled;
 }
 
+#if ENABLE(CSS_GRID_LAYOUT)
+bool CSSParser::isCSSGridLayoutEnabled() const
+{
+    return m_context.cssGridLayoutEnabled;
+}
+#endif
+
 #if ENABLE(CSS_REGIONS)
 
 // none | <ident>

Modified: trunk/Source/WebCore/css/CSSParser.h (200214 => 200215)


--- trunk/Source/WebCore/css/CSSParser.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/css/CSSParser.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -208,6 +208,7 @@
     bool parseColumnsShorthand(bool important);
 
 #if ENABLE(CSS_GRID_LAYOUT)
+    bool isCSSGridLayoutEnabled() const;
     RefPtr<CSSValue> parseGridPosition();
     bool parseGridItemPositionShorthand(CSSPropertyID, bool important);
     RefPtr<CSSValue> parseGridTemplateColumns();

Modified: trunk/Source/WebCore/css/CSSParserMode.h (200214 => 200215)


--- trunk/Source/WebCore/css/CSSParserMode.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/css/CSSParserMode.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -66,6 +66,9 @@
     bool isHTMLDocument;
     bool isCSSRegionsEnabled;
     bool isCSSCompositingEnabled;
+#if ENABLE(CSS_GRID_LAYOUT)
+    bool cssGridLayoutEnabled;
+#endif
     bool needsSiteSpecificQuirks;
     bool enforcesCSSMIMETypeInNoQuirksMode;
     bool useLegacyBackgroundSizeShorthandBehavior;

Modified: trunk/Source/WebCore/dom/Document.cpp (200214 => 200215)


--- trunk/Source/WebCore/dom/Document.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1138,6 +1138,13 @@
     return RuntimeEnabledFeatures::sharedFeatures().cssCompositingEnabled();
 }
 
+#if ENABLE(CSS_GRID_LAYOUT)
+bool Document::isCSSGridLayoutEnabled() const
+{
+    return RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled();
+}
+#endif
+
 #if ENABLE(CSS_REGIONS)
 
 RefPtr<DOMNamedFlowCollection> Document::webkitGetNamedFlows()

Modified: trunk/Source/WebCore/dom/Document.h (200214 => 200215)


--- trunk/Source/WebCore/dom/Document.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/dom/Document.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -394,6 +394,9 @@
 
     bool cssRegionsEnabled() const;
     bool cssCompositingEnabled() const;
+#if ENABLE(CSS_GRID_LAYOUT)
+    bool isCSSGridLayoutEnabled() const;
+#endif
 #if ENABLE(CSS_REGIONS)
     RefPtr<DOMNamedFlowCollection> webkitGetNamedFlows();
 #endif

Modified: trunk/Source/WebCore/testing/Internals.cpp (200214 => 200215)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -3318,4 +3318,11 @@
     RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(enable);
 }
 
+#if ENABLE(CSS_GRID_LAYOUT)
+void Internals::setCSSGridLayoutEnabled(bool enable)
+{
+    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enable);
 }
+#endif
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (200214 => 200215)


--- trunk/Source/WebCore/testing/Internals.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/testing/Internals.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -469,6 +469,10 @@
     void setViewportForceAlwaysUserScalable(bool);
     void setLinkPreloadSupport(bool);
 
+#if ENABLE(CSS_GRID_LAYOUT)
+    void setCSSGridLayoutEnabled(bool);
+#endif
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (200214 => 200215)


--- trunk/Source/WebCore/testing/Internals.idl	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-04-28 23:13:59 UTC (rev 200215)
@@ -446,4 +446,9 @@
 
     void setViewportForceAlwaysUserScalable(boolean scalable);
     void setLinkPreloadSupport(boolean scalable);
+
+#if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
+    void setCSSGridLayoutEnabled(boolean enable);
+#endif
+
 };

Modified: trunk/Source/WebKit/mac/ChangeLog (200214 => 200215)


--- trunk/Source/WebKit/mac/ChangeLog	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1,3 +1,22 @@
+2016-04-28  Manuel Rego Casasnovas  <[email protected]>
+
+        [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 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:]):
+
 2016-04-28  Daniel Bates  <[email protected]>
 
         Another fix for the Apple Internal OS X build

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (200214 => 200215)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -164,6 +164,7 @@
 #define WebKitCustomElementsEnabledPreferenceKey @"WebKitCustomElementsEnabled"
 #define WebKitFetchAPIEnabledPreferenceKey @"WebKitFetchAPIEnabled"
 #define WebKitDownloadAttributeEnabledPreferenceKey @"WebKitDownloadAttributeEnabled"
+#define WebKitCSSGridLayoutEnabledPreferenceKey @"WebKitCSSGridLayoutEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (200214 => 200215)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-04-28 23:13:59 UTC (rev 200215)
@@ -619,6 +619,9 @@
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
         [NSNumber numberWithBool:NO], WebKitDownloadAttributeEnabledPreferenceKey,
 #endif
+#if ENABLE(CSS_GRID_LAYOUT)
+        [NSNumber numberWithBool:YES], WebKitCSSGridLayoutEnabledPreferenceKey,
+#endif
         nil];
 
 #if !PLATFORM(IOS)
@@ -2739,6 +2742,16 @@
     [self _setBoolValue:flag forKey:WebKitDownloadAttributeEnabledPreferenceKey];
 }
 
+- (BOOL)isCSSGridLayoutEnabled
+{
+    return [self _boolValueForKey:WebKitCSSGridLayoutEnabledPreferenceKey];
+}
+
+- (void)setCSSGridLayoutEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitCSSGridLayoutEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (200214 => 200215)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -490,6 +490,9 @@
 - (void)setDownloadAttributeEnabled:(BOOL)flag;
 - (BOOL)downloadAttributeEnabled;
 
+- (void)setCSSGridLayoutEnabled:(BOOL)flag;
+- (BOOL)isCSSGridLayoutEnabled;
+
 @property (nonatomic) BOOL _javascript_MarkupEnabled;
 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
 @property (nonatomic) BOOL attachmentElementEnabled;

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (200214 => 200215)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-04-28 23:13:59 UTC (rev 200215)
@@ -2493,6 +2493,10 @@
     RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled([preferences downloadAttributeEnabled]);
 #endif
 
+#if ENABLE(CSS_GRID_LAYOUT)
+    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled([preferences isCSSGridLayoutEnabled]);
+#endif
+
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)
         settings.setIncrementalRenderingSuppressionTimeoutInSeconds(timeout);

Modified: trunk/Source/WebKit2/ChangeLog (200214 => 200215)


--- trunk/Source/WebKit2/ChangeLog	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1,3 +1,23 @@
+2016-04-28  Manuel Rego Casasnovas  <[email protected]>
+
+        [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 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):
+
 2016-04-28  Daniel Bates  <[email protected]>
 
         Fix the Apple Internal OS X build

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (200214 => 200215)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -281,6 +281,7 @@
 #define FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(macro) \
     macro(ExperimentalShadowDOMEnabled, experimentalShadowDOMEnabled, Bool, bool, false, "Shadow DOM", "Support for the Shadow DOM feature") \
     macro(ExperimentalWebGL2Enabled, experimentalWebGL2Enabled, Bool, bool, false, "WebGL 2.0", "Prototype WebGL 2 Support") \
+    macro(CSSGridLayoutEnabled, cssGridLayoutEnabled, Bool, bool, true, "", "") \
     \
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (200214 => 200215)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -1540,3 +1540,13 @@
 {
     return toImpl(preferencesRef)->downloadAttributeEnabled();
 }
+
+void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setCSSGridLayoutEnabled(flag);
+}
+
+bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->cssGridLayoutEnabled();
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (200214 => 200215)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-04-28 23:13:59 UTC (rev 200215)
@@ -431,6 +431,10 @@
 WK_EXPORT void WKPreferencesSetDownloadAttributeEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetDownloadAttributeEnabled(WKPreferencesRef);
 
+// Defaults to true
+WK_EXPORT void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (200214 => 200215)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -217,7 +217,12 @@
     if (preference == "WebKitDownloadAttributeEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled(enabled);
 #endif
-    
+
+#if ENABLE(CSS_GRID_LAYOUT)
+    if (preference == "WebKitCSSGridLayoutEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enabled);
+#endif
+
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (200214 => 200215)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-04-28 23:12:37 UTC (rev 200214)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-04-28 23:13:59 UTC (rev 200215)
@@ -3118,6 +3118,10 @@
     RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled(store.getBoolValueForKey(WebPreferencesKey::downloadAttributeEnabledKey()));
 #endif
 
+#if ENABLE(CSS_GRID_LAYOUT)
+    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey()));
+#endif
+
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     if (m_processSuppressionEnabled != processSuppressionEnabled) {
         m_processSuppressionEnabled = processSuppressionEnabled;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to