|
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 typedef nsHTMLButtonControlFrame nsColorControlFrameSuper; |
|
14 |
|
15 // Class which implements the input type=color |
|
16 |
|
17 class nsColorControlFrame MOZ_FINAL : public nsColorControlFrameSuper, |
|
18 public nsIAnonymousContentCreator |
|
19 { |
|
20 typedef mozilla::dom::Element Element; |
|
21 |
|
22 public: |
|
23 friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell, |
|
24 nsStyleContext* aContext); |
|
25 |
|
26 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; |
|
27 |
|
28 NS_DECL_QUERYFRAME_TARGET(nsColorControlFrame) |
|
29 NS_DECL_QUERYFRAME |
|
30 NS_DECL_FRAMEARENA_HELPERS |
|
31 |
|
32 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
33 |
|
34 #ifdef DEBUG_FRAME_DUMP |
|
35 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; |
|
36 #endif |
|
37 |
|
38 // nsIAnonymousContentCreator |
|
39 virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE; |
|
40 virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, |
|
41 uint32_t aFilter) MOZ_OVERRIDE; |
|
42 |
|
43 // nsIFrame |
|
44 virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
|
45 nsIAtom* aAttribute, |
|
46 int32_t aModType) MOZ_OVERRIDE; |
|
47 virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } |
|
48 virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE; |
|
49 |
|
50 virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; |
|
51 |
|
52 // Refresh the color swatch, using associated input's value |
|
53 nsresult UpdateColor(); |
|
54 |
|
55 private: |
|
56 nsColorControlFrame(nsStyleContext* aContext); |
|
57 |
|
58 nsCOMPtr<Element> mColorContent; |
|
59 }; |
|
60 |
|
61 |
|
62 #endif // nsColorControlFrame_h___ |