1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsGfxButtonControlFrame_h___ 8 #define nsGfxButtonControlFrame_h___ 9 10 #include "mozilla/Attributes.h" 11 #include "nsHTMLButtonControlFrame.h" 12 #include "nsCOMPtr.h" 13 #include "nsIAnonymousContentCreator.h" 14 15 class nsTextNode; 16 17 // Class which implements the input[type=button, reset, submit] and 18 // browse button for input[type=file]. 19 // The label for button is specified through generated content 20 // in the ua.css file. 21 22 class nsGfxButtonControlFrame final : public nsHTMLButtonControlFrame, 23 public nsIAnonymousContentCreator { 24 public: 25 NS_DECL_FRAMEARENA_HELPERS(nsGfxButtonControlFrame) 26 27 explicit nsGfxButtonControlFrame(ComputedStyle* aStyle, 28 nsPresContext* aPresContext); 29 30 virtual void DestroyFrom(nsIFrame* aDestructRoot, 31 PostDestroyData& aPostDestroyData) override; 32 33 virtual nsresult HandleEvent(nsPresContext* aPresContext, 34 mozilla::WidgetGUIEvent* aEvent, 35 nsEventStatus* aEventStatus) override; 36 37 #ifdef DEBUG_FRAME_DUMP 38 virtual nsresult GetFrameName(nsAString& aResult) const override; 39 #endif 40 41 NS_DECL_QUERYFRAME 42 43 // nsIAnonymousContentCreator 44 virtual nsresult CreateAnonymousContent( 45 nsTArray<ContentInfo>& aElements) override; 46 virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, 47 uint32_t aFilter) override; 48 49 virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, 50 int32_t aModType) override; 51 52 virtual nsContainerFrame* GetContentInsertionFrame() override; 53 54 protected: 55 nsresult GetDefaultLabel(nsAString& aLabel) const; 56 57 nsresult GetLabel(nsString& aLabel); 58 IsInput()59 virtual bool IsInput() override { return true; } 60 61 private: 62 RefPtr<nsTextNode> mTextContent; 63 }; 64 65 #endif 66