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/. */
7 #ifndef nsColorControlFrame_h___
8 #define nsColorControlFrame_h___
11 #include "nsHTMLButtonControlFrame.h"
12 #include "nsIAnonymousContentCreator.h"
15 enum class PseudoStyleType
: uint8_t;
17 } // namespace mozilla
19 // Class which implements the input type=color
21 class nsColorControlFrame final
: public nsHTMLButtonControlFrame
,
22 public nsIAnonymousContentCreator
{
23 typedef mozilla::PseudoStyleType PseudoStyleType
;
24 typedef mozilla::dom::Element Element
;
27 friend nsIFrame
* NS_NewColorControlFrame(mozilla::PresShell
* aPresShell
,
28 ComputedStyle
* aStyle
);
30 void Destroy(DestroyContext
&) override
;
33 NS_DECL_FRAMEARENA_HELPERS(nsColorControlFrame
)
35 #ifdef DEBUG_FRAME_DUMP
36 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
;
39 // nsIAnonymousContentCreator
40 virtual nsresult
CreateAnonymousContent(
41 nsTArray
<ContentInfo
>& aElements
) override
;
42 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
43 uint32_t aFilter
) override
;
46 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
47 int32_t aModType
) override
;
48 virtual nsContainerFrame
* GetContentInsertionFrame() override
;
50 // Refresh the color swatch, using associated input's value
51 nsresult
UpdateColor();
54 explicit nsColorControlFrame(ComputedStyle
* aStyle
,
55 nsPresContext
* aPresContext
);
57 nsCOMPtr
<Element
> mColorContent
;
60 #endif // nsColorControlFrame_h___