Chromium Code Reviews| 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@gmail.com> | 9 * Christian Biesinger <cbiesinger@gmail.com> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 // PaintLayerScrollableArea does not maintain that flag: it gets set, bu t it never | 632 // PaintLayerScrollableArea does not maintain that flag: it gets set, bu t it never |
| 633 // gets unset. We should unset the flag after layout. | 633 // gets unset. We should unset the flag after layout. |
| 634 scrollPositionChanged(scrollPositionDouble(), ProgrammaticScroll); | 634 scrollPositionChanged(scrollPositionDouble(), ProgrammaticScroll); |
| 635 } | 635 } |
| 636 | 636 |
| 637 m_scrollbarManager.setCanDetachScrollbars(false); | 637 m_scrollbarManager.setCanDetachScrollbars(false); |
| 638 | 638 |
| 639 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); | 639 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); |
| 640 bool hasVerticalOverflow = this->hasVerticalOverflow(); | 640 bool hasVerticalOverflow = this->hasVerticalOverflow(); |
| 641 | 641 |
| 642 // Don't add auto scrollbars if the box contents aren't visible. | |
| 643 bool shouldHaveAutoHorizontalScrollbar = hasHorizontalOverflow && box().pixe lSnappedClientHeight(); | |
| 644 bool shouldHaveAutoVerticalScrollbar = hasVerticalOverflow && box().pixelSna ppedClientWidth(); | |
| 645 | |
| 642 { | 646 { |
| 643 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. | 647 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. |
| 644 DisableCompositingQueryAsserts disabler; | 648 DisableCompositingQueryAsserts disabler; |
| 645 | 649 |
| 646 // overflow:scroll should just enable/disable. | 650 // overflow:scroll should just enable/disable. |
| 647 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar( )) | 651 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar( )) |
| 648 horizontalScrollbar()->setEnabled(hasHorizontalOverflow); | 652 horizontalScrollbar()->setEnabled(hasHorizontalOverflow); |
| 649 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) | 653 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) |
| 650 verticalScrollbar()->setEnabled(hasVerticalOverflow); | 654 verticalScrollbar()->setEnabled(hasVerticalOverflow); |
| 651 } | 655 } |
| 652 | 656 |
| 653 // We need to layout again if scrollbars are added or removed by overflow:au to, | 657 // We need to layout again if scrollbars are added or removed by overflow:au to, |
| 654 // or by changing between native and custom. | 658 // or by changing between native and custom. |
| 655 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha sHorizontalScrollbar() != hasHorizontalOverflow)) | 659 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha sHorizontalScrollbar() != shouldHaveAutoHorizontalScrollbar)) |
| 656 || (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar ()); | 660 || (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar ()); |
| 657 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer ticalScrollbar() != hasVerticalOverflow)) | 661 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer ticalScrollbar() != shouldHaveAutoVerticalScrollbar)) |
| 658 || (box().style()->overflowY() == OverflowScroll && !verticalScrollbar() ); | 662 || (box().style()->overflowY() == OverflowScroll && !verticalScrollbar() ); |
| 659 if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || ve rticalScrollBarChanged)) { | 663 if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || ve rticalScrollBarChanged)) { |
| 660 if (box().hasAutoHorizontalScrollbar()) | 664 if (box().hasAutoHorizontalScrollbar()) |
| 661 setHasHorizontalScrollbar(hasHorizontalOverflow); | 665 setHasHorizontalScrollbar(shouldHaveAutoHorizontalScrollbar); |
| 662 else if (box().style()->overflowX() == OverflowScroll) | 666 else if (box().style()->overflowX() == OverflowScroll) |
| 663 setHasHorizontalScrollbar(true); | 667 setHasHorizontalScrollbar(true); |
| 664 if (box().hasAutoVerticalScrollbar()) | 668 if (box().hasAutoVerticalScrollbar()) |
| 665 setHasVerticalScrollbar(hasVerticalOverflow); | 669 setHasVerticalScrollbar(shouldHaveAutoVerticalScrollbar); |
| 666 else if (box().style()->overflowY() == OverflowScroll) | 670 else if (box().style()->overflowY() == OverflowScroll) |
| 667 setHasVerticalScrollbar(true); | 671 setHasVerticalScrollbar(true); |
| 668 | 672 |
| 669 if (hasVerticalOverflow || hasHorizontalOverflow) | 673 if (hasScrollbar()) |
| 670 updateScrollCornerStyle(); | 674 updateScrollCornerStyle(); |
| 671 | 675 |
| 672 layer()->updateSelfPaintingLayer(); | 676 layer()->updateSelfPaintingLayer(); |
| 673 | 677 |
| 674 // Force an update since we know the scrollbars have changed things. | 678 // Force an update since we know the scrollbars have changed things. |
| 675 if (box().document().hasAnnotatedRegions()) | 679 if (box().document().hasAnnotatedRegions()) |
| 676 box().document().setAnnotatedRegionsDirty(true); | 680 box().document().setAnnotatedRegionsDirty(true); |
| 677 | 681 |
| 678 // Our proprietary overflow: overlay value doesn't trigger a layout. | 682 // Our proprietary overflow: overlay value doesn't trigger a layout. |
| 679 if ((horizontalScrollBarChanged && box().style()->overflowX() != Overflo wOverlay) || (verticalScrollBarChanged && box().style()->overflowY() != Overflow Overlay)) { | 683 if ((horizontalScrollBarChanged && box().style()->overflowX() != Overflo wOverlay) || (verticalScrollBarChanged && box().style()->overflowY() != Overflow Overlay)) { |
| 680 if (!m_inOverflowRelayout) { | 684 if (!m_inOverflowRelayout) { |
| 685 if ((verticalScrollBarChanged && box().isHorizontalWritingMode() ) | |
| 686 || (horizontalScrollBarChanged && !box().isHorizontalWriting Mode())) { | |
| 687 box().setPreferredLogicalWidthsDirty(); | |
| 688 box().updateLogicalWidth(); | |
|
skobes
2016/05/16 20:55:53
Won't this (updateLogicalWidth) happen during layo
szager1
2016/05/23 22:17:31
If delayedLayoutScope is not null, then layout won
| |
| 689 } | |
| 681 m_inOverflowRelayout = true; | 690 m_inOverflowRelayout = true; |
| 682 if (delayedLayoutScope) { | 691 if (delayedLayoutScope) { |
| 683 if (box().isLayoutBlock()) | 692 if (box().isLayoutBlock()) |
| 684 toLayoutBlock(box()).scrollbarsChanged(horizontalScrollB arChanged, verticalScrollBarChanged); | 693 toLayoutBlock(box()).scrollbarsChanged(horizontalScrollB arChanged, verticalScrollBarChanged); |
| 685 delayedLayoutScope->setNeedsLayout(&box(), LayoutInvalidatio nReason::ScrollbarChanged); | 694 delayedLayoutScope->setNeedsLayout(&box(), LayoutInvalidatio nReason::ScrollbarChanged); |
| 686 didMarkForDelayedLayout = true; | 695 didMarkForDelayedLayout = true; |
| 687 } else { | 696 } else { |
| 688 SubtreeLayoutScope layoutScope(box()); | 697 SubtreeLayoutScope layoutScope(box()); |
| 689 layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason: :ScrollbarChanged); | 698 layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason: :ScrollbarChanged); |
| 690 if (box().isLayoutBlock()) { | 699 if (box().isLayoutBlock()) { |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1608 } | 1617 } |
| 1609 | 1618 |
| 1610 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1619 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1611 { | 1620 { |
| 1612 visitor->trace(m_scrollableArea); | 1621 visitor->trace(m_scrollableArea); |
| 1613 visitor->trace(m_hBar); | 1622 visitor->trace(m_hBar); |
| 1614 visitor->trace(m_vBar); | 1623 visitor->trace(m_vBar); |
| 1615 } | 1624 } |
| 1616 | 1625 |
| 1617 } // namespace blink | 1626 } // namespace blink |
| OLD | NEW |