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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "core/html/HTMLFrameOwnerElement.h" | 52 #include "core/html/HTMLFrameOwnerElement.h" |
53 #include "core/inspector/InspectorInstrumentation.h" | 53 #include "core/inspector/InspectorInstrumentation.h" |
54 #include "core/inspector/InspectorTraceEvents.h" | 54 #include "core/inspector/InspectorTraceEvents.h" |
55 #include "core/page/EventHandler.h" | 55 #include "core/page/EventHandler.h" |
56 #include "core/page/FocusController.h" | 56 #include "core/page/FocusController.h" |
57 #include "core/page/Page.h" | 57 #include "core/page/Page.h" |
58 #include "core/page/scrolling/ScrollingCoordinator.h" | 58 #include "core/page/scrolling/ScrollingCoordinator.h" |
59 #include "core/rendering/RenderGeometryMap.h" | 59 #include "core/rendering/RenderGeometryMap.h" |
60 #include "core/rendering/RenderScrollbar.h" | 60 #include "core/rendering/RenderScrollbar.h" |
61 #include "core/rendering/RenderScrollbarPart.h" | 61 #include "core/rendering/RenderScrollbarPart.h" |
| 62 #include "core/rendering/RenderTheme.h" |
62 #include "core/rendering/RenderView.h" | 63 #include "core/rendering/RenderView.h" |
63 #include "core/rendering/compositing/CompositedLayerMapping.h" | 64 #include "core/rendering/compositing/CompositedLayerMapping.h" |
64 #include "core/rendering/compositing/RenderLayerCompositor.h" | 65 #include "core/rendering/compositing/RenderLayerCompositor.h" |
65 #include "platform/PlatformGestureEvent.h" | 66 #include "platform/PlatformGestureEvent.h" |
66 #include "platform/PlatformMouseEvent.h" | 67 #include "platform/PlatformMouseEvent.h" |
67 #include "platform/graphics/GraphicsContextStateSaver.h" | 68 #include "platform/graphics/GraphicsContextStateSaver.h" |
68 #include "platform/graphics/GraphicsLayer.h" | 69 #include "platform/graphics/GraphicsLayer.h" |
69 #include "platform/scroll/ScrollAnimator.h" | 70 #include "platform/scroll/ScrollAnimator.h" |
70 #include "platform/scroll/ScrollbarTheme.h" | 71 #include "platform/scroll/ScrollbarTheme.h" |
71 #include "public/platform/Platform.h" | 72 #include "public/platform/Platform.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 562 |
562 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro
llOffsetClamping clamp) | 563 void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, Scro
llOffsetClamping clamp) |
563 { | 564 { |
564 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s
crollOffset) : scrollOffset; | 565 IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(s
crollOffset) : scrollOffset; |
565 if (newScrollOffset != adjustedScrollOffset()) | 566 if (newScrollOffset != adjustedScrollOffset()) |
566 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); | 567 scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); |
567 } | 568 } |
568 | 569 |
569 void RenderLayerScrollableArea::updateAfterLayout() | 570 void RenderLayerScrollableArea::updateAfterLayout() |
570 { | 571 { |
571 // List box parts handle the scrollbars by themselves so we have nothing to
do. | |
572 if (box().style()->appearance() == ListboxPart) | |
573 return; | |
574 | |
575 m_scrollDimensionsDirty = true; | 572 m_scrollDimensionsDirty = true; |
576 IntSize originalScrollOffset = adjustedScrollOffset(); | 573 IntSize originalScrollOffset = adjustedScrollOffset(); |
577 | 574 |
578 computeScrollDimensions(); | 575 computeScrollDimensions(); |
579 | 576 |
580 if (!box().isMarquee()) { | 577 if (!box().isMarquee()) { |
581 // Layout may cause us to be at an invalid scroll position. In this case
we need | 578 // Layout may cause us to be at an invalid scroll position. In this case
we need |
582 // to pull our scroll offsets back to the max (or push them up to the mi
n). | 579 // to pull our scroll offsets back to the max (or push them up to the mi
n). |
583 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); | 580 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); |
584 if (clampedScrollOffset != adjustedScrollOffset()) | 581 if (clampedScrollOffset != adjustedScrollOffset()) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 return overflow == OSCROLL; | 686 return overflow == OSCROLL; |
690 } | 687 } |
691 | 688 |
692 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 689 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
693 { | 690 { |
694 return overflow == OAUTO || overflow == OOVERLAY; | 691 return overflow == OAUTO || overflow == OOVERLAY; |
695 } | 692 } |
696 | 693 |
697 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) | 694 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) |
698 { | 695 { |
699 // List box parts handle the scrollbars by themselves so we have nothing to
do. | |
700 if (box().style()->appearance() == ListboxPart) | |
701 return; | |
702 | |
703 // RenderView shouldn't provide scrollbars on its own. | 696 // RenderView shouldn't provide scrollbars on its own. |
704 if (box().isRenderView()) | 697 if (box().isRenderView()) |
705 return; | 698 return; |
706 | 699 |
707 if (!m_scrollDimensionsDirty) | 700 if (!m_scrollDimensionsDirty) |
708 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); | 701 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); |
709 | 702 |
710 EOverflow overflowX = box().style()->overflowX(); | 703 EOverflow overflowX = box().style()->overflowX(); |
711 EOverflow overflowY = box().style()->overflowY(); | 704 EOverflow overflowY = box().style()->overflowY(); |
712 | 705 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 833 } |
841 | 834 |
842 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient
ation orientation) | 835 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient
ation orientation) |
843 { | 836 { |
844 RefPtr<Scrollbar> widget; | 837 RefPtr<Scrollbar> widget; |
845 RenderObject* actualRenderer = rendererForScrollbar(box()); | 838 RenderObject* actualRenderer = rendererForScrollbar(box()); |
846 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st
yle()->hasPseudoStyle(SCROLLBAR); | 839 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st
yle()->hasPseudoStyle(SCROLLBAR); |
847 if (hasCustomScrollbarStyle) { | 840 if (hasCustomScrollbarStyle) { |
848 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua
lRenderer->node()); | 841 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua
lRenderer->node()); |
849 } else { | 842 } else { |
850 widget = Scrollbar::create(this, orientation, RegularScrollbar); | 843 ScrollbarControlSize scrollbarSize = RegularScrollbar; |
| 844 if (actualRenderer->style()->hasAppearance()) |
| 845 scrollbarSize = RenderTheme::theme().scrollbarControlSizeForPart(act
ualRenderer->style()->appearance()); |
| 846 widget = Scrollbar::create(this, orientation, scrollbarSize); |
851 if (orientation == HorizontalScrollbar) | 847 if (orientation == HorizontalScrollbar) |
852 didAddScrollbar(widget.get(), HorizontalScrollbar); | 848 didAddScrollbar(widget.get(), HorizontalScrollbar); |
853 else | 849 else |
854 didAddScrollbar(widget.get(), VerticalScrollbar); | 850 didAddScrollbar(widget.get(), VerticalScrollbar); |
855 } | 851 } |
856 box().document().view()->addChild(widget.get()); | 852 box().document().view()->addChild(widget.get()); |
857 return widget.release(); | 853 return widget.release(); |
858 } | 854 } |
859 | 855 |
860 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio
n) | 856 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio
n) |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 DisableCompositingQueryAsserts disabler; | 1445 DisableCompositingQueryAsserts disabler; |
1450 return box().hasCompositedLayerMapping() && box().compositedLayerMapping()->
scrollingLayer(); | 1446 return box().hasCompositedLayerMapping() && box().compositedLayerMapping()->
scrollingLayer(); |
1451 } | 1447 } |
1452 | 1448 |
1453 bool RenderLayerScrollableArea::needsCompositedScrolling() const | 1449 bool RenderLayerScrollableArea::needsCompositedScrolling() const |
1454 { | 1450 { |
1455 return scrollsOverflow() && box().view()->compositor()->acceleratedCompositi
ngForOverflowScrollEnabled(); | 1451 return scrollsOverflow() && box().view()->compositor()->acceleratedCompositi
ngForOverflowScrollEnabled(); |
1456 } | 1452 } |
1457 | 1453 |
1458 } // Namespace WebCore | 1454 } // Namespace WebCore |
OLD | NEW |