Changeset 200215 in webkit


Ignore:
Timestamp:
Apr 28, 2016 4:13:59 PM (8 years ago)
Author:
Manuel Rego Casasnovas
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.
Location:
trunk
Files:
2 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200214 r200215  
     12016-04-28  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Add CSS Grid Layout runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=157134
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add test to verify that CSS Grid Layout is disabled if the flag is off.
     9
     10        * fast/css-grid-layout/grid-disable-expected.txt: Added.
     11        * fast/css-grid-layout/grid-disable.html: Added.
     12
    1132016-04-28  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r200214 r200215  
     12016-04-28  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Add CSS Grid Layout runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=157134
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add CSS Grid Layout runtime flag enabled by default.
     9        Disable parsing of CSS Grid Layout properties
     10        if the runtime flag is not enabled.
     11        Expose runtime flag through internals to verify that
     12        it's working as expected.
     13
     14        Test: fast/css-grid-layout/grid-disable.html
     15
     16        * bindings/generic/RuntimeEnabledFeatures.cpp:
     17        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
     18        * bindings/generic/RuntimeEnabledFeatures.h:
     19        (WebCore::RuntimeEnabledFeatures::setCSSGridLayoutEnabled):
     20        (WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
     21        * css/CSSParser.cpp:
     22        (WebCore::CSSParserContext::CSSParserContext):
     23        (WebCore::operator==):
     24        (WebCore::isValidKeywordPropertyAndValue):
     25        (WebCore::CSSParser::parseValue):
     26        (WebCore::CSSParser::parseIntegerOrCustomIdentFromGridPosition):
     27        (WebCore::CSSParser::parseGridPosition):
     28        (WebCore::CSSParser::parseGridItemPositionShorthand):
     29        (WebCore::CSSParser::parseGridGapShorthand):
     30        (WebCore::CSSParser::parseGridTemplateColumns):
     31        (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
     32        (WebCore::CSSParser::parseGridTemplateShorthand):
     33        (WebCore::CSSParser::parseGridShorthand):
     34        (WebCore::CSSParser::parseGridAreaShorthand):
     35        (WebCore::CSSParser::parseSingleGridAreaLonghand):
     36        (WebCore::CSSParser::parseGridLineNames):
     37        (WebCore::CSSParser::parseGridTrackList):
     38        (WebCore::CSSParser::parseGridTrackRepeatFunction):
     39        (WebCore::CSSParser::parseGridTrackSize):
     40        (WebCore::CSSParser::parseGridBreadth):
     41        (WebCore::CSSParser::parseGridAutoFlow):
     42        (WebCore::CSSParser::parseGridTemplateAreasRow):
     43        (WebCore::CSSParser::parseGridTemplateAreas):
     44        (WebCore::CSSParser::iscSSGridLayoutEnabled):
     45        * css/CSSParser.h:
     46        * css/CSSParserMode.h:
     47        * dom/Document.cpp:
     48        (WebCore::Document::isCSSGridLayoutEnabled):
     49        * dom/Document.h:
     50        * testing/Internals.cpp:
     51        (WebCore::Internals::setCSSGridLayoutEnabled):
     52        * testing/Internals.h:
     53        * testing/Internals.idl:
     54
    1552016-04-28  Chris Fleizach  <cfleizach@apple.com>
    256
  • trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp

    r199779 r200215  
    114114    , m_areWebAnimationsEnabled(false)
    115115#endif
     116#if ENABLE(CSS_GRID_LAYOUT)
     117    , m_cssGridLayoutEnabled(true)
     118#endif
    116119{
    117120}
  • trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h

    r199779 r200215  
    242242#endif
    243243
     244#if ENABLE(CSS_GRID_LAYOUT)
     245    void setCSSGridLayoutEnabled(bool isEnabled) { m_cssGridLayoutEnabled = isEnabled; }
     246    bool isCSSGridLayoutEnabled() const { return m_cssGridLayoutEnabled; }
     247#endif
     248
    244249    WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
    245250
     
    355360#endif
    356361
     362#if ENABLE(CSS_GRID_LAYOUT)
     363    bool m_cssGridLayoutEnabled;
     364#endif
     365
    357366    friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
    358367};
  • trunk/Source/WebCore/css/CSSParser.cpp

    r200043 r200215  
    249249    , isCSSRegionsEnabled(RuntimeEnabledFeatures::sharedFeatures().cssRegionsEnabled())
    250250    , isCSSCompositingEnabled(RuntimeEnabledFeatures::sharedFeatures().cssCompositingEnabled())
     251#if ENABLE(CSS_GRID_LAYOUT)
     252    , cssGridLayoutEnabled(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled())
     253#endif
    251254    , needsSiteSpecificQuirks(false)
    252255    , enforcesCSSMIMETypeInNoQuirksMode(true)
     
    268271    , isCSSRegionsEnabled(document.cssRegionsEnabled())
    269272    , isCSSCompositingEnabled(document.cssCompositingEnabled())
     273#if ENABLE(CSS_GRID_LAYOUT)
     274    , cssGridLayoutEnabled(document.isCSSGridLayoutEnabled())
     275#endif
    270276    , needsSiteSpecificQuirks(document.settings() ? document.settings()->needsSiteSpecificQuirks() : false)
    271277    , enforcesCSSMIMETypeInNoQuirksMode(!document.settings() || document.settings()->enforceCSSMIMETypeInNoQuirksMode())
     
    288294        && a.isCSSRegionsEnabled == b.isCSSRegionsEnabled
    289295        && a.isCSSCompositingEnabled == b.isCSSCompositingEnabled
     296#if ENABLE(CSS_GRID_LAYOUT)
     297        && a.cssGridLayoutEnabled == b.cssGridLayoutEnabled
     298#endif
    290299        && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks
    291300        && a.enforcesCSSMIMETypeInNoQuirksMode == b.enforcesCSSMIMETypeInNoQuirksMode
     
    675684            return true;
    676685#if ENABLE(CSS_GRID_LAYOUT)
    677         if (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid)
     686        if (parserContext.cssGridLayoutEnabled && (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid))
    678687            return true;
    679688#endif
     
    27902799    case CSSPropertyWebkitGridAutoColumns:
    27912800    case CSSPropertyWebkitGridAutoRows:
     2801        if (!isCSSGridLayoutEnabled())
     2802            return false;
    27922803        parsedValue = parseGridTrackSize(*m_valueList);
    27932804        break;
     
    27952806    case CSSPropertyWebkitGridTemplateColumns:
    27962807    case CSSPropertyWebkitGridTemplateRows:
     2808        if (!isCSSGridLayoutEnabled())
     2809            return false;
    27972810        parsedValue = parseGridTrackList();
    27982811        break;
     
    28022815    case CSSPropertyWebkitGridRowStart:
    28032816    case CSSPropertyWebkitGridRowEnd:
     2817        if (!isCSSGridLayoutEnabled())
     2818            return false;
    28042819        parsedValue = parseGridPosition();
    28052820        break;
     
    28072822    case CSSPropertyWebkitGridColumnGap:
    28082823    case CSSPropertyWebkitGridRowGap:
     2824        if (!isCSSGridLayoutEnabled())
     2825            return false;
    28092826        validPrimitive = validateUnit(valueWithCalculation, FLength | FNonNeg);
    28102827        break;
    28112828
    28122829    case CSSPropertyWebkitGridGap:
     2830        if (!isCSSGridLayoutEnabled())
     2831            return false;
    28132832        return parseGridGapShorthand(important);
    28142833
    28152834    case CSSPropertyWebkitGridColumn:
    2816     case CSSPropertyWebkitGridRow: {
     2835    case CSSPropertyWebkitGridRow:
     2836        if (!isCSSGridLayoutEnabled())
     2837            return false;
    28172838        return parseGridItemPositionShorthand(propId, important);
    2818     }
    28192839
    28202840    case CSSPropertyWebkitGridTemplate:
     2841        if (!isCSSGridLayoutEnabled())
     2842            return false;
    28212843        return parseGridTemplateShorthand(important);
    28222844
    28232845    case CSSPropertyWebkitGrid:
     2846        if (!isCSSGridLayoutEnabled())
     2847            return false;
    28242848        return parseGridShorthand(important);
    28252849
    28262850    case CSSPropertyWebkitGridArea:
     2851        if (!isCSSGridLayoutEnabled())
     2852            return false;
    28272853        return parseGridAreaShorthand(important);
    28282854
    28292855    case CSSPropertyWebkitGridTemplateAreas:
     2856        if (!isCSSGridLayoutEnabled())
     2857            return false;
    28302858        parsedValue = parseGridTemplateAreas();
    28312859        break;
    28322860    case CSSPropertyWebkitGridAutoFlow:
     2861        if (!isCSSGridLayoutEnabled())
     2862            return false;
    28332863        parsedValue = parseGridAutoFlow(*m_valueList);
    28342864        break;
     
    54235453bool CSSParser::parseIntegerOrCustomIdentFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName)
    54245454{
     5455    ASSERT(isCSSGridLayoutEnabled());
     5456
    54255457    ValueWithCalculation valueWithCalculation(*m_valueList->current());
    54265458    if (validateUnit(valueWithCalculation, FInteger) && valueWithCalculation.value().fValue) {
     
    54515483RefPtr<CSSValue> CSSParser::parseGridPosition()
    54525484{
     5485    ASSERT(isCSSGridLayoutEnabled());
     5486
    54535487    CSSParserValue* value = m_valueList->current();
    54545488    if (value->id == CSSValueAuto) {
     
    55135547bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool important)
    55145548{
     5549    ASSERT(isCSSGridLayoutEnabled());
     5550
    55155551    ShorthandScope scope(this, shorthandId);
    55165552    const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
     
    55425578bool CSSParser::parseGridGapShorthand(bool important)
    55435579{
     5580    ASSERT(isCSSGridLayoutEnabled());
     5581
    55445582    ShorthandScope scope(this, CSSPropertyWebkitGridGap);
    55455583    ASSERT(shorthandForProperty(CSSPropertyWebkitGridGap).length() == 2);
     
    55795617RefPtr<CSSValue> CSSParser::parseGridTemplateColumns()
    55805618{
     5619    ASSERT(isCSSGridLayoutEnabled());
     5620
    55815621    if (!(m_valueList->current() && isForwardSlashOperator(*m_valueList->current()) && m_valueList->next()))
    55825622        return nullptr;
     
    55925632bool CSSParser::parseGridTemplateRowsAndAreasAndColumns(bool important)
    55935633{
     5634    ASSERT(isCSSGridLayoutEnabled());
     5635
    55945636    // At least template-areas strings must be defined.
    55955637    if (!m_valueList->current() || isForwardSlashOperator(*m_valueList->current()))
     
    56555697bool CSSParser::parseGridTemplateShorthand(bool important)
    56565698{
     5699    ASSERT(isCSSGridLayoutEnabled());
     5700
    56575701    ShorthandScope scope(this, CSSPropertyWebkitGridTemplate);
    56585702    ASSERT(shorthandForProperty(CSSPropertyWebkitGridTemplate).length() == 3);
     
    56995743bool CSSParser::parseGridShorthand(bool important)
    57005744{
     5745    ASSERT(isCSSGridLayoutEnabled());
     5746
    57015747    ShorthandScope scope(this, CSSPropertyWebkitGrid);
    57025748    ASSERT(shorthandForProperty(CSSPropertyWebkitGrid).length() == 8);
     
    57635809bool CSSParser::parseGridAreaShorthand(bool important)
    57645810{
     5811    ASSERT(isCSSGridLayoutEnabled());
     5812
    57655813    ShorthandScope scope(this, CSSPropertyWebkitGridArea);
    57665814    ASSERT(shorthandForProperty(CSSPropertyWebkitGridArea).length() == 4);
     
    58005848bool CSSParser::parseSingleGridAreaLonghand(RefPtr<CSSValue>& property)
    58015849{
     5850    ASSERT(isCSSGridLayoutEnabled());
     5851
    58025852    if (!m_valueList->current())
    58035853        return true;
     
    58155865bool CSSParser::parseGridLineNames(CSSParserValueList& inputList, CSSValueList& valueList, CSSGridLineNamesValue* previousNamedAreaTrailingLineNames)
    58165866{
     5867    ASSERT(isCSSGridLayoutEnabled());
    58175868    ASSERT(inputList.current() && inputList.current()->unit == CSSParserValue::ValueList);
    58185869
     
    58665917RefPtr<CSSValue> CSSParser::parseGridTrackList()
    58675918{
     5919    ASSERT(isCSSGridLayoutEnabled());
     5920
    58685921    CSSParserValue* value = m_valueList->current();
    58695922    if (value->id == CSSValueNone) {
     
    59175970bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list, bool& isAutoRepeat)
    59185971{
     5972    ASSERT(isCSSGridLayoutEnabled());
     5973
    59195974    CSSParserValueList* arguments = m_valueList->current()->function->args.get();
    59205975    if (!arguments || arguments->size() < 3 || !isComma(arguments->valueAt(1)))
     
    59806035RefPtr<CSSValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList, TrackSizeRestriction restriction)
    59816036{
     6037    ASSERT(isCSSGridLayoutEnabled());
     6038
    59826039    CSSParserValue& currentValue = *inputList.current();
    59836040    inputList.next();
     
    60116068RefPtr<CSSPrimitiveValue> CSSParser::parseGridBreadth(CSSParserValue& value, TrackSizeRestriction restriction)
    60126069{
     6070    ASSERT(isCSSGridLayoutEnabled());
     6071
    60136072    if (value.id == CSSValueWebkitMinContent || value.id == CSSValueWebkitMaxContent || value.id == CSSValueAuto) {
    60146073        if (restriction == FixedSizeOnly)
     
    60446103RefPtr<CSSValue> CSSParser::parseGridAutoFlow(CSSParserValueList& inputList)
    60456104{
     6105    ASSERT(isCSSGridLayoutEnabled());
     6106
    60466107    // [ row | column ] || dense
    60476108    CSSParserValue* value = inputList.current();
     
    62646325bool CSSParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const unsigned rowCount, unsigned& columnCount)
    62656326{
     6327    ASSERT(isCSSGridLayoutEnabled());
     6328
    62666329    CSSParserValue* currentValue = m_valueList->current();
    62676330    if (!currentValue || currentValue->unit != CSSPrimitiveValue::CSS_STRING)
     
    63256388RefPtr<CSSValue> CSSParser::parseGridTemplateAreas()
    63266389{
     6390    ASSERT(isCSSGridLayoutEnabled());
     6391
    63276392    if (m_valueList->current() && m_valueList->current()->id == CSSValueNone) {
    63286393        m_valueList->next();
     
    1021310278}
    1021410279
     10280#if ENABLE(CSS_GRID_LAYOUT)
     10281bool CSSParser::isCSSGridLayoutEnabled() const
     10282{
     10283    return m_context.cssGridLayoutEnabled;
     10284}
     10285#endif
     10286
    1021510287#if ENABLE(CSS_REGIONS)
    1021610288
  • trunk/Source/WebCore/css/CSSParser.h

    r199343 r200215  
    209209
    210210#if ENABLE(CSS_GRID_LAYOUT)
     211    bool isCSSGridLayoutEnabled() const;
    211212    RefPtr<CSSValue> parseGridPosition();
    212213    bool parseGridItemPositionShorthand(CSSPropertyID, bool important);
  • trunk/Source/WebCore/css/CSSParserMode.h

    r181209 r200215  
    6767    bool isCSSRegionsEnabled;
    6868    bool isCSSCompositingEnabled;
     69#if ENABLE(CSS_GRID_LAYOUT)
     70    bool cssGridLayoutEnabled;
     71#endif
    6972    bool needsSiteSpecificQuirks;
    7073    bool enforcesCSSMIMETypeInNoQuirksMode;
  • trunk/Source/WebCore/dom/Document.cpp

    r200098 r200215  
    11391139}
    11401140
     1141#if ENABLE(CSS_GRID_LAYOUT)
     1142bool Document::isCSSGridLayoutEnabled() const
     1143{
     1144    return RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled();
     1145}
     1146#endif
     1147
    11411148#if ENABLE(CSS_REGIONS)
    11421149
  • trunk/Source/WebCore/dom/Document.h

    r200098 r200215  
    395395    bool cssRegionsEnabled() const;
    396396    bool cssCompositingEnabled() const;
     397#if ENABLE(CSS_GRID_LAYOUT)
     398    bool isCSSGridLayoutEnabled() const;
     399#endif
    397400#if ENABLE(CSS_REGIONS)
    398401    RefPtr<DOMNamedFlowCollection> webkitGetNamedFlows();
  • trunk/Source/WebCore/testing/Internals.cpp

    r200037 r200215  
    33193319}
    33203320
    3321 }
     3321#if ENABLE(CSS_GRID_LAYOUT)
     3322void Internals::setCSSGridLayoutEnabled(bool enable)
     3323{
     3324    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enable);
     3325}
     3326#endif
     3327
     3328}
  • trunk/Source/WebCore/testing/Internals.h

    r200087 r200215  
    470470    void setLinkPreloadSupport(bool);
    471471
     472#if ENABLE(CSS_GRID_LAYOUT)
     473    void setCSSGridLayoutEnabled(bool);
     474#endif
     475
    472476private:
    473477    explicit Internals(Document&);
  • trunk/Source/WebCore/testing/Internals.idl

    r200087 r200215  
    447447    void setViewportForceAlwaysUserScalable(boolean scalable);
    448448    void setLinkPreloadSupport(boolean scalable);
    449 };
     449
     450#if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
     451    void setCSSGridLayoutEnabled(boolean enable);
     452#endif
     453
     454};
  • trunk/Source/WebKit/mac/ChangeLog

    r200211 r200215  
     12016-04-28  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Add CSS Grid Layout runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=157134
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add CSS Grid Layout runtime flag based on preferences,
     9        enabled by default.
     10
     11        * WebView/WebPreferenceKeysPrivate.h:
     12        * WebView/WebPreferences.mm:
     13        (+[WebPreferences initialize]):
     14        (-[WebPreferences isCSSGridLayoutEnabled]):
     15        (-[WebPreferences setCSSGridLayoutEnabled:]):
     16        * WebView/WebPreferencesPrivate.h:
     17        * WebView/WebView.mm:
     18        (-[WebView _preferencesChanged:]):
     19
    1202016-04-28  Daniel Bates  <dabates@apple.com>
    221
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r199571 r200215  
    165165#define WebKitFetchAPIEnabledPreferenceKey @"WebKitFetchAPIEnabled"
    166166#define WebKitDownloadAttributeEnabledPreferenceKey @"WebKitDownloadAttributeEnabled"
     167#define WebKitCSSGridLayoutEnabledPreferenceKey @"WebKitCSSGridLayoutEnabled"
    167168
    168169#if !TARGET_OS_IPHONE
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r199571 r200215  
    620620        [NSNumber numberWithBool:NO], WebKitDownloadAttributeEnabledPreferenceKey,
    621621#endif
     622#if ENABLE(CSS_GRID_LAYOUT)
     623        [NSNumber numberWithBool:YES], WebKitCSSGridLayoutEnabledPreferenceKey,
     624#endif
    622625        nil];
    623626
     
    27402743}
    27412744
     2745- (BOOL)isCSSGridLayoutEnabled
     2746{
     2747    return [self _boolValueForKey:WebKitCSSGridLayoutEnabledPreferenceKey];
     2748}
     2749
     2750- (void)setCSSGridLayoutEnabled:(BOOL)flag
     2751{
     2752    [self _setBoolValue:flag forKey:WebKitCSSGridLayoutEnabledPreferenceKey];
     2753}
     2754
    27422755@end
    27432756
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r199571 r200215  
    491491- (BOOL)downloadAttributeEnabled;
    492492
     493- (void)setCSSGridLayoutEnabled:(BOOL)flag;
     494- (BOOL)isCSSGridLayoutEnabled;
     495
    493496@property (nonatomic) BOOL javaScriptMarkupEnabled;
    494497@property (nonatomic) BOOL mediaDataLoadsAutomatically;
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r200130 r200215  
    24942494#endif
    24952495
     2496#if ENABLE(CSS_GRID_LAYOUT)
     2497    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled([preferences isCSSGridLayoutEnabled]);
     2498#endif
     2499
    24962500    NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
    24972501    if (timeout > 0)
  • trunk/Source/WebKit2/ChangeLog

    r200201 r200215  
     12016-04-28  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Add CSS Grid Layout runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=157134
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add CSS Grid Layout runtime flag based on preferences,
     9        enabled by default.
     10
     11        * Shared/WebPreferencesDefinitions.h:
     12        * UIProcess/API/C/WKPreferences.cpp:
     13        (WKPreferencesSetCSSGridLayoutEnabled):
     14        (WKPreferencesGetCSSGridLayoutEnabled):
     15        * UIProcess/API/C/WKPreferencesRefPrivate.h:
     16        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     17        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
     18        * WebProcess/WebPage/WebPage.cpp:
     19        (WebKit::WebPage::updatePreferences):
     20
    1212016-04-28  Daniel Bates  <dabates@apple.com>
    222
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r200116 r200215  
    282282    macro(ExperimentalShadowDOMEnabled, experimentalShadowDOMEnabled, Bool, bool, false, "Shadow DOM", "Support for the Shadow DOM feature") \
    283283    macro(ExperimentalWebGL2Enabled, experimentalWebGL2Enabled, Bool, bool, false, "WebGL 2.0", "Prototype WebGL 2 Support") \
     284    macro(CSSGridLayoutEnabled, cssGridLayoutEnabled, Bool, bool, true, "", "") \
    284285    \
    285286
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r200193 r200215  
    15411541    return toImpl(preferencesRef)->downloadAttributeEnabled();
    15421542}
     1543
     1544void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef, bool flag)
     1545{
     1546    toImpl(preferencesRef)->setCSSGridLayoutEnabled(flag);
     1547}
     1548
     1549bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef)
     1550{
     1551    return toImpl(preferencesRef)->cssGridLayoutEnabled();
     1552}
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h

    r199571 r200215  
    432432WK_EXPORT bool WKPreferencesGetDownloadAttributeEnabled(WKPreferencesRef);
    433433
     434// Defaults to true
     435WK_EXPORT void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef, bool flag);
     436WK_EXPORT bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef);
     437
    434438#ifdef __cplusplus
    435439}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r199571 r200215  
    218218        RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled(enabled);
    219219#endif
    220    
     220
     221#if ENABLE(CSS_GRID_LAYOUT)
     222    if (preference == "WebKitCSSGridLayoutEnabled")
     223        RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enabled);
     224#endif
     225
    221226    // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
    222227#define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r200116 r200215  
    31193119#endif
    31203120
     3121#if ENABLE(CSS_GRID_LAYOUT)
     3122    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey()));
     3123#endif
     3124
    31213125    bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
    31223126    if (m_processSuppressionEnabled != processSuppressionEnabled) {
Note: See TracChangeset for help on using the changeset viewer.