| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 DisableCompositingQueryAsserts disabler; | 228 DisableCompositingQueryAsserts disabler; |
| 229 | 229 |
| 230 return layer()->hasCompositedLayerMapping() | 230 return layer()->hasCompositedLayerMapping() |
| 231 ? layer()->compositedLayerMapping()->layerForScrollCorner() | 231 ? layer()->compositedLayerMapping()->layerForScrollCorner() |
| 232 : 0; | 232 : 0; |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool PaintLayerScrollableArea::shouldUseIntegerScrollOffset() const { | 235 bool PaintLayerScrollableArea::shouldUseIntegerScrollOffset() const { |
| 236 Frame* frame = box().frame(); | 236 Frame* frame = box().frame(); |
| 237 if (frame->settings() && | 237 if (frame->settings() && |
| 238 !frame->settings()->preferCompositingToLCDTextEnabled()) | 238 !frame->settings()->GetPreferCompositingToLCDTextEnabled()) |
| 239 return true; | 239 return true; |
| 240 | 240 |
| 241 return ScrollableArea::shouldUseIntegerScrollOffset(); | 241 return ScrollableArea::shouldUseIntegerScrollOffset(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool PaintLayerScrollableArea::isActive() const { | 244 bool PaintLayerScrollableArea::isActive() const { |
| 245 Page* page = box().frame()->page(); | 245 Page* page = box().frame()->page(); |
| 246 return page && page->focusController().isActive(); | 246 return page && page->focusController().isActive(); |
| 247 } | 247 } |
| 248 | 248 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()); | 544 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()); |
| 545 } | 545 } |
| 546 | 546 |
| 547 IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const { | 547 IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const { |
| 548 return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() | 548 return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() |
| 549 : IntPoint(); | 549 : IntPoint(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 bool PaintLayerScrollableArea::scrollAnimatorEnabled() const { | 552 bool PaintLayerScrollableArea::scrollAnimatorEnabled() const { |
| 553 if (Settings* settings = box().frame()->settings()) | 553 if (Settings* settings = box().frame()->settings()) |
| 554 return settings->scrollAnimatorEnabled(); | 554 return settings->GetScrollAnimatorEnabled(); |
| 555 return false; | 555 return false; |
| 556 } | 556 } |
| 557 | 557 |
| 558 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { | 558 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { |
| 559 LayoutView* view = box().view(); | 559 LayoutView* view = box().view(); |
| 560 if (!view) | 560 if (!view) |
| 561 return true; | 561 return true; |
| 562 return view->frameView()->shouldSuspendScrollAnimations(); | 562 return view->frameView()->shouldSuspendScrollAnimations(); |
| 563 } | 563 } |
| 564 | 564 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 resetScrollOriginChanged(); | 826 resetScrollOriginChanged(); |
| 827 m_scrollbarManager.destroyDetachedScrollbars(); | 827 m_scrollbarManager.destroyDetachedScrollbars(); |
| 828 } | 828 } |
| 829 | 829 |
| 830 void PaintLayerScrollableArea::didChangeGlobalRootScroller() { | 830 void PaintLayerScrollableArea::didChangeGlobalRootScroller() { |
| 831 // On Android, where the VisualViewport supplies scrollbars, we need to | 831 // On Android, where the VisualViewport supplies scrollbars, we need to |
| 832 // remove the PLSA's scrollbars. In general, this would be problematic as | 832 // remove the PLSA's scrollbars. In general, this would be problematic as |
| 833 // that can cause layout but this should only ever apply with overlay | 833 // that can cause layout but this should only ever apply with overlay |
| 834 // scrollbars. | 834 // scrollbars. |
| 835 if (!box().frame()->settings() || | 835 if (!box().frame()->settings() || |
| 836 !box().frame()->settings()->viewportEnabled()) | 836 !box().frame()->settings()->GetViewportEnabled()) |
| 837 return; | 837 return; |
| 838 | 838 |
| 839 bool needsHorizontalScrollbar; | 839 bool needsHorizontalScrollbar; |
| 840 bool needsVerticalScrollbar; | 840 bool needsVerticalScrollbar; |
| 841 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); | 841 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); |
| 842 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 842 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
| 843 setHasVerticalScrollbar(needsVerticalScrollbar); | 843 setHasVerticalScrollbar(needsVerticalScrollbar); |
| 844 } | 844 } |
| 845 | 845 |
| 846 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { | 846 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 ASSERT_NOT_REACHED(); | 1077 ASSERT_NOT_REACHED(); |
| 1078 return IntSize(); | 1078 return IntSize(); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 static inline const LayoutObject& layoutObjectForScrollbar( | 1081 static inline const LayoutObject& layoutObjectForScrollbar( |
| 1082 const LayoutObject& layoutObject) { | 1082 const LayoutObject& layoutObject) { |
| 1083 if (Node* node = layoutObject.node()) { | 1083 if (Node* node = layoutObject.node()) { |
| 1084 if (layoutObject.isLayoutView()) { | 1084 if (layoutObject.isLayoutView()) { |
| 1085 Document& doc = node->document(); | 1085 Document& doc = node->document(); |
| 1086 if (Settings* settings = doc.settings()) { | 1086 if (Settings* settings = doc.settings()) { |
| 1087 if (!settings->allowCustomScrollbarInMainFrame() && | 1087 if (!settings->GetAllowCustomScrollbarInMainFrame() && |
| 1088 layoutObject.frame() && layoutObject.frame()->isMainFrame()) | 1088 layoutObject.frame() && layoutObject.frame()->isMainFrame()) |
| 1089 return layoutObject; | 1089 return layoutObject; |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 // Try the <body> element first as a scrollbar source. | 1092 // Try the <body> element first as a scrollbar source. |
| 1093 Element* body = doc.body(); | 1093 Element* body = doc.body(); |
| 1094 if (body && body->layoutObject() && | 1094 if (body && body->layoutObject() && |
| 1095 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) | 1095 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) |
| 1096 return *body->layoutObject(); | 1096 return *body->layoutObject(); |
| 1097 | 1097 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 (shouldUseCustom && didCustomScrollbarOwnerChanged)); | 1144 (shouldUseCustom && didCustomScrollbarOwnerChanged)); |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 void PaintLayerScrollableArea::computeScrollbarExistence( | 1147 void PaintLayerScrollableArea::computeScrollbarExistence( |
| 1148 bool& needsHorizontalScrollbar, | 1148 bool& needsHorizontalScrollbar, |
| 1149 bool& needsVerticalScrollbar, | 1149 bool& needsVerticalScrollbar, |
| 1150 ComputeScrollbarExistenceOption option) const { | 1150 ComputeScrollbarExistenceOption option) const { |
| 1151 // Scrollbars may be hidden or provided by visual viewport or frame instead. | 1151 // Scrollbars may be hidden or provided by visual viewport or frame instead. |
| 1152 DCHECK(box().frame()->settings()); | 1152 DCHECK(box().frame()->settings()); |
| 1153 if (visualViewportSuppliesScrollbars() || !canHaveOverflowScrollbars(box()) || | 1153 if (visualViewportSuppliesScrollbars() || !canHaveOverflowScrollbars(box()) || |
| 1154 box().frame()->settings()->hideScrollbars()) { | 1154 box().frame()->settings()->GetHideScrollbars()) { |
| 1155 needsHorizontalScrollbar = false; | 1155 needsHorizontalScrollbar = false; |
| 1156 needsVerticalScrollbar = false; | 1156 needsVerticalScrollbar = false; |
| 1157 return; | 1157 return; |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 needsHorizontalScrollbar = box().scrollsOverflowX(); | 1160 needsHorizontalScrollbar = box().scrollsOverflowX(); |
| 1161 needsVerticalScrollbar = box().scrollsOverflowY(); | 1161 needsVerticalScrollbar = box().scrollsOverflowY(); |
| 1162 | 1162 |
| 1163 // Don't add auto scrollbars if the box contents aren't visible. | 1163 // Don't add auto scrollbars if the box contents aren't visible. |
| 1164 if (box().hasAutoHorizontalScrollbar()) { | 1164 if (box().hasAutoHorizontalScrollbar()) { |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 return; | 1775 return; |
| 1776 m_nextTopmostScrollChild = scrollChild; | 1776 m_nextTopmostScrollChild = scrollChild; |
| 1777 } | 1777 } |
| 1778 | 1778 |
| 1779 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { | 1779 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { |
| 1780 LocalFrame* frame = box().frame(); | 1780 LocalFrame* frame = box().frame(); |
| 1781 if (!frame || !frame->settings()) | 1781 if (!frame || !frame->settings()) |
| 1782 return false; | 1782 return false; |
| 1783 | 1783 |
| 1784 // On desktop, we always use the layout viewport's scrollbars. | 1784 // On desktop, we always use the layout viewport's scrollbars. |
| 1785 if (!frame->settings()->viewportEnabled()) | 1785 if (!frame->settings()->GetViewportEnabled()) |
| 1786 return false; | 1786 return false; |
| 1787 | 1787 |
| 1788 const TopDocumentRootScrollerController& controller = | 1788 const TopDocumentRootScrollerController& controller = |
| 1789 layoutBox()->document().frameHost()->globalRootScrollerController(); | 1789 layoutBox()->document().frameHost()->globalRootScrollerController(); |
| 1790 | 1790 |
| 1791 return RootScrollerUtil::scrollableAreaForRootScroller( | 1791 return RootScrollerUtil::scrollableAreaForRootScroller( |
| 1792 controller.globalRootScroller()) == this; | 1792 controller.globalRootScroller()) == this; |
| 1793 } | 1793 } |
| 1794 | 1794 |
| 1795 Widget* PaintLayerScrollableArea::getWidget() { | 1795 Widget* PaintLayerScrollableArea::getWidget() { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 | 2026 |
| 2027 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2027 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2028 clampScrollableAreas() { | 2028 clampScrollableAreas() { |
| 2029 for (auto& scrollableArea : *s_needsClamp) | 2029 for (auto& scrollableArea : *s_needsClamp) |
| 2030 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2030 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2031 delete s_needsClamp; | 2031 delete s_needsClamp; |
| 2032 s_needsClamp = nullptr; | 2032 s_needsClamp = nullptr; |
| 2033 } | 2033 } |
| 2034 | 2034 |
| 2035 } // namespace blink | 2035 } // namespace blink |
| OLD | NEW |