Commit 3dc05efc authored by eric@webkit.org's avatar eric@webkit.org

2010-04-15 Matt Perry <mpcomplete@chromium.org>

        Reviewed by Dimitri Glazkov.

        Implement layoutTestController's addUserStyleSheet and
        setAuthorAndUserStylesEnabled on Chromium port.
        https://bugs.webkit.org/show_bug.cgi?id=37595

        * public/WebSettings.h:
        * public/WebView.h:
        * src/WebSettingsImpl.cpp:
        (WebKit::WebSettingsImpl::setAuthorAndUserStylesEnabled):
        * src/WebSettingsImpl.h:
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::addUserStyleSheet):
        * src/WebViewImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 333ccf7c
2010-04-15 Matt Perry <mpcomplete@chromium.org>
Reviewed by Dimitri Glazkov.
Implement layoutTestController's addUserStyleSheet and
setAuthorAndUserStylesEnabled on Chromium port.
https://bugs.webkit.org/show_bug.cgi?id=37595
* public/WebSettings.h:
* public/WebView.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setAuthorAndUserStylesEnabled):
* src/WebSettingsImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::addUserStyleSheet):
* src/WebViewImpl.h:
2010-04-15 Zhenyao Mo <zmo@google.com>
Reviewed by Dimitri Glazkov.
......
......@@ -69,6 +69,7 @@ public:
virtual void setJavaEnabled(bool) = 0;
virtual void setAllowScriptsToCloseWindows(bool) = 0;
virtual void setUserStyleSheetLocation(const WebURL&) = 0;
virtual void setAuthorAndUserStylesEnabled(bool) = 0;
virtual void setUsesPageCache(bool) = 0;
virtual void setDownloadableBinaryFontsEnabled(bool) = 0;
virtual void setXSSAuditorEnabled(bool) = 0;
......
......@@ -283,6 +283,7 @@ public:
// User scripts --------------------------------------------------------
virtual void addUserScript(const WebString& sourceCode,
bool runAtStart) = 0;
virtual void addUserStyleSheet(const WebString& sourceCode) = 0;
virtual void removeAllUserContent() = 0;
// Modal dialog support ------------------------------------------------
......
......@@ -185,6 +185,11 @@ void WebSettingsImpl::setUserStyleSheetLocation(const WebURL& location)
m_settings->setUserStyleSheetLocation(location);
}
void WebSettingsImpl::setAuthorAndUserStylesEnabled(bool enabled)
{
m_settings->setAuthorAndUserStylesEnabled(enabled);
}
void WebSettingsImpl::setUsesPageCache(bool usesPageCache)
{
m_settings->setUsesPageCache(usesPageCache);
......
......@@ -71,6 +71,7 @@ public:
virtual void setJavaEnabled(bool);
virtual void setAllowScriptsToCloseWindows(bool);
virtual void setUserStyleSheetLocation(const WebURL&);
virtual void setAuthorAndUserStylesEnabled(bool);
virtual void setUsesPageCache(bool);
virtual void setDownloadableBinaryFontsEnabled(bool);
virtual void setXSSAuditorEnabled(bool);
......
......@@ -1886,6 +1886,13 @@ void WebViewImpl::addUserScript(const WebString& sourceCode, bool runAtStart)
runAtStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
}
void WebViewImpl::addUserStyleSheet(const WebString& sourceCode)
{
PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName);
RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create());
pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), 0, 0);
}
void WebViewImpl::removeAllUserContent()
{
PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName);
......
......@@ -181,6 +181,7 @@ public:
virtual void performCustomContextMenuAction(unsigned action);
virtual void addUserScript(const WebString& sourceCode,
bool runAtStart);
virtual void addUserStyleSheet(const WebString& sourceCode);
virtual void removeAllUserContent();
// WebViewImpl
......
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