mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove usesCompositedScrolling
BUG= R=abarth@chromium.org Review URL: https://codereview.chromium.org/712573003
This commit is contained in:
parent
0d05dbf789
commit
f6b3a8cb02
@ -142,21 +142,6 @@ ScrollingCoordinator* Page::scrollingCoordinator()
|
||||
return m_scrollingCoordinator.get();
|
||||
}
|
||||
|
||||
PassRefPtr<ClientRectList> Page::nonFastScrollableRects(const LocalFrame* frame)
|
||||
{
|
||||
if (mainFrame()->document())
|
||||
mainFrame()->document()->updateLayout();
|
||||
|
||||
Vector<IntRect> rects;
|
||||
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
|
||||
rects = scrollingCoordinator->computeShouldHandleScrollGestureOnMainThreadRegion(frame, IntPoint()).rects();
|
||||
|
||||
Vector<FloatQuad> quads(rects.size());
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
quads[i] = FloatRect(rects[i]);
|
||||
return ClientRectList::create(quads);
|
||||
}
|
||||
|
||||
void Page::setMainFrame(LocalFrame* mainFrame)
|
||||
{
|
||||
// Should only be called during initialization or swaps between local and
|
||||
|
||||
@ -120,8 +120,6 @@ public:
|
||||
|
||||
ScrollingCoordinator* scrollingCoordinator();
|
||||
|
||||
PassRefPtr<ClientRectList> nonFastScrollableRects(const LocalFrame*);
|
||||
|
||||
Settings& settings() const { return *m_settings; }
|
||||
|
||||
UseCounter& useCounter() { return m_useCounter; }
|
||||
|
||||
@ -463,31 +463,6 @@ void ScrollingCoordinator::willBeDestroyed()
|
||||
GraphicsLayer::unregisterContentsLayer(it->value->layer());
|
||||
}
|
||||
|
||||
Region ScrollingCoordinator::computeShouldHandleScrollGestureOnMainThreadRegion(const LocalFrame* frame, const IntPoint& frameLocation) const
|
||||
{
|
||||
Region shouldHandleScrollGestureOnMainThreadRegion;
|
||||
FrameView* frameView = frame->view();
|
||||
if (!frameView)
|
||||
return shouldHandleScrollGestureOnMainThreadRegion;
|
||||
|
||||
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;
|
||||
// Composited scrollable areas can be scrolled off the main thread.
|
||||
if (scrollableArea->usesCompositedScrolling())
|
||||
continue;
|
||||
IntRect box = scrollableArea->scrollableAreaBoundingBox();
|
||||
box.moveBy(offset);
|
||||
shouldHandleScrollGestureOnMainThreadRegion.unite(box);
|
||||
}
|
||||
}
|
||||
|
||||
return shouldHandleScrollGestureOnMainThreadRegion;
|
||||
}
|
||||
|
||||
static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, const Document* document)
|
||||
{
|
||||
ASSERT(document);
|
||||
|
||||
@ -76,8 +76,6 @@ public:
|
||||
void updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent);
|
||||
void updateClipParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent);
|
||||
|
||||
Region computeShouldHandleScrollGestureOnMainThreadRegion(const LocalFrame*, const IntPoint& frameLocation) const;
|
||||
|
||||
void updateTouchEventTargetRectsIfNeeded();
|
||||
|
||||
// For testing purposes only. This ScrollingCoordinator is reused between layout test, and must be reset
|
||||
|
||||
@ -1166,7 +1166,7 @@ void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
|
||||
// FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView
|
||||
// paints the root's background.
|
||||
if (!isDocumentElement()) {
|
||||
overflowBox = overflowRectForPaintRejection();
|
||||
overflowBox = visualOverflowRect();
|
||||
overflowBox.moveBy(adjustedPaintOffset);
|
||||
if (!overflowBox.intersects(paintInfo.rect))
|
||||
return;
|
||||
|
||||
@ -474,11 +474,6 @@ bool RenderBox::canBeProgramaticallyScrolled() const
|
||||
return node && node->hasEditableStyle();
|
||||
}
|
||||
|
||||
bool RenderBox::usesCompositedScrolling() const
|
||||
{
|
||||
return hasOverflowClip() && hasLayer() && layer()->scrollableArea()->usesCompositedScrolling();
|
||||
}
|
||||
|
||||
void RenderBox::autoscroll(const IntPoint& position)
|
||||
{
|
||||
LocalFrame* frame = this->frame();
|
||||
@ -587,10 +582,6 @@ void RenderBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p
|
||||
|
||||
paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden.
|
||||
|
||||
// Do not clip scroll layer contents to reduce the number of paint invalidations while scrolling.
|
||||
if (usesCompositedScrolling())
|
||||
return;
|
||||
|
||||
// height() is inaccurate if we're in the middle of a layout of this RenderBox, so use the
|
||||
// layer's size instead. Even if the layer's size is wrong, the layer itself will issue paint invalidations
|
||||
// anyway if its size does change.
|
||||
@ -3721,17 +3712,6 @@ LayoutRect RenderBox::noOverflowRect() const
|
||||
return rect;
|
||||
}
|
||||
|
||||
LayoutRect RenderBox::overflowRectForPaintRejection() const
|
||||
{
|
||||
LayoutRect overflowRect = visualOverflowRect();
|
||||
if (!m_overflow || !usesCompositedScrolling())
|
||||
return overflowRect;
|
||||
|
||||
overflowRect.unite(layoutOverflowRect());
|
||||
overflowRect.move(-scrolledContentOffset());
|
||||
return overflowRect;
|
||||
}
|
||||
|
||||
LayoutUnit RenderBox::offsetLeft() const
|
||||
{
|
||||
return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x();
|
||||
|
||||
@ -200,8 +200,6 @@ public:
|
||||
LayoutUnit logicalLeftVisualOverflow() const { return visualOverflowRect().x(); }
|
||||
LayoutUnit logicalRightVisualOverflow() const { return visualOverflowRect().maxX(); }
|
||||
|
||||
LayoutRect overflowRectForPaintRejection() const;
|
||||
|
||||
LayoutRect contentsVisualOverflowRect() const { return m_overflow ? m_overflow->contentsVisualOverflowRect() : LayoutRect(); }
|
||||
|
||||
void addLayoutOverflow(const LayoutRect&);
|
||||
@ -449,11 +447,6 @@ public:
|
||||
bool hasScrollableOverflowY() const { return scrollsOverflowY() && pixelSnappedScrollHeight() != pixelSnappedClientHeight(); }
|
||||
virtual bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
|
||||
virtual bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
|
||||
bool usesCompositedScrolling() const;
|
||||
|
||||
// Elements such as the <input> field override this to specify that they are scrollable
|
||||
// outside the context of the CSS overflow style
|
||||
virtual bool isIntristicallyScrollable(ScrollbarOrientation orientation) const { return false; }
|
||||
|
||||
virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
|
||||
|
||||
|
||||
@ -94,7 +94,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type)
|
||||
, m_hasSelfPaintingLayerDescendantDirty(false)
|
||||
, m_isRootLayer(renderer->isRenderView())
|
||||
, m_usedTransparency(false)
|
||||
, m_hasVisibleNonLayerContent(false)
|
||||
, m_3DTransformedDescendantStatusDirty(true)
|
||||
, m_has3DTransformedDescendant(false)
|
||||
, m_containsDirtyOverlayScrollbars(false)
|
||||
@ -103,7 +102,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type)
|
||||
, m_needsDescendantDependentCompositingInputsUpdate(true)
|
||||
, m_childNeedsCompositingInputsUpdate(true)
|
||||
, m_hasCompositingDescendant(false)
|
||||
, m_hasNonCompositedChild(false)
|
||||
, m_shouldIsolateCompositedDescendants(false)
|
||||
, m_lostGroupedMapping(false)
|
||||
, m_renderer(renderer)
|
||||
@ -424,28 +422,6 @@ LayoutRect RenderLayer::computePaintInvalidationRect(const RenderObject* renderO
|
||||
return rect;
|
||||
}
|
||||
|
||||
// FIXME: this is quite brute-force. We could be more efficient if we were to
|
||||
// track state and update it as appropriate as changes are made in the Render tree.
|
||||
void RenderLayer::updateScrollingStateAfterCompositingChange()
|
||||
{
|
||||
TRACE_EVENT0("blink", "RenderLayer::updateScrollingStateAfterCompositingChange");
|
||||
m_hasVisibleNonLayerContent = false;
|
||||
for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()) {
|
||||
if (!r->hasLayer()) {
|
||||
m_hasVisibleNonLayerContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_hasNonCompositedChild = false;
|
||||
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
|
||||
if (child->compositingState() == NotComposited || child->compositingState() == HasOwnBackingButPaintsIntoAncestor) {
|
||||
m_hasNonCompositedChild = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayer::dirty3DTransformedDescendantStatus()
|
||||
{
|
||||
RenderLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingContextNode();
|
||||
@ -2152,8 +2128,7 @@ void RenderLayer::invalidatePaintForBlockSelectionGaps()
|
||||
if (renderer()->hasOverflowClip()) {
|
||||
RenderBox* box = renderBox();
|
||||
rect.move(-box->scrolledContentOffset());
|
||||
if (!scrollableArea()->usesCompositedScrolling())
|
||||
rect.intersect(box->overflowClipRect(LayoutPoint()));
|
||||
rect.intersect(box->overflowClipRect(LayoutPoint()));
|
||||
}
|
||||
if (renderer()->hasClip())
|
||||
rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint()));
|
||||
@ -2172,18 +2147,6 @@ IntRect RenderLayer::blockSelectionGapsBounds() const
|
||||
return pixelSnappedIntRect(gapRects);
|
||||
}
|
||||
|
||||
bool RenderLayer::hasBlockSelectionGapBounds() const
|
||||
{
|
||||
// FIXME: it would be more accurate to return !blockSelectionGapsBounds().isEmpty(), but this is impossible
|
||||
// at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802).
|
||||
// ASSERT(renderer()->document().lifecycle().state() >= DocumentLifecycle::LayoutClean);
|
||||
|
||||
if (!renderer()->isRenderBlock())
|
||||
return false;
|
||||
|
||||
return toRenderBlock(renderer())->shouldPaintSelectionGaps();
|
||||
}
|
||||
|
||||
bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot) const
|
||||
{
|
||||
// Always examine the canvas and the root.
|
||||
|
||||
@ -156,7 +156,6 @@ public:
|
||||
void clearBlockSelectionGapsBounds();
|
||||
void invalidatePaintForBlockSelectionGaps();
|
||||
IntRect blockSelectionGapsBounds() const;
|
||||
bool hasBlockSelectionGapBounds() const;
|
||||
|
||||
RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); }
|
||||
const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.get(); }
|
||||
@ -168,11 +167,6 @@ public:
|
||||
// True if this layer container renderers that paint.
|
||||
bool hasNonEmptyChildRenderers() const;
|
||||
|
||||
// Will ensure that hasNonCompositiedChild are up to date.
|
||||
void updateScrollingStateAfterCompositingChange();
|
||||
bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; }
|
||||
bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasNonCompositedChild; }
|
||||
|
||||
bool usedTransparency() const { return m_usedTransparency; }
|
||||
|
||||
// Gets the nearest enclosing positioned ancestor layer (also includes
|
||||
@ -614,8 +608,6 @@ private:
|
||||
// we ended up painting this layer or any descendants (and therefore need to
|
||||
// blend).
|
||||
|
||||
unsigned m_hasVisibleNonLayerContent : 1;
|
||||
|
||||
unsigned m_3DTransformedDescendantStatusDirty : 1;
|
||||
// Set on a stacking context layer that has 3D descendants anywhere
|
||||
// in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
|
||||
@ -631,10 +623,6 @@ private:
|
||||
// Used only while determining what layers should be composited. Applies to the tree of z-order lists.
|
||||
unsigned m_hasCompositingDescendant : 1;
|
||||
|
||||
// Applies to the real render layer tree (i.e., the tree determined by the layer's parent and children and
|
||||
// as opposed to the tree formed by the z-order and normal flow lists).
|
||||
unsigned m_hasNonCompositedChild : 1;
|
||||
|
||||
// Should be for stacking contexts having unisolated blending descendants.
|
||||
unsigned m_shouldIsolateCompositedDescendants : 1;
|
||||
|
||||
|
||||
@ -295,31 +295,13 @@ void RenderLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset)
|
||||
quadForFakeMouseMoveEvent = paintInvalidationContainer->localToAbsoluteQuad(quadForFakeMouseMoveEvent);
|
||||
frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseMoveEvent);
|
||||
|
||||
bool requiresPaintInvalidation = true;
|
||||
|
||||
if (box().view()->compositor()->inCompositingMode()) {
|
||||
// Hits in virtual/gpu/fast/canvas/canvas-scroll-path-into-view.html.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
bool onlyScrolledCompositedLayers = scrollsOverflow()
|
||||
&& !layer()->hasVisibleNonLayerContent()
|
||||
&& !layer()->hasNonCompositedChild()
|
||||
&& !layer()->hasBlockSelectionGapBounds()
|
||||
&& box().style()->backgroundLayers().attachment() != LocalBackgroundAttachment;
|
||||
|
||||
if (usesCompositedScrolling() || onlyScrolledCompositedLayers)
|
||||
requiresPaintInvalidation = false;
|
||||
}
|
||||
|
||||
// Just schedule a full paint invalidation of our object.
|
||||
if (requiresPaintInvalidation) {
|
||||
// For querying RenderLayer::compositingState()
|
||||
// This code appears correct, since scrolling outside of layout happens during activities that do not dirty compositing state.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
if (box().frameView()->isInPerformLayout())
|
||||
box().setShouldDoFullPaintInvalidation(true);
|
||||
else
|
||||
box().invalidatePaintUsingContainer(paintInvalidationContainer, layer()->renderer()->previousPaintInvalidationRect(), InvalidationScroll);
|
||||
}
|
||||
// For querying RenderLayer::compositingState()
|
||||
// This code appears correct, since scrolling outside of layout happens during activities that do not dirty compositing state.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
if (box().frameView()->isInPerformLayout())
|
||||
box().setShouldDoFullPaintInvalidation(true);
|
||||
else
|
||||
box().invalidatePaintUsingContainer(paintInvalidationContainer, layer()->renderer()->previousPaintInvalidationRect(), InvalidationScroll);
|
||||
|
||||
// Schedule the scroll DOM event.
|
||||
if (box().node())
|
||||
@ -388,9 +370,6 @@ IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const
|
||||
|
||||
bool RenderLayerScrollableArea::userInputScrollable(ScrollbarOrientation orientation) const
|
||||
{
|
||||
if (box().isIntristicallyScrollable(orientation))
|
||||
return true;
|
||||
|
||||
EOverflow overflowStyle = (orientation == HorizontalScrollbar) ?
|
||||
box().style()->overflowX() : box().style()->overflowY();
|
||||
return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle == OOVERLAY);
|
||||
@ -623,7 +602,6 @@ void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
|
||||
|
||||
bool RenderLayerScrollableArea::updateAfterCompositingChange()
|
||||
{
|
||||
layer()->updateScrollingStateAfterCompositingChange();
|
||||
const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild;
|
||||
m_topmostScrollChild = m_nextTopmostScrollChild;
|
||||
m_nextTopmostScrollChild = nullptr;
|
||||
@ -910,28 +888,10 @@ void RenderLayerScrollableArea::updateCompositingLayersAfterScroll()
|
||||
{
|
||||
RenderLayerCompositor* compositor = box().view()->compositor();
|
||||
if (compositor->inCompositingMode()) {
|
||||
if (usesCompositedScrolling()) {
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
ASSERT(layer()->hasCompositedLayerMapping());
|
||||
layer()->compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
|
||||
compositor->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange);
|
||||
} else {
|
||||
layer()->setNeedsCompositingInputsUpdate();
|
||||
}
|
||||
layer()->setNeedsCompositingInputsUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderLayerScrollableArea::usesCompositedScrolling() const
|
||||
{
|
||||
// Scroll form controls on the main thread so they exhibit correct touch scroll event bubbling
|
||||
if (box().isIntristicallyScrollable(VerticalScrollbar) || box().isIntristicallyScrollable(HorizontalScrollbar))
|
||||
return false;
|
||||
|
||||
// See https://codereview.chromium.org/176633003/ for the tests that fail without this disabler.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
return layer()->hasCompositedLayerMapping() && layer()->compositedLayerMapping()->scrollingLayer();
|
||||
}
|
||||
|
||||
static bool layerNeedsCompositedScrolling(const RenderLayer* layer)
|
||||
{
|
||||
return layer->scrollsOverflow()
|
||||
|
||||
@ -70,7 +70,6 @@ public:
|
||||
virtual GraphicsLayer* layerForScrolling() const override;
|
||||
virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
|
||||
virtual GraphicsLayer* layerForVerticalScrollbar() const override;
|
||||
virtual bool usesCompositedScrolling() const override;
|
||||
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
|
||||
virtual bool isActive() const override;
|
||||
IntRect scrollCornerRect() const;
|
||||
|
||||
@ -169,8 +169,6 @@ public:
|
||||
bool scheduleAnimation();
|
||||
void serviceScrollAnimations(double monotonicTime);
|
||||
|
||||
virtual bool usesCompositedScrolling() const { return false; }
|
||||
|
||||
// Returns true if the GraphicsLayer tree needs to be rebuilt.
|
||||
virtual bool updateAfterCompositingChange() { return false; }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user