Commit 52498d7e authored by ojan@chromium.org's avatar ojan@chromium.org
Browse files

Provide a runtime setting to disable position:sticky

https://bugs.webkit.org/show_bug.cgi?id=96827

Reviewed by James Robinson.

Source/WebCore:

Have it be on by default so that only ports that both enable
the define and don't want it on by default need to do something special.

* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::isValidKeywordPropertyAndValue):
* css/CSSParserMode.h:
(CSSParserContext):
* dom/Document.cpp:
(WebCore::Document::cssStickyPositionEnabled):
(WebCore):
* dom/Document.h:
(Document):
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(Settings):
(WebCore::Settings::setCSSStickyPositionEnabled):
(WebCore::Settings::cssStickyPositionEnabled):

Source/WebKit/chromium:

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setCSSStickyPositionEnabled):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128663 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 160c1356
2012-09-14 Ojan Vafai <ojan@chromium.org>
Provide a runtime setting to disable position:sticky
https://bugs.webkit.org/show_bug.cgi?id=96827
Reviewed by James Robinson.
Have it be on by default so that only ports that both enable
the define and don't want it on by default need to do something special.
* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::isValidKeywordPropertyAndValue):
* css/CSSParserMode.h:
(CSSParserContext):
* dom/Document.cpp:
(WebCore::Document::cssStickyPositionEnabled):
(WebCore):
* dom/Document.h:
(Document):
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(Settings):
(WebCore::Settings::setCSSStickyPositionEnabled):
(WebCore::Settings::cssStickyPositionEnabled):
2012-09-14 Simon Fraser <simon.fraser@apple.com>
 
Fix builds with CSS_IMAGE_RESOLUTION enabled after r128656.
......@@ -199,6 +199,7 @@ CSSParserContext::CSSParserContext(CSSParserMode mode, const KURL& baseURL)
, mode(mode)
, isHTMLDocument(false)
, isCSSCustomFilterEnabled(false)
, isCSSStickyPositionEnabled(false)
, isCSSRegionsEnabled(false)
, isCSSGridLayoutEnabled(false)
#if ENABLE(CSS_VARIABLES)
......@@ -215,6 +216,7 @@ CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons
, mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode)
, isHTMLDocument(document->isHTMLDocument())
, isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCSSCustomFilterEnabled() : false)
, isCSSStickyPositionEnabled(document->cssStickyPositionEnabled())
, isCSSRegionsEnabled(document->cssRegionsEnabled())
, isCSSGridLayoutEnabled(document->cssGridLayoutEnabled())
#if ENABLE(CSS_VARIABLES)
......@@ -232,6 +234,7 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b)
&& a.mode == b.mode
&& a.isHTMLDocument == b.isHTMLDocument
&& a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled
&& a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled
&& a.isCSSRegionsEnabled == b.isCSSRegionsEnabled
&& a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled
#if ENABLE(CSS_VARIABLES)
......@@ -670,7 +673,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
case CSSPropertyPosition: // static | relative | absolute | fixed | sticky | inherit
if (valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed
#if ENABLE(CSS_STICKY_POSITION)
|| valueID == CSSValueWebkitSticky
|| (parserContext.isCSSStickyPositionEnabled && valueID == CSSValueWebkitSticky)
#endif
)
return true;
......
......@@ -65,6 +65,7 @@ public:
CSSParserMode mode;
bool isHTMLDocument;
bool isCSSCustomFilterEnabled;
bool isCSSStickyPositionEnabled;
bool isCSSRegionsEnabled;
bool isCSSGridLayoutEnabled;
#if ENABLE(CSS_VARIABLES)
......
......@@ -1139,6 +1139,11 @@ bool Document::regionBasedColumnsEnabled() const
return settings() && settings()->regionBasedColumnsEnabled();
}
bool Document::cssStickyPositionEnabled() const
{
return settings() && settings()->cssStickyPositionEnabled();
}
bool Document::cssRegionsEnabled() const
{
return settings() && settings()->cssRegionsEnabled();
......
......@@ -355,6 +355,7 @@ public:
virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser);
bool cssStickyPositionEnabled() const;
bool cssRegionsEnabled() const;
#if ENABLE(CSS_REGIONS)
PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&);
......
......@@ -202,6 +202,9 @@ Settings::Settings(Page* page)
, m_acceleratedDrawingEnabled(false)
, m_acceleratedFiltersEnabled(false)
, m_isCSSCustomFilterEnabled(false)
#if ENABLE(CSS_STICKY_POSITION)
, m_cssStickyPositionEnabled(true)
#endif
#if ENABLE(CSS_REGIONS)
, m_cssRegionsEnabled(false)
#endif
......
......@@ -337,6 +337,14 @@ namespace WebCore {
void setCSSCustomFilterEnabled(bool enabled) { m_isCSSCustomFilterEnabled = enabled; }
bool isCSSCustomFilterEnabled() const { return m_isCSSCustomFilterEnabled; }
#if ENABLE(CSS_STICKY_POSITION)
void setCSSStickyPositionEnabled(bool enabled) { m_cssStickyPositionEnabled = enabled; }
bool cssStickyPositionEnabled() const { return m_cssStickyPositionEnabled; }
#else
void setCSSStickyPositionEnabled(bool) { }
bool cssStickyPositionEnabled() const { return false; }
#endif
#if ENABLE(CSS_REGIONS)
void setCSSRegionsEnabled(bool enabled) { m_cssRegionsEnabled = enabled; }
bool cssRegionsEnabled() const { return m_cssRegionsEnabled; }
......@@ -711,6 +719,9 @@ namespace WebCore {
bool m_acceleratedDrawingEnabled : 1;
bool m_acceleratedFiltersEnabled : 1;
bool m_isCSSCustomFilterEnabled : 1;
#if ENABLE(CSS_STICKY_POSITION)
bool m_cssStickyPositionEnabled : 1;
#endif
#if ENABLE(CSS_REGIONS)
bool m_cssRegionsEnabled : 1;
#endif
......
2012-09-14 Ojan Vafai <ojan@chromium.org>
Provide a runtime setting to disable position:sticky
https://bugs.webkit.org/show_bug.cgi?id=96827
Reviewed by James Robinson.
* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setCSSStickyPositionEnabled):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):
2012-09-14 Adam Barth <abarth@webkit.org>
 
Remove webkitPostMessage
......
......@@ -93,6 +93,7 @@ public:
virtual void setEnableScrollAnimator(bool) = 0;
virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0;
virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0;
virtual void setCSSStickyPositionEnabled(bool) = 0;
virtual void setExperimentalCSSRegionsEnabled(bool) = 0;
virtual void setExperimentalCSSVariablesEnabled(bool) = 0;
virtual void setExperimentalWebGLEnabled(bool) = 0;
......
......@@ -337,6 +337,11 @@ void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled)
m_settings->setWebGLEnabled(enabled);
}
void WebSettingsImpl::setCSSStickyPositionEnabled(bool enabled)
{
m_settings->setCSSStickyPositionEnabled(enabled);
}
void WebSettingsImpl::setExperimentalCSSRegionsEnabled(bool enabled)
{
m_settings->setCSSRegionsEnabled(enabled);
......
......@@ -85,6 +85,7 @@ public:
virtual void setEnableScrollAnimator(bool);
virtual void setExperimentalCSSCustomFilterEnabled(bool);
virtual void setExperimentalCSSGridLayoutEnabled(bool);
virtual void setCSSStickyPositionEnabled(bool);
virtual void setExperimentalCSSRegionsEnabled(bool);
virtual void setExperimentalCSSVariablesEnabled(bool);
virtual void setExperimentalWebGLEnabled(bool);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment