void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView*) { if (!m_scrollingStateTree->rootStateNode()) return; m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint())); }
void ScrollingCoordinator::frameViewScrollableAreasDidChange(FrameView*) { ASSERT(isMainThread()); ASSERT(m_page); Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view()); setNonFastScrollableRegion(nonFastScrollableRegion); }
void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); // If there isn't a root node yet, don't do anything. We'll be called again after creating one. if (!m_scrollingStateTree->rootStateNode()) return; // Compute the region of the page that we can't do fast scrolling for. This currently includes // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the // frame view whose layout was updated is not the main frame. // In the future, we may want to have the ability to set non-fast scrolling regions for more than // just the root node. But right now, this concept only applies to the root. if (frameView->frame().isMainFrame()) m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&frameView->frame(), IntPoint())); if (!coordinatesScrollingForFrameView(frameView)) return; ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID())); if (!node) return; Scrollbar* verticalScrollbar = frameView->verticalScrollbar(); Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar(); node->setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar); node->setFrameScaleFactor(frameView->frame().frameScaleFactor()); node->setHeaderHeight(frameView->headerHeight()); node->setFooterHeight(frameView->footerHeight()); node->setTopContentInset(frameView->topContentInset()); node->setScrollOrigin(frameView->scrollOrigin()); node->setScrollableAreaSize(frameView->visibleContentRect().size()); node->setTotalContentsSize(frameView->totalContentsSize()); node->setReachableContentsSize(frameView->totalContentsSize()); #if ENABLE(CSS_SCROLL_SNAP) frameView->updateSnapOffsets(); if (const Vector<LayoutUnit>* horizontalSnapOffsets = frameView->horizontalSnapOffsets()) setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Horizontal, *horizontalSnapOffsets, m_page->deviceScaleFactor()); if (const Vector<LayoutUnit>* verticalSnapOffsets = frameView->verticalSnapOffsets()) setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, *verticalSnapOffsets, m_page->deviceScaleFactor()); #endif ScrollableAreaParameters scrollParameters; scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity(); scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity(); scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled(); scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled(); scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode(); scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode(); node->setScrollableAreaParameters(scrollParameters); }
void ScrollingCoordinatorChromium::frameViewLayoutUpdated(FrameView*) { ASSERT(m_page); // Compute the region of the page that we can't do fast scrolling for. This currently includes // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the // frame view whose layout was updated is not the main frame. Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()); setNonFastScrollableRegion(nonFastScrollableRegion); }
String AsyncScrollingCoordinator::scrollingStateTreeAsText() const { if (m_scrollingStateTree->rootStateNode()) { if (m_nonFastScrollableRegionDirty) m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint())); return m_scrollingStateTree->rootStateNode()->scrollingStateTreeAsText(); } return String(); }
Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame* frame, const IntPoint& frameLocation) const { #if ENABLE(IOS_TOUCH_EVENTS) // On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers. ASSERT(frame->isMainFrame()); UNUSED_PARAM(frameLocation); Document* document = frame->document(); if (!document) return Region(); Vector<IntRect> touchRects; document->getTouchRects(touchRects); Region touchRegion; for (const auto& rect : touchRects) touchRegion.unite(rect); return touchRegion; #else Region nonFastScrollableRegion; FrameView* frameView = frame->view(); if (!frameView) return nonFastScrollableRegion; IntPoint offset = frameLocation; offset.moveBy(frameView->frameRect().location()); offset.move(0, frameView->topContentInset()); if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) { for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) { ScrollableArea* scrollableArea = *it; // Composited scrollable areas can be scrolled off the main thread. if (scrollableArea->usesCompositedScrolling()) continue; IntRect box = scrollableArea->scrollableAreaBoundingBox(); box.moveBy(offset); nonFastScrollableRegion.unite(box); } } for (const auto& child : frameView->children()) { if (!child->isPluginViewBase()) continue; PluginViewBase* pluginViewBase = toPluginViewBase(child.get()); if (pluginViewBase->wantsWheelEvents()) nonFastScrollableRegion.unite(pluginViewBase->frameRect()); } for (Frame* subframe = frame->tree().firstChild(); subframe; subframe = subframe->tree().nextSibling()) nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subframe, offset)); return nonFastScrollableRegion; #endif }
void AsyncScrollingCoordinator::updateNonFastScrollableRegion() { if (!m_nonFastScrollableRegionDirty) return; if (!m_scrollingStateTree->rootStateNode()) return; m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint())); m_nonFastScrollableRegionDirty = false; }
void ScrollingCoordinatorChromium::frameViewLayoutUpdated(FrameView*) { ASSERT(m_page); // Compute the region of the page that we can't do fast scrolling for. This currently includes // all scrollable areas, such as subframes, overflow divs and list boxes, whose composited // scrolling are not enabled. We need to do this even if the frame view whose layout was updated // is not the main frame. Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()); setNonFastScrollableRegion(nonFastScrollableRegion); #if ENABLE(TOUCH_EVENT_TRACKING) Vector<IntRect> touchEventTargetRects; computeAbsoluteTouchEventTargetRects(m_page->mainFrame()->document(), touchEventTargetRects); setTouchEventTargetRects(touchEventTargetRects); #endif }
void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); // If there isn't a root node yet, don't do anything. We'll be called again after creating one. if (!m_scrollingStateTree->rootStateNode()) return; // Compute the region of the page that we can't do fast scrolling for. This currently includes // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the // frame view whose layout was updated is not the main frame. Region nonFastScrollableRegion = computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()); // In the future, we may want to have the ability to set non-fast scrolling regions for more than // just the root node. But right now, this concept only applies to the root. setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree->rootStateNode()); if (!coordinatesScrollingForFrameView(frameView)) return; ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID())); if (!node) return; Scrollbar* verticalScrollbar = frameView->verticalScrollbar(); Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar(); setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node); node->setFrameScaleFactor(frameView->frame().frameScaleFactor()); node->setHeaderHeight(frameView->headerHeight()); node->setFooterHeight(frameView->footerHeight()); node->setScrollOrigin(frameView->scrollOrigin()); node->setViewportConstrainedObjectRect(FloatRect(FloatPoint(), frameView->visibleContentRect().size())); node->setTotalContentsSize(frameView->totalContentsSize()); ScrollableAreaParameters scrollParameters; scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity(); scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity(); scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled(); scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled(); scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode(); scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode(); node->setScrollableAreaParameters(scrollParameters); }
Region ScrollingCoordinator::computeNonFastScrollableRegion(Frame* frame, const IntPoint& frameLocation) { Region nonFastScrollableRegion; FrameView* frameView = frame->view(); if (!frameView) return nonFastScrollableRegion; IntPoint offset = frameLocation; offset.moveBy(frameView->frameRect().location()); if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) { for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) { ScrollableArea* scrollableArea = *it; #if USE(ACCELERATED_COMPOSITING) // Composited scrollable areas can be scrolled off the main thread. if (scrollableArea->usesCompositedScrolling()) continue; #endif IntRect box = scrollableArea->scrollableAreaBoundingBox(); box.moveBy(offset); nonFastScrollableRegion.unite(box); } } if (const HashSet<RefPtr<Widget> >* children = frameView->children()) { for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), end = children->end(); it != end; ++it) { if (!(*it)->isPluginViewBase()) continue; PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>((*it).get()); if (pluginViewBase->wantsWheelEvents()) nonFastScrollableRegion.unite(pluginViewBase->frameRect()); } } FrameTree* tree = frame->tree(); for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tree()->nextSibling()) nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, offset)); return nonFastScrollableRegion; }
void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); // Compute the region of the page that we can't do fast scrolling for. This currently includes // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the // frame view whose layout was updated is not the main frame. Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view()); setNonFastScrollableRegion(nonFastScrollableRegion); if (!coordinatesScrollingForFrameView(frameView)) return; setScrollParameters(frameView->horizontalScrollElasticity(), frameView->verticalScrollElasticity(), frameView->horizontalScrollbar() && frameView->horizontalScrollbar()->enabled(), frameView->verticalScrollbar() && frameView->verticalScrollbar()->enabled(), IntRect(IntPoint(), frameView->visibleContentRect().size()), frameView->contentsSize()); }