| 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 dd65fe3998e1f0588f41f1628eec4cdcbbd8e2e7..29096603d9b63a9755fa09492108724c80373533 100644
|
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| @@ -382,6 +382,9 @@
|
|
|
| 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);
|
| @@ -397,7 +400,7 @@
|
| layoutObject->borderTop() + layoutObject->paddingTop());
|
| // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
|
| DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
|
| - layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(LayoutRect(paintInvalidationRect));
|
| + layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect));
|
| }
|
|
|
| void FrameView::setFrameRect(const IntRect& newRect)
|
| @@ -980,7 +983,7 @@
|
| setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
|
|
|
| setScrollbarModes(hMode, vMode);
|
| - setScrollbarsSuppressed(false);
|
| + setScrollbarsSuppressed(false, true);
|
| } else if (hMode != currentHMode || vMode != currentVMode) {
|
| setScrollbarModes(hMode, vMode);
|
| }
|
| @@ -1054,6 +1057,10 @@
|
| 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())
|
| @@ -1069,11 +1076,12 @@
|
|
|
| rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState);
|
|
|
| - if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) {
|
| - paintInvalidationState.setViewClippingAndScrollOffsetDisabled(true);
|
| - invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState, paintInvalidationState.paintInvalidationContainer());
|
| - paintInvalidationState.setViewClippingAndScrollOffsetDisabled(false);
|
| - }
|
| + // Invalidate the paint of the frameviews scrollbars if needed
|
| + if (hasVerticalBarDamage())
|
| + invalidateRect(verticalBarDamage());
|
| + if (hasHorizontalBarDamage())
|
| + invalidateRect(horizontalBarDamage());
|
| + resetScrollbarDamage();
|
|
|
| #if ENABLE(ASSERT)
|
| layoutView()->assertSubtreeClearedPaintInvalidationState();
|
| @@ -1501,7 +1509,8 @@
|
| if (delta != 0) {
|
| m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width());
|
| scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0));
|
| - setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get());
|
| + if (!m_scrollbarsSuppressed)
|
| + m_horizontalScrollbar->invalidate();
|
| }
|
| }
|
| if (m_verticalScrollbar) {
|
| @@ -1509,7 +1518,8 @@
|
| if (delta != 0) {
|
| m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height());
|
| scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta));
|
| - setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get());
|
| + if (!m_scrollbarsSuppressed)
|
| + m_verticalScrollbar->invalidate();
|
| }
|
| }
|
| }
|
| @@ -2073,10 +2083,24 @@
|
| frame().loader().client()->didChangeScrollOffset();
|
| }
|
|
|
| -void FrameView::invalidatePaintForTickmarks()
|
| +void FrameView::invalidatePaintForTickmarks() const
|
| {
|
| if (Scrollbar* scrollbar = verticalScrollbar())
|
| - setScrollbarNeedsPaintInvalidation(scrollbar);
|
| + 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);
|
| }
|
|
|
| void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
|
| @@ -2276,7 +2300,7 @@
|
| if (!m_scrollCorner)
|
| m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc);
|
| m_scrollCorner->setStyle(cornerStyle.release());
|
| - setScrollCornerNeedsPaintInvalidation();
|
| + invalidateScrollCorner(cornerRect);
|
| } else if (m_scrollCorner) {
|
| m_scrollCorner->destroy();
|
| m_scrollCorner = nullptr;
|
| @@ -3001,7 +3025,7 @@
|
| cache->handleScrollbarUpdate(this);
|
| }
|
|
|
| - setScrollCornerNeedsPaintInvalidation();
|
| + invalidateScrollCorner(scrollCornerRect());
|
| }
|
|
|
| void FrameView::setHasVerticalScrollbar(bool hasBar)
|
| @@ -3029,7 +3053,7 @@
|
| cache->handleScrollbarUpdate(this);
|
| }
|
|
|
| - setScrollCornerNeedsPaintInvalidation();
|
| + invalidateScrollCorner(scrollCornerRect());
|
| }
|
|
|
| void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode,
|
| @@ -3196,12 +3220,16 @@
|
| width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
|
| m_horizontalScrollbar->height());
|
| m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRect, m_horizontalScrollbar.get()));
|
| - if (oldRect != m_horizontalScrollbar->frameRect())
|
| - setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get());
|
| -
|
| + if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect())
|
| + m_horizontalScrollbar->invalidate();
|
| +
|
| + 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) {
|
| @@ -3212,12 +3240,16 @@
|
| m_verticalScrollbar->width(),
|
| height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
|
| m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect, m_verticalScrollbar.get()));
|
| - if (oldRect != m_verticalScrollbar->frameRect())
|
| - setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get());
|
| -
|
| + if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
|
| + m_verticalScrollbar->invalidate();
|
| +
|
| + 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);
|
| }
|
| }
|
|
|
| @@ -3320,6 +3352,8 @@
|
| return;
|
| InUpdateScrollbarsScope inUpdateScrollbarsScope(this);
|
|
|
| + IntSize oldVisibleSize = visibleContentSize();
|
| +
|
| bool scrollbarExistenceChanged = false;
|
|
|
| if (needsScrollbarReconstruction()) {
|
| @@ -3343,6 +3377,17 @@
|
| positionScrollbarLayers();
|
| 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);
|
| }
|
| @@ -3524,6 +3569,24 @@
|
| }
|
| }
|
|
|
| +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);
|
| @@ -3641,6 +3704,13 @@
|
| 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
|
| @@ -3977,10 +4047,4 @@
|
| return m_hiddenForThrottling && m_crossOriginForThrottling;
|
| }
|
|
|
| -LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
|
| -{
|
| - ASSERT(layoutView());
|
| - return *layoutView();
|
| -}
|
| -
|
| } // namespace blink
|
|
|