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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 706 } |
707 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 707 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
708 int clientHeight = box().pixelSnappedClientHeight(); | 708 int clientHeight = box().pixelSnappedClientHeight(); |
709 verticalScrollbar->setProportion(clientHeight, overflowRect().height
()); | 709 verticalScrollbar->setProportion(clientHeight, overflowRect().height
()); |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVertica
lOverflow(); | 713 bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVertica
lOverflow(); |
714 updateScrollableAreaSet(hasOverflow); | 714 updateScrollableAreaSet(hasOverflow); |
715 | 715 |
716 if (hasOverflow) { | 716 DisableCompositingQueryAsserts disabler; |
717 DisableCompositingQueryAsserts disabler; | 717 positionOverflowControls(); |
718 positionOverflowControls(IntSize()); | |
719 } | |
720 } | 718 } |
721 | 719 |
722 bool LayerScrollableArea::hasHorizontalOverflow() const | 720 bool LayerScrollableArea::hasHorizontalOverflow() const |
723 { | 721 { |
724 ASSERT(!m_scrollDimensionsDirty); | 722 ASSERT(!m_scrollDimensionsDirty); |
725 | 723 |
726 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); | 724 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); |
727 } | 725 } |
728 | 726 |
729 bool LayerScrollableArea::hasVerticalOverflow() const | 727 bool LayerScrollableArea::hasVerticalOverflow() const |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 return m_vBar->width(); | 1005 return m_vBar->width(); |
1008 } | 1006 } |
1009 | 1007 |
1010 int LayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy
relevancy) const | 1008 int LayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy
relevancy) const |
1011 { | 1009 { |
1012 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_hBar->shouldParticipateInHitTesting()))) | 1010 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_hBar->shouldParticipateInHitTesting()))) |
1013 return 0; | 1011 return 0; |
1014 return m_hBar->height(); | 1012 return m_hBar->height(); |
1015 } | 1013 } |
1016 | 1014 |
1017 void LayerScrollableArea::positionOverflowControls(const IntSize& offsetFromRoot
) | 1015 void LayerScrollableArea::positionOverflowControls() |
1018 { | 1016 { |
1019 if (!hasScrollbar() && !box().canResize()) | 1017 if (!hasScrollbar() && !box().canResize()) |
1020 return; | 1018 return; |
1021 | 1019 |
1022 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); | 1020 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); |
1023 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 1021 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) |
1024 IntRect vBarRect = rectForVerticalScrollbar(borderBox); | 1022 verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox)); |
1025 vBarRect.move(offsetFromRoot); | |
1026 verticalScrollbar->setFrameRect(vBarRect); | |
1027 } | |
1028 | 1023 |
1029 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 1024 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) |
1030 IntRect hBarRect = rectForHorizontalScrollbar(borderBox); | 1025 horizontalScrollbar->setFrameRect(rectForHorizontalScrollbar(borderBox))
; |
1031 hBarRect.move(offsetFromRoot); | |
1032 horizontalScrollbar->setFrameRect(hBarRect); | |
1033 } | |
1034 | 1026 |
1035 const IntRect& scrollCorner = scrollCornerRect(); | 1027 const IntRect& scrollCorner = scrollCornerRect(); |
1036 if (m_scrollCorner) | 1028 if (m_scrollCorner) |
1037 m_scrollCorner->setFrameRect(LayoutRect(scrollCorner)); | 1029 m_scrollCorner->setFrameRect(LayoutRect(scrollCorner)); |
1038 | 1030 |
1039 if (m_resizer) | 1031 if (m_resizer) |
1040 m_resizer->setFrameRect(LayoutRect(resizerCornerRect(borderBox, ResizerF
orPointer))); | 1032 m_resizer->setFrameRect(LayoutRect(resizerCornerRect(borderBox, ResizerF
orPointer))); |
1041 | 1033 |
1042 // FIXME, this should eventually be removed, once we are certain that compos
ited | 1034 // FIXME, this should eventually be removed, once we are certain that compos
ited |
1043 // controls get correctly positioned on a compositor update. For now, conser
vatively | 1035 // controls get correctly positioned on a compositor update. For now, conser
vatively |
1044 // leaving this unchanged. | 1036 // leaving this unchanged. |
1045 if (layer()->hasCompositedLayerMapping()) | 1037 if (layer()->hasCompositedLayerMapping()) |
1046 layer()->compositedLayerMapping()->positionOverflowControlsLayers(offset
FromRoot); | 1038 layer()->compositedLayerMapping()->positionOverflowControlsLayers(); |
1047 } | 1039 } |
1048 | 1040 |
1049 void LayerScrollableArea::updateScrollCornerStyle() | 1041 void LayerScrollableArea::updateScrollCornerStyle() |
1050 { | 1042 { |
1051 if (!m_scrollCorner && !hasScrollbar()) | 1043 if (!m_scrollCorner && !hasScrollbar()) |
1052 return; | 1044 return; |
1053 if (!m_scrollCorner && hasOverlayScrollbars()) | 1045 if (!m_scrollCorner && hasOverlayScrollbars()) |
1054 return; | 1046 return; |
1055 | 1047 |
1056 LayoutObject* actualRenderer = rendererForScrollbar(box()); | 1048 LayoutObject* actualRenderer = rendererForScrollbar(box()); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 void LayerScrollableArea::setTopmostScrollChild(Layer* scrollChild) | 1374 void LayerScrollableArea::setTopmostScrollChild(Layer* scrollChild) |
1383 { | 1375 { |
1384 // We only want to track the topmost scroll child for scrollable areas with | 1376 // We only want to track the topmost scroll child for scrollable areas with |
1385 // overlay scrollbars. | 1377 // overlay scrollbars. |
1386 if (!hasOverlayScrollbars()) | 1378 if (!hasOverlayScrollbars()) |
1387 return; | 1379 return; |
1388 m_nextTopmostScrollChild = scrollChild; | 1380 m_nextTopmostScrollChild = scrollChild; |
1389 } | 1381 } |
1390 | 1382 |
1391 } // namespace blink | 1383 } // namespace blink |
OLD | NEW |