Line data Source code
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/. */
5 :
6 : #ifndef nsColorControlFrame_h___
7 : #define nsColorControlFrame_h___
8 :
9 : #include "nsCOMPtr.h"
10 : #include "nsHTMLButtonControlFrame.h"
11 : #include "nsIAnonymousContentCreator.h"
12 :
13 : namespace mozilla {
14 : enum class CSSPseudoElementType : uint8_t;
15 : } // namespace mozilla
16 :
17 : // Class which implements the input type=color
18 :
19 0 : class nsColorControlFrame final : public nsHTMLButtonControlFrame,
20 : public nsIAnonymousContentCreator
21 : {
22 : typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
23 : typedef mozilla::dom::Element Element;
24 :
25 : public:
26 : friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
27 : nsStyleContext* aContext);
28 :
29 : virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
30 :
31 : NS_DECL_QUERYFRAME
32 0 : NS_DECL_FRAMEARENA_HELPERS(nsColorControlFrame)
33 :
34 : #ifdef DEBUG_FRAME_DUMP
35 : virtual nsresult GetFrameName(nsAString& aResult) const override;
36 : #endif
37 :
38 : // nsIAnonymousContentCreator
39 : virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
40 : virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
41 : uint32_t aFilter) override;
42 :
43 : // nsIFrame
44 : virtual nsresult AttributeChanged(int32_t aNameSpaceID,
45 : nsIAtom* aAttribute,
46 : int32_t aModType) override;
47 : virtual nsContainerFrame* GetContentInsertionFrame() override;
48 :
49 : virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
50 :
51 : // Refresh the color swatch, using associated input's value
52 : nsresult UpdateColor();
53 :
54 : private:
55 : explicit nsColorControlFrame(nsStyleContext* aContext);
56 :
57 : nsCOMPtr<Element> mColorContent;
58 : };
59 :
60 :
61 : #endif // nsColorControlFrame_h___
|