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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 | 80 |
81 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) | 81 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) |
82 : m_layer(layer) | 82 : m_layer(layer) |
83 , m_inResizeMode(false) | 83 , m_inResizeMode(false) |
84 , m_scrollsOverflow(false) | 84 , m_scrollsOverflow(false) |
85 , m_scrollDimensionsDirty(true) | 85 , m_scrollDimensionsDirty(true) |
86 , m_inOverflowRelayout(false) | 86 , m_inOverflowRelayout(false) |
87 , m_nextTopmostScrollChild(0) | 87 , m_nextTopmostScrollChild(0) |
88 , m_topmostScrollChild(0) | 88 , m_topmostScrollChild(0) |
89 , m_needsCompositedScrolling(false) | 89 , m_needsCompositedScrolling(false) |
90 , m_horizontalScrollbarRectChanged(false) | |
91 , m_verticalScrollbarRectChanged(false) | |
90 , m_scrollCorner(nullptr) | 92 , m_scrollCorner(nullptr) |
91 , m_resizer(nullptr) | 93 , m_resizer(nullptr) |
92 { | 94 { |
93 ScrollableArea::setConstrainsScrollingToContentEdge(false); | 95 ScrollableArea::setConstrainsScrollingToContentEdge(false); |
94 | 96 |
95 Node* node = box().node(); | 97 Node* node = box().node(); |
96 if (node && node->isElementNode()) { | 98 if (node && node->isElementNode()) { |
97 // We save and restore only the scrollOffset as the other scroll values are recalculated. | 99 // We save and restore only the scrollOffset as the other scroll values are recalculated. |
98 Element* element = toElement(node); | 100 Element* element = toElement(node); |
99 m_scrollOffset = element->savedLayerScrollOffset(); | 101 m_scrollOffset = element->savedLayerScrollOffset(); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 if (box().style()->overflowY() == OSCROLL && verticalScrollbar()) | 614 if (box().style()->overflowY() == OSCROLL && verticalScrollbar()) |
613 verticalScrollbar()->setEnabled(hasVerticalOverflow); | 615 verticalScrollbar()->setEnabled(hasVerticalOverflow); |
614 } | 616 } |
615 if (hasOverlayScrollbars()) { | 617 if (hasOverlayScrollbars()) { |
616 if (!scrollSize(HorizontalScrollbar)) | 618 if (!scrollSize(HorizontalScrollbar)) |
617 setHasHorizontalScrollbar(false); | 619 setHasHorizontalScrollbar(false); |
618 if (!scrollSize(VerticalScrollbar)) | 620 if (!scrollSize(VerticalScrollbar)) |
619 setHasVerticalScrollbar(false); | 621 setHasVerticalScrollbar(false); |
620 } | 622 } |
621 // overflow:auto may need to lay out again if scrollbars got added/removed. | 623 // overflow:auto may need to lay out again if scrollbars got added/removed. |
622 bool autoHorizontalScrollBarChanged = box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow); | 624 bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (ha sHorizontalScrollbar() != hasHorizontalOverflow)) || m_horizontalScrollbarRectCh anged; |
623 bool autoVerticalScrollBarChanged = box().hasAutoVerticalScrollbar() && (has VerticalScrollbar() != hasVerticalOverflow); | 625 bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVer ticalScrollbar() != hasVerticalOverflow)) || m_verticalScrollbarRectChanged; |
624 | 626 |
625 if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) { | 627 if (horizontalScrollBarChanged || verticalScrollBarChanged) { |
626 if (box().hasAutoHorizontalScrollbar()) | 628 if (box().hasAutoHorizontalScrollbar()) |
627 setHasHorizontalScrollbar(hasHorizontalOverflow); | 629 setHasHorizontalScrollbar(hasHorizontalOverflow); |
628 if (box().hasAutoVerticalScrollbar()) | 630 if (box().hasAutoVerticalScrollbar()) |
629 setHasVerticalScrollbar(hasVerticalOverflow); | 631 setHasVerticalScrollbar(hasVerticalOverflow); |
630 | 632 |
631 if (hasVerticalOverflow || hasHorizontalOverflow) | 633 if (hasVerticalOverflow || hasHorizontalOverflow) |
632 updateScrollCornerStyle(); | 634 updateScrollCornerStyle(); |
633 | 635 |
634 layer()->updateSelfPaintingLayer(); | 636 layer()->updateSelfPaintingLayer(); |
635 | 637 |
636 // Force an update since we know the scrollbars have changed things. | 638 // Force an update since we know the scrollbars have changed things. |
637 if (box().document().hasAnnotatedRegions()) | 639 if (box().document().hasAnnotatedRegions()) |
638 box().document().setAnnotatedRegionsDirty(true); | 640 box().document().setAnnotatedRegionsDirty(true); |
639 | 641 |
640 if (box().style()->overflowX() == OAUTO || box().style()->overflowY() == OAUTO) { | 642 if (box().style()->overflowX() == OAUTO || box().style()->overflowY() == OAUTO || m_verticalScrollbarRectChanged || m_horizontalScrollbarRectChanged) { |
skobes
2014/11/10 20:26:09
I think this codepath is intended for the case whe
| |
641 if (!m_inOverflowRelayout) { | 643 if (!m_inOverflowRelayout) { |
642 // Our proprietary overflow: overlay value doesn't trigger a lay out. | 644 // Our proprietary overflow: overlay value doesn't trigger a lay out. |
643 m_inOverflowRelayout = true; | 645 m_inOverflowRelayout = true; |
644 SubtreeLayoutScope layoutScope(box()); | 646 SubtreeLayoutScope layoutScope(box()); |
645 layoutScope.setNeedsLayout(&box()); | 647 layoutScope.setNeedsLayout(&box()); |
646 if (box().isRenderBlock()) { | 648 if (box().isRenderBlock()) { |
647 RenderBlock& block = toRenderBlock(box()); | 649 RenderBlock& block = toRenderBlock(box()); |
648 block.scrollbarsChanged(autoHorizontalScrollBarChanged, auto VerticalScrollBarChanged); | 650 block.scrollbarsChanged(horizontalScrollBarChanged, vertical ScrollBarChanged); |
649 block.layoutBlock(true); | 651 block.layoutBlock(true); |
650 } else { | 652 } else { |
651 box().layout(); | 653 box().layout(); |
652 } | 654 } |
653 m_inOverflowRelayout = false; | 655 m_inOverflowRelayout = false; |
654 } | 656 } |
657 m_verticalScrollbarRectChanged = false; | |
658 m_horizontalScrollbarRectChanged = false; | |
655 } | 659 } |
656 } | 660 } |
657 | 661 |
658 { | 662 { |
659 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. | 663 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. |
660 DisableCompositingQueryAsserts disabler; | 664 DisableCompositingQueryAsserts disabler; |
661 | 665 |
662 // Set up the range (and page step/line step). | 666 // Set up the range (and page step/line step). |
663 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 667 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
664 int clientWidth = box().pixelSnappedClientWidth(); | 668 int clientWidth = box().pixelSnappedClientWidth(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 ASSERT(hasHorizontalScrollbar()); | 750 ASSERT(hasHorizontalScrollbar()); |
747 m_hBar->setEnabled(true); | 751 m_hBar->setEnabled(true); |
748 } | 752 } |
749 | 753 |
750 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { | 754 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { |
751 ASSERT(hasVerticalScrollbar()); | 755 ASSERT(hasVerticalScrollbar()); |
752 m_vBar->setEnabled(true); | 756 m_vBar->setEnabled(true); |
753 } | 757 } |
754 | 758 |
755 // FIXME: Need to detect a swap from custom to native scrollbars (and vice v ersa). | 759 // FIXME: Need to detect a swap from custom to native scrollbars (and vice v ersa). |
756 if (m_hBar) | 760 if (m_hBar) { |
761 IntRect oldHBarRect = m_hBar->frameRect(); | |
757 m_hBar->styleChanged(); | 762 m_hBar->styleChanged(); |
758 if (m_vBar) | 763 if (oldHBarRect != m_hBar->frameRect()) |
764 m_horizontalScrollbarRectChanged = true; | |
765 } | |
766 if (m_vBar) { | |
767 IntRect oldVBarRect = m_vBar->frameRect(); | |
759 m_vBar->styleChanged(); | 768 m_vBar->styleChanged(); |
769 if (oldVBarRect != m_vBar->frameRect()) | |
770 m_verticalScrollbarRectChanged = true; | |
771 } | |
760 | 772 |
MuVen
2014/11/11 14:45:04
if (box().isRenderBlock()) {
RenderBlock&
| |
761 updateScrollCornerStyle(); | 773 updateScrollCornerStyle(); |
762 updateResizerAreaSet(); | 774 updateResizerAreaSet(); |
763 updateResizerStyle(); | 775 updateResizerStyle(); |
764 } | 776 } |
765 | 777 |
766 bool RenderLayerScrollableArea::updateAfterCompositingChange() | 778 bool RenderLayerScrollableArea::updateAfterCompositingChange() |
767 { | 779 { |
768 layer()->updateScrollingStateAfterCompositingChange(); | 780 layer()->updateScrollingStateAfterCompositingChange(); |
769 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; | 781 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; |
770 m_topmostScrollChild = m_nextTopmostScrollChild; | 782 m_topmostScrollChild = m_nextTopmostScrollChild; |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1488 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 1500 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
1489 { | 1501 { |
1490 // We only want to track the topmost scroll child for scrollable areas with | 1502 // We only want to track the topmost scroll child for scrollable areas with |
1491 // overlay scrollbars. | 1503 // overlay scrollbars. |
1492 if (!hasOverlayScrollbars()) | 1504 if (!hasOverlayScrollbars()) |
1493 return; | 1505 return; |
1494 m_nextTopmostScrollChild = scrollChild; | 1506 m_nextTopmostScrollChild = scrollChild; |
1495 } | 1507 } |
1496 | 1508 |
1497 } // namespace blink | 1509 } // namespace blink |
OLD | NEW |