| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 DisableCompositingQueryAsserts disabler; | 231 DisableCompositingQueryAsserts disabler; |
| 232 | 232 |
| 233 return layer()->hasCompositedLayerMapping() | 233 return layer()->hasCompositedLayerMapping() |
| 234 ? layer()->compositedLayerMapping()->layerForScrollCorner() | 234 ? layer()->compositedLayerMapping()->layerForScrollCorner() |
| 235 : 0; | 235 : 0; |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool PaintLayerScrollableArea::shouldUseIntegerScrollOffset() const { | 238 bool PaintLayerScrollableArea::shouldUseIntegerScrollOffset() const { |
| 239 Frame* frame = box().frame(); | 239 Frame* frame = box().frame(); |
| 240 if (frame->settings() && | 240 if (frame->settings() && |
| 241 !frame->settings()->preferCompositingToLCDTextEnabled()) | 241 !frame->settings()->getPreferCompositingToLCDTextEnabled()) |
| 242 return true; | 242 return true; |
| 243 | 243 |
| 244 return ScrollableArea::shouldUseIntegerScrollOffset(); | 244 return ScrollableArea::shouldUseIntegerScrollOffset(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 bool PaintLayerScrollableArea::isActive() const { | 247 bool PaintLayerScrollableArea::isActive() const { |
| 248 Page* page = box().frame()->page(); | 248 Page* page = box().frame()->page(); |
| 249 return page && page->focusController().isActive(); | 249 return page && page->focusController().isActive(); |
| 250 } | 250 } |
| 251 | 251 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()); | 546 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()); |
| 547 } | 547 } |
| 548 | 548 |
| 549 IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const { | 549 IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const { |
| 550 return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() | 550 return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() |
| 551 : IntPoint(); | 551 : IntPoint(); |
| 552 } | 552 } |
| 553 | 553 |
| 554 bool PaintLayerScrollableArea::scrollAnimatorEnabled() const { | 554 bool PaintLayerScrollableArea::scrollAnimatorEnabled() const { |
| 555 if (Settings* settings = box().frame()->settings()) | 555 if (Settings* settings = box().frame()->settings()) |
| 556 return settings->scrollAnimatorEnabled(); | 556 return settings->getScrollAnimatorEnabled(); |
| 557 return false; | 557 return false; |
| 558 } | 558 } |
| 559 | 559 |
| 560 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { | 560 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { |
| 561 LayoutView* view = box().view(); | 561 LayoutView* view = box().view(); |
| 562 if (!view) | 562 if (!view) |
| 563 return true; | 563 return true; |
| 564 return view->frameView()->shouldSuspendScrollAnimations(); | 564 return view->frameView()->shouldSuspendScrollAnimations(); |
| 565 } | 565 } |
| 566 | 566 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 resetScrollOriginChanged(); | 828 resetScrollOriginChanged(); |
| 829 m_scrollbarManager.destroyDetachedScrollbars(); | 829 m_scrollbarManager.destroyDetachedScrollbars(); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void PaintLayerScrollableArea::didChangeGlobalRootScroller() { | 832 void PaintLayerScrollableArea::didChangeGlobalRootScroller() { |
| 833 // On Android, where the VisualViewport supplies scrollbars, we need to | 833 // On Android, where the VisualViewport supplies scrollbars, we need to |
| 834 // remove the PLSA's scrollbars. In general, this would be problematic as | 834 // remove the PLSA's scrollbars. In general, this would be problematic as |
| 835 // that can cause layout but this should only ever apply with overlay | 835 // that can cause layout but this should only ever apply with overlay |
| 836 // scrollbars. | 836 // scrollbars. |
| 837 if (!box().frame()->settings() || | 837 if (!box().frame()->settings() || |
| 838 !box().frame()->settings()->viewportEnabled()) | 838 !box().frame()->settings()->getViewportEnabled()) |
| 839 return; | 839 return; |
| 840 | 840 |
| 841 bool needsHorizontalScrollbar; | 841 bool needsHorizontalScrollbar; |
| 842 bool needsVerticalScrollbar; | 842 bool needsVerticalScrollbar; |
| 843 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); | 843 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); |
| 844 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 844 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
| 845 setHasVerticalScrollbar(needsVerticalScrollbar); | 845 setHasVerticalScrollbar(needsVerticalScrollbar); |
| 846 } | 846 } |
| 847 | 847 |
| 848 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { | 848 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 ASSERT_NOT_REACHED(); | 1079 ASSERT_NOT_REACHED(); |
| 1080 return IntSize(); | 1080 return IntSize(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 static inline const LayoutObject& layoutObjectForScrollbar( | 1083 static inline const LayoutObject& layoutObjectForScrollbar( |
| 1084 const LayoutObject& layoutObject) { | 1084 const LayoutObject& layoutObject) { |
| 1085 if (Node* node = layoutObject.node()) { | 1085 if (Node* node = layoutObject.node()) { |
| 1086 if (layoutObject.isLayoutView()) { | 1086 if (layoutObject.isLayoutView()) { |
| 1087 Document& doc = node->document(); | 1087 Document& doc = node->document(); |
| 1088 if (Settings* settings = doc.settings()) { | 1088 if (Settings* settings = doc.settings()) { |
| 1089 if (!settings->allowCustomScrollbarInMainFrame() && | 1089 if (!settings->getAllowCustomScrollbarInMainFrame() && |
| 1090 layoutObject.frame() && layoutObject.frame()->isMainFrame()) | 1090 layoutObject.frame() && layoutObject.frame()->isMainFrame()) |
| 1091 return layoutObject; | 1091 return layoutObject; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 // Try the <body> element first as a scrollbar source. | 1094 // Try the <body> element first as a scrollbar source. |
| 1095 Element* body = doc.body(); | 1095 Element* body = doc.body(); |
| 1096 if (body && body->layoutObject() && | 1096 if (body && body->layoutObject() && |
| 1097 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) | 1097 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) |
| 1098 return *body->layoutObject(); | 1098 return *body->layoutObject(); |
| 1099 | 1099 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 (shouldUseCustom && didCustomScrollbarOwnerChanged)); | 1146 (shouldUseCustom && didCustomScrollbarOwnerChanged)); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void PaintLayerScrollableArea::computeScrollbarExistence( | 1149 void PaintLayerScrollableArea::computeScrollbarExistence( |
| 1150 bool& needsHorizontalScrollbar, | 1150 bool& needsHorizontalScrollbar, |
| 1151 bool& needsVerticalScrollbar, | 1151 bool& needsVerticalScrollbar, |
| 1152 ComputeScrollbarExistenceOption option) const { | 1152 ComputeScrollbarExistenceOption option) const { |
| 1153 // Scrollbars may be hidden or provided by visual viewport or frame instead. | 1153 // Scrollbars may be hidden or provided by visual viewport or frame instead. |
| 1154 DCHECK(box().frame()->settings()); | 1154 DCHECK(box().frame()->settings()); |
| 1155 if (visualViewportSuppliesScrollbars() || !canHaveOverflowScrollbars(box()) || | 1155 if (visualViewportSuppliesScrollbars() || !canHaveOverflowScrollbars(box()) || |
| 1156 box().frame()->settings()->hideScrollbars()) { | 1156 box().frame()->settings()->getHideScrollbars()) { |
| 1157 needsHorizontalScrollbar = false; | 1157 needsHorizontalScrollbar = false; |
| 1158 needsVerticalScrollbar = false; | 1158 needsVerticalScrollbar = false; |
| 1159 return; | 1159 return; |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 needsHorizontalScrollbar = box().scrollsOverflowX(); | 1162 needsHorizontalScrollbar = box().scrollsOverflowX(); |
| 1163 needsVerticalScrollbar = box().scrollsOverflowY(); | 1163 needsVerticalScrollbar = box().scrollsOverflowY(); |
| 1164 | 1164 |
| 1165 // Don't add auto scrollbars if the box contents aren't visible. | 1165 // Don't add auto scrollbars if the box contents aren't visible. |
| 1166 if (box().hasAutoHorizontalScrollbar()) { | 1166 if (box().hasAutoHorizontalScrollbar()) { |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 return; | 1830 return; |
| 1831 m_nextTopmostScrollChild = scrollChild; | 1831 m_nextTopmostScrollChild = scrollChild; |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { | 1834 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { |
| 1835 LocalFrame* frame = box().frame(); | 1835 LocalFrame* frame = box().frame(); |
| 1836 if (!frame || !frame->settings()) | 1836 if (!frame || !frame->settings()) |
| 1837 return false; | 1837 return false; |
| 1838 | 1838 |
| 1839 // On desktop, we always use the layout viewport's scrollbars. | 1839 // On desktop, we always use the layout viewport's scrollbars. |
| 1840 if (!frame->settings()->viewportEnabled()) | 1840 if (!frame->settings()->getViewportEnabled()) |
| 1841 return false; | 1841 return false; |
| 1842 | 1842 |
| 1843 const TopDocumentRootScrollerController& controller = | 1843 const TopDocumentRootScrollerController& controller = |
| 1844 layoutBox()->document().frameHost()->globalRootScrollerController(); | 1844 layoutBox()->document().frameHost()->globalRootScrollerController(); |
| 1845 | 1845 |
| 1846 return RootScrollerUtil::scrollableAreaForRootScroller( | 1846 return RootScrollerUtil::scrollableAreaForRootScroller( |
| 1847 controller.globalRootScroller()) == this; | 1847 controller.globalRootScroller()) == this; |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 Widget* PaintLayerScrollableArea::getWidget() { | 1850 Widget* PaintLayerScrollableArea::getWidget() { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 | 2081 |
| 2082 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2082 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2083 clampScrollableAreas() { | 2083 clampScrollableAreas() { |
| 2084 for (auto& scrollableArea : *s_needsClamp) | 2084 for (auto& scrollableArea : *s_needsClamp) |
| 2085 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2085 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2086 delete s_needsClamp; | 2086 delete s_needsClamp; |
| 2087 s_needsClamp = nullptr; | 2087 s_needsClamp = nullptr; |
| 2088 } | 2088 } |
| 2089 | 2089 |
| 2090 } // namespace blink | 2090 } // namespace blink |
| OLD | NEW |