Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 1980103002: Include auto vertical scrollbar in intrinsicScrollbarLogicalWidth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // PaintLayerScrollableArea does not maintain that flag: it gets set, bu t it never 636 // PaintLayerScrollableArea does not maintain that flag: it gets set, bu t it never
637 // gets unset. We should unset the flag after layout. 637 // gets unset. We should unset the flag after layout.
638 scrollPositionChanged(scrollPositionDouble(), ProgrammaticScroll); 638 scrollPositionChanged(scrollPositionDouble(), ProgrammaticScroll);
639 } 639 }
640 640
641 m_scrollbarManager.setCanDetachScrollbars(false); 641 m_scrollbarManager.setCanDetachScrollbars(false);
642 642
643 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); 643 bool hasHorizontalOverflow = this->hasHorizontalOverflow();
644 bool hasVerticalOverflow = this->hasVerticalOverflow(); 644 bool hasVerticalOverflow = this->hasVerticalOverflow();
645 645
646 // Don't add auto scrollbars if the box contents aren't visible.
647 bool shouldHaveAutoHorizontalScrollbar = hasHorizontalOverflow && box().pixe lSnappedClientHeight();
648 bool shouldHaveAutoVerticalScrollbar = hasVerticalOverflow && box().pixelSna ppedClientWidth();
649
646 { 650 {
647 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. 651 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html.
648 DisableCompositingQueryAsserts disabler; 652 DisableCompositingQueryAsserts disabler;
649 653
650 // overflow:scroll should just enable/disable. 654 // overflow:scroll should just enable/disable.
651 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar( )) 655 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar( ))
652 horizontalScrollbar()->setEnabled(hasHorizontalOverflow); 656 horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
653 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) 657 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar())
654 verticalScrollbar()->setEnabled(hasVerticalOverflow); 658 verticalScrollbar()->setEnabled(hasVerticalOverflow);
655 } 659 }
656 660
657 // We need to layout again if scrollbars are added or removed by overflow:au to, 661 // We need to layout again if scrollbars are added or removed by overflow:au to,
658 // or by changing between native and custom. 662 // or by changing between native and custom.
659 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha sHorizontalScrollbar() != hasHorizontalOverflow)) 663 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha sHorizontalScrollbar() != shouldHaveAutoHorizontalScrollbar))
660 || (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar ()); 664 || (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar ());
661 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer ticalScrollbar() != hasVerticalOverflow)) 665 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer ticalScrollbar() != shouldHaveAutoVerticalScrollbar))
662 || (box().style()->overflowY() == OverflowScroll && !verticalScrollbar() ); 666 || (box().style()->overflowY() == OverflowScroll && !verticalScrollbar() );
663 if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || ve rticalScrollBarChanged)) { 667 if (!m_inOverflowRelayout
668 && !visualViewportSuppliesScrollbars()
669 && (horizontalScrollBarChanged || verticalScrollBarChanged)) {
664 if (box().hasAutoHorizontalScrollbar()) 670 if (box().hasAutoHorizontalScrollbar())
665 setHasHorizontalScrollbar(hasHorizontalOverflow); 671 setHasHorizontalScrollbar(shouldHaveAutoHorizontalScrollbar);
666 else if (box().style()->overflowX() == OverflowScroll) 672 else if (box().style()->overflowX() == OverflowScroll)
667 setHasHorizontalScrollbar(true); 673 setHasHorizontalScrollbar(true);
668 if (box().hasAutoVerticalScrollbar()) 674 if (box().hasAutoVerticalScrollbar())
669 setHasVerticalScrollbar(hasVerticalOverflow); 675 setHasVerticalScrollbar(shouldHaveAutoVerticalScrollbar);
670 else if (box().style()->overflowY() == OverflowScroll) 676 else if (box().style()->overflowY() == OverflowScroll)
671 setHasVerticalScrollbar(true); 677 setHasVerticalScrollbar(true);
672 678
673 if (hasVerticalOverflow || hasHorizontalOverflow) 679 if (hasScrollbar())
674 updateScrollCornerStyle(); 680 updateScrollCornerStyle();
675 681
676 layer()->updateSelfPaintingLayer(); 682 layer()->updateSelfPaintingLayer();
677 683
678 // Force an update since we know the scrollbars have changed things. 684 // Force an update since we know the scrollbars have changed things.
679 if (box().document().hasAnnotatedRegions()) 685 if (box().document().hasAnnotatedRegions())
680 box().document().setAnnotatedRegionsDirty(true); 686 box().document().setAnnotatedRegionsDirty(true);
681 687
682 // Our proprietary overflow: overlay value doesn't trigger a layout. 688 // Our proprietary overflow: overlay value doesn't trigger a layout.
683 if ((horizontalScrollBarChanged && box().style()->overflowX() != Overflo wOverlay) || (verticalScrollBarChanged && box().style()->overflowY() != Overflow Overlay)) { 689 if ((horizontalScrollBarChanged && box().style()->overflowX() != Overflo wOverlay) || (verticalScrollBarChanged && box().style()->overflowY() != Overflow Overlay)) {
684 if (!m_inOverflowRelayout) { 690 if ((verticalScrollBarChanged && box().isHorizontalWritingMode())
691 || (horizontalScrollBarChanged && !box().isHorizontalWritingMode ())) {
692 box().setPreferredLogicalWidthsDirty();
693 box().updateLogicalWidth();
cbiesinger 2016/05/23 21:46:12 I think skobes asked this too -- why is this call
694 }
695 if (delayedLayoutScope) {
696 if (box().isLayoutBlock())
697 toLayoutBlock(box()).scrollbarsChanged(horizontalScrollBarCh anged, verticalScrollBarChanged);
698 delayedLayoutScope->setNeedsLayout(&box(), LayoutInvalidationRea son::ScrollbarChanged);
699 didMarkForDelayedLayout = true;
700 } else {
685 m_inOverflowRelayout = true; 701 m_inOverflowRelayout = true;
686 if (delayedLayoutScope) { 702 SubtreeLayoutScope layoutScope(box());
687 if (box().isLayoutBlock()) 703 layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason::Scr ollbarChanged);
688 toLayoutBlock(box()).scrollbarsChanged(horizontalScrollB arChanged, verticalScrollBarChanged); 704 if (box().isLayoutBlock()) {
689 delayedLayoutScope->setNeedsLayout(&box(), LayoutInvalidatio nReason::ScrollbarChanged); 705 LayoutBlock& block = toLayoutBlock(box());
690 didMarkForDelayedLayout = true; 706 block.scrollbarsChanged(horizontalScrollBarChanged, vertical ScrollBarChanged);
707 block.layoutBlock(true);
691 } else { 708 } else {
692 SubtreeLayoutScope layoutScope(box()); 709 box().layout();
693 layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason: :ScrollbarChanged);
694 if (box().isLayoutBlock()) {
695 LayoutBlock& block = toLayoutBlock(box());
696 block.scrollbarsChanged(horizontalScrollBarChanged, vert icalScrollBarChanged);
697 block.layoutBlock(true);
698 } else {
699 box().layout();
700 }
701 } 710 }
702 LayoutObject* parent = box().parent();
703 if (parent && parent->isFlexibleBox())
704 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box ());
705 m_inOverflowRelayout = false; 711 m_inOverflowRelayout = false;
706 } 712 }
713 LayoutObject* parent = box().parent();
714 if (parent && parent->isFlexibleBox())
715 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box());
707 } 716 }
708 } 717 }
709 718
710 { 719 {
711 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. 720 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html.
712 DisableCompositingQueryAsserts disabler; 721 DisableCompositingQueryAsserts disabler;
713 722
714 // Set up the range (and page step/line step). 723 // Set up the range (and page step/line step).
715 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { 724 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
716 int clientWidth = box().pixelSnappedClientWidth(); 725 int clientWidth = box().pixelSnappedClientWidth();
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 } 1621 }
1613 1622
1614 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) 1623 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager)
1615 { 1624 {
1616 visitor->trace(m_scrollableArea); 1625 visitor->trace(m_scrollableArea);
1617 visitor->trace(m_hBar); 1626 visitor->trace(m_hBar);
1618 visitor->trace(m_vBar); 1627 visitor->trace(m_vBar);
1619 } 1628 }
1620 1629
1621 } // namespace blink 1630 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | third_party/WebKit/Source/web/resources/listPicker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698