ButtonControlFrame.h (2012B)
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 LAYOUT_FORMS_BUTTONCONTROLFRAME_H_ 8 #define LAYOUT_FORMS_BUTTONCONTROLFRAME_H_ 9 10 #include "nsBlockFrame.h" 11 #include "nsIAnonymousContentCreator.h" 12 13 class nsTextNode; 14 15 namespace mozilla { 16 17 // Abstract base class for: 18 // * Combobox <select> 19 // * <input> with type={button,reset,submit} 20 // * <input> with type=color 21 // Each of which are basically buttons but with different native-anonymous 22 // content. Note that this isn't used to implement <button> itself (that uses 23 // regular frames like nsBlockFrame or nsGridContainerFrame or so, depending on 24 // the display type). 25 class ButtonControlFrame : public nsBlockFrame, 26 public nsIAnonymousContentCreator { 27 public: 28 NS_DECL_QUERYFRAME_TARGET(ButtonControlFrame) 29 NS_DECL_QUERYFRAME 30 NS_DECL_ABSTRACT_FRAME(ButtonControlFrame) 31 32 ButtonControlFrame(ComputedStyle* aStyle, nsPresContext* aPc, 33 ClassID aClassID) 34 : nsBlockFrame(aStyle, aPc, aClassID) { 35 MOZ_ASSERT(IsReplaced(), "Our subclasses should be replaced elements"); 36 } 37 nsContainerFrame* GetContentInsertionFrame() override { return this; } 38 nsresult HandleEvent(nsPresContext* aPresContext, 39 mozilla::WidgetGUIEvent* aEvent, 40 nsEventStatus* aEventStatus) override; 41 42 void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&, 43 nsReflowStatus&) override; 44 45 // Given a string of text (for the button label), ensure it's not empty so 46 // that line height computations work (inserting a zero-width character if 47 // necessary). 48 static void EnsureNonEmptyLabel(nsAString&); 49 }; 50 51 } // namespace mozilla 52 53 #endif // LAYOUT_FORMS_BUTTONCONTROLFRAME_H_