Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1456953003: Revert of Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 setScrollbarsSuppressed(true); 375 setScrollbarsSuppressed(true);
376 } 376 }
377 377
378 bool FrameView::didFirstLayout() const 378 bool FrameView::didFirstLayout() const
379 { 379 {
380 return !m_firstLayout; 380 return !m_firstLayout;
381 } 381 }
382 382
383 void FrameView::invalidateRect(const IntRect& rect) 383 void FrameView::invalidateRect(const IntRect& rect)
384 { 384 {
385 // For querying PaintLayer::compositingState() when invalidating scrollbars.
386 // FIXME: do all scrollbar invalidations after layout of all frames is compl ete. It's currently not recursively true.
387 DisableCompositingQueryAsserts disabler;
385 if (!parent()) { 388 if (!parent()) {
386 if (HostWindow* window = hostWindow()) 389 if (HostWindow* window = hostWindow())
387 window->invalidateRect(rect); 390 window->invalidateRect(rect);
388 return; 391 return;
389 } 392 }
390 393
391 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); 394 LayoutPart* layoutObject = m_frame->ownerLayoutObject();
392 if (!layoutObject) 395 if (!layoutObject)
393 return; 396 return;
394 397
395 IntRect paintInvalidationRect = rect; 398 IntRect paintInvalidationRect = rect;
396 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), 399 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(),
397 layoutObject->borderTop() + layoutObject->paddingTop()); 400 layoutObject->borderTop() + layoutObject->paddingTop());
398 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 401 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415
399 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; 402 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
400 layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layo utRect(paintInvalidationRect)); 403 layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect));
401 } 404 }
402 405
403 void FrameView::setFrameRect(const IntRect& newRect) 406 void FrameView::setFrameRect(const IntRect& newRect)
404 { 407 {
405 IntRect oldRect = frameRect(); 408 IntRect oldRect = frameRect();
406 if (newRect == oldRect) 409 if (newRect == oldRect)
407 return; 410 return;
408 411
409 Widget::setFrameRect(newRect); 412 Widget::setFrameRect(newRect);
410 413
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 m_lastZoomFactor = layoutView()->style()->zoom(); 976 m_lastZoomFactor = layoutView()->style()->zoom();
974 977
975 // Set the initial vMode to AlwaysOn if we're auto. 978 // Set the initial vMode to AlwaysOn if we're auto.
976 if (vMode == ScrollbarAuto) 979 if (vMode == ScrollbarAuto)
977 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. 980 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
978 // Set the initial hMode to AlwaysOff if we're auto. 981 // Set the initial hMode to AlwaysOff if we're auto.
979 if (hMode == ScrollbarAuto) 982 if (hMode == ScrollbarAuto)
980 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. 983 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear.
981 984
982 setScrollbarModes(hMode, vMode); 985 setScrollbarModes(hMode, vMode);
983 setScrollbarsSuppressed(false); 986 setScrollbarsSuppressed(false, true);
984 } else if (hMode != currentHMode || vMode != currentVMode) { 987 } else if (hMode != currentHMode || vMode != currentVMode) {
985 setScrollbarModes(hMode, vMode); 988 setScrollbarModes(hMode, vMode);
986 } 989 }
987 990
988 if (needsScrollbarReconstruction()) 991 if (needsScrollbarReconstruction())
989 updateScrollbars(scrollOffsetDouble()); 992 updateScrollbars(scrollOffsetDouble());
990 993
991 LayoutSize oldSize = m_size; 994 LayoutSize oldSize = m_size;
992 995
993 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); 996 m_size = LayoutSize(layoutSize().width(), layoutSize().height());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 return; 1050 return;
1048 1051
1049 #if ENABLE(ASSERT) 1052 #if ENABLE(ASSERT)
1050 // Post-layout assert that nobody was re-marked as needing layout during lay out. 1053 // Post-layout assert that nobody was re-marked as needing layout during lay out.
1051 layoutView()->assertSubtreeIsLaidOut(); 1054 layoutView()->assertSubtreeIsLaidOut();
1052 #endif 1055 #endif
1053 1056
1054 frame().document()->layoutUpdated(); 1057 frame().document()->layoutUpdated();
1055 } 1058 }
1056 1059
1060 // The plan is to move to compositor-queried paint invalidation, in which case t his
1061 // method would setNeedsRedraw on the GraphicsLayers with invalidations and
1062 // let the compositor pick which to actually draw.
1063 // See http://crbug.com/306706
1057 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State) 1064 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State)
1058 { 1065 {
1059 if (shouldThrottleRendering()) 1066 if (shouldThrottleRendering())
1060 return; 1067 return;
1061 1068
1062 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); 1069 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation);
1063 1070
1064 ASSERT(layoutView()); 1071 ASSERT(layoutView());
1065 LayoutView& rootForPaintInvalidation = *layoutView(); 1072 LayoutView& rootForPaintInvalidation = *layoutView();
1066 ASSERT(!rootForPaintInvalidation.needsLayout()); 1073 ASSERT(!rootForPaintInvalidation.needsLayout());
1067 1074
1068 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); 1075 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii());
1069 1076
1070 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); 1077 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState);
1071 1078
1072 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) { 1079 // Invalidate the paint of the frameviews scrollbars if needed
1073 paintInvalidationState.setViewClippingAndScrollOffsetDisabled(true); 1080 if (hasVerticalBarDamage())
1074 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState, paintInv alidationState.paintInvalidationContainer()); 1081 invalidateRect(verticalBarDamage());
1075 paintInvalidationState.setViewClippingAndScrollOffsetDisabled(false); 1082 if (hasHorizontalBarDamage())
1076 } 1083 invalidateRect(horizontalBarDamage());
1084 resetScrollbarDamage();
1077 1085
1078 #if ENABLE(ASSERT) 1086 #if ENABLE(ASSERT)
1079 layoutView()->assertSubtreeClearedPaintInvalidationState(); 1087 layoutView()->assertSubtreeClearedPaintInvalidationState();
1080 #endif 1088 #endif
1081 1089
1082 if (m_frame->selection().isCaretBoundsDirty()) 1090 if (m_frame->selection().isCaretBoundsDirty())
1083 m_frame->selection().invalidateCaretRect(); 1091 m_frame->selection().invalidateCaretRect();
1084 1092
1085 m_doFullPaintInvalidation = false; 1093 m_doFullPaintInvalidation = false;
1086 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); 1094 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 { 1502 {
1495 Page* page = frame().page(); 1503 Page* page = frame().page();
1496 if (!page) 1504 if (!page)
1497 return; 1505 return;
1498 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); 1506 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll();
1499 if (m_horizontalScrollbar) { 1507 if (m_horizontalScrollbar) {
1500 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); 1508 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll();
1501 if (delta != 0) { 1509 if (delta != 0) {
1502 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); 1510 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( ));
1503 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); 1511 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0));
1504 setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); 1512 if (!m_scrollbarsSuppressed)
1513 m_horizontalScrollbar->invalidate();
1505 } 1514 }
1506 } 1515 }
1507 if (m_verticalScrollbar) { 1516 if (m_verticalScrollbar) {
1508 float delta = elasticOverscroll.height() - m_verticalScrollbar->elasticO verscroll(); 1517 float delta = elasticOverscroll.height() - m_verticalScrollbar->elasticO verscroll();
1509 if (delta != 0) { 1518 if (delta != 0) {
1510 m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height() ); 1519 m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height() );
1511 scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta)); 1520 scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta));
1512 setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); 1521 if (!m_scrollbarsSuppressed)
1522 m_verticalScrollbar->invalidate();
1513 } 1523 }
1514 } 1524 }
1515 } 1525 }
1516 1526
1517 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const 1527 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const
1518 { 1528 {
1519 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; 1529 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize;
1520 } 1530 }
1521 1531
1522 void FrameView::setLayoutSize(const IntSize& size) 1532 void FrameView::setLayoutSize(const IntSize& size)
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 2076
2067 if (!scrollbarsSuppressed()) 2077 if (!scrollbarsSuppressed())
2068 m_pendingScrollDelta += scrollDelta; 2078 m_pendingScrollDelta += scrollDelta;
2069 2079
2070 clearScrollAnchor(); 2080 clearScrollAnchor();
2071 updateLayersAndCompositingAfterScrollIfNeeded(); 2081 updateLayersAndCompositingAfterScrollIfNeeded();
2072 scrollPositionChanged(); 2082 scrollPositionChanged();
2073 frame().loader().client()->didChangeScrollOffset(); 2083 frame().loader().client()->didChangeScrollOffset();
2074 } 2084 }
2075 2085
2076 void FrameView::invalidatePaintForTickmarks() 2086 void FrameView::invalidatePaintForTickmarks() const
2077 { 2087 {
2078 if (Scrollbar* scrollbar = verticalScrollbar()) 2088 if (Scrollbar* scrollbar = verticalScrollbar())
2079 setScrollbarNeedsPaintInvalidation(scrollbar); 2089 scrollbar->invalidate();
2090 }
2091
2092 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec t)
2093 {
2094 // Add in our offset within the FrameView.
2095 IntRect dirtyRect = rect;
2096 dirtyRect.moveBy(scrollbar->location());
2097
2098 layoutView()->invalidateDisplayItemClient(*scrollbar);
2099
2100 if (isInPerformLayout())
2101 addScrollbarDamage(scrollbar, rect);
2102 else
2103 invalidateRect(dirtyRect);
2080 } 2104 }
2081 2105
2082 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const 2106 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
2083 { 2107 {
2084 if (!m_tickmarks.isEmpty()) 2108 if (!m_tickmarks.isEmpty())
2085 tickmarks = m_tickmarks; 2109 tickmarks = m_tickmarks;
2086 else 2110 else
2087 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch); 2111 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch);
2088 } 2112 }
2089 2113
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also. 2293 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also.
2270 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject()) 2294 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject())
2271 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe quest(SCROLLBAR_CORNER), layoutObject->style()); 2295 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe quest(SCROLLBAR_CORNER), layoutObject->style());
2272 } 2296 }
2273 } 2297 }
2274 2298
2275 if (cornerStyle) { 2299 if (cornerStyle) {
2276 if (!m_scrollCorner) 2300 if (!m_scrollCorner)
2277 m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc); 2301 m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc);
2278 m_scrollCorner->setStyle(cornerStyle.release()); 2302 m_scrollCorner->setStyle(cornerStyle.release());
2279 setScrollCornerNeedsPaintInvalidation(); 2303 invalidateScrollCorner(cornerRect);
2280 } else if (m_scrollCorner) { 2304 } else if (m_scrollCorner) {
2281 m_scrollCorner->destroy(); 2305 m_scrollCorner->destroy();
2282 m_scrollCorner = nullptr; 2306 m_scrollCorner = nullptr;
2283 } 2307 }
2284 } 2308 }
2285 2309
2286 Color FrameView::documentBackgroundColor() const 2310 Color FrameView::documentBackgroundColor() const
2287 { 2311 {
2288 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of 2312 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of
2289 // the document and the body against the base background color of the frame view. 2313 // the document and the body against the base background color of the frame view.
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 // then its removal should reduce the count. 3018 // then its removal should reduce the count.
2995 if (m_horizontalScrollbar->overlapsResizer()) 3019 if (m_horizontalScrollbar->overlapsResizer())
2996 adjustScrollbarsAvoidingResizerCount(-1); 3020 adjustScrollbarsAvoidingResizerCount(-1);
2997 removeChild(m_horizontalScrollbar.get()); 3021 removeChild(m_horizontalScrollbar.get());
2998 m_horizontalScrollbar->disconnectFromScrollableArea(); 3022 m_horizontalScrollbar->disconnectFromScrollableArea();
2999 m_horizontalScrollbar = nullptr; 3023 m_horizontalScrollbar = nullptr;
3000 if (AXObjectCache* cache = axObjectCache()) 3024 if (AXObjectCache* cache = axObjectCache())
3001 cache->handleScrollbarUpdate(this); 3025 cache->handleScrollbarUpdate(this);
3002 } 3026 }
3003 3027
3004 setScrollCornerNeedsPaintInvalidation(); 3028 invalidateScrollCorner(scrollCornerRect());
3005 } 3029 }
3006 3030
3007 void FrameView::setHasVerticalScrollbar(bool hasBar) 3031 void FrameView::setHasVerticalScrollbar(bool hasBar)
3008 { 3032 {
3009 if (hasBar == !!m_verticalScrollbar) 3033 if (hasBar == !!m_verticalScrollbar)
3010 return; 3034 return;
3011 3035
3012 if (hasBar) { 3036 if (hasBar) {
3013 m_verticalScrollbar = createScrollbar(VerticalScrollbar); 3037 m_verticalScrollbar = createScrollbar(VerticalScrollbar);
3014 addChild(m_verticalScrollbar.get()); 3038 addChild(m_verticalScrollbar.get());
3015 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); 3039 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar);
3016 m_verticalScrollbar->styleChanged(); 3040 m_verticalScrollbar->styleChanged();
3017 } else { 3041 } else {
3018 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); 3042 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar);
3019 if (AXObjectCache* cache = axObjectCache()) 3043 if (AXObjectCache* cache = axObjectCache())
3020 cache->remove(m_verticalScrollbar.get()); 3044 cache->remove(m_verticalScrollbar.get());
3021 // If the scrollbar has been marked as overlapping the window resizer, 3045 // If the scrollbar has been marked as overlapping the window resizer,
3022 // then its removal should reduce the count. 3046 // then its removal should reduce the count.
3023 if (m_verticalScrollbar->overlapsResizer()) 3047 if (m_verticalScrollbar->overlapsResizer())
3024 adjustScrollbarsAvoidingResizerCount(-1); 3048 adjustScrollbarsAvoidingResizerCount(-1);
3025 removeChild(m_verticalScrollbar.get()); 3049 removeChild(m_verticalScrollbar.get());
3026 m_verticalScrollbar->disconnectFromScrollableArea(); 3050 m_verticalScrollbar->disconnectFromScrollableArea();
3027 m_verticalScrollbar = nullptr; 3051 m_verticalScrollbar = nullptr;
3028 if (AXObjectCache* cache = axObjectCache()) 3052 if (AXObjectCache* cache = axObjectCache())
3029 cache->handleScrollbarUpdate(this); 3053 cache->handleScrollbarUpdate(this);
3030 } 3054 }
3031 3055
3032 setScrollCornerNeedsPaintInvalidation(); 3056 invalidateScrollCorner(scrollCornerRect());
3033 } 3057 }
3034 3058
3035 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode, 3059 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode,
3036 bool horizontalLock, bool verticalLock) 3060 bool horizontalLock, bool verticalLock)
3037 { 3061 {
3038 bool needsUpdate = false; 3062 bool needsUpdate = false;
3039 3063
3040 // If the page's overflow setting has disabled scrolling, do not allow anyth ing to override that setting. 3064 // If the page's overflow setting has disabled scrolling, do not allow anyth ing to override that setting.
3041 // http://crbug.com/426447 3065 // http://crbug.com/426447
3042 LayoutObject* viewport = viewportLayoutObject(); 3066 LayoutObject* viewport = viewportLayoutObject();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 void FrameView::updateScrollbarGeometry() 3213 void FrameView::updateScrollbarGeometry()
3190 { 3214 {
3191 if (m_horizontalScrollbar) { 3215 if (m_horizontalScrollbar) {
3192 int clientWidth = visibleWidth(); 3216 int clientWidth = visibleWidth();
3193 IntRect oldRect(m_horizontalScrollbar->frameRect()); 3217 IntRect oldRect(m_horizontalScrollbar->frameRect());
3194 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, 3218 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0,
3195 height() - m_horizontalScrollbar->height(), 3219 height() - m_horizontalScrollbar->height(),
3196 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), 3220 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
3197 m_horizontalScrollbar->height()); 3221 m_horizontalScrollbar->height());
3198 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); 3222 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get()));
3199 if (oldRect != m_horizontalScrollbar->frameRect()) 3223 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct())
3200 setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); 3224 m_horizontalScrollbar->invalidate();
3201 3225
3226 if (m_scrollbarsSuppressed)
3227 m_horizontalScrollbar->setSuppressInvalidation(true);
3202 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); 3228 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
3203 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); 3229 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth());
3204 m_horizontalScrollbar->offsetDidChange(); 3230 m_horizontalScrollbar->offsetDidChange();
3231 if (m_scrollbarsSuppressed)
3232 m_horizontalScrollbar->setSuppressInvalidation(false);
3205 } 3233 }
3206 3234
3207 if (m_verticalScrollbar) { 3235 if (m_verticalScrollbar) {
3208 int clientHeight = visibleHeight(); 3236 int clientHeight = visibleHeight();
3209 IntRect oldRect(m_verticalScrollbar->frameRect()); 3237 IntRect oldRect(m_verticalScrollbar->frameRect());
3210 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), 3238 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()),
3211 0, 3239 0,
3212 m_verticalScrollbar->width(), 3240 m_verticalScrollbar->width(),
3213 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); 3241 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
3214 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); 3242 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get()));
3215 if (oldRect != m_verticalScrollbar->frameRect()) 3243 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ())
3216 setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); 3244 m_verticalScrollbar->invalidate();
3217 3245
3246 if (m_scrollbarsSuppressed)
3247 m_verticalScrollbar->setSuppressInvalidation(true);
3218 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); 3248 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
3219 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); 3249 m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
3220 m_verticalScrollbar->offsetDidChange(); 3250 m_verticalScrollbar->offsetDidChange();
3251 if (m_scrollbarsSuppressed)
3252 m_verticalScrollbar->setSuppressInvalidation(false);
3221 } 3253 }
3222 } 3254 }
3223 3255
3224 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) 3256 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar)
3225 { 3257 {
3226 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap 3258 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap
3227 // if necessary. 3259 // if necessary.
3228 IntRect adjustedRect(rect); 3260 IntRect adjustedRect(rect);
3229 bool overlapsResizer = false; 3261 bool overlapsResizer = false;
3230 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { 3262 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 setHasHorizontalScrollbar(false); 3345 setHasHorizontalScrollbar(false);
3314 setHasVerticalScrollbar(false); 3346 setHasVerticalScrollbar(false);
3315 setScrollOffsetFromUpdateScrollbars(desiredOffset); 3347 setScrollOffsetFromUpdateScrollbars(desiredOffset);
3316 return; 3348 return;
3317 } 3349 }
3318 3350
3319 if (m_inUpdateScrollbars) 3351 if (m_inUpdateScrollbars)
3320 return; 3352 return;
3321 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); 3353 InUpdateScrollbarsScope inUpdateScrollbarsScope(this);
3322 3354
3355 IntSize oldVisibleSize = visibleContentSize();
3356
3323 bool scrollbarExistenceChanged = false; 3357 bool scrollbarExistenceChanged = false;
3324 3358
3325 if (needsScrollbarReconstruction()) { 3359 if (needsScrollbarReconstruction()) {
3326 setHasHorizontalScrollbar(false); 3360 setHasHorizontalScrollbar(false);
3327 setHasVerticalScrollbar(false); 3361 setHasVerticalScrollbar(false);
3328 scrollbarExistenceChanged = true; 3362 scrollbarExistenceChanged = true;
3329 } 3363 }
3330 3364
3331 int maxUpdateScrollbarsPass = hasOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3; 3365 int maxUpdateScrollbarsPass = hasOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3;
3332 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) { 3366 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) {
3333 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass)) 3367 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass))
3334 break; 3368 break;
3335 scrollbarExistenceChanged = true; 3369 scrollbarExistenceChanged = true;
3336 } 3370 }
3337 3371
3338 updateScrollbarGeometry(); 3372 updateScrollbarGeometry();
3339 3373
3340 if (scrollbarExistenceChanged) { 3374 if (scrollbarExistenceChanged) {
3341 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec ts changed? 3375 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec ts changed?
3342 frameRectsChanged(); 3376 frameRectsChanged();
3343 positionScrollbarLayers(); 3377 positionScrollbarLayers();
3344 updateScrollCorner(); 3378 updateScrollCorner();
3345 } 3379 }
3346 3380
3381 // FIXME: We don't need to do this if we are composited.
3382 IntSize newVisibleSize = visibleContentSize();
3383 if (newVisibleSize.width() > oldVisibleSize.width()) {
3384 if (shouldPlaceVerticalScrollbarOnLeft())
3385 invalidateRect(IntRect(0, 0, newVisibleSize.width() - oldVisibleSize .width(), newVisibleSize.height()));
3386 else
3387 invalidateRect(IntRect(oldVisibleSize.width(), 0, newVisibleSize.wid th() - oldVisibleSize.width(), newVisibleSize.height()));
3388 }
3389 if (newVisibleSize.height() > oldVisibleSize.height())
3390 invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width( ), newVisibleSize.height() - oldVisibleSize.height()));
3391
3347 setScrollOffsetFromUpdateScrollbars(desiredOffset); 3392 setScrollOffsetFromUpdateScrollbars(desiredOffset);
3348 } 3393 }
3349 3394
3350 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) 3395 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset)
3351 { 3396 {
3352 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset) ); 3397 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset) );
3353 3398
3354 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) { 3399 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) {
3355 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll); 3400 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll);
3356 resetScrollOriginChanged(); 3401 resetScrollOriginChanged();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 } else if (!scrollbarsSuppressed()) { 3562 } else if (!scrollbarsSuppressed()) {
3518 // If we went from n to 0 or from 0 to n and we're the outermost view, 3563 // If we went from n to 0 or from 0 to n and we're the outermost view,
3519 // we need to invalidate the windowResizerRect(), since it will now need to paint 3564 // we need to invalidate the windowResizerRect(), since it will now need to paint
3520 // differently. 3565 // differently.
3521 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0) 3566 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0)
3522 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0)) 3567 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0))
3523 invalidateRect(windowResizerRect()); 3568 invalidateRect(windowResizerRect());
3524 } 3569 }
3525 } 3570 }
3526 3571
3572 void FrameView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppres s)
3573 {
3574 if (suppressed == m_scrollbarsSuppressed)
3575 return;
3576
3577 m_scrollbarsSuppressed = suppressed;
3578
3579 if (repaintOnUnsuppress && !suppressed) {
3580 if (m_horizontalScrollbar)
3581 m_horizontalScrollbar->invalidate();
3582 if (m_verticalScrollbar)
3583 m_verticalScrollbar->invalidate();
3584
3585 // Invalidate the scroll corner too on unsuppress.
3586 invalidateScrollCorner(scrollCornerRect());
3587 }
3588 }
3589
3527 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame ) 3590 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame )
3528 { 3591 {
3529 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); 3592 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame);
3530 return scrollbarAtFramePoint(pointInFrame); 3593 return scrollbarAtFramePoint(pointInFrame);
3531 } 3594 }
3532 3595
3533 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) 3596 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame)
3534 { 3597 {
3535 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) 3598 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame))
3536 return m_horizontalScrollbar.get(); 3599 return m_horizontalScrollbar.get();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 } 3699 }
3637 3700
3638 return cornerRect; 3701 return cornerRect;
3639 } 3702 }
3640 3703
3641 bool FrameView::isScrollCornerVisible() const 3704 bool FrameView::isScrollCornerVisible() const
3642 { 3705 {
3643 return !scrollCornerRect().isEmpty(); 3706 return !scrollCornerRect().isEmpty();
3644 } 3707 }
3645 3708
3709 void FrameView::invalidateScrollCornerRect(const IntRect& rect)
3710 {
3711 invalidateRect(rect);
3712 if (m_scrollCorner)
3713 layoutView()->invalidateDisplayItemClientForNonCompositingDescendantsOf( *m_scrollCorner);
3714 }
3715
3646 ScrollBehavior FrameView::scrollBehaviorStyle() const 3716 ScrollBehavior FrameView::scrollBehaviorStyle() const
3647 { 3717 {
3648 Element* scrollElement = m_frame->document()->scrollingElement(); 3718 Element* scrollElement = m_frame->document()->scrollingElement();
3649 LayoutObject* layoutObject = scrollElement ? scrollElement->layoutObject() : nullptr; 3719 LayoutObject* layoutObject = scrollElement ? scrollElement->layoutObject() : nullptr;
3650 if (layoutObject && layoutObject->style()->scrollBehavior() == ScrollBehavio rSmooth) 3720 if (layoutObject && layoutObject->style()->scrollBehavior() == ScrollBehavio rSmooth)
3651 return ScrollBehaviorSmooth; 3721 return ScrollBehaviorSmooth;
3652 3722
3653 return ScrollBehaviorInstant; 3723 return ScrollBehaviorInstant;
3654 } 3724 }
3655 3725
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 return canThrottleRendering() && lifecycle().throttlingAllowed(); 4040 return canThrottleRendering() && lifecycle().throttlingAllowed();
3971 } 4041 }
3972 4042
3973 bool FrameView::canThrottleRendering() const 4043 bool FrameView::canThrottleRendering() const
3974 { 4044 {
3975 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4045 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
3976 return false; 4046 return false;
3977 return m_hiddenForThrottling && m_crossOriginForThrottling; 4047 return m_hiddenForThrottling && m_crossOriginForThrottling;
3978 } 4048 }
3979 4049
3980 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
3981 {
3982 ASSERT(layoutView());
3983 return *layoutView();
3984 }
3985
3986 } // namespace blink 4050 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/RootFrameViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698