| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 IntPoint RenderLayerScrollableArea::maximumScrollPosition() const | 321 IntPoint RenderLayerScrollableArea::maximumScrollPosition() const |
| 322 { | 322 { |
| 323 if (!box().hasOverflowClip()) | 323 if (!box().hasOverflowClip()) |
| 324 return -scrollOrigin(); | 324 return -scrollOrigin(); |
| 325 return -scrollOrigin() + IntPoint(pixelSnappedScrollWidth(), pixelSnappedScr
ollHeight()) - enclosingIntRect(box().clientBoxRect()).size(); | 325 return -scrollOrigin() + IntPoint(pixelSnappedScrollWidth(), pixelSnappedScr
ollHeight()) - enclosingIntRect(box().clientBoxRect()).size(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 IntRect RenderLayerScrollableArea::visibleContentRect(IncludeScrollbarsInRect sc
rollbarInclusion) const | 328 IntRect RenderLayerScrollableArea::visibleContentRect(IncludeScrollbarsInRect sc
rollbarInclusion) const |
| 329 { | 329 { |
| 330 int verticalScrollbarWidth = 0; | |
| 331 int horizontalScrollbarHeight = 0; | |
| 332 if (scrollbarInclusion == IncludeScrollbars) { | |
| 333 verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->i
sOverlayScrollbar()) ? verticalScrollbar()->width() : 0; | |
| 334 horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollb
ar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0; | |
| 335 } | |
| 336 | |
| 337 return IntRect(IntPoint(scrollXOffset(), scrollYOffset()), | 330 return IntRect(IntPoint(scrollXOffset(), scrollYOffset()), |
| 338 IntSize(max(0, layer()->size().width() - verticalScrollbarWidth), max(0,
layer()->size().height() - horizontalScrollbarHeight))); | 331 IntSize(max(0, layer()->size().width()), max(0, layer()->size().height()
))); |
| 339 } | 332 } |
| 340 | 333 |
| 341 int RenderLayerScrollableArea::visibleHeight() const | 334 int RenderLayerScrollableArea::visibleHeight() const |
| 342 { | 335 { |
| 343 return layer()->size().height(); | 336 return layer()->size().height(); |
| 344 } | 337 } |
| 345 | 338 |
| 346 int RenderLayerScrollableArea::visibleWidth() const | 339 int RenderLayerScrollableArea::visibleWidth() const |
| 347 { | 340 { |
| 348 return layer()->size().width(); | 341 return layer()->size().width(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 { | 416 { |
| 424 return snapSizeToPixel(scrollHeight(), box().clientTop() + box().y()); | 417 return snapSizeToPixel(scrollHeight(), box().clientTop() + box().y()); |
| 425 } | 418 } |
| 426 | 419 |
| 427 void RenderLayerScrollableArea::computeScrollDimensions() | 420 void RenderLayerScrollableArea::computeScrollDimensions() |
| 428 { | 421 { |
| 429 m_scrollDimensionsDirty = false; | 422 m_scrollDimensionsDirty = false; |
| 430 | 423 |
| 431 m_overflowRect = box().layoutOverflowRect(); | 424 m_overflowRect = box().layoutOverflowRect(); |
| 432 | 425 |
| 433 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box(
).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr
ollbarWidth() : 0); | 426 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft(); |
| 434 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); | 427 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); |
| 435 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); | 428 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
| 436 } | 429 } |
| 437 | 430 |
| 438 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro
llOffsetClamping clamp) | 431 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro
llOffsetClamping clamp) |
| 439 { | 432 { |
| 440 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s
crollOffset) : scrollOffset; | 433 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s
crollOffset) : scrollOffset; |
| 441 if (newScrollOffset != adjustedScrollOffset()) | 434 if (newScrollOffset != adjustedScrollOffset()) |
| 442 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); | 435 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); |
| 443 } | 436 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 725 |
| 733 if (hasScrollbar) { | 726 if (hasScrollbar) { |
| 734 // Hits in compositing/overflow/automatically-opt-into-composited-scroll
ing-after-style-change.html | 727 // Hits in compositing/overflow/automatically-opt-into-composited-scroll
ing-after-style-change.html |
| 735 DisableCompositingQueryAsserts disabler; | 728 DisableCompositingQueryAsserts disabler; |
| 736 m_vBar = createScrollbar(VerticalScrollbar); | 729 m_vBar = createScrollbar(VerticalScrollbar); |
| 737 } else { | 730 } else { |
| 738 destroyScrollbar(VerticalScrollbar); | 731 destroyScrollbar(VerticalScrollbar); |
| 739 } | 732 } |
| 740 } | 733 } |
| 741 | 734 |
| 742 int RenderLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeReleva
ncy relevancy) const | |
| 743 { | |
| 744 if (!m_vBar || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_vBar->shouldParticipateInHitTesting()))) | |
| 745 return 0; | |
| 746 return m_vBar->width(); | |
| 747 } | |
| 748 | |
| 749 int RenderLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRel
evancy relevancy) const | |
| 750 { | |
| 751 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_hBar->shouldParticipateInHitTesting()))) | |
| 752 return 0; | |
| 753 return m_hBar->height(); | |
| 754 } | |
| 755 | |
| 756 void RenderLayerScrollableArea::positionOverflowControls(const IntSize& offsetFr
omRoot) | 735 void RenderLayerScrollableArea::positionOverflowControls(const IntSize& offsetFr
omRoot) |
| 757 { | 736 { |
| 758 if (!hasScrollbar()) | 737 if (!hasScrollbar()) |
| 759 return; | 738 return; |
| 760 | 739 |
| 761 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); | 740 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); |
| 762 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 741 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
| 763 IntRect vBarRect = rectForVerticalScrollbar(borderBox); | 742 IntRect vBarRect = rectForVerticalScrollbar(borderBox); |
| 764 vBarRect.move(offsetFromRoot); | 743 vBarRect.move(offsetFromRoot); |
| 765 verticalScrollbar->setFrameRect(vBarRect); | 744 verticalScrollbar->setFrameRect(vBarRect); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 891 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
| 913 { | 892 { |
| 914 // We only want to track the topmost scroll child for scrollable areas with | 893 // We only want to track the topmost scroll child for scrollable areas with |
| 915 // overlay scrollbars. | 894 // overlay scrollbars. |
| 916 if (!hasOverlayScrollbars()) | 895 if (!hasOverlayScrollbars()) |
| 917 return; | 896 return; |
| 918 m_nextTopmostScrollChild = scrollChild; | 897 m_nextTopmostScrollChild = scrollChild; |
| 919 } | 898 } |
| 920 | 899 |
| 921 } // namespace blink | 900 } // namespace blink |
| OLD | NEW |