summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage/mac
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/mac')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm23
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h96
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm279
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm75
7 files changed, 438 insertions, 40 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
index fa4aa1a..c88ab7e 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "AccessibilityWebPageObject.h"
#import "WebFrame.h"
@@ -32,6 +33,7 @@
#import <WebCore/FrameView.h>
#import <WebCore/ScrollView.h>
#import <WebCore/Scrollbar.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
using namespace WebKit;
@@ -70,6 +72,7 @@ using namespace WebKit;
- (void)dealloc
{
+ WKUnregisterUniqueIdForElement(self);
[m_accessibilityChildren release];
[m_attributeNames release];
[m_parent release];
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
index 6bcecfd..b39598f 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
index 24fa124..25a1dfd 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
@@ -23,18 +23,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
+#import "config.h"
+#import "LayerBackedDrawingArea.h"
-#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebKitSystemInterface.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
+#import "DrawingAreaProxyMessageKinds.h"
+#import "WebKitSystemInterface.h"
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsLayer.h>
+#import <WebCore/Page.h>
using namespace WebCore;
@@ -83,7 +84,7 @@ void LayerBackedDrawingArea::attachCompositingContext()
WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_hostingLayer->platformLayer());
uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get());
- WebProcess::shared().connection()->sendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
+ WebProcess::shared().connection()->deprecatedSendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
new file mode 100644
index 0000000..016f0d6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LayerTreeHostMac_h
+#define LayerTreeHostMac_h
+
+#include "LayerTreeContext.h"
+#include "LayerTreeHost.h"
+#include <WebCore/GraphicsLayerClient.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RetainPtr.h>
+
+typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef;
+
+namespace WebKit {
+
+class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient {
+public:
+ static PassRefPtr<LayerTreeHostMac> create(WebPage*);
+ ~LayerTreeHostMac();
+
+private:
+ explicit LayerTreeHostMac(WebPage*);
+
+ // LayerTreeHost.
+ virtual const LayerTreeContext& layerTreeContext();
+ virtual void scheduleLayerFlush();
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
+ virtual void invalidate();
+
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void sizeDidChange(const WebCore::IntSize& newSize);
+
+ virtual void didInstallPageOverlay();
+ virtual void didUninstallPageOverlay();
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
+
+ // GraphicsLayerClient
+ virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+ virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+ virtual bool showDebugBorders() const;
+ virtual bool showRepaintCounter() const;
+
+ static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
+ void flushPendingLayerChangesRunLoopObserverCallback();
+ bool flushPendingLayerChanges();
+
+ void createPageOverlayLayer();
+ void destroyPageOverlayLayer();
+
+ // The context for this layer tree.
+ LayerTreeContext m_layerTreeContext;
+
+ // Whether the layer tree host is valid or not.
+ bool m_isValid;
+
+ // The root layer.
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+
+ // The layer which contains all non-composited content.
+ OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+
+ // The page overlay layer. Will be null if there's no page overlay.
+ OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
+
+ RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
+ RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
+};
+
+} // namespace WebKit
+
+#endif // LayerTreeHostMac_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
new file mode 100644
index 0000000..9734aec
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "LayerTreeHostMac.h"
+
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <QuartzCore/CATransaction.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/Page.h>
+#import <WebCore/Settings.h>
+#import <WebKitSystemInterface.h>
+
+@interface CATransaction (Details)
++ (void)synchronize;
+@end
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
+{
+ return adoptRef(new LayerTreeHostMac(webPage));
+}
+
+LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
+ : LayerTreeHost(webPage)
+ , m_isValid(true)
+{
+ mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
+ m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
+
+ // Create a root layer.
+ m_rootLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_rootLayer->setName("LayerTreeHost root layer");
+#endif
+ m_rootLayer->setDrawsContent(false);
+ m_rootLayer->setSize(webPage->size());
+
+ [m_rootLayer->platformLayer() setGeometryFlipped:YES];
+
+ m_nonCompositedContentLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");
+#endif
+ m_nonCompositedContentLayer->setDrawsContent(true);
+ m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
+ m_nonCompositedContentLayer->setSize(webPage->size());
+
+ m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+
+ WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
+
+ if (m_webPage->hasPageOverlay())
+ createPageOverlayLayer();
+
+ scheduleLayerFlush();
+
+ m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+}
+
+LayerTreeHostMac::~LayerTreeHostMac()
+{
+ ASSERT(!m_isValid);
+ ASSERT(!m_flushPendingLayerChangesRunLoopObserver);
+ ASSERT(!m_remoteLayerClient);
+ ASSERT(!m_rootLayer);
+}
+
+const LayerTreeContext& LayerTreeHostMac::layerTreeContext()
+{
+ return m_layerTreeContext;
+}
+
+void LayerTreeHostMac::scheduleLayerFlush()
+{
+ CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
+
+ // Make sure we wake up the loop or the observer could be delayed until some other source fires.
+ CFRunLoopWakeUp(currentRunLoop);
+
+ if (m_flushPendingLayerChangesRunLoopObserver)
+ return;
+
+ // Run before the Core Animation commit observer, which has order 2000000.
+ const CFIndex runLoopOrder = 2000000 - 1;
+ CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
+ m_flushPendingLayerChangesRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, runLoopOrder, flushPendingLayerChangesRunLoopObserverCallback, &context));
+
+ CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
+}
+
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ ASSERT(graphicsLayer);
+
+ m_nonCompositedContentLayer->removeAllChildren();
+
+ // Add the accelerated layer tree hierarchy.
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
+}
+
+void LayerTreeHostMac::invalidate()
+{
+ ASSERT(m_isValid);
+
+ if (m_flushPendingLayerChangesRunLoopObserver) {
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = nullptr;
+ }
+
+ WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
+ m_remoteLayerClient = nullptr;
+ m_rootLayer = nullptr;
+ m_isValid = false;
+}
+
+void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
+{
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ setNonCompositedContentsNeedDisplay(scrollRect);
+}
+
+void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
+{
+ m_rootLayer->setSize(newSize);
+ m_nonCompositedContentLayer->setSize(newSize);
+
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setSize(newSize);
+
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
+void LayerTreeHostMac::didInstallPageOverlay()
+{
+ createPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::didUninstallPageOverlay()
+{
+ destroyPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect)
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+}
+
+void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+}
+
+void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+{
+ if (graphicsLayer == m_nonCompositedContentLayer) {
+ m_webPage->drawRect(graphicsContext, clipRect);
+ return;
+ }
+
+ if (graphicsLayer == m_pageOverlayLayer) {
+ m_webPage->drawPageOverlay(graphicsContext, clipRect);
+ return;
+ }
+}
+
+bool LayerTreeHostMac::showDebugBorders() const
+{
+ return m_webPage->corePage()->settings()->showDebugBorders();
+}
+
+bool LayerTreeHostMac::showRepaintCounter() const
+{
+ return m_webPage->corePage()->settings()->showRepaintCounter();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
+{
+ static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
+{
+ {
+ RefPtr<LayerTreeHostMac> protect(this);
+ m_webPage->layoutIfNeeded();
+
+ if (!m_isValid)
+ return;
+ }
+
+ if (!flushPendingLayerChanges())
+ return;
+
+ // We successfully flushed the pending layer changes, remove the run loop observer.
+ ASSERT(m_flushPendingLayerChangesRunLoopObserver);
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = 0;
+}
+
+bool LayerTreeHostMac::flushPendingLayerChanges()
+{
+ m_rootLayer->syncCompositingStateForThisLayerOnly();
+ m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->syncCompositingStateForThisLayerOnly();
+
+ return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+}
+
+void LayerTreeHostMac::createPageOverlayLayer()
+{
+ ASSERT(!m_pageOverlayLayer);
+
+ m_pageOverlayLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_pageOverlayLayer->setName("LayerTreeHost page overlay content");
+#endif
+
+ m_pageOverlayLayer->setDrawsContent(true);
+ m_pageOverlayLayer->setSize(m_webPage->size());
+
+ m_rootLayer->addChild(m_pageOverlayLayer.get());
+}
+
+void LayerTreeHostMac::destroyPageOverlayLayer()
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->removeFromParent();
+ m_pageOverlayLayer = nullptr;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
index 83909be..f053cab 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebInspector.h"
#import <wtf/text/WTFString.h>
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index f3211f2..71bbf78 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -23,28 +23,29 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPage.h"
+#import "config.h"
+#import "WebPage.h"
-#include "AccessibilityWebPageObject.h"
-#include "DataReference.h"
-#include "PluginView.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebEvent.h"
-#include "WebFrame.h"
-#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
-#include <WebCore/AXObjectCache.h>
-#include <WebCore/FocusController.h>
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/HitTestResult.h>
-#include <WebCore/KeyboardEvent.h>
-#include <WebCore/Page.h>
-#include <WebCore/PlatformKeyboardEvent.h>
-#include <WebCore/ScrollView.h>
-#include <WebCore/TextIterator.h>
-#include <WebCore/WindowsKeyboardCodes.h>
-#include <WebKitSystemInterface.h>
+#import "AccessibilityWebPageObject.h"
+#import "DataReference.h"
+#import "PluginView.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebEvent.h"
+#import "WebFrame.h"
+#import "WebPageProxyMessages.h"
+#import "WebProcess.h"
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FocusController.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/HitTestResult.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/Page.h>
+#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/TextIterator.h>
+#import <WebCore/WindowsKeyboardCodes.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -65,7 +66,7 @@ void WebPage::platformInitialize()
// send data back over
NSData* remoteToken = (NSData *)WKAXRemoteTokenForElement(mockAccessibilityElement);
CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
- send(Messages::WebPageProxy::DidReceiveAccessibilityPageToken(dataToken));
+ send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken));
m_mockAccessibilityElement = mockAccessibilityElement;
#endif
}
@@ -230,10 +231,11 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web
resultRect.setSize(IntSize(0, 0));
RefPtr<Range> range = convertToRange(frame, NSMakeRange(location, length));
- if (range) {
- ASSERT(range->startContainer());
- ASSERT(range->endContainer());
- }
+ if (!range)
+ return;
+
+ ASSERT(range->startContainer());
+ ASSERT(range->endContainer());
IntRect rect = frame->editor()->firstRectForRange(range.get());
resultRect = frame->view()->contentsToWindow(rect);
@@ -334,11 +336,16 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
return true;
}
-void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data)
+void WebPage::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
- NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()];
- [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)];
+ NSData* elementTokenData = [NSData dataWithBytes:elementToken.data() length:elementToken.size()];
+ NSData* windowTokenData = [NSData dataWithBytes:windowToken.data() length:windowToken.size()];
+ id remoteElement = WKAXRemoteElementForToken(elementTokenData);
+ id remoteWindow = WKAXRemoteElementForToken(windowTokenData);
+ WKAXSetWindowForRemoteElement(remoteWindow, remoteElement);
+
+ [accessibilityRemoteObject() setRemoteParent:remoteElement];
#endif
}
@@ -357,6 +364,16 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
return cachedResponse;
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
+{
+ NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
+ [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
+ NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+ [request release];
+
+ return [[cachedResponse response] MIMEType];
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
{
if ([NSURLConnection canHandleRequest:request.nsURLRequest()])