diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/WebPage.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 68 |
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; |