diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/DrawingAreaProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/DrawingAreaProxy.cpp | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp index d15d3e00d..a5f75f0e0 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,68 +31,73 @@ #include "WebPageProxy.h" #include "WebProcessProxy.h" +#if PLATFORM(COCOA) +#include <WebCore/MachSendRight.h> +#endif + using namespace WebCore; namespace WebKit { -DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy* webPageProxy) +DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy& webPageProxy) : m_type(type) , m_webPageProxy(webPageProxy) - , m_size(webPageProxy->viewSize()) + , m_size(webPageProxy.viewSize()) #if PLATFORM(MAC) - , m_exposedRectChangedTimer(this, &DrawingAreaProxy::exposedRectChangedTimerFired) + , m_viewExposedRectChangedTimer(RunLoop::main(), this, &DrawingAreaProxy::viewExposedRectChangedTimerFired) #endif { - m_webPageProxy->process().addMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), webPageProxy->pageID(), *this); + m_webPageProxy.process().addMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_webPageProxy.pageID(), *this); } DrawingAreaProxy::~DrawingAreaProxy() { - m_webPageProxy->process().removeMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_webPageProxy->pageID()); + m_webPageProxy.process().removeMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_webPageProxy.pageID()); } -void DrawingAreaProxy::setSize(const IntSize& size, const IntSize& layerPosition, const IntSize& scrollOffset) +bool DrawingAreaProxy::setSize(const IntSize& size, const IntSize& layerPosition, const IntSize& scrollOffset) { if (m_size == size && m_layerPosition == layerPosition && scrollOffset.isZero()) - return; + return false; m_size = size; m_layerPosition = layerPosition; m_scrollOffset += scrollOffset; sizeDidChange(); + return true; } -#if PLATFORM(MAC) -void DrawingAreaProxy::setExposedRect(const FloatRect& exposedRect) +#if PLATFORM(COCOA) +MachSendRight DrawingAreaProxy::createFence() { - if (!m_webPageProxy->isValid()) - return; - - m_exposedRect = exposedRect; - - if (!m_exposedRectChangedTimer.isActive()) - m_exposedRectChangedTimer.startOneShot(0); + ASSERT_NOT_REACHED(); + return MachSendRight(); } +#endif -void DrawingAreaProxy::exposedRectChangedTimerFired(Timer<DrawingAreaProxy>*) +#if PLATFORM(MAC) +void DrawingAreaProxy::setViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) { - if (!m_webPageProxy->isValid()) + if (!m_webPageProxy.isValid()) return; - if (m_exposedRect == m_lastSentExposedRect) - return; + m_viewExposedRect = viewExposedRect; - m_webPageProxy->process().send(Messages::DrawingArea::SetExposedRect(m_exposedRect), m_webPageProxy->pageID()); - m_lastSentExposedRect = m_exposedRect; + if (!m_viewExposedRectChangedTimer.isActive()) + m_viewExposedRectChangedTimer.startOneShot(0); } -void DrawingAreaProxy::setCustomFixedPositionRect(const FloatRect& fixedPositionRect) +void DrawingAreaProxy::viewExposedRectChangedTimerFired() { - if (!m_webPageProxy->isValid()) + if (!m_webPageProxy.isValid()) return; - m_webPageProxy->process().send(Messages::DrawingArea::SetCustomFixedPositionRect(fixedPositionRect), m_webPageProxy->pageID()); + if (m_viewExposedRect == m_lastSentViewExposedRect) + return; + + m_webPageProxy.process().send(Messages::DrawingArea::SetViewExposedRect(m_viewExposedRect), m_webPageProxy.pageID()); + m_lastSentViewExposedRect = m_viewExposedRect; } -#endif +#endif // PLATFORM(MAC) } // namespace WebKit |