Title: [198754] trunk/Source/WebKit2
- Revision
- 198754
- Author
- bb...@apple.com
- Date
- 2016-03-28 11:52:12 -0700 (Mon, 28 Mar 2016)
Log Message
Web Automation: report the browsing context's window frame (size and origin)
https://bugs.webkit.org/show_bug.cgi?id=155323
<rdar://problem/25094089>
Reviewed by Timothy Hatcher.
To prepare for implementing resize and move commands, add a
windowFrame member to the browsing context protocol type.
* UIProcess/Automation/Automation.json:
Add a frame Rect to BrowsingContext.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::handleForWebPageProxy):
(WebKit::WebAutomationSession::buildBrowsingContextForPage):
Extract the code to build a BrowsingContext object. Add
code to calculate and insert the page's window frame size.
(WebKit::WebAutomationSession::getBrowsingContexts):
(WebKit::WebAutomationSession::getBrowsingContext):
(WebKit::WebAutomationSession::createBrowsingContext):
(WebKit::WebAutomationSession::switchToBrowsingContext):
Refactoring as above.
* UIProcess/Automation/WebAutomationSession.h:
Adjust signatures.
* UIProcess/WebPageProxy.h: Make getWindowFrame public.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (198753 => 198754)
--- trunk/Source/WebKit2/ChangeLog 2016-03-28 18:39:21 UTC (rev 198753)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-28 18:52:12 UTC (rev 198754)
@@ -1,5 +1,36 @@
2016-03-28 Brian Burg <bb...@apple.com>
+ Web Automation: report the browsing context's window frame (size and origin)
+ https://bugs.webkit.org/show_bug.cgi?id=155323
+ <rdar://problem/25094089>
+
+ Reviewed by Timothy Hatcher.
+
+ To prepare for implementing resize and move commands, add a
+ windowFrame member to the browsing context protocol type.
+
+ * UIProcess/Automation/Automation.json:
+ Add a frame Rect to BrowsingContext.
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::handleForWebPageProxy):
+ (WebKit::WebAutomationSession::buildBrowsingContextForPage):
+ Extract the code to build a BrowsingContext object. Add
+ code to calculate and insert the page's window frame size.
+
+ (WebKit::WebAutomationSession::getBrowsingContexts):
+ (WebKit::WebAutomationSession::getBrowsingContext):
+ (WebKit::WebAutomationSession::createBrowsingContext):
+ (WebKit::WebAutomationSession::switchToBrowsingContext):
+ Refactoring as above.
+
+ * UIProcess/Automation/WebAutomationSession.h:
+ Adjust signatures.
+
+ * UIProcess/WebPageProxy.h: Make getWindowFrame public.
+
+2016-03-28 Brian Burg <bb...@apple.com>
+
Unreviewed, fix the build.
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (198753 => 198754)
--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2016-03-28 18:39:21 UTC (rev 198753)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2016-03-28 18:52:12 UTC (rev 198754)
@@ -63,7 +63,8 @@
"properties": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "Opaque handle for a browsing context (window or tab). Used as a key for window-related commands." },
{ "name": "active", "type": "boolean", "description": "Whether the browsing context has focus at the time the command is handled." },
- { "name": "url", "type": "string", "description": "The URL loaded by the browsing context at the time the command is handled." }
+ { "name": "url", "type": "string", "description": "The URL loaded by the browsing context at the time the command is handled." },
+ { "name": "windowFrame", "$ref": "Rect", "description": "The current frame (position and size) of the browsing context's window." }
]
}
],
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (198753 => 198754)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-03-28 18:39:21 UTC (rev 198753)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-03-28 18:52:12 UTC (rev 198754)
@@ -190,24 +190,47 @@
return handleForWebFrameID(webFrameProxy.frameID());
}
+RefPtr<Inspector::Protocol::Automation::BrowsingContext> WebAutomationSession::buildBrowsingContextForPage(WebPageProxy& page)
+{
+ WebCore::FloatRect windowFrame;
+ page.getWindowFrame(windowFrame);
+
+ auto originObject = Inspector::Protocol::Automation::Point::create()
+ .setX(windowFrame.x())
+ .setY(windowFrame.y())
+ .release();
+
+ auto sizeObject = Inspector::Protocol::Automation::Size::create()
+ .setWidth(windowFrame.width())
+ .setHeight(windowFrame.height())
+ .release();
+
+ auto windowFrameObject = Inspector::Protocol::Automation::Rect::create()
+ .setOrigin(WTFMove(originObject))
+ .setSize(WTFMove(sizeObject))
+ .release();
+
+ String handle = handleForWebPageProxy(page);
+
+ return Inspector::Protocol::Automation::BrowsingContext::create()
+ .setHandle(handle)
+ .setActive(m_activeBrowsingContextHandle == handle)
+ .setUrl(page.pageLoadState().activeURL())
+ .setWindowFrame(WTFMove(windowFrameObject))
+ .release();
+}
+
void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>& contexts)
{
contexts = Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create();
for (auto& process : m_processPool->processes()) {
- for (auto& page : process->pages()) {
+ for (auto* page : process->pages()) {
+ ASSERT(page);
if (!page->isControlledByAutomation())
continue;
- String handle = handleForWebPageProxy(*page);
-
- auto browsingContext = Inspector::Protocol::Automation::BrowsingContext::create()
- .setHandle(handleForWebPageProxy(*page))
- .setActive(m_activeBrowsingContextHandle == handle)
- .setUrl(page->pageLoadState().activeURL())
- .release();
-
- contexts->addItem(browsingContext.copyRef());
+ contexts->addItem(buildBrowsingContextForPage(*page));
}
}
}
@@ -218,11 +241,7 @@
if (!page)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
- context = Inspector::Protocol::Automation::BrowsingContext::create()
- .setHandle(handleForWebPageProxy(*page))
- .setActive(m_activeBrowsingContextHandle == handle)
- .setUrl(page->pageLoadState().activeURL())
- .release();
+ context = buildBrowsingContextForPage(*page);
}
void WebAutomationSession::createBrowsingContext(Inspector::ErrorString& errorString, String* handle)
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (198753 => 198754)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2016-03-28 18:39:21 UTC (rev 198753)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2016-03-28 18:52:12 UTC (rev 198754)
@@ -104,6 +104,7 @@
private:
WebPageProxy* webPageProxyForHandle(const String&);
String handleForWebPageProxy(const WebPageProxy&);
+ RefPtr<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&);
WebFrameProxy* webFrameProxyForHandle(const String&, WebPageProxy&);
String handleForWebFrameID(uint64_t frameID);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (198753 => 198754)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-28 18:39:21 UTC (rev 198753)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-28 18:52:12 UTC (rev 198754)
@@ -1094,6 +1094,7 @@
void didRestoreScrollPosition();
void setFocus(bool focused);
+ void getWindowFrame(WebCore::FloatRect&);
bool isResourceCachingDisabled() const { return m_isResourceCachingDisabled; }
void setResourceCachingDisabled(bool);
@@ -1198,7 +1199,6 @@
void setIsResizable(bool isResizable);
void getIsResizable(bool& isResizable);
void setWindowFrame(const WebCore::FloatRect&);
- void getWindowFrame(WebCore::FloatRect&);
void screenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
void rootViewToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
#if PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes