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: #ifndef nsColorControlFrame_h___ michael@0: #define nsColorControlFrame_h___ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsHTMLButtonControlFrame.h" michael@0: #include "nsIAnonymousContentCreator.h" michael@0: michael@0: typedef nsHTMLButtonControlFrame nsColorControlFrameSuper; michael@0: michael@0: // Class which implements the input type=color michael@0: michael@0: class nsColorControlFrame MOZ_FINAL : public nsColorControlFrameSuper, michael@0: public nsIAnonymousContentCreator michael@0: { michael@0: typedef mozilla::dom::Element Element; michael@0: michael@0: public: michael@0: friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell, michael@0: nsStyleContext* aContext); michael@0: michael@0: virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; michael@0: michael@0: NS_DECL_QUERYFRAME_TARGET(nsColorControlFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: // nsIAnonymousContentCreator michael@0: virtual nsresult CreateAnonymousContent(nsTArray& aElements) MOZ_OVERRIDE; michael@0: virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, michael@0: uint32_t aFilter) MOZ_OVERRIDE; michael@0: michael@0: // nsIFrame michael@0: virtual nsresult AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) MOZ_OVERRIDE; michael@0: virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } michael@0: virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE; michael@0: michael@0: virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; michael@0: michael@0: // Refresh the color swatch, using associated input's value michael@0: nsresult UpdateColor(); michael@0: michael@0: private: michael@0: nsColorControlFrame(nsStyleContext* aContext); michael@0: michael@0: nsCOMPtr mColorContent; michael@0: }; michael@0: michael@0: michael@0: #endif // nsColorControlFrame_h___