Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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; | |
| 388 if (!parent()) { | 385 if (!parent()) { |
| 389 if (HostWindow* window = hostWindow()) | 386 if (HostWindow* window = hostWindow()) |
| 390 window->invalidateRect(rect); | 387 window->invalidateRect(rect); |
| 391 return; | 388 return; |
| 392 } | 389 } |
| 393 | 390 |
| 394 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 391 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
| 395 if (!layoutObject) | 392 if (!layoutObject) |
| 396 return; | 393 return; |
| 397 | 394 |
| 398 IntRect paintInvalidationRect = rect; | 395 IntRect paintInvalidationRect = rect; |
| 399 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), | 396 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), |
| 400 layoutObject->borderTop() + layoutObject->paddingTop()); | 397 layoutObject->borderTop() + layoutObject->paddingTop()); |
| 401 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 | 398 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 |
| 402 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; | 399 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; |
| 403 layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect)); | 400 layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layo utRect(paintInvalidationRect)); |
| 404 } | 401 } |
| 405 | 402 |
| 406 void FrameView::setFrameRect(const IntRect& newRect) | 403 void FrameView::setFrameRect(const IntRect& newRect) |
| 407 { | 404 { |
| 408 IntRect oldRect = frameRect(); | 405 IntRect oldRect = frameRect(); |
| 409 if (newRect == oldRect) | 406 if (newRect == oldRect) |
| 410 return; | 407 return; |
| 411 | 408 |
| 412 Widget::setFrameRect(newRect); | 409 Widget::setFrameRect(newRect); |
| 413 | 410 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 m_lastZoomFactor = layoutView()->style()->zoom(); | 973 m_lastZoomFactor = layoutView()->style()->zoom(); |
| 977 | 974 |
| 978 // Set the initial vMode to AlwaysOn if we're auto. | 975 // Set the initial vMode to AlwaysOn if we're auto. |
| 979 if (vMode == ScrollbarAuto) | 976 if (vMode == ScrollbarAuto) |
| 980 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. | 977 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. |
| 981 // Set the initial hMode to AlwaysOff if we're auto. | 978 // Set the initial hMode to AlwaysOff if we're auto. |
| 982 if (hMode == ScrollbarAuto) | 979 if (hMode == ScrollbarAuto) |
| 983 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. | 980 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. |
| 984 | 981 |
| 985 setScrollbarModes(hMode, vMode); | 982 setScrollbarModes(hMode, vMode); |
| 986 setScrollbarsSuppressed(false, true); | 983 setScrollbarsSuppressed(false); |
| 987 } else if (hMode != currentHMode || vMode != currentVMode) { | 984 } else if (hMode != currentHMode || vMode != currentVMode) { |
| 988 setScrollbarModes(hMode, vMode); | 985 setScrollbarModes(hMode, vMode); |
| 989 } | 986 } |
| 990 | 987 |
| 991 if (needsScrollbarReconstruction()) | 988 if (needsScrollbarReconstruction()) |
| 992 updateScrollbars(scrollOffsetDouble()); | 989 updateScrollbars(scrollOffsetDouble()); |
| 993 | 990 |
| 994 LayoutSize oldSize = m_size; | 991 LayoutSize oldSize = m_size; |
| 995 | 992 |
| 996 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); | 993 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 return; | 1047 return; |
| 1051 | 1048 |
| 1052 #if ENABLE(ASSERT) | 1049 #if ENABLE(ASSERT) |
| 1053 // Post-layout assert that nobody was re-marked as needing layout during lay out. | 1050 // Post-layout assert that nobody was re-marked as needing layout during lay out. |
| 1054 layoutView()->assertSubtreeIsLaidOut(); | 1051 layoutView()->assertSubtreeIsLaidOut(); |
| 1055 #endif | 1052 #endif |
| 1056 | 1053 |
| 1057 frame().document()->layoutUpdated(); | 1054 frame().document()->layoutUpdated(); |
| 1058 } | 1055 } |
| 1059 | 1056 |
| 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 | |
| 1064 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State) | 1057 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State) |
| 1065 { | 1058 { |
| 1066 if (shouldThrottleRendering()) | 1059 if (shouldThrottleRendering()) |
| 1067 return; | 1060 return; |
| 1068 | 1061 |
| 1069 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); | 1062 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); |
| 1070 | 1063 |
| 1071 ASSERT(layoutView()); | 1064 ASSERT(layoutView()); |
| 1072 LayoutView& rootForPaintInvalidation = *layoutView(); | 1065 LayoutView& rootForPaintInvalidation = *layoutView(); |
| 1073 ASSERT(!rootForPaintInvalidation.needsLayout()); | 1066 ASSERT(!rootForPaintInvalidation.needsLayout()); |
| 1074 | 1067 |
| 1075 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); | 1068 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); |
| 1076 | 1069 |
| 1077 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); | 1070 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); |
| 1078 | 1071 |
| 1079 // Invalidate the paint of the frameviews scrollbars if needed | 1072 |
| 1080 if (hasVerticalBarDamage()) | 1073 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) { |
| 1081 invalidateRect(verticalBarDamage()); | 1074 paintInvalidationState.setViewClippingAndScrollOffsetDisabled(true); |
| 1082 if (hasHorizontalBarDamage()) | 1075 invalidatePaintOfScrollControlsIfNeeded(rootForPaintInvalidation, paintI nvalidationState, paintInvalidationState.paintInvalidationContainer(), m_scrollC orner, nullptr); |
| 1083 invalidateRect(horizontalBarDamage()); | 1076 paintInvalidationState.setViewClippingAndScrollOffsetDisabled(false); |
| 1084 resetScrollbarDamage(); | 1077 } |
| 1085 | 1078 |
| 1086 #if ENABLE(ASSERT) | 1079 #if ENABLE(ASSERT) |
| 1087 layoutView()->assertSubtreeClearedPaintInvalidationState(); | 1080 layoutView()->assertSubtreeClearedPaintInvalidationState(); |
| 1088 #endif | 1081 #endif |
| 1089 | 1082 |
| 1090 if (m_frame->selection().isCaretBoundsDirty()) | 1083 if (m_frame->selection().isCaretBoundsDirty()) |
| 1091 m_frame->selection().invalidateCaretRect(); | 1084 m_frame->selection().invalidateCaretRect(); |
| 1092 | 1085 |
| 1093 m_doFullPaintInvalidation = false; | 1086 m_doFullPaintInvalidation = false; |
| 1094 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); | 1087 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1502 { | 1495 { |
| 1503 Page* page = frame().page(); | 1496 Page* page = frame().page(); |
| 1504 if (!page) | 1497 if (!page) |
| 1505 return; | 1498 return; |
| 1506 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1499 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
| 1507 if (m_horizontalScrollbar) { | 1500 if (m_horizontalScrollbar) { |
| 1508 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); | 1501 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); |
| 1509 if (delta != 0) { | 1502 if (delta != 0) { |
| 1510 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); | 1503 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); |
| 1511 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); | 1504 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); |
| 1512 if (!m_scrollbarsSuppressed) | 1505 setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); |
|
chrishtr
2015/11/17 01:34:20
So now we always invalidate, even with m_scrollbar
Xianzhu
2015/11/17 18:31:36
Previously we invalidated or added scrollbar damag
chrishtr
2015/11/17 18:52:54
Is there any benefit to the scrollbarsSuppressed()
Xianzhu
2015/11/17 19:04:24
The comment for setScrollbarsSuppressed() seems in
| |
| 1513 m_horizontalScrollbar->invalidate(); | |
| 1514 } | 1506 } |
| 1515 } | 1507 } |
| 1516 if (m_verticalScrollbar) { | 1508 if (m_verticalScrollbar) { |
| 1517 float delta = elasticOverscroll.height() - m_verticalScrollbar->elasticO verscroll(); | 1509 float delta = elasticOverscroll.height() - m_verticalScrollbar->elasticO verscroll(); |
| 1518 if (delta != 0) { | 1510 if (delta != 0) { |
| 1519 m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height() ); | 1511 m_verticalScrollbar->setElasticOverscroll(elasticOverscroll.height() ); |
| 1520 scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta)); | 1512 scrollAnimator()->notifyContentAreaScrolled(FloatSize(0, delta)); |
| 1521 if (!m_scrollbarsSuppressed) | 1513 setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); |
| 1522 m_verticalScrollbar->invalidate(); | |
| 1523 } | 1514 } |
| 1524 } | 1515 } |
| 1525 } | 1516 } |
| 1526 | 1517 |
| 1527 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const | 1518 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const |
| 1528 { | 1519 { |
| 1529 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; | 1520 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; |
| 1530 } | 1521 } |
| 1531 | 1522 |
| 1532 void FrameView::setLayoutSize(const IntSize& size) | 1523 void FrameView::setLayoutSize(const IntSize& size) |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2076 | 2067 |
| 2077 if (!scrollbarsSuppressed()) | 2068 if (!scrollbarsSuppressed()) |
| 2078 m_pendingScrollDelta += scrollDelta; | 2069 m_pendingScrollDelta += scrollDelta; |
| 2079 | 2070 |
| 2080 clearScrollAnchor(); | 2071 clearScrollAnchor(); |
| 2081 updateLayersAndCompositingAfterScrollIfNeeded(); | 2072 updateLayersAndCompositingAfterScrollIfNeeded(); |
| 2082 scrollPositionChanged(); | 2073 scrollPositionChanged(); |
| 2083 frame().loader().client()->didChangeScrollOffset(); | 2074 frame().loader().client()->didChangeScrollOffset(); |
| 2084 } | 2075 } |
| 2085 | 2076 |
| 2086 void FrameView::invalidatePaintForTickmarks() const | 2077 void FrameView::invalidatePaintForTickmarks() |
| 2087 { | 2078 { |
| 2088 if (Scrollbar* scrollbar = verticalScrollbar()) | 2079 if (Scrollbar* scrollbar = verticalScrollbar()) |
| 2089 scrollbar->invalidate(); | 2080 setScrollbarNeedsPaintInvalidation(scrollbar); |
| 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); | |
| 2104 } | 2081 } |
| 2105 | 2082 |
| 2106 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const | 2083 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const |
| 2107 { | 2084 { |
| 2108 if (!m_tickmarks.isEmpty()) | 2085 if (!m_tickmarks.isEmpty()) |
| 2109 tickmarks = m_tickmarks; | 2086 tickmarks = m_tickmarks; |
| 2110 else | 2087 else |
| 2111 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch); | 2088 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch); |
| 2112 } | 2089 } |
| 2113 | 2090 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2293 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also. | 2270 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also. |
| 2294 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject()) | 2271 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject()) |
| 2295 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe quest(SCROLLBAR_CORNER), layoutObject->style()); | 2272 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe quest(SCROLLBAR_CORNER), layoutObject->style()); |
| 2296 } | 2273 } |
| 2297 } | 2274 } |
| 2298 | 2275 |
| 2299 if (cornerStyle) { | 2276 if (cornerStyle) { |
| 2300 if (!m_scrollCorner) | 2277 if (!m_scrollCorner) |
| 2301 m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc); | 2278 m_scrollCorner = LayoutScrollbarPart::createAnonymous(doc); |
| 2302 m_scrollCorner->setStyle(cornerStyle.release()); | 2279 m_scrollCorner->setStyle(cornerStyle.release()); |
| 2303 invalidateScrollCorner(cornerRect); | 2280 setScrollCornerNeedsPaintInvalidation(); |
| 2304 } else if (m_scrollCorner) { | 2281 } else if (m_scrollCorner) { |
| 2305 m_scrollCorner->destroy(); | 2282 m_scrollCorner->destroy(); |
| 2306 m_scrollCorner = nullptr; | 2283 m_scrollCorner = nullptr; |
| 2307 } | 2284 } |
| 2308 } | 2285 } |
| 2309 | 2286 |
| 2310 Color FrameView::documentBackgroundColor() const | 2287 Color FrameView::documentBackgroundColor() const |
| 2311 { | 2288 { |
| 2312 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of | 2289 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of |
| 2313 // the document and the body against the base background color of the frame view. | 2290 // the document and the body against the base background color of the frame view. |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3004 { | 2981 { |
| 3005 if (hasBar == !!m_horizontalScrollbar) | 2982 if (hasBar == !!m_horizontalScrollbar) |
| 3006 return; | 2983 return; |
| 3007 | 2984 |
| 3008 if (hasBar) { | 2985 if (hasBar) { |
| 3009 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); | 2986 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); |
| 3010 addChild(m_horizontalScrollbar.get()); | 2987 addChild(m_horizontalScrollbar.get()); |
| 3011 didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); | 2988 didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); |
| 3012 m_horizontalScrollbar->styleChanged(); | 2989 m_horizontalScrollbar->styleChanged(); |
| 3013 } else { | 2990 } else { |
| 3014 willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); | 2991 willRemoveScrollbar(*layoutView(), m_horizontalScrollbar.get(), Horizont alScrollbar); |
| 3015 if (AXObjectCache* cache = axObjectCache()) | 2992 if (AXObjectCache* cache = axObjectCache()) |
| 3016 cache->remove(m_horizontalScrollbar.get()); | 2993 cache->remove(m_horizontalScrollbar.get()); |
| 3017 // If the scrollbar has been marked as overlapping the window resizer, | 2994 // If the scrollbar has been marked as overlapping the window resizer, |
| 3018 // then its removal should reduce the count. | 2995 // then its removal should reduce the count. |
| 3019 if (m_horizontalScrollbar->overlapsResizer()) | 2996 if (m_horizontalScrollbar->overlapsResizer()) |
| 3020 adjustScrollbarsAvoidingResizerCount(-1); | 2997 adjustScrollbarsAvoidingResizerCount(-1); |
| 3021 removeChild(m_horizontalScrollbar.get()); | 2998 removeChild(m_horizontalScrollbar.get()); |
| 3022 m_horizontalScrollbar->disconnectFromScrollableArea(); | 2999 m_horizontalScrollbar->disconnectFromScrollableArea(); |
| 3023 m_horizontalScrollbar = nullptr; | 3000 m_horizontalScrollbar = nullptr; |
| 3024 if (AXObjectCache* cache = axObjectCache()) | 3001 if (AXObjectCache* cache = axObjectCache()) |
| 3025 cache->handleScrollbarUpdate(this); | 3002 cache->handleScrollbarUpdate(this); |
| 3026 } | 3003 } |
| 3027 | 3004 |
| 3028 invalidateScrollCorner(scrollCornerRect()); | 3005 setScrollCornerNeedsPaintInvalidation(); |
| 3029 } | 3006 } |
| 3030 | 3007 |
| 3031 void FrameView::setHasVerticalScrollbar(bool hasBar) | 3008 void FrameView::setHasVerticalScrollbar(bool hasBar) |
| 3032 { | 3009 { |
| 3033 if (hasBar == !!m_verticalScrollbar) | 3010 if (hasBar == !!m_verticalScrollbar) |
| 3034 return; | 3011 return; |
| 3035 | 3012 |
| 3036 if (hasBar) { | 3013 if (hasBar) { |
| 3037 m_verticalScrollbar = createScrollbar(VerticalScrollbar); | 3014 m_verticalScrollbar = createScrollbar(VerticalScrollbar); |
| 3038 addChild(m_verticalScrollbar.get()); | 3015 addChild(m_verticalScrollbar.get()); |
| 3039 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 3016 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
| 3040 m_verticalScrollbar->styleChanged(); | 3017 m_verticalScrollbar->styleChanged(); |
| 3041 } else { | 3018 } else { |
| 3042 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 3019 willRemoveScrollbar(*layoutView(), m_verticalScrollbar.get(), VerticalSc rollbar); |
| 3043 if (AXObjectCache* cache = axObjectCache()) | 3020 if (AXObjectCache* cache = axObjectCache()) |
| 3044 cache->remove(m_verticalScrollbar.get()); | 3021 cache->remove(m_verticalScrollbar.get()); |
| 3045 // If the scrollbar has been marked as overlapping the window resizer, | 3022 // If the scrollbar has been marked as overlapping the window resizer, |
| 3046 // then its removal should reduce the count. | 3023 // then its removal should reduce the count. |
| 3047 if (m_verticalScrollbar->overlapsResizer()) | 3024 if (m_verticalScrollbar->overlapsResizer()) |
| 3048 adjustScrollbarsAvoidingResizerCount(-1); | 3025 adjustScrollbarsAvoidingResizerCount(-1); |
| 3049 removeChild(m_verticalScrollbar.get()); | 3026 removeChild(m_verticalScrollbar.get()); |
| 3050 m_verticalScrollbar->disconnectFromScrollableArea(); | 3027 m_verticalScrollbar->disconnectFromScrollableArea(); |
| 3051 m_verticalScrollbar = nullptr; | 3028 m_verticalScrollbar = nullptr; |
| 3052 if (AXObjectCache* cache = axObjectCache()) | 3029 if (AXObjectCache* cache = axObjectCache()) |
| 3053 cache->handleScrollbarUpdate(this); | 3030 cache->handleScrollbarUpdate(this); |
| 3054 } | 3031 } |
| 3055 | 3032 |
| 3056 invalidateScrollCorner(scrollCornerRect()); | 3033 setScrollCornerNeedsPaintInvalidation(); |
| 3057 } | 3034 } |
| 3058 | 3035 |
| 3059 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode, | 3036 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode, |
| 3060 bool horizontalLock, bool verticalLock) | 3037 bool horizontalLock, bool verticalLock) |
| 3061 { | 3038 { |
| 3062 bool needsUpdate = false; | 3039 bool needsUpdate = false; |
| 3063 | 3040 |
| 3064 // If the page's overflow setting has disabled scrolling, do not allow anyth ing to override that setting. | 3041 // If the page's overflow setting has disabled scrolling, do not allow anyth ing to override that setting. |
| 3065 // http://crbug.com/426447 | 3042 // http://crbug.com/426447 |
| 3066 LayoutObject* viewport = viewportLayoutObject(); | 3043 LayoutObject* viewport = viewportLayoutObject(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3213 void FrameView::updateScrollbarGeometry() | 3190 void FrameView::updateScrollbarGeometry() |
| 3214 { | 3191 { |
| 3215 if (m_horizontalScrollbar) { | 3192 if (m_horizontalScrollbar) { |
| 3216 int clientWidth = visibleWidth(); | 3193 int clientWidth = visibleWidth(); |
| 3217 IntRect oldRect(m_horizontalScrollbar->frameRect()); | 3194 IntRect oldRect(m_horizontalScrollbar->frameRect()); |
| 3218 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, | 3195 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, |
| 3219 height() - m_horizontalScrollbar->height(), | 3196 height() - m_horizontalScrollbar->height(), |
| 3220 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), | 3197 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), |
| 3221 m_horizontalScrollbar->height()); | 3198 m_horizontalScrollbar->height()); |
| 3222 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); | 3199 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); |
| 3223 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) | 3200 if (oldRect != m_horizontalScrollbar->frameRect()) |
| 3224 m_horizontalScrollbar->invalidate(); | 3201 setScrollbarNeedsPaintInvalidation(m_horizontalScrollbar.get()); |
| 3225 | 3202 |
| 3226 if (m_scrollbarsSuppressed) | |
| 3227 m_horizontalScrollbar->setSuppressInvalidation(true); | |
| 3228 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); | 3203 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); |
| 3229 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); | 3204 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); |
| 3230 m_horizontalScrollbar->offsetDidChange(); | 3205 m_horizontalScrollbar->offsetDidChange(); |
| 3231 if (m_scrollbarsSuppressed) | |
| 3232 m_horizontalScrollbar->setSuppressInvalidation(false); | |
| 3233 } | 3206 } |
| 3234 | 3207 |
| 3235 if (m_verticalScrollbar) { | 3208 if (m_verticalScrollbar) { |
| 3236 int clientHeight = visibleHeight(); | 3209 int clientHeight = visibleHeight(); |
| 3237 IntRect oldRect(m_verticalScrollbar->frameRect()); | 3210 IntRect oldRect(m_verticalScrollbar->frameRect()); |
| 3238 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), | 3211 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), |
| 3239 0, | 3212 0, |
| 3240 m_verticalScrollbar->width(), | 3213 m_verticalScrollbar->width(), |
| 3241 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); | 3214 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); |
| 3242 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); | 3215 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); |
| 3243 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) | 3216 if (oldRect != m_verticalScrollbar->frameRect()) |
| 3244 m_verticalScrollbar->invalidate(); | 3217 setScrollbarNeedsPaintInvalidation(m_verticalScrollbar.get()); |
| 3245 | 3218 |
| 3246 if (m_scrollbarsSuppressed) | |
| 3247 m_verticalScrollbar->setSuppressInvalidation(true); | |
| 3248 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); | 3219 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); |
| 3249 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); | 3220 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); |
| 3250 m_verticalScrollbar->offsetDidChange(); | 3221 m_verticalScrollbar->offsetDidChange(); |
| 3251 if (m_scrollbarsSuppressed) | |
| 3252 m_verticalScrollbar->setSuppressInvalidation(false); | |
| 3253 } | 3222 } |
| 3254 } | 3223 } |
| 3255 | 3224 |
| 3256 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) | 3225 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) |
| 3257 { | 3226 { |
| 3258 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap | 3227 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap |
| 3259 // if necessary. | 3228 // if necessary. |
| 3260 IntRect adjustedRect(rect); | 3229 IntRect adjustedRect(rect); |
| 3261 bool overlapsResizer = false; | 3230 bool overlapsResizer = false; |
| 3262 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { | 3231 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3345 setHasHorizontalScrollbar(false); | 3314 setHasHorizontalScrollbar(false); |
| 3346 setHasVerticalScrollbar(false); | 3315 setHasVerticalScrollbar(false); |
| 3347 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3316 setScrollOffsetFromUpdateScrollbars(desiredOffset); |
| 3348 return; | 3317 return; |
| 3349 } | 3318 } |
| 3350 | 3319 |
| 3351 if (m_inUpdateScrollbars) | 3320 if (m_inUpdateScrollbars) |
| 3352 return; | 3321 return; |
| 3353 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); | 3322 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
| 3354 | 3323 |
| 3355 IntSize oldVisibleSize = visibleContentSize(); | |
| 3356 | |
| 3357 bool scrollbarExistenceChanged = false; | 3324 bool scrollbarExistenceChanged = false; |
| 3358 | 3325 |
| 3359 if (needsScrollbarReconstruction()) { | 3326 if (needsScrollbarReconstruction()) { |
| 3360 setHasHorizontalScrollbar(false); | 3327 setHasHorizontalScrollbar(false); |
| 3361 setHasVerticalScrollbar(false); | 3328 setHasVerticalScrollbar(false); |
| 3362 scrollbarExistenceChanged = true; | 3329 scrollbarExistenceChanged = true; |
| 3363 } | 3330 } |
| 3364 | 3331 |
| 3365 int maxUpdateScrollbarsPass = hasOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3; | 3332 int maxUpdateScrollbarsPass = hasOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3; |
| 3366 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) { | 3333 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) { |
| 3367 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass)) | 3334 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass)) |
| 3368 break; | 3335 break; |
| 3369 scrollbarExistenceChanged = true; | 3336 scrollbarExistenceChanged = true; |
| 3370 } | 3337 } |
| 3371 | 3338 |
| 3372 updateScrollbarGeometry(); | 3339 updateScrollbarGeometry(); |
| 3373 | 3340 |
| 3374 if (scrollbarExistenceChanged) { | 3341 if (scrollbarExistenceChanged) { |
| 3375 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec ts changed? | 3342 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec ts changed? |
| 3376 frameRectsChanged(); | 3343 frameRectsChanged(); |
| 3377 positionScrollbarLayers(); | 3344 positionScrollbarLayers(); |
| 3378 updateScrollCorner(); | 3345 updateScrollCorner(); |
| 3379 } | 3346 } |
| 3380 | 3347 |
| 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 | |
| 3392 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3348 setScrollOffsetFromUpdateScrollbars(desiredOffset); |
| 3393 } | 3349 } |
| 3394 | 3350 |
| 3395 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) | 3351 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) |
| 3396 { | 3352 { |
| 3397 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset) ); | 3353 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset) ); |
| 3398 | 3354 |
| 3399 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) { | 3355 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) { |
| 3400 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll); | 3356 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll); |
| 3401 resetScrollOriginChanged(); | 3357 resetScrollOriginChanged(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3562 } else if (!scrollbarsSuppressed()) { | 3518 } else if (!scrollbarsSuppressed()) { |
| 3563 // If we went from n to 0 or from 0 to n and we're the outermost view, | 3519 // If we went from n to 0 or from 0 to n and we're the outermost view, |
| 3564 // we need to invalidate the windowResizerRect(), since it will now need to paint | 3520 // we need to invalidate the windowResizerRect(), since it will now need to paint |
| 3565 // differently. | 3521 // differently. |
| 3566 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0) | 3522 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0) |
| 3567 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0)) | 3523 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0)) |
| 3568 invalidateRect(windowResizerRect()); | 3524 invalidateRect(windowResizerRect()); |
| 3569 } | 3525 } |
| 3570 } | 3526 } |
| 3571 | 3527 |
| 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 | |
| 3590 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame ) | 3528 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame ) |
| 3591 { | 3529 { |
| 3592 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); | 3530 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); |
| 3593 return scrollbarAtFramePoint(pointInFrame); | 3531 return scrollbarAtFramePoint(pointInFrame); |
| 3594 } | 3532 } |
| 3595 | 3533 |
| 3596 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) | 3534 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) |
| 3597 { | 3535 { |
| 3598 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) | 3536 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) |
| 3599 return m_horizontalScrollbar.get(); | 3537 return m_horizontalScrollbar.get(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3699 } | 3637 } |
| 3700 | 3638 |
| 3701 return cornerRect; | 3639 return cornerRect; |
| 3702 } | 3640 } |
| 3703 | 3641 |
| 3704 bool FrameView::isScrollCornerVisible() const | 3642 bool FrameView::isScrollCornerVisible() const |
| 3705 { | 3643 { |
| 3706 return !scrollCornerRect().isEmpty(); | 3644 return !scrollCornerRect().isEmpty(); |
| 3707 } | 3645 } |
| 3708 | 3646 |
| 3709 void FrameView::invalidateScrollCornerRect(const IntRect& rect) | |
| 3710 { | |
| 3711 invalidateRect(rect); | |
| 3712 if (m_scrollCorner) | |
| 3713 layoutView()->invalidateDisplayItemClientForNonCompositingDescendantsOf( *m_scrollCorner); | |
| 3714 } | |
| 3715 | |
| 3716 ScrollBehavior FrameView::scrollBehaviorStyle() const | 3647 ScrollBehavior FrameView::scrollBehaviorStyle() const |
| 3717 { | 3648 { |
| 3718 Element* scrollElement = m_frame->document()->scrollingElement(); | 3649 Element* scrollElement = m_frame->document()->scrollingElement(); |
| 3719 LayoutObject* layoutObject = scrollElement ? scrollElement->layoutObject() : nullptr; | 3650 LayoutObject* layoutObject = scrollElement ? scrollElement->layoutObject() : nullptr; |
| 3720 if (layoutObject && layoutObject->style()->scrollBehavior() == ScrollBehavio rSmooth) | 3651 if (layoutObject && layoutObject->style()->scrollBehavior() == ScrollBehavio rSmooth) |
| 3721 return ScrollBehaviorSmooth; | 3652 return ScrollBehaviorSmooth; |
| 3722 | 3653 |
| 3723 return ScrollBehaviorInstant; | 3654 return ScrollBehaviorInstant; |
| 3724 } | 3655 } |
| 3725 | 3656 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4041 } | 3972 } |
| 4042 | 3973 |
| 4043 bool FrameView::canThrottleRendering() const | 3974 bool FrameView::canThrottleRendering() const |
| 4044 { | 3975 { |
| 4045 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 3976 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
| 4046 return false; | 3977 return false; |
| 4047 return m_hiddenForThrottling && m_crossOriginForThrottling; | 3978 return m_hiddenForThrottling && m_crossOriginForThrottling; |
| 4048 } | 3979 } |
| 4049 | 3980 |
| 4050 } // namespace blink | 3981 } // namespace blink |
| OLD | NEW |