| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 #include "core/css/PseudoStyleRequest.h" | 47 #include "core/css/PseudoStyleRequest.h" |
| 48 #include "core/dom/AXObjectCache.h" | 48 #include "core/dom/AXObjectCache.h" |
| 49 #include "core/dom/DOMNodeIds.h" | 49 #include "core/dom/DOMNodeIds.h" |
| 50 #include "core/dom/Node.h" | 50 #include "core/dom/Node.h" |
| 51 #include "core/dom/shadow/ShadowRoot.h" | 51 #include "core/dom/shadow/ShadowRoot.h" |
| 52 #include "core/editing/FrameSelection.h" | 52 #include "core/editing/FrameSelection.h" |
| 53 #include "core/frame/FrameHost.h" | 53 #include "core/frame/FrameHost.h" |
| 54 #include "core/frame/FrameView.h" | 54 #include "core/frame/FrameView.h" |
| 55 #include "core/frame/LocalFrame.h" | 55 #include "core/frame/LocalFrame.h" |
| 56 #include "core/frame/PageScaleConstraintsSet.h" |
| 56 #include "core/frame/RootFrameViewport.h" | 57 #include "core/frame/RootFrameViewport.h" |
| 57 #include "core/frame/Settings.h" | 58 #include "core/frame/Settings.h" |
| 59 #include "core/frame/VisualViewport.h" |
| 58 #include "core/html/HTMLFrameOwnerElement.h" | 60 #include "core/html/HTMLFrameOwnerElement.h" |
| 59 #include "core/input/EventHandler.h" | 61 #include "core/input/EventHandler.h" |
| 60 #include "core/layout/LayoutFlexibleBox.h" | 62 #include "core/layout/LayoutFlexibleBox.h" |
| 61 #include "core/layout/LayoutPart.h" | 63 #include "core/layout/LayoutPart.h" |
| 62 #include "core/layout/LayoutScrollbar.h" | 64 #include "core/layout/LayoutScrollbar.h" |
| 63 #include "core/layout/LayoutScrollbarPart.h" | 65 #include "core/layout/LayoutScrollbarPart.h" |
| 64 #include "core/layout/LayoutTheme.h" | 66 #include "core/layout/LayoutTheme.h" |
| 65 #include "core/layout/LayoutView.h" | 67 #include "core/layout/LayoutView.h" |
| 66 #include "core/layout/api/LayoutBoxItem.h" | 68 #include "core/layout/api/LayoutBoxItem.h" |
| 67 #include "core/layout/compositing/CompositedLayerMapping.h" | 69 #include "core/layout/compositing/CompositedLayerMapping.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 494 |
| 493 ScrollOffset PaintLayerScrollableArea::getScrollOffset() const { | 495 ScrollOffset PaintLayerScrollableArea::getScrollOffset() const { |
| 494 return m_scrollOffset; | 496 return m_scrollOffset; |
| 495 } | 497 } |
| 496 | 498 |
| 497 IntSize PaintLayerScrollableArea::minimumScrollOffsetInt() const { | 499 IntSize PaintLayerScrollableArea::minimumScrollOffsetInt() const { |
| 498 return toIntSize(-scrollOrigin()); | 500 return toIntSize(-scrollOrigin()); |
| 499 } | 501 } |
| 500 | 502 |
| 501 IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const { | 503 IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const { |
| 502 IntSize contentSize; | 504 if (!box().hasOverflowClip()) |
| 503 IntSize visibleSize; | 505 return toIntSize(-scrollOrigin()); |
| 504 if (box().hasOverflowClip()) { | |
| 505 contentSize = contentsSize(); | |
| 506 visibleSize = | |
| 507 pixelSnappedIntRect(box().overflowClipRect(box().location())).size(); | |
| 508 | 506 |
| 509 // TODO(skobes): We should really ASSERT that contentSize >= visibleSize | 507 IntSize contentSize = contentsSize(); |
| 510 // when we are not the root layer, but we can't because contentSize is | 508 IntSize visibleSize = |
| 511 // based on stale layout overflow data (http://crbug.com/576933). | 509 pixelSnappedIntRect(box().overflowClipRect(box().location())).size(); |
| 512 contentSize = contentSize.expandedTo(visibleSize); | 510 |
| 513 } | 511 FrameHost* host = layoutBox()->document().frameHost(); |
| 514 if (box().isLayoutView()) | 512 DCHECK(host); |
| 515 visibleSize += toLayoutView(box()).frameView()->browserControlsSize(); | 513 TopDocumentRootScrollerController& controller = |
| 514 host->globalRootScrollerController(); |
| 515 |
| 516 // The global root scroller should be clipped by the top FrameView rather |
| 517 // than it's overflow clipping box. This is to ensure that content exposed by |
| 518 // hiding the URL bar at the bottom of the screen is visible. |
| 519 if (this == controller.rootScrollerArea()) |
| 520 visibleSize = controller.rootScrollerVisibleArea(); |
| 521 |
| 522 // TODO(skobes): We should really ASSERT that contentSize >= visibleSize |
| 523 // when we are not the root layer, but we can't because contentSize is |
| 524 // based on stale layout overflow data (http://crbug.com/576933). |
| 525 contentSize = contentSize.expandedTo(visibleSize); |
| 526 |
| 516 return toIntSize(-scrollOrigin() + (contentSize - visibleSize)); | 527 return toIntSize(-scrollOrigin() + (contentSize - visibleSize)); |
| 517 } | 528 } |
| 518 | 529 |
| 519 IntRect PaintLayerScrollableArea::visibleContentRect( | 530 IntRect PaintLayerScrollableArea::visibleContentRect( |
| 520 IncludeScrollbarsInRect scrollbarInclusion) const { | 531 IncludeScrollbarsInRect scrollbarInclusion) const { |
| 521 int verticalScrollbarWidth = 0; | 532 int verticalScrollbarWidth = 0; |
| 522 int horizontalScrollbarHeight = 0; | 533 int horizontalScrollbarHeight = 0; |
| 523 if (scrollbarInclusion == IncludeScrollbars) { | 534 if (scrollbarInclusion == IncludeScrollbars) { |
| 524 verticalScrollbarWidth = | 535 verticalScrollbarWidth = |
| 525 (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) | 536 (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 | 2105 |
| 2095 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2106 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2096 clampScrollableAreas() { | 2107 clampScrollableAreas() { |
| 2097 for (auto& scrollableArea : *s_needsClamp) | 2108 for (auto& scrollableArea : *s_needsClamp) |
| 2098 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2109 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2099 delete s_needsClamp; | 2110 delete s_needsClamp; |
| 2100 s_needsClamp = nullptr; | 2111 s_needsClamp = nullptr; |
| 2101 } | 2112 } |
| 2102 | 2113 |
| 2103 } // namespace blink | 2114 } // namespace blink |
| OLD | NEW |