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

Side by Side Diff: Source/core/rendering/RenderLayerScrollableArea.cpp

Issue 347773002: Implement select listbox using shadow DOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/shadow/ShadowElementNames.cpp ('k') | Source/core/rendering/RenderListBox.h » ('j') | 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/html/HTMLFrameOwnerElement.h" 53 #include "core/html/HTMLFrameOwnerElement.h"
54 #include "core/inspector/InspectorInstrumentation.h" 54 #include "core/inspector/InspectorInstrumentation.h"
55 #include "core/inspector/InspectorTraceEvents.h" 55 #include "core/inspector/InspectorTraceEvents.h"
56 #include "core/page/EventHandler.h" 56 #include "core/page/EventHandler.h"
57 #include "core/page/FocusController.h" 57 #include "core/page/FocusController.h"
58 #include "core/page/Page.h" 58 #include "core/page/Page.h"
59 #include "core/page/scrolling/ScrollingCoordinator.h" 59 #include "core/page/scrolling/ScrollingCoordinator.h"
60 #include "core/rendering/RenderGeometryMap.h" 60 #include "core/rendering/RenderGeometryMap.h"
61 #include "core/rendering/RenderScrollbar.h" 61 #include "core/rendering/RenderScrollbar.h"
62 #include "core/rendering/RenderScrollbarPart.h" 62 #include "core/rendering/RenderScrollbarPart.h"
63 #include "core/rendering/RenderTheme.h"
63 #include "core/rendering/RenderView.h" 64 #include "core/rendering/RenderView.h"
64 #include "core/rendering/compositing/CompositedLayerMapping.h" 65 #include "core/rendering/compositing/CompositedLayerMapping.h"
65 #include "core/rendering/compositing/RenderLayerCompositor.h" 66 #include "core/rendering/compositing/RenderLayerCompositor.h"
66 #include "platform/PlatformGestureEvent.h" 67 #include "platform/PlatformGestureEvent.h"
67 #include "platform/PlatformMouseEvent.h" 68 #include "platform/PlatformMouseEvent.h"
68 #include "platform/graphics/GraphicsContextStateSaver.h" 69 #include "platform/graphics/GraphicsContextStateSaver.h"
69 #include "platform/graphics/GraphicsLayer.h" 70 #include "platform/graphics/GraphicsLayer.h"
70 #include "platform/scroll/ScrollAnimator.h" 71 #include "platform/scroll/ScrollAnimator.h"
71 #include "platform/scroll/ScrollbarTheme.h" 72 #include "platform/scroll/ScrollbarTheme.h"
72 #include "public/platform/Platform.h" 73 #include "public/platform/Platform.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 568
568 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro llOffsetClamping clamp) 569 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro llOffsetClamping clamp)
569 { 570 {
570 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s crollOffset) : scrollOffset; 571 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s crollOffset) : scrollOffset;
571 if (newScrollOffset != adjustedScrollOffset()) 572 if (newScrollOffset != adjustedScrollOffset())
572 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); 573 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset);
573 } 574 }
574 575
575 void RenderLayerScrollableArea::updateAfterLayout() 576 void RenderLayerScrollableArea::updateAfterLayout()
576 { 577 {
577 // List box parts handle the scrollbars by themselves so we have nothing to do.
578 if (box().style()->appearance() == ListboxPart)
579 return;
580
581 m_scrollDimensionsDirty = true; 578 m_scrollDimensionsDirty = true;
582 IntSize originalScrollOffset = adjustedScrollOffset(); 579 IntSize originalScrollOffset = adjustedScrollOffset();
583 580
584 computeScrollDimensions(); 581 computeScrollDimensions();
585 582
586 if (!box().isMarquee()) { 583 if (!box().isMarquee()) {
587 // Layout may cause us to be at an invalid scroll position. In this case we need 584 // Layout may cause us to be at an invalid scroll position. In this case we need
588 // to pull our scroll offsets back to the max (or push them up to the mi n). 585 // to pull our scroll offsets back to the max (or push them up to the mi n).
589 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); 586 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset());
590 if (clampedScrollOffset != adjustedScrollOffset()) 587 if (clampedScrollOffset != adjustedScrollOffset())
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return overflow == OSCROLL; 689 return overflow == OSCROLL;
693 } 690 }
694 691
695 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) 692 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
696 { 693 {
697 return overflow == OAUTO || overflow == OOVERLAY; 694 return overflow == OAUTO || overflow == OOVERLAY;
698 } 695 }
699 696
700 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le) 697 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le)
701 { 698 {
702 // List box parts handle the scrollbars by themselves so we have nothing to do.
703 if (box().style()->appearance() == ListboxPart)
704 return;
705
706 // RenderView shouldn't provide scrollbars on its own. 699 // RenderView shouldn't provide scrollbars on its own.
707 if (box().isRenderView()) 700 if (box().isRenderView())
708 return; 701 return;
709 702
710 if (!m_scrollDimensionsDirty) 703 if (!m_scrollDimensionsDirty)
711 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); 704 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow());
712 705
713 EOverflow overflowX = box().style()->overflowX(); 706 EOverflow overflowX = box().style()->overflowX();
714 EOverflow overflowY = box().style()->overflowY(); 707 EOverflow overflowY = box().style()->overflowY();
715 708
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 840 }
848 841
849 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient ation orientation) 842 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient ation orientation)
850 { 843 {
851 RefPtr<Scrollbar> widget; 844 RefPtr<Scrollbar> widget;
852 RenderObject* actualRenderer = rendererForScrollbar(box()); 845 RenderObject* actualRenderer = rendererForScrollbar(box());
853 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR); 846 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR);
854 if (hasCustomScrollbarStyle) { 847 if (hasCustomScrollbarStyle) {
855 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node()); 848 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node());
856 } else { 849 } else {
857 widget = Scrollbar::create(this, orientation, RegularScrollbar); 850 ScrollbarControlSize scrollbarSize = RegularScrollbar;
851 if (actualRenderer->style()->hasAppearance())
852 scrollbarSize = RenderTheme::theme().scrollbarControlSizeForPart(act ualRenderer->style()->appearance());
853 widget = Scrollbar::create(this, orientation, scrollbarSize);
858 if (orientation == HorizontalScrollbar) 854 if (orientation == HorizontalScrollbar)
859 didAddScrollbar(widget.get(), HorizontalScrollbar); 855 didAddScrollbar(widget.get(), HorizontalScrollbar);
860 else 856 else
861 didAddScrollbar(widget.get(), VerticalScrollbar); 857 didAddScrollbar(widget.get(), VerticalScrollbar);
862 } 858 }
863 box().document().view()->addChild(widget.get()); 859 box().document().view()->addChild(widget.get());
864 return widget.release(); 860 return widget.release();
865 } 861 }
866 862
867 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n) 863 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n)
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) 1468 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild)
1473 { 1469 {
1474 // We only want to track the topmost scroll child for scrollable areas with 1470 // We only want to track the topmost scroll child for scrollable areas with
1475 // overlay scrollbars. 1471 // overlay scrollbars.
1476 if (!hasOverlayScrollbars()) 1472 if (!hasOverlayScrollbars())
1477 return; 1473 return;
1478 m_nextTopmostScrollChild = scrollChild; 1474 m_nextTopmostScrollChild = scrollChild;
1479 } 1475 }
1480 1476
1481 } // Namespace WebCore 1477 } // Namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/shadow/ShadowElementNames.cpp ('k') | Source/core/rendering/RenderListBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698