1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/nsColorControlFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsColorControlFrame_h___ 1.10 +#define nsColorControlFrame_h___ 1.11 + 1.12 +#include "nsCOMPtr.h" 1.13 +#include "nsHTMLButtonControlFrame.h" 1.14 +#include "nsIAnonymousContentCreator.h" 1.15 + 1.16 +typedef nsHTMLButtonControlFrame nsColorControlFrameSuper; 1.17 + 1.18 +// Class which implements the input type=color 1.19 + 1.20 +class nsColorControlFrame MOZ_FINAL : public nsColorControlFrameSuper, 1.21 + public nsIAnonymousContentCreator 1.22 +{ 1.23 + typedef mozilla::dom::Element Element; 1.24 + 1.25 +public: 1.26 + friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell, 1.27 + nsStyleContext* aContext); 1.28 + 1.29 + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; 1.30 + 1.31 + NS_DECL_QUERYFRAME_TARGET(nsColorControlFrame) 1.32 + NS_DECL_QUERYFRAME 1.33 + NS_DECL_FRAMEARENA_HELPERS 1.34 + 1.35 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.36 + 1.37 +#ifdef DEBUG_FRAME_DUMP 1.38 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; 1.39 +#endif 1.40 + 1.41 + // nsIAnonymousContentCreator 1.42 + virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE; 1.43 + virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, 1.44 + uint32_t aFilter) MOZ_OVERRIDE; 1.45 + 1.46 + // nsIFrame 1.47 + virtual nsresult AttributeChanged(int32_t aNameSpaceID, 1.48 + nsIAtom* aAttribute, 1.49 + int32_t aModType) MOZ_OVERRIDE; 1.50 + virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } 1.51 + virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE; 1.52 + 1.53 + virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; 1.54 + 1.55 + // Refresh the color swatch, using associated input's value 1.56 + nsresult UpdateColor(); 1.57 + 1.58 +private: 1.59 + nsColorControlFrame(nsStyleContext* aContext); 1.60 + 1.61 + nsCOMPtr<Element> mColorContent; 1.62 +}; 1.63 + 1.64 + 1.65 +#endif // nsColorControlFrame_h___