summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
commit03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch)
tree52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/WebKit2/WebProcess/WebPage/WebPage.cpp
parentcd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff)
downloadqtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/WebPage.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp68
1 files changed, 67 insertions, 1 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 3b9a487e4..4aa1e45e8 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -206,6 +206,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_isRunningModal(false)
, m_cachedMainFrameIsPinnedToLeftSide(false)
, m_cachedMainFrameIsPinnedToRightSide(false)
+ , m_canShortCircuitHorizontalWheelEvents(false)
+ , m_numWheelEventHandlers(0)
, m_cachedPageCount(0)
, m_isShowingContextMenu(false)
#if PLATFORM(WIN)
@@ -1797,7 +1799,7 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
#if PLATFORM(MAC) || PLATFORM(WIN)
RetainPtr<CFDataRef> data;
if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
- if ((data = frame->webArchiveData()))
+ if ((data = frame->webArchiveData(0, 0)))
dataReference = CoreIPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
}
#endif
@@ -2388,6 +2390,8 @@ void WebPage::setWindowIsVisible(bool windowIsVisible)
{
m_windowIsVisible = windowIsVisible;
+ corePage()->focusController()->setContainingWindowIsVisible(windowIsVisible);
+
// Tell all our plug-in views that the window visibility changed.
for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
(*it)->setWindowIsVisible(windowIsVisible);
@@ -2998,6 +3002,68 @@ void WebPage::confirmCompositionForTesting(const String& compositionString)
frame->editor()->confirmComposition(compositionString);
}
+void WebPage::numWheelEventHandlersChanged(unsigned numWheelEventHandlers)
+{
+ if (m_numWheelEventHandlers == numWheelEventHandlers)
+ return;
+
+ m_numWheelEventHandlers = numWheelEventHandlers;
+ recomputeShortCircuitHorizontalWheelEventsState();
+}
+
+static bool hasEnabledHorizontalScrollbar(ScrollableArea* scrollableArea)
+{
+ if (Scrollbar* scrollbar = scrollableArea->horizontalScrollbar())
+ return scrollbar->enabled();
+
+ return false;
+}
+
+static bool pageContainsAnyHorizontalScrollbars(Frame* mainFrame)
+{
+ if (FrameView* frameView = mainFrame->view()) {
+ if (hasEnabledHorizontalScrollbar(frameView))
+ return true;
+ }
+
+ for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) {
+ FrameView* frameView = frame->view();
+ if (!frameView)
+ continue;
+
+ const HashSet<ScrollableArea*>* scrollableAreas = frameView->scrollableAreas();
+ if (!scrollableAreas)
+ continue;
+
+ for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
+ ScrollableArea* scrollableArea = *it;
+ ASSERT(scrollableArea->isOnActivePage());
+
+ if (hasEnabledHorizontalScrollbar(scrollableArea))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void WebPage::recomputeShortCircuitHorizontalWheelEventsState()
+{
+ bool canShortCircuitHorizontalWheelEvents = !m_numWheelEventHandlers;
+
+ if (canShortCircuitHorizontalWheelEvents) {
+ // Check if we have any horizontal scroll bars on the page.
+ if (pageContainsAnyHorizontalScrollbars(mainFrame()))
+ canShortCircuitHorizontalWheelEvents = false;
+ }
+
+ if (m_canShortCircuitHorizontalWheelEvents == canShortCircuitHorizontalWheelEvents)
+ return;
+
+ m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents;
+ send(Messages::WebPageProxy::SetCanShortCircuitHorizontalWheelEvents(m_canShortCircuitHorizontalWheelEvents));
+}
+
Frame* WebPage::mainFrame() const
{
return m_page ? m_page->mainFrame() : 0;