Skip to content
Permalink
Browse files
Add WebKit2 API for window feature getter/setters
<rdar://problem/8590373>
https://bugs.webkit.org/show_bug.cgi?id=48496

Reviewed by Anders Carlsson.

WebKit2:

* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setToolbarsAreVisible):
(WebKit::WebPageProxy::getToolbarsAreVisible):
(WebKit::WebPageProxy::setMenuBarIsVisible):
(WebKit::WebPageProxy::getMenuBarIsVisible):
(WebKit::WebPageProxy::setStatusBarIsVisible):
(WebKit::WebPageProxy::getStatusBarIsVisible):
(WebKit::WebPageProxy::setIsResizable):
(WebKit::WebPageProxy::getIsResizable):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::toolbarsAreVisible):
(WebKit::WebUIClient::setToolbarsAreVisible):
(WebKit::WebUIClient::menuBarIsVisible):
(WebKit::WebUIClient::setMenuBarIsVisible):
(WebKit::WebUIClient::statusBarIsVisible):
(WebKit::WebUIClient::setStatusBarIsVisible):
(WebKit::WebUIClient::isResizable):
(WebKit::WebUIClient::setIsResizable):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setToolbarsVisible):
(WebKit::WebChromeClient::toolbarsVisible):
(WebKit::WebChromeClient::setStatusbarVisible):
(WebKit::WebChromeClient::statusbarVisible):
(WebKit::WebChromeClient::setMenubarVisible):
(WebKit::WebChromeClient::menubarVisible):
(WebKit::WebChromeClient::setResizable):
Plumb through the calls.

WebKitTools:

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* MiniBrowser/win/BrowserView.cpp:
(BrowserView::create):
* WebKitTestRunner/TestController.cpp:
(WTR::createOtherPage):
(WTR::TestController::initialize):



Canonical link: https://commits.webkit.org/61304@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Oct 28, 2010
1 parent ba81c42 commit 4331fe4e4b88f58424569d05b096fab938242cd8
Showing 13 changed files with 268 additions and 16 deletions.
@@ -1,3 +1,43 @@
2010-10-28 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

Add WebKit2 API for window feature getter/setters
<rdar://problem/8590373>
https://bugs.webkit.org/show_bug.cgi?id=48496

* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setToolbarsAreVisible):
(WebKit::WebPageProxy::getToolbarsAreVisible):
(WebKit::WebPageProxy::setMenuBarIsVisible):
(WebKit::WebPageProxy::getMenuBarIsVisible):
(WebKit::WebPageProxy::setStatusBarIsVisible):
(WebKit::WebPageProxy::getStatusBarIsVisible):
(WebKit::WebPageProxy::setIsResizable):
(WebKit::WebPageProxy::getIsResizable):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::toolbarsAreVisible):
(WebKit::WebUIClient::setToolbarsAreVisible):
(WebKit::WebUIClient::menuBarIsVisible):
(WebKit::WebUIClient::setMenuBarIsVisible):
(WebKit::WebUIClient::statusBarIsVisible):
(WebKit::WebUIClient::setStatusBarIsVisible):
(WebKit::WebUIClient::isResizable):
(WebKit::WebUIClient::setIsResizable):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setToolbarsVisible):
(WebKit::WebChromeClient::toolbarsVisible):
(WebKit::WebChromeClient::setStatusbarVisible):
(WebKit::WebChromeClient::statusbarVisible):
(WebKit::WebChromeClient::setMenubarVisible):
(WebKit::WebChromeClient::menubarVisible):
(WebKit::WebChromeClient::setResizable):
Plumb through the calls.

2010-10-28 Dan Bernstein <mitz@apple.com>

Build fix.
@@ -142,6 +142,14 @@ typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStrin
typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo);
typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo);
typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo);
typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo);
typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo);
typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo);
typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo);
typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
@@ -161,6 +169,14 @@ struct WKPageUIClient {
WKPageSetStatusTextCallback setStatusText;
WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent;
WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible;
WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible;
WKPageGetMenuBarIsVisibleCallback menuBarIsVisible;
WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible;
WKPageGetStatusBarIsVisibleCallback statusBarIsVisible;
WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible;
WKPageGetIsResizableCallback isResizable;
WKPageSetIsResizableCallback setIsResizable;
WKPageGetWindowFrameCallback getWindowFrame;
WKPageSetWindowFrameCallback setWindowFrame;
WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel;
@@ -319,6 +319,14 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
0, /* setStatusText */
0, /* mouseDidMoveOverElement */
0, /* didNotHandleKeyEvent */
0, /* toolbarsAreVisible */
0, /* setToolbarsAreVisible */
0, /* menuBarIsVisible */
0, /* setMenuBarIsVisible */
0, /* statusBarIsVisible */
0, /* setStatusBarIsVisible */
0, /* isResizable */
0, /* setIsResizable */
0, /* getWindowFrame */
0, /* setWindowFrame */
0, /* runBeforeUnloadConfirmPanel */
@@ -941,6 +941,46 @@ void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::Ar
m_uiClient.mouseDidMoveOverElement(this, modifiers, userData.get());
}

void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
{
m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
}

void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
{
toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
}

void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
{
m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
}

void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
{
menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
}

void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
{
m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
}

void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
{
statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
}

void WebPageProxy::setIsResizable(bool isResizable)
{
m_uiClient.setIsResizable(this, isResizable);
}

void WebPageProxy::getIsResizable(bool& isResizable)
{
isResizable = m_uiClient.isResizable(this);
}

void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
{
m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
@@ -275,6 +275,14 @@ class WebPageProxy : public APIObject {
void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);
void setStatusText(const String&);
void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*);
void setToolbarsAreVisible(bool toolbarsAreVisible);
void getToolbarsAreVisible(bool& toolbarsAreVisible);
void setMenuBarIsVisible(bool menuBarIsVisible);
void getMenuBarIsVisible(bool& menuBarIsVisible);
void setStatusBarIsVisible(bool statusBarIsVisible);
void getStatusBarIsVisible(bool& statusBarIsVisible);
void setIsResizable(bool isResizable);
void getIsResizable(bool& isResizable);
void setWindowFrame(const WebCore::FloatRect&);
void getWindowFrame(WebCore::FloatRect&);
void canRunBeforeUnloadConfirmPanel(bool& canRun);
@@ -36,6 +36,14 @@ messages -> WebPageProxy {
SetStatusText(WTF::String statusText)
SetToolTip(WTF::String toolTip)
TakeFocus(bool direction)
SetToolbarsAreVisible(bool toolbarsAreVisible)
GetToolbarsAreVisible() -> (bool toolbarsAreVisible)
SetMenuBarIsVisible(bool menuBarIsVisible);
GetMenuBarIsVisible() -> (bool menuBarIsVisible);
SetStatusBarIsVisible(bool statusBarIsVisible)
GetStatusBarIsVisible() -> (bool statusBarIsVisible)
SetIsResizable(bool isResizable)
GetIsResizable() -> (bool isResizable)
SetWindowFrame(WebCore::FloatRect windowFrame)
GetWindowFrame() -> (WebCore::FloatRect windowFrame)
CanRunBeforeUnloadConfirmPanel() -> (bool canRun)
@@ -148,6 +148,62 @@ void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboa
m_pageUIClient.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_pageUIClient.clientInfo);
}

bool WebUIClient::toolbarsAreVisible(WebPageProxy* page)
{
if (!m_pageUIClient.toolbarsAreVisible)
return true;
return m_pageUIClient.toolbarsAreVisible(toAPI(page), m_pageUIClient.clientInfo);

}
void WebUIClient::setToolbarsAreVisible(WebPageProxy* page, bool visible)
{
if (!m_pageUIClient.setToolbarsAreVisible)
return;
m_pageUIClient.setToolbarsAreVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
}

bool WebUIClient::menuBarIsVisible(WebPageProxy* page)
{
if (!m_pageUIClient.menuBarIsVisible)
return true;
return m_pageUIClient.menuBarIsVisible(toAPI(page), m_pageUIClient.clientInfo);
}

void WebUIClient::setMenuBarIsVisible(WebPageProxy* page, bool visible)
{
if (!m_pageUIClient.setMenuBarIsVisible)
return;
m_pageUIClient.setMenuBarIsVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
}

bool WebUIClient::statusBarIsVisible(WebPageProxy* page)
{
if (!m_pageUIClient.statusBarIsVisible)
return true;
return m_pageUIClient.statusBarIsVisible(toAPI(page), m_pageUIClient.clientInfo);
}

void WebUIClient::setStatusBarIsVisible(WebPageProxy* page, bool visible)
{
if (!m_pageUIClient.setStatusBarIsVisible)
return;
m_pageUIClient.setStatusBarIsVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
}

bool WebUIClient::isResizable(WebPageProxy* page)
{
if (!m_pageUIClient.isResizable)
return true;
return m_pageUIClient.isResizable(toAPI(page), m_pageUIClient.clientInfo);
}

void WebUIClient::setIsResizable(WebPageProxy* page, bool resizable)
{
if (!m_pageUIClient.setIsResizable)
return;
m_pageUIClient.setIsResizable(toAPI(page), resizable, m_pageUIClient.clientInfo);
}

void WebUIClient::setWindowFrame(WebPageProxy* page, const FloatRect& frame)
{
if (!m_pageUIClient.setWindowFrame)
@@ -59,9 +59,17 @@ class WebUIClient {
void setStatusText(WebPageProxy*, const String&);
void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);

void contentsSizeChanged(WebPageProxy*, const WebCore::IntSize&, WebFrameProxy*);
void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);

bool toolbarsAreVisible(WebPageProxy*);
void setToolbarsAreVisible(WebPageProxy*, bool);
bool menuBarIsVisible(WebPageProxy*);
void setMenuBarIsVisible(WebPageProxy*, bool);
bool statusBarIsVisible(WebPageProxy*);
void setStatusBarIsVisible(WebPageProxy*, bool);
bool isResizable(WebPageProxy*);
void setIsResizable(WebPageProxy*, bool);

void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
WebCore::FloatRect windowFrame(WebPageProxy*);

@@ -148,26 +148,36 @@ void WebChromeClient::runModal()
notImplemented();
}

void WebChromeClient::setToolbarsVisible(bool)
void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible)
{
notImplemented();
WebProcess::shared().connection()->send(Messages::WebPageProxy::SetToolbarsAreVisible(toolbarsAreVisible), m_page->pageID());
}

bool WebChromeClient::toolbarsVisible()
{
notImplemented();
return true;
bool toolbarsAreVisible = true;
if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetToolbarsAreVisible(),
Messages::WebPageProxy::GetToolbarsAreVisible::Reply(toolbarsAreVisible),
m_page->pageID(), CoreIPC::Connection::NoTimeout))
return true;

return toolbarsAreVisible;
}

void WebChromeClient::setStatusbarVisible(bool)
void WebChromeClient::setStatusbarVisible(bool statusBarIsVisible)
{
notImplemented();
WebProcess::shared().connection()->send(Messages::WebPageProxy::SetStatusBarIsVisible(statusBarIsVisible), m_page->pageID());
}

bool WebChromeClient::statusbarVisible()
{
notImplemented();
return true;
bool statusBarIsVisible = true;
if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetStatusBarIsVisible(),
Messages::WebPageProxy::GetStatusBarIsVisible::Reply(statusBarIsVisible),
m_page->pageID(), CoreIPC::Connection::NoTimeout))
return true;

return statusBarIsVisible;
}

void WebChromeClient::setScrollbarsVisible(bool)
@@ -181,20 +191,25 @@ bool WebChromeClient::scrollbarsVisible()
return true;
}

void WebChromeClient::setMenubarVisible(bool)
void WebChromeClient::setMenubarVisible(bool menuBarVisible)
{
notImplemented();
WebProcess::shared().connection()->send(Messages::WebPageProxy::SetMenuBarIsVisible(menuBarVisible), m_page->pageID());
}

bool WebChromeClient::menubarVisible()
{
notImplemented();
return true;
bool menuBarIsVisible = true;
if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetMenuBarIsVisible(),
Messages::WebPageProxy::GetMenuBarIsVisible::Reply(menuBarIsVisible),
m_page->pageID(), CoreIPC::Connection::NoTimeout))
return true;

return menuBarIsVisible;
}

void WebChromeClient::setResizable(bool)
void WebChromeClient::setResizable(bool resizable)
{
notImplemented();
WebProcess::shared().connection()->send(Messages::WebPageProxy::SetIsResizable(resizable), m_page->pageID());
}

void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID)
@@ -1,3 +1,19 @@
2010-10-27 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

Add WebKit2 API for window feature getter/setters
<rdar://problem/8590373>
https://bugs.webkit.org/show_bug.cgi?id=48496

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* MiniBrowser/win/BrowserView.cpp:
(BrowserView::create):
* WebKitTestRunner/TestController.cpp:
(WTR::createOtherPage):
(WTR::TestController::initialize):

2010-10-28 Søren Gjesse <sgjesse@chromium.org>

Reviewed by Tony Chang.
@@ -585,6 +585,14 @@ - (void)awakeFromNib
setStatusText,
mouseDidMoveOverElement,
0, /* didNotHandleKeyEvent */
0, /* toolbarsAreVisible */
0, /* setToolbarsAreVisible */
0, /* menuBarIsVisible */
0, /* setMenuBarIsVisible */
0, /* statusBarIsVisible */
0, /* setStatusBarIsVisible */
0, /* isResizable */
0, /* setIsResizable */
getWindowFrame,
setWindowFrame,
runBeforeUnloadConfirmPanel,
@@ -105,7 +105,20 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
runJavaScriptPrompt,
setStatusText,
mouseDidMoveOverElement,
0 /* didNotHandleKeyEvent */
0, /* didNotHandleKeyEvent */
0, /* toolbarsAreVisible */
0, /* setToolbarsAreVisible */
0, /* menuBarIsVisible */
0, /* setMenuBarIsVisible */
0, /* statusBarIsVisible */
0, /* setStatusBarIsVisible */
0, /* isResizable */
0, /* setIsResizable */
0, /* getWindowFrame */
0, /* setWindowFrame */
0, /* runBeforeUnloadConfirmPanel */
0, /* didDraw */
0 /* pageDidScroll */
};

WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);

0 comments on commit 4331fe4

Please sign in to comment.