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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp

Issue 1292513002: Create custom scrollbars when html element has overflow:scroll (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 if (newScrollOffset != adjustedScrollOffset()) { 639 if (newScrollOffset != adjustedScrollOffset()) {
640 DoublePoint origin(scrollOrigin()); 640 DoublePoint origin(scrollOrigin());
641 ScrollableArea::setScrollPosition(-origin + newScrollOffset, Programmati cScroll, scrollBehavior); 641 ScrollableArea::setScrollPosition(-origin + newScrollOffset, Programmati cScroll, scrollBehavior);
642 } 642 }
643 } 643 }
644 644
645 void DeprecatedPaintLayerScrollableArea::updateAfterLayout() 645 void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
646 { 646 {
647 ASSERT(box().hasOverflowClip()); 647 ASSERT(box().hasOverflowClip());
648 648
649 bool isScrollbarReconstructionRequired = needsScrollbarReconstruction();
650 if (m_hBar && !m_hBar->isCustomScrollbar() && isScrollbarReconstructionRequi red) {
651 destroyScrollbar(HorizontalScrollbar);
MuVen 2015/08/13 19:36:32 !m_hBar->isCustomScrollbar() This condition wont t
skobes 2015/08/13 19:53:43 Yes, to make it easier to follow, needsScrollbarRe
652 setHasHorizontalScrollbar(true);
653 }
654 if (m_vBar && !m_vBar->isCustomScrollbar() && isScrollbarReconstructionRequi red) {
655 destroyScrollbar(VerticalScrollbar);
656 setHasVerticalScrollbar(true);
657 }
658
649 DoubleSize originalScrollOffset = adjustedScrollOffset(); 659 DoubleSize originalScrollOffset = adjustedScrollOffset();
650 computeScrollDimensions(); 660 computeScrollDimensions();
651 661
652 // Layout may cause us to be at an invalid scroll position. In this case we need 662 // Layout may cause us to be at an invalid scroll position. In this case we need
653 // to pull our scroll offsets back to the max (or push them up to the min). 663 // to pull our scroll offsets back to the max (or push them up to the min).
654 DoubleSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); 664 DoubleSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset());
655 if (clampedScrollOffset != adjustedScrollOffset()) 665 if (clampedScrollOffset != adjustedScrollOffset())
656 scrollToOffset(clampedScrollOffset); 666 scrollToOffset(clampedScrollOffset);
657 667
658 if (originalScrollOffset != adjustedScrollOffset()) { 668 if (originalScrollOffset != adjustedScrollOffset()) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 } 961 }
952 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { 962 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
953 if (shadowRoot->type() == ShadowRootType::UserAgent) 963 if (shadowRoot->type() == ShadowRootType::UserAgent)
954 return shadowRoot->host()->layoutObject(); 964 return shadowRoot->host()->layoutObject();
955 } 965 }
956 } 966 }
957 967
958 return &layoutObject; 968 return &layoutObject;
959 } 969 }
960 970
971 bool DeprecatedPaintLayerScrollableArea::needsScrollbarReconstruction() const
972 {
973 LayoutObject* actualLayoutObject = layoutObjectForScrollbar(box());
974 return actualLayoutObject->isBox() && actualLayoutObject->style()->hasPseudo Style(SCROLLBAR);
skobes 2015/08/13 18:12:40 This will reconstruct custom scrollbars after ever
975 }
976
961 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation) 977 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation)
962 { 978 {
963 RefPtrWillBeRawPtr<Scrollbar> widget = nullptr; 979 RefPtrWillBeRawPtr<Scrollbar> widget = nullptr;
964 LayoutObject* actualLayoutObject = layoutObjectForScrollbar(box()); 980 LayoutObject* actualLayoutObject = layoutObjectForScrollbar(box());
965 bool hasCustomScrollbarStyle = actualLayoutObject->isBox() && actualLayoutOb ject->style()->hasPseudoStyle(SCROLLBAR); 981 bool hasCustomScrollbarStyle = actualLayoutObject->isBox() && actualLayoutOb ject->style()->hasPseudoStyle(SCROLLBAR);
966 if (hasCustomScrollbarStyle) { 982 if (hasCustomScrollbarStyle) {
967 widget = LayoutScrollbar::createCustomScrollbar(this, orientation, actua lLayoutObject->node()); 983 widget = LayoutScrollbar::createCustomScrollbar(this, orientation, actua lLayoutObject->node());
968 } else { 984 } else {
969 ScrollbarControlSize scrollbarSize = RegularScrollbar; 985 ScrollbarControlSize scrollbarSize = RegularScrollbar;
970 if (actualLayoutObject->style()->hasAppearance()) 986 if (actualLayoutObject->style()->hasAppearance())
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 return false; 1467 return false;
1452 1468
1453 LocalFrame* frame = box().frame(); 1469 LocalFrame* frame = box().frame();
1454 if (!frame || !frame->isMainFrame() || !frame->settings()) 1470 if (!frame || !frame->isMainFrame() || !frame->settings())
1455 return false; 1471 return false;
1456 1472
1457 return frame->settings()->viewportMetaEnabled(); 1473 return frame->settings()->viewportMetaEnabled();
1458 } 1474 }
1459 1475
1460 } // namespace blink 1476 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698