From 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Thu, 2 Jun 2011 12:07:03 +0100 Subject: Merge WebKit at r84325: Initial merge by git. Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b --- .../WebProcess/WebPage/win/LayerTreeHostWin.cpp | 44 ++++++++++ .../WebKit2/WebProcess/WebPage/win/WebPageWin.cpp | 94 +++++++++++++++++++++- 2 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 Source/WebKit2/WebProcess/WebPage/win/LayerTreeHostWin.cpp (limited to 'Source/WebKit2/WebProcess/WebPage/win') diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerTreeHostWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerTreeHostWin.cpp new file mode 100644 index 0000000..57c04bb --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/win/LayerTreeHostWin.cpp @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#include "config.h" +#include "LayerTreeHost.h" + +#if USE(CA) +#include "LayerTreeHostCAWin.h" +#endif + +namespace WebKit { + +bool LayerTreeHost::supportsAcceleratedCompositing() +{ +#if USE(CA) && HAVE(WKQCA) + return LayerTreeHostCAWin::supportsAcceleratedCompositing(); +#else + return false; +#endif +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp index 41bb219..9c7206a 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp @@ -28,17 +28,22 @@ #include "FontSmoothingLevel.h" #include "WebEvent.h" +#include "WebPageProxyMessages.h" #include "WebPreferencesStore.h" #include #include #include #include +#include +#include #include #include #include +#include +#include #include #include -#if PLATFORM(CG) +#if USE(CG) #include #endif #include @@ -62,7 +67,7 @@ void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store) { FontSmoothingLevel fontSmoothingLevel = static_cast(store.getUInt32ValueForKey(WebPreferencesKey::fontSmoothingLevelKey())); -#if PLATFORM(CG) +#if USE(CG) FontSmoothingLevel adjustedLevel = fontSmoothingLevel; if (adjustedLevel == FontSmoothingLevelWindows) adjustedLevel = FontSmoothingLevelMedium; @@ -351,4 +356,89 @@ void WebPage::getSelectedText(String& text) text = selectedRange->text(); } +void WebPage::gestureWillBegin(const WebCore::IntPoint& point, bool& canBeginPanning) +{ + m_gestureReachedScrollingLimit = false; + + bool hitScrollbar = false; + + HitTestRequest request(HitTestRequest::ReadOnly); + for (Frame* childFrame = m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) { + ScrollView* scollView = childFrame->view(); + if (!scollView) + break; + + RenderView* renderView = childFrame->document()->renderView(); + if (!renderView) + break; + + RenderLayer* layer = renderView->layer(); + if (!layer) + break; + + HitTestResult result = scollView->windowToContents(point); + layer->hitTest(request, result); + m_gestureTargetNode = result.innerNode(); + + if (!hitScrollbar) + hitScrollbar = result.scrollbar(); + } + + if (hitScrollbar) { + canBeginPanning = false; + return; + } + + if (!m_gestureTargetNode) { + canBeginPanning = false; + return; + } + + for (RenderObject* renderer = m_gestureTargetNode->renderer(); renderer; renderer = renderer->parent()) { + if (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) { + canBeginPanning = true; + return; + } + } + + canBeginPanning = false; +} + +static bool scrollbarAtTopOrBottomOfDocument(Scrollbar* scrollbar) +{ + ASSERT_ARG(scrollbar, scrollbar); + return !scrollbar->currentPos() || scrollbar->currentPos() >= scrollbar->maximum(); +} + +void WebPage::gestureDidScroll(const IntSize& size) +{ + ASSERT_ARG(size, !size.isZero()); + + if (!m_gestureTargetNode || !m_gestureTargetNode->renderer() || !m_gestureTargetNode->renderer()->enclosingLayer()) + return; + + Scrollbar* verticalScrollbar = 0; + if (Frame* frame = m_page->mainFrame()) { + if (ScrollView* view = frame->view()) + verticalScrollbar = view->verticalScrollbar(); + } + + m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(size.width(), size.height()); + bool gestureReachedScrollingLimit = verticalScrollbar && scrollbarAtTopOrBottomOfDocument(verticalScrollbar); + + // FIXME: We really only want to update this state if the state was updated via scrolling the main frame, + // not scrolling something in a main frame when the main frame had already reached its scrolling limit. + + if (gestureReachedScrollingLimit == m_gestureReachedScrollingLimit) + return; + + send(Messages::WebPageProxy::SetGestureReachedScrollingLimit(gestureReachedScrollingLimit)); + m_gestureReachedScrollingLimit = gestureReachedScrollingLimit; +} + +void WebPage::gestureDidEnd() +{ + m_gestureTargetNode = nullptr; +} + } // namespace WebKit -- cgit v1.1