1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsColorControlFrame_h___
7 #define nsColorControlFrame_h___
10 #include "nsHTMLButtonControlFrame.h"
11 #include "nsIAnonymousContentCreator.h"
13 typedef nsHTMLButtonControlFrame nsColorControlFrameSuper
;
15 // Class which implements the input type=color
17 class nsColorControlFrame MOZ_FINAL
: public nsColorControlFrameSuper
,
18 public nsIAnonymousContentCreator
20 typedef mozilla::dom::Element Element
;
23 friend nsIFrame
* NS_NewColorControlFrame(nsIPresShell
* aPresShell
,
24 nsStyleContext
* aContext
);
26 virtual void DestroyFrom(nsIFrame
* aDestructRoot
) MOZ_OVERRIDE
;
28 NS_DECL_QUERYFRAME_TARGET(nsColorControlFrame
)
30 NS_DECL_FRAMEARENA_HELPERS
32 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
34 #ifdef DEBUG_FRAME_DUMP
35 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
;
38 // nsIAnonymousContentCreator
39 virtual nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) MOZ_OVERRIDE
;
40 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
41 uint32_t aFilter
) MOZ_OVERRIDE
;
44 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
,
46 int32_t aModType
) MOZ_OVERRIDE
;
47 virtual bool IsLeaf() const MOZ_OVERRIDE
{ return true; }
48 virtual nsContainerFrame
* GetContentInsertionFrame() MOZ_OVERRIDE
;
50 virtual Element
* GetPseudoElement(nsCSSPseudoElements::Type aType
) MOZ_OVERRIDE
;
52 // Refresh the color swatch, using associated input's value
53 nsresult
UpdateColor();
56 explicit nsColorControlFrame(nsStyleContext
* aContext
);
58 nsCOMPtr
<Element
> mColorContent
;
62 #endif // nsColorControlFrame_h___