WebPageCoordinatedGraphics.cpp [plain text]
#include "config.h"
#if USE(COORDINATED_GRAPHICS)
#include "WebPage.h"
#include "HitTestResult.h"
#include "WebCoreArgumentCoders.h"
#include "WebFrame.h"
#include "WebPageProxyMessages.h"
#include <WebCore/Document.h>
#include <WebCore/EventHandler.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
#include <WebCore/RenderObject.h>
#include <WebCore/ScrollView.h>
using namespace WebCore;
namespace WebKit {
void WebPage::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
{
UNUSED_PARAM(area);
Frame* mainframe = m_mainFrame->coreFrame();
HitTestResult result = mainframe->eventHandler().hitTestResultAtPoint(mainframe->view()->windowToContents(point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
Node* node = result.innerNode();
if (!node)
return;
IntRect zoomableArea;
if (RenderObject* renderer = node->renderer())
zoomableArea = renderer->absoluteBoundingBoxRect();
while (true) {
bool found = !node->isTextNode() && !node->isShadowRoot();
if (!found && !node->parentNode())
return;
if (found && (!node->parentNode() || !node->parentNode()->hasOneChild()))
break;
node = node->parentNode();
if (RenderObject* renderer = node->renderer())
zoomableArea.unite(renderer->absoluteBoundingBoxRect());
}
if (node->document().frame() && node->document().frame()->view()) {
const ScrollView* view = node->document().frame()->view();
zoomableArea = view->contentsToWindow(zoomableArea);
}
send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea));
}
}
#endif // USE(COORDINATED_GRAPHICS)