Chromium Code Reviews| Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| index 597e7c877a1f8020f94fb8afedbb4adf4db3fe16..ab8e54729fa675d3c840597170e660192b676d82 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -382,9 +382,6 @@ bool FrameView::didFirstLayout() const |
| void FrameView::invalidateRect(const IntRect& rect) |
| { |
| - // For querying PaintLayer::compositingState() when invalidating scrollbars. |
| - // FIXME: do all scrollbar invalidations after layout of all frames is complete. It's currently not recursively true. |
| - DisableCompositingQueryAsserts disabler; |
| if (!parent()) { |
| if (HostWindow* window = hostWindow()) |
| window->invalidateRect(rect); |
| @@ -400,7 +397,7 @@ void FrameView::invalidateRect(const IntRect& rect) |
| layoutObject->borderTop() + layoutObject->paddingTop()); |
| // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415 |
| DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; |
| - layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect)); |
| + layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(LayoutRect(paintInvalidationRect)); |
| } |
| void FrameView::setFrameRect(const IntRect& newRect) |
| @@ -983,7 +980,7 @@ void FrameView::layout() |
| setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear. |
| setScrollbarModes(hMode, vMode); |
| - setScrollbarsSuppressed(false, true); |
| + setScrollbarsSuppressed(false); |
| } else if (hMode != currentHMode || vMode != currentVMode) { |
| setScrollbarModes(hMode, vMode); |
| } |
| @@ -1057,10 +1054,6 @@ void FrameView::layout() |
| frame().document()->layoutUpdated(); |
| } |
| -// The plan is to move to compositor-queried paint invalidation, in which case this |
| -// method would setNeedsRedraw on the GraphicsLayers with invalidations and |
| -// let the compositor pick which to actually draw. |
| -// See http://crbug.com/306706 |
| void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidationState) |
| { |
| if (shouldThrottleRendering()) |
| @@ -1076,12 +1069,12 @@ void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation |
| rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); |
| - // Invalidate the paint of the frameviews scrollbars if needed |
| - if (hasVerticalBarDamage()) |
| - invalidateRect(verticalBarDamage()); |
| - if (hasHorizontalBarDamage()) |
| - invalidateRect(horizontalBarDamage()); |
| - resetScrollbarDamage(); |
| + |
| + if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) { |
| + paintInvalidationState.setViewClippingAndScrollOffsetDisabled(true); |
| + invalidatePaintOfScrollControlsIfNeeded(rootForPaintInvalidation, paintInvalidationState, paintInvalidationState.paintInvalidationContainer(), m_scrollCorner, nullptr); |
|
chrishtr
2015/11/17 00:35:47
How about just passing a null pointer for PaintInv
Xianzhu
2015/11/17 00:56:05
For now the only purpose of the paintInvalidationS
|
| + paintInvalidationState.setViewClippingAndScrollOffsetDisabled(false); |
| + } |
| #if ENABLE(ASSERT) |
| layoutView()->assertSubtreeClearedPaintInvalidationState(); |
| @@ -1503,8 +1496,7 @@ void FrameView::didUpdateElasticOverscroll() |
| if (delta != 0) { |
| m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width()); |
| scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); |
| - if (!m_scrollbarsSuppressed) |
| - m_horizontalScrollbar->invalidate(); |
| + setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); |
| } |
| } |
| if (m_verticalScrollbar) { |
| @@ -1512,8 +1504,7 @@ void FrameView::didUpdateElasticOverscroll() |
| if (delta != 0) { |
| m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height()); |
| scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta)); |
| - if (!m_scrollbarsSuppressed) |
| - m_verticalScrollbar->invalidate(); |
| + setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); |
| } |
| } |
| } |
| @@ -2077,24 +2068,10 @@ void FrameView::scrollTo(const DoublePoint& newPosition) |
| frame().loader().client()->didChangeScrollOffset(); |
| } |
| -void FrameView::invalidatePaintForTickmarks() const |
| +void FrameView::invalidatePaintForTickmarks() |
| { |
| if (Scrollbar* scrollbar = verticalScrollbar()) |
| - scrollbar->invalidate(); |
| -} |
| - |
| -void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) |
| -{ |
| - // Add in our offset within the FrameView. |
| - IntRect dirtyRect = rect; |
| - dirtyRect.moveBy(scrollbar->location()); |
| - |
| - layoutView()->invalidateDisplayItemClient(*scrollbar); |
| - |
| - if (isInPerformLayout()) |
| - addScrollbarDamage(scrollbar, rect); |
| - else |
| - invalidateRect(dirtyRect); |
| + setScrollbarNeedsPaintInvalidation(scrollbar); |
| } |
| void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const |
| @@ -2294,7 +2271,7 @@ void FrameView::updateScrollCorner() |
| if (!m_scrollCorner) |
| m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc); |
| m_scrollCorner->setStyle(cornerStyle.release()); |
| - invalidateScrollCorner(cornerRect); |
| + setScrollCornerNeedsPaintInvalidation(); |
| } else if (m_scrollCorner) { |
| m_scrollCorner->destroy(); |
| m_scrollCorner = nullptr; |
| @@ -3005,7 +2982,7 @@ void FrameView::setHasHorizontalScrollbar(bool hasBar) |
| didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); |
| m_horizontalScrollbar->styleChanged(); |
| } else { |
| - willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); |
| + willRemoveScrollbar(*layoutView(), m_horizontalScrollbar.get(), HorizontalScrollbar); |
| if (AXObjectCache* cache = axObjectCache()) |
| cache->remove(m_horizontalScrollbar.get()); |
| // If the scrollbar has been marked as overlapping the window resizer, |
| @@ -3019,7 +2996,7 @@ void FrameView::setHasHorizontalScrollbar(bool hasBar) |
| cache->handleScrollbarUpdate(this); |
| } |
| - invalidateScrollCorner(scrollCornerRect()); |
| + setScrollCornerNeedsPaintInvalidation(); |
| } |
| void FrameView::setHasVerticalScrollbar(bool hasBar) |
| @@ -3033,7 +3010,7 @@ void FrameView::setHasVerticalScrollbar(bool hasBar) |
| didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
| m_verticalScrollbar->styleChanged(); |
| } else { |
| - willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
| + willRemoveScrollbar(*layoutView(), m_verticalScrollbar.get(), VerticalScrollbar); |
| if (AXObjectCache* cache = axObjectCache()) |
| cache->remove(m_verticalScrollbar.get()); |
| // If the scrollbar has been marked as overlapping the window resizer, |
| @@ -3047,7 +3024,7 @@ void FrameView::setHasVerticalScrollbar(bool hasBar) |
| cache->handleScrollbarUpdate(this); |
| } |
| - invalidateScrollCorner(scrollCornerRect()); |
| + setScrollCornerNeedsPaintInvalidation(); |
| } |
| void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, |
| @@ -3214,16 +3191,12 @@ void FrameView::updateScrollbarGeometry() |
| width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), |
| m_horizontalScrollbar->height()); |
| m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRect, m_horizontalScrollbar.get())); |
| - if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect()) |
| - m_horizontalScrollbar->invalidate(); |
| + if (oldRect != m_horizontalScrollbar->frameRect()) |
| + setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); |
| - if (m_scrollbarsSuppressed) |
| - m_horizontalScrollbar->setSuppressInvalidation(true); |
| m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); |
| m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); |
| m_horizontalScrollbar->offsetDidChange(); |
| - if (m_scrollbarsSuppressed) |
| - m_horizontalScrollbar->setSuppressInvalidation(false); |
| } |
| if (m_verticalScrollbar) { |
| @@ -3234,16 +3207,12 @@ void FrameView::updateScrollbarGeometry() |
| m_verticalScrollbar->width(), |
| height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); |
| m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect, m_verticalScrollbar.get())); |
| - if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect()) |
| - m_verticalScrollbar->invalidate(); |
| + if (oldRect != m_verticalScrollbar->frameRect()) |
| + setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); |
| - if (m_scrollbarsSuppressed) |
| - m_verticalScrollbar->setSuppressInvalidation(true); |
| m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); |
| m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); |
| m_verticalScrollbar->offsetDidChange(); |
| - if (m_scrollbarsSuppressed) |
| - m_verticalScrollbar->setSuppressInvalidation(false); |
| } |
| } |
| @@ -3346,8 +3315,6 @@ void FrameView::updateScrollbars(const DoubleSize& desiredOffset) |
| return; |
| InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
| - IntSize oldVisibleSize = visibleContentSize(); |
| - |
| bool scrollbarExistenceChanged = false; |
| if (needsScrollbarReconstruction()) { |
| @@ -3372,17 +3339,6 @@ void FrameView::updateScrollbars(const DoubleSize& desiredOffset) |
| updateScrollCorner(); |
| } |
| - // FIXME: We don't need to do this if we are composited. |
| - IntSize newVisibleSize = visibleContentSize(); |
| - if (newVisibleSize.width() > oldVisibleSize.width()) { |
| - if (shouldPlaceVerticalScrollbarOnLeft()) |
| - invalidateRect(IntRect(0, 0, newVisibleSize.width() - oldVisibleSize.width(), newVisibleSize.height())); |
| - else |
| - invalidateRect(IntRect(oldVisibleSize.width(), 0, newVisibleSize.width() - oldVisibleSize.width(), newVisibleSize.height())); |
| - } |
| - if (newVisibleSize.height() > oldVisibleSize.height()) |
| - invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width(), newVisibleSize.height() - oldVisibleSize.height())); |
| - |
| setScrollOffsetFromUpdateScrollbars(desiredOffset); |
| } |
| @@ -3563,24 +3519,6 @@ void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) |
| } |
| } |
| -void FrameView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress) |
| -{ |
| - if (suppressed == m_scrollbarsSuppressed) |
| - return; |
| - |
| - m_scrollbarsSuppressed = suppressed; |
| - |
| - if (repaintOnUnsuppress && !suppressed) { |
| - if (m_horizontalScrollbar) |
| - m_horizontalScrollbar->invalidate(); |
| - if (m_verticalScrollbar) |
| - m_verticalScrollbar->invalidate(); |
| - |
| - // Invalidate the scroll corner too on unsuppress. |
| - invalidateScrollCorner(scrollCornerRect()); |
| - } |
| -} |
| - |
| Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame) |
| { |
| IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); |
| @@ -3700,13 +3638,6 @@ bool FrameView::isScrollCornerVisible() const |
| return !scrollCornerRect().isEmpty(); |
| } |
| -void FrameView::invalidateScrollCornerRect(const IntRect& rect) |
| -{ |
| - invalidateRect(rect); |
| - if (m_scrollCorner) |
| - layoutView()->invalidateDisplayItemClientForNonCompositingDescendantsOf(*m_scrollCorner); |
| -} |
| - |
| ScrollBehavior FrameView::scrollBehaviorStyle() const |
| { |
| Element* scrollElement = m_frame->document()->scrollingElement(); |