michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // michael@0: // nsScrollbarFrame michael@0: // michael@0: michael@0: #ifndef nsScrollbarFrame_h__ michael@0: #define nsScrollbarFrame_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsBoxFrame.h" michael@0: michael@0: class nsIScrollbarMediator; michael@0: michael@0: nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: michael@0: class nsScrollbarFrame : public nsBoxFrame michael@0: { michael@0: public: michael@0: nsScrollbarFrame(nsIPresShell* aShell, nsStyleContext* aContext): michael@0: nsBoxFrame(aShell, aContext), mScrollbarMediator(nullptr) {} michael@0: michael@0: NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame) michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { michael@0: return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult); michael@0: } michael@0: #endif michael@0: michael@0: // nsIFrame overrides michael@0: virtual nsresult AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) MOZ_OVERRIDE; michael@0: michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: NS_IMETHOD HandlePress(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus, michael@0: bool aControlHeld) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD HandleDrag(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD HandleRelease(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual void Init(nsIContent* aContent, michael@0: nsIFrame* aParent, michael@0: nsIFrame* aPrevInFlow) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: void SetScrollbarMediatorContent(nsIContent* aMediator); michael@0: nsIScrollbarMediator* GetScrollbarMediator(); michael@0: michael@0: // nsBox methods michael@0: michael@0: /** michael@0: * Treat scrollbars as clipping their children; overflowing children michael@0: * will not be allowed to set an overflow rect on this michael@0: * frame. This means that when the scroll code decides to hide a michael@0: * scrollframe by setting its height or width to zero, that will michael@0: * hide the children too. michael@0: */ michael@0: virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; } michael@0: michael@0: virtual nsresult GetMargin(nsMargin& aMargin) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: nsCOMPtr mScrollbarMediator; michael@0: }; // class nsScrollbarFrame michael@0: michael@0: #endif