WebCore:
Reviewed by Dave Hyatt.
<rdar://problem/5569233> Add the ability to disable author and user CSS styles
* WebCore.base.exp: Add the Settings::setAuthorAndUserStylesEnabled symbol.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::CSSStyleSelector): Add a new matchAuthorAndUserStyles parameter.
(WebCore::CSSStyleSelector::styleForElement): Check m_matchAuthorAndUserStyles before
matching user and author rules.
(WebCore::CSSStyleSelector::pseudoStyleForElement): Ditto.
(WebCore::CSSStyleSelector::styleRulesForElement): Ditto.
* css/CSSStyleSelector.h: Add m_matchAuthorAndUserStyles and new constructor parameter.
* dom/Document.cpp:
(WebCore::Document::Document): Pass Settings::authorAndUserStylesEnabled to the CSSStyleSelector.
(WebCore::Document::recalcStyleSelector): Skip collecting the author stylesheets if
Settings::authorAndUserStylesEnabled is false, and pass that to the CSSStyleSelector.
* page/Settings.cpp:
(WebCore::Settings::Settings): Initialize m_authorAndUserStylesEnabled to true.
(WebCore::Settings::setAuthorAndUserStylesEnabled): Recalc style in all the frames
when the setting changes.
* page/Settings.h: Add m_authorAndUserStylesEnabled.
(WebCore::Settings::authorAndUserStylesEnabled): Return m_authorAndUserStylesEnabled.
WebKit/mac:
Reviewed by Dave Hyatt.
<rdar://problem/5569233> Add the ability to disable author and user CSS styles
* WebView/WebPreferenceKeysPrivate.h: Define WebKitRespectStandardStyleKeyEquivalentsPreferenceKey.
* WebView/WebPreferences.m:
(+[WebPreferences initialize]): Default WebKitRespectStandardStyleKeyEquivalentsPreferenceKey to YES.
(-[WebPreferences authorAndUserStylesEnabled]): Return the setting's BOOL value.
(-[WebPreferences setAuthorAndUserStylesEnabled:]): Set the setting's BOOL value.
* WebView/WebPreferencesPrivate.h: Add authorAndUserStylesEnabled and setAuthorAndUserStylesEnabled:.
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]): Update WebCore::Settings::authorAndUserStylesEnabled.
WebKitTools:
Reviewed by Dave Hyatt.
<rdar://problem/5569233> Add the ability to disable author and user CSS styles
Add support for disabling author and user styles for testing.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/LayoutTestController.cpp:
(setAuthorAndUserStylesEnabledCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setAuthorAndUserStylesEnabled):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setAuthorAndUserStylesEnabled):
LayoutTests:
Reviewed by Dave Hyatt.
Test for: <rdar://problem/5569233> Add the ability to disable author and user CSS styles
* fast/css/disabled-author-styles.html: Added.
* platform/mac/fast/css/disabled-author-styles-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed