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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 if (box().style()->overflowY() == OSCROLL && verticalScrollbar()) | 680 if (box().style()->overflowY() == OSCROLL && verticalScrollbar()) |
681 verticalScrollbar()->setEnabled(hasVerticalOverflow); | 681 verticalScrollbar()->setEnabled(hasVerticalOverflow); |
682 } | 682 } |
683 | 683 |
684 // We need to layout again if scrollbars are added or removed by overflow:au
to, | 684 // We need to layout again if scrollbars are added or removed by overflow:au
to, |
685 // or by changing between native and custom. | 685 // or by changing between native and custom. |
686 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha
sHorizontalScrollbar() != hasHorizontalOverflow)) | 686 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha
sHorizontalScrollbar() != hasHorizontalOverflow)) |
687 || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar()); | 687 || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar()); |
688 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer
ticalScrollbar() != hasVerticalOverflow)) | 688 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer
ticalScrollbar() != hasVerticalOverflow)) |
689 || (box().style()->overflowY() == OSCROLL && !verticalScrollbar()); | 689 || (box().style()->overflowY() == OSCROLL && !verticalScrollbar()); |
690 if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || ve
rticalScrollBarChanged)) { | 690 if (horizontalScrollBarChanged || verticalScrollBarChanged) { |
691 if (box().hasAutoHorizontalScrollbar() || (box().style()->overflowX() ==
OSCROLL && !horizontalScrollbar())) | 691 if (box().hasAutoHorizontalScrollbar() || (box().style()->overflowX() ==
OSCROLL && !horizontalScrollbar())) |
692 setHasHorizontalScrollbar(box().style()->overflowX() == OSCROLL ? tr
ue : hasHorizontalOverflow); | 692 setHasHorizontalScrollbar(box().style()->overflowX() == OSCROLL ? tr
ue : hasHorizontalOverflow); |
693 if (box().hasAutoVerticalScrollbar() || (box().style()->overflowY() == O
SCROLL && !verticalScrollbar())) | 693 if (box().hasAutoVerticalScrollbar() || (box().style()->overflowY() == O
SCROLL && !verticalScrollbar())) |
694 setHasVerticalScrollbar(box().style()->overflowY() == OSCROLL ? true
: hasVerticalOverflow); | 694 setHasVerticalScrollbar(box().style()->overflowY() == OSCROLL ? true
: hasVerticalOverflow); |
695 | 695 |
696 if (hasVerticalOverflow || hasHorizontalOverflow) | 696 if (hasVerticalOverflow || hasHorizontalOverflow) |
697 updateScrollCornerStyle(); | 697 updateScrollCornerStyle(); |
698 | 698 |
699 layer()->updateSelfPaintingLayer(); | 699 layer()->updateSelfPaintingLayer(); |
700 | 700 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 void DeprecatedPaintLayerScrollableArea::updateAfterStyleChange(const ComputedSt
yle* oldStyle) | 798 void DeprecatedPaintLayerScrollableArea::updateAfterStyleChange(const ComputedSt
yle* oldStyle) |
799 { | 799 { |
800 // Don't do this on first style recalc, before layout has ever happened. | 800 // Don't do this on first style recalc, before layout has ever happened. |
801 if (!overflowRect().size().isZero()) | 801 if (!overflowRect().size().isZero()) |
802 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); | 802 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); |
803 | 803 |
804 if (!canHaveOverflowScrollbars(box())) | 804 if (!canHaveOverflowScrollbars(box())) |
805 return; | 805 return; |
806 | 806 |
807 // Avoid drawing two sets of scrollbars when one is provided by the visual v
iewport. | |
808 if (visualViewportSuppliesScrollbars()) { | |
809 setHasHorizontalScrollbar(false); | |
810 setHasVerticalScrollbar(false); | |
811 return; | |
812 } | |
813 | |
814 EOverflow overflowX = box().style()->overflowX(); | 807 EOverflow overflowX = box().style()->overflowX(); |
815 EOverflow overflowY = box().style()->overflowY(); | 808 EOverflow overflowY = box().style()->overflowY(); |
816 | 809 |
817 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. | 810 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. |
818 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); | 811 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); |
819 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); | 812 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); |
820 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 813 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
821 setHasVerticalScrollbar(needsVerticalScrollbar); | 814 setHasVerticalScrollbar(needsVerticalScrollbar); |
822 | 815 |
823 // With overflow: scroll, scrollbars are always visible but may be disabled. | 816 // With overflow: scroll, scrollbars are always visible but may be disabled. |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1451 |
1459 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa
yer* scrollChild) | 1452 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa
yer* scrollChild) |
1460 { | 1453 { |
1461 // We only want to track the topmost scroll child for scrollable areas with | 1454 // We only want to track the topmost scroll child for scrollable areas with |
1462 // overlay scrollbars. | 1455 // overlay scrollbars. |
1463 if (!hasOverlayScrollbars()) | 1456 if (!hasOverlayScrollbars()) |
1464 return; | 1457 return; |
1465 m_nextTopmostScrollChild = scrollChild; | 1458 m_nextTopmostScrollChild = scrollChild; |
1466 } | 1459 } |
1467 | 1460 |
1468 bool DeprecatedPaintLayerScrollableArea::visualViewportSuppliesScrollbars() cons
t | |
1469 { | |
1470 if (!layer()->isRootLayer()) | |
1471 return false; | |
1472 | |
1473 LocalFrame* frame = box().frame(); | |
1474 if (!frame || !frame->isMainFrame() || !frame->settings()) | |
1475 return false; | |
1476 | |
1477 return frame->settings()->viewportMetaEnabled(); | |
1478 } | |
1479 | |
1480 } // namespace blink | 1461 } // namespace blink |
OLD | NEW |