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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
699 } | 699 } |
700 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 700 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
701 int clientHeight = box().pixelSnappedClientHeight(); | 701 int clientHeight = box().pixelSnappedClientHeight(); |
702 verticalScrollbar->setProportion(clientHeight, overflowRect().height ()); | 702 verticalScrollbar->setProportion(clientHeight, overflowRect().height ()); |
703 } | 703 } |
704 } | 704 } |
705 | 705 |
706 bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVertica lOverflow(); | 706 bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVertica lOverflow(); |
707 updateScrollableAreaSet(hasOverflow); | 707 updateScrollableAreaSet(hasOverflow); |
708 | 708 |
709 if (hasOverflow) { | 709 DisableCompositingQueryAsserts disabler; |
710 DisableCompositingQueryAsserts disabler; | 710 positionOverflowControls(); |
Julien - ping for review
2015/02/25 01:43:36
If we have no overflow it seems wasteful to call p
Xianzhu
2015/02/25 01:57:09
Even if we have no overflow, we can still have scr
| |
711 positionOverflowControls(IntSize()); | |
712 } | |
713 } | 711 } |
714 | 712 |
715 bool LayerScrollableArea::hasHorizontalOverflow() const | 713 bool LayerScrollableArea::hasHorizontalOverflow() const |
716 { | 714 { |
717 ASSERT(!m_scrollDimensionsDirty); | 715 ASSERT(!m_scrollDimensionsDirty); |
718 | 716 |
719 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); | 717 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); |
720 } | 718 } |
721 | 719 |
722 bool LayerScrollableArea::hasVerticalOverflow() const | 720 bool LayerScrollableArea::hasVerticalOverflow() const |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1000 return m_vBar->width(); | 998 return m_vBar->width(); |
1001 } | 999 } |
1002 | 1000 |
1003 int LayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const | 1001 int LayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const |
1004 { | 1002 { |
1005 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS crollbarSize || !m_hBar->shouldParticipateInHitTesting()))) | 1003 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS crollbarSize || !m_hBar->shouldParticipateInHitTesting()))) |
1006 return 0; | 1004 return 0; |
1007 return m_hBar->height(); | 1005 return m_hBar->height(); |
1008 } | 1006 } |
1009 | 1007 |
1010 void LayerScrollableArea::positionOverflowControls(const IntSize& offsetFromRoot ) | 1008 void LayerScrollableArea::positionOverflowControls() |
1011 { | 1009 { |
1012 if (!hasScrollbar() && !box().canResize()) | 1010 if (!hasScrollbar() && !box().canResize()) |
1013 return; | 1011 return; |
1014 | 1012 |
1015 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); | 1013 const IntRect borderBox = box().pixelSnappedBorderBoxRect(); |
1016 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 1014 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) |
1017 IntRect vBarRect = rectForVerticalScrollbar(borderBox); | 1015 verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox)); |
1018 vBarRect.move(offsetFromRoot); | |
1019 verticalScrollbar->setFrameRect(vBarRect); | |
1020 } | |
1021 | 1016 |
1022 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 1017 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) |
1023 IntRect hBarRect = rectForHorizontalScrollbar(borderBox); | 1018 horizontalScrollbar->setFrameRect(rectForHorizontalScrollbar(borderBox)) ; |
1024 hBarRect.move(offsetFromRoot); | |
1025 horizontalScrollbar->setFrameRect(hBarRect); | |
1026 } | |
1027 | 1019 |
1028 const IntRect& scrollCorner = scrollCornerRect(); | 1020 const IntRect& scrollCorner = scrollCornerRect(); |
1029 if (m_scrollCorner) | 1021 if (m_scrollCorner) |
1030 m_scrollCorner->setFrameRect(scrollCorner); | 1022 m_scrollCorner->setFrameRect(scrollCorner); |
1031 | 1023 |
1032 if (m_resizer) | 1024 if (m_resizer) |
1033 m_resizer->setFrameRect(resizerCornerRect(borderBox, ResizerForPointer)) ; | 1025 m_resizer->setFrameRect(resizerCornerRect(borderBox, ResizerForPointer)) ; |
1034 | 1026 |
1035 // FIXME, this should eventually be removed, once we are certain that compos ited | 1027 // FIXME, this should eventually be removed, once we are certain that compos ited |
1036 // controls get correctly positioned on a compositor update. For now, conser vatively | 1028 // controls get correctly positioned on a compositor update. For now, conser vatively |
1037 // leaving this unchanged. | 1029 // leaving this unchanged. |
1038 if (layer()->hasCompositedLayerMapping()) | 1030 if (layer()->hasCompositedLayerMapping()) |
1039 layer()->compositedLayerMapping()->positionOverflowControlsLayers(offset FromRoot); | 1031 layer()->compositedLayerMapping()->positionOverflowControlsLayers(); |
1040 } | 1032 } |
1041 | 1033 |
1042 void LayerScrollableArea::updateScrollCornerStyle() | 1034 void LayerScrollableArea::updateScrollCornerStyle() |
1043 { | 1035 { |
1044 if (!m_scrollCorner && !hasScrollbar()) | 1036 if (!m_scrollCorner && !hasScrollbar()) |
1045 return; | 1037 return; |
1046 if (!m_scrollCorner && hasOverlayScrollbars()) | 1038 if (!m_scrollCorner && hasOverlayScrollbars()) |
1047 return; | 1039 return; |
1048 | 1040 |
1049 LayoutObject* actualRenderer = rendererForScrollbar(box()); | 1041 LayoutObject* actualRenderer = rendererForScrollbar(box()); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1375 void LayerScrollableArea::setTopmostScrollChild(Layer* scrollChild) | 1367 void LayerScrollableArea::setTopmostScrollChild(Layer* scrollChild) |
1376 { | 1368 { |
1377 // We only want to track the topmost scroll child for scrollable areas with | 1369 // We only want to track the topmost scroll child for scrollable areas with |
1378 // overlay scrollbars. | 1370 // overlay scrollbars. |
1379 if (!hasOverlayScrollbars()) | 1371 if (!hasOverlayScrollbars()) |
1380 return; | 1372 return; |
1381 m_nextTopmostScrollChild = scrollChild; | 1373 m_nextTopmostScrollChild = scrollChild; |
1382 } | 1374 } |
1383 | 1375 |
1384 } // namespace blink | 1376 } // namespace blink |
OLD | NEW |