Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // |
michael@0 | 7 | // nsScrollbarFrame |
michael@0 | 8 | // |
michael@0 | 9 | |
michael@0 | 10 | #ifndef nsScrollbarFrame_h__ |
michael@0 | 11 | #define nsScrollbarFrame_h__ |
michael@0 | 12 | |
michael@0 | 13 | #include "mozilla/Attributes.h" |
michael@0 | 14 | #include "nsBoxFrame.h" |
michael@0 | 15 | |
michael@0 | 16 | class nsIScrollbarMediator; |
michael@0 | 17 | |
michael@0 | 18 | nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
michael@0 | 19 | |
michael@0 | 20 | class nsScrollbarFrame : public nsBoxFrame |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | nsScrollbarFrame(nsIPresShell* aShell, nsStyleContext* aContext): |
michael@0 | 24 | nsBoxFrame(aShell, aContext), mScrollbarMediator(nullptr) {} |
michael@0 | 25 | |
michael@0 | 26 | NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame) |
michael@0 | 27 | |
michael@0 | 28 | #ifdef DEBUG_FRAME_DUMP |
michael@0 | 29 | virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { |
michael@0 | 30 | return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult); |
michael@0 | 31 | } |
michael@0 | 32 | #endif |
michael@0 | 33 | |
michael@0 | 34 | // nsIFrame overrides |
michael@0 | 35 | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 36 | nsIAtom* aAttribute, |
michael@0 | 37 | int32_t aModType) MOZ_OVERRIDE; |
michael@0 | 38 | |
michael@0 | 39 | NS_DECL_QUERYFRAME |
michael@0 | 40 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 41 | |
michael@0 | 42 | NS_IMETHOD HandlePress(nsPresContext* aPresContext, |
michael@0 | 43 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 44 | nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
michael@0 | 45 | |
michael@0 | 46 | NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, |
michael@0 | 47 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 48 | nsEventStatus* aEventStatus, |
michael@0 | 49 | bool aControlHeld) MOZ_OVERRIDE; |
michael@0 | 50 | |
michael@0 | 51 | NS_IMETHOD HandleDrag(nsPresContext* aPresContext, |
michael@0 | 52 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 53 | nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
michael@0 | 54 | |
michael@0 | 55 | NS_IMETHOD HandleRelease(nsPresContext* aPresContext, |
michael@0 | 56 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 57 | nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
michael@0 | 58 | |
michael@0 | 59 | virtual void Init(nsIContent* aContent, |
michael@0 | 60 | nsIFrame* aParent, |
michael@0 | 61 | nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
michael@0 | 62 | |
michael@0 | 63 | virtual nsresult Reflow(nsPresContext* aPresContext, |
michael@0 | 64 | nsHTMLReflowMetrics& aDesiredSize, |
michael@0 | 65 | const nsHTMLReflowState& aReflowState, |
michael@0 | 66 | nsReflowStatus& aStatus) MOZ_OVERRIDE; |
michael@0 | 67 | |
michael@0 | 68 | virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
michael@0 | 69 | |
michael@0 | 70 | void SetScrollbarMediatorContent(nsIContent* aMediator); |
michael@0 | 71 | nsIScrollbarMediator* GetScrollbarMediator(); |
michael@0 | 72 | |
michael@0 | 73 | // nsBox methods |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | * Treat scrollbars as clipping their children; overflowing children |
michael@0 | 77 | * will not be allowed to set an overflow rect on this |
michael@0 | 78 | * frame. This means that when the scroll code decides to hide a |
michael@0 | 79 | * scrollframe by setting its height or width to zero, that will |
michael@0 | 80 | * hide the children too. |
michael@0 | 81 | */ |
michael@0 | 82 | virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; } |
michael@0 | 83 | |
michael@0 | 84 | virtual nsresult GetMargin(nsMargin& aMargin) MOZ_OVERRIDE; |
michael@0 | 85 | |
michael@0 | 86 | private: |
michael@0 | 87 | nsCOMPtr<nsIContent> mScrollbarMediator; |
michael@0 | 88 | }; // class nsScrollbarFrame |
michael@0 | 89 | |
michael@0 | 90 | #endif |