Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 if (FrameView* frame_view = frame->View()) | 658 if (FrameView* frame_view = frame->View()) |
| 659 frame_view->RemoveAnimatingScrollableArea(this); | 659 frame_view->RemoveAnimatingScrollableArea(this); |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 | 662 |
| 663 bool PaintLayerScrollableArea::UserInputScrollable( | 663 bool PaintLayerScrollableArea::UserInputScrollable( |
| 664 ScrollbarOrientation orientation) const { | 664 ScrollbarOrientation orientation) const { |
| 665 if (Box().IsIntrinsicallyScrollable(orientation)) | 665 if (Box().IsIntrinsicallyScrollable(orientation)) |
| 666 return true; | 666 return true; |
| 667 | 667 |
| 668 if (Box().IsLayoutView()) { | 668 if (Box().IsLayoutView()) { |
|
szager1
2017/05/22 18:29:35
General observation: we should probably work towar
skobes
2017/05/22 19:15:10
Agreed. Scrollability is a big mess right now wit
| |
| 669 if (LocalFrame* frame = Box().GetFrame()) { | 669 ScrollbarMode h_mode; |
| 670 if (FrameView* frame_view = frame->View()) { | 670 ScrollbarMode v_mode; |
| 671 ScrollbarMode h_mode; | 671 ToLayoutView(Box()).CalculateScrollbarModes(h_mode, v_mode); |
| 672 ScrollbarMode v_mode; | 672 if (orientation == kHorizontalScrollbar && h_mode == kScrollbarAlwaysOff) |
| 673 frame_view->CalculateScrollbarModes(h_mode, v_mode); | 673 return false; |
| 674 if (orientation == kHorizontalScrollbar && | 674 if (orientation == kVerticalScrollbar && v_mode == kScrollbarAlwaysOff) |
| 675 h_mode == kScrollbarAlwaysOff) | 675 return false; |
| 676 return false; | |
| 677 if (orientation == kVerticalScrollbar && v_mode == kScrollbarAlwaysOff) | |
| 678 return false; | |
| 679 } | |
| 680 } | |
| 681 } | 676 } |
| 682 | 677 |
| 683 EOverflow overflow_style = (orientation == kHorizontalScrollbar) | 678 EOverflow overflow_style = (orientation == kHorizontalScrollbar) |
| 684 ? Box().Style()->OverflowX() | 679 ? Box().Style()->OverflowX() |
| 685 : Box().Style()->OverflowY(); | 680 : Box().Style()->OverflowY(); |
| 686 return (overflow_style == EOverflow::kScroll || | 681 return (overflow_style == EOverflow::kScroll || |
| 687 overflow_style == EOverflow::kAuto || | 682 overflow_style == EOverflow::kAuto || |
| 688 overflow_style == EOverflow::kOverlay); | 683 overflow_style == EOverflow::kOverlay); |
| 689 } | 684 } |
| 690 | 685 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 Box().IsRooted() && this->HasVerticalOverflow() && | 1279 Box().IsRooted() && this->HasVerticalOverflow() && |
| 1285 Box().PixelSnappedClientWidth() + Box().VerticalScrollbarWidth() > 0; | 1280 Box().PixelSnappedClientWidth() + Box().VerticalScrollbarWidth() > 0; |
| 1286 } | 1281 } |
| 1287 | 1282 |
| 1288 // Look for the scrollbarModes and reset the needs Horizontal & vertical | 1283 // Look for the scrollbarModes and reset the needs Horizontal & vertical |
| 1289 // Scrollbar values based on scrollbarModes, as during force style change | 1284 // Scrollbar values based on scrollbarModes, as during force style change |
| 1290 // StyleResolver::styleForDocument returns documentStyle with no overflow | 1285 // StyleResolver::styleForDocument returns documentStyle with no overflow |
| 1291 // values, due to which we are destroying the scrollbars that were already | 1286 // values, due to which we are destroying the scrollbars that were already |
| 1292 // present. | 1287 // present. |
| 1293 if (Box().IsLayoutView()) { | 1288 if (Box().IsLayoutView()) { |
| 1294 if (LocalFrame* frame = Box().GetFrame()) { | 1289 ScrollbarMode h_mode; |
| 1295 if (FrameView* frame_view = frame->View()) { | 1290 ScrollbarMode v_mode; |
| 1296 ScrollbarMode h_mode; | 1291 ToLayoutView(Box()).CalculateScrollbarModes(h_mode, v_mode); |
| 1297 ScrollbarMode v_mode; | 1292 if (h_mode == kScrollbarAlwaysOn) |
| 1298 frame_view->CalculateScrollbarModes(h_mode, v_mode); | 1293 needs_horizontal_scrollbar = true; |
| 1299 if (h_mode == kScrollbarAlwaysOn) | 1294 else if (h_mode == kScrollbarAlwaysOff) |
| 1300 needs_horizontal_scrollbar = true; | 1295 needs_horizontal_scrollbar = false; |
| 1301 else if (h_mode == kScrollbarAlwaysOff) | 1296 if (v_mode == kScrollbarAlwaysOn) |
| 1302 needs_horizontal_scrollbar = false; | 1297 needs_vertical_scrollbar = true; |
| 1303 if (v_mode == kScrollbarAlwaysOn) | 1298 else if (v_mode == kScrollbarAlwaysOff) |
| 1304 needs_vertical_scrollbar = true; | 1299 needs_vertical_scrollbar = false; |
| 1305 else if (v_mode == kScrollbarAlwaysOff) | |
| 1306 needs_vertical_scrollbar = false; | |
| 1307 } | |
| 1308 } | |
| 1309 } | 1300 } |
| 1310 } | 1301 } |
| 1311 | 1302 |
| 1312 bool PaintLayerScrollableArea::SetHasHorizontalScrollbar(bool has_scrollbar) { | 1303 bool PaintLayerScrollableArea::SetHasHorizontalScrollbar(bool has_scrollbar) { |
| 1313 if (FreezeScrollbarsScope::ScrollbarsAreFrozen()) | 1304 if (FreezeScrollbarsScope::ScrollbarsAreFrozen()) |
| 1314 return false; | 1305 return false; |
| 1315 | 1306 |
| 1316 if (has_scrollbar == HasHorizontalScrollbar()) | 1307 if (has_scrollbar == HasHorizontalScrollbar()) |
| 1317 return false; | 1308 return false; |
| 1318 | 1309 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 | 1764 |
| 1774 FrameView* frame_view = frame->View(); | 1765 FrameView* frame_view = frame->View(); |
| 1775 if (!frame_view) | 1766 if (!frame_view) |
| 1776 return; | 1767 return; |
| 1777 | 1768 |
| 1778 bool is_visible_to_hit_test = Box().Style()->VisibleToHitTesting(); | 1769 bool is_visible_to_hit_test = Box().Style()->VisibleToHitTesting(); |
| 1779 bool did_scroll_overflow = scrolls_overflow_; | 1770 bool did_scroll_overflow = scrolls_overflow_; |
| 1780 if (Box().IsLayoutView()) { | 1771 if (Box().IsLayoutView()) { |
| 1781 ScrollbarMode h_mode; | 1772 ScrollbarMode h_mode; |
| 1782 ScrollbarMode v_mode; | 1773 ScrollbarMode v_mode; |
| 1783 frame_view->CalculateScrollbarModes(h_mode, v_mode); | 1774 ToLayoutView(Box()).CalculateScrollbarModes(h_mode, v_mode); |
| 1784 if (h_mode == kScrollbarAlwaysOff && v_mode == kScrollbarAlwaysOff) | 1775 if (h_mode == kScrollbarAlwaysOff && v_mode == kScrollbarAlwaysOff) |
| 1785 has_overflow = false; | 1776 has_overflow = false; |
| 1786 } | 1777 } |
| 1787 scrolls_overflow_ = has_overflow && is_visible_to_hit_test; | 1778 scrolls_overflow_ = has_overflow && is_visible_to_hit_test; |
| 1788 if (did_scroll_overflow == ScrollsOverflow()) | 1779 if (did_scroll_overflow == ScrollsOverflow()) |
| 1789 return; | 1780 return; |
| 1790 | 1781 |
| 1791 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 1782 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
| 1792 // The scroll and scroll offset properties depend on |scrollsOverflow| (see: | 1783 // The scroll and scroll offset properties depend on |scrollsOverflow| (see: |
| 1793 // PaintPropertyTreeBuilder::updateScrollAndScrollTranslation). | 1784 // PaintPropertyTreeBuilder::updateScrollAndScrollTranslation). |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2194 | 2185 |
| 2195 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2186 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2196 ClampScrollableAreas() { | 2187 ClampScrollableAreas() { |
| 2197 for (auto& scrollable_area : *needs_clamp_) | 2188 for (auto& scrollable_area : *needs_clamp_) |
| 2198 scrollable_area->ClampScrollOffsetAfterOverflowChange(); | 2189 scrollable_area->ClampScrollOffsetAfterOverflowChange(); |
| 2199 delete needs_clamp_; | 2190 delete needs_clamp_; |
| 2200 needs_clamp_ = nullptr; | 2191 needs_clamp_ = nullptr; |
| 2201 } | 2192 } |
| 2202 | 2193 |
| 2203 } // namespace blink | 2194 } // namespace blink |
| OLD | NEW |