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

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: Fixed accessibility 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
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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 567
567 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro llOffsetClamping clamp) 568 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro llOffsetClamping clamp)
568 { 569 {
569 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s crollOffset) : scrollOffset; 570 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s crollOffset) : scrollOffset;
570 if (newScrollOffset != adjustedScrollOffset()) 571 if (newScrollOffset != adjustedScrollOffset())
571 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); 572 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset);
572 } 573 }
573 574
574 void RenderLayerScrollableArea::updateAfterLayout() 575 void RenderLayerScrollableArea::updateAfterLayout()
575 { 576 {
576 // List box parts handle the scrollbars by themselves so we have nothing to do.
577 if (box().style()->appearance() == ListboxPart)
578 return;
579
580 m_scrollDimensionsDirty = true; 577 m_scrollDimensionsDirty = true;
581 IntSize originalScrollOffset = adjustedScrollOffset(); 578 IntSize originalScrollOffset = adjustedScrollOffset();
582 579
583 computeScrollDimensions(); 580 computeScrollDimensions();
584 581
585 if (!box().isMarquee()) { 582 if (!box().isMarquee()) {
586 // Layout may cause us to be at an invalid scroll position. In this case we need 583 // Layout may cause us to be at an invalid scroll position. In this case we need
587 // to pull our scroll offsets back to the max (or push them up to the mi n). 584 // to pull our scroll offsets back to the max (or push them up to the mi n).
588 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); 585 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset());
589 if (clampedScrollOffset != adjustedScrollOffset()) 586 if (clampedScrollOffset != adjustedScrollOffset())
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return overflow == OSCROLL; 688 return overflow == OSCROLL;
692 } 689 }
693 690
694 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) 691 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
695 { 692 {
696 return overflow == OAUTO || overflow == OOVERLAY; 693 return overflow == OAUTO || overflow == OOVERLAY;
697 } 694 }
698 695
699 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le) 696 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le)
700 { 697 {
701 // List box parts handle the scrollbars by themselves so we have nothing to do.
702 if (box().style()->appearance() == ListboxPart)
703 return;
704
705 // RenderView shouldn't provide scrollbars on its own. 698 // RenderView shouldn't provide scrollbars on its own.
706 if (box().isRenderView()) 699 if (box().isRenderView())
707 return; 700 return;
708 701
709 if (!m_scrollDimensionsDirty) 702 if (!m_scrollDimensionsDirty)
710 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); 703 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow());
711 704
712 EOverflow overflowX = box().style()->overflowX(); 705 EOverflow overflowX = box().style()->overflowX();
713 EOverflow overflowY = box().style()->overflowY(); 706 EOverflow overflowY = box().style()->overflowY();
714 707
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 839 }
847 840
848 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient ation orientation) 841 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient ation orientation)
849 { 842 {
850 RefPtr<Scrollbar> widget; 843 RefPtr<Scrollbar> widget;
851 RenderObject* actualRenderer = rendererForScrollbar(box()); 844 RenderObject* actualRenderer = rendererForScrollbar(box());
852 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR); 845 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR);
853 if (hasCustomScrollbarStyle) { 846 if (hasCustomScrollbarStyle) {
854 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node()); 847 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node());
855 } else { 848 } else {
856 widget = Scrollbar::create(this, orientation, RegularScrollbar); 849 ScrollbarControlSize scrollbarSize = RegularScrollbar;
850 if (actualRenderer->style()->hasAppearance())
851 scrollbarSize = RenderTheme::theme().scrollbarControlSizeForPart(act ualRenderer->style()->appearance());
852 widget = Scrollbar::create(this, orientation, scrollbarSize);
857 if (orientation == HorizontalScrollbar) 853 if (orientation == HorizontalScrollbar)
858 didAddScrollbar(widget.get(), HorizontalScrollbar); 854 didAddScrollbar(widget.get(), HorizontalScrollbar);
859 else 855 else
860 didAddScrollbar(widget.get(), VerticalScrollbar); 856 didAddScrollbar(widget.get(), VerticalScrollbar);
861 } 857 }
862 box().document().view()->addChild(widget.get()); 858 box().document().view()->addChild(widget.get());
863 return widget.release(); 859 return widget.release();
864 } 860 }
865 861
866 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n) 862 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n)
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) 1460 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild)
1465 { 1461 {
1466 // We only want to track the topmost scroll child for scrollable areas with 1462 // We only want to track the topmost scroll child for scrollable areas with
1467 // overlay scrollbars. 1463 // overlay scrollbars.
1468 if (!hasOverlayScrollbars()) 1464 if (!hasOverlayScrollbars())
1469 return; 1465 return;
1470 m_nextTopmostScrollChild = scrollChild; 1466 m_nextTopmostScrollChild = scrollChild;
1471 } 1467 }
1472 1468
1473 } // Namespace WebCore 1469 } // Namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698