2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-07-10 02:25:27 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef nsColorControlFrame_h___
|
|
|
|
#define nsColorControlFrame_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2013-10-22 19:29:20 +04:00
|
|
|
#include "nsHTMLButtonControlFrame.h"
|
2013-07-10 02:25:27 +04:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
|
2016-02-17 23:37:00 +03:00
|
|
|
namespace mozilla {
|
2019-02-19 16:44:33 +03:00
|
|
|
enum class PseudoStyleType : uint8_t;
|
2019-04-16 10:24:49 +03:00
|
|
|
class PresShell;
|
2016-02-17 23:37:00 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-07-10 02:25:27 +04:00
|
|
|
// Class which implements the input type=color
|
|
|
|
|
2016-04-18 08:32:19 +03:00
|
|
|
class nsColorControlFrame final : public nsHTMLButtonControlFrame,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIAnonymousContentCreator {
|
2019-02-19 16:44:33 +03:00
|
|
|
typedef mozilla::PseudoStyleType PseudoStyleType;
|
2013-12-03 08:49:03 +04:00
|
|
|
typedef mozilla::dom::Element Element;
|
|
|
|
|
2013-07-10 02:25:27 +04:00
|
|
|
public:
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsIFrame* NS_NewColorControlFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
2013-07-10 02:25:27 +04:00
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2013-07-10 02:25:27 +04:00
|
|
|
|
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsColorControlFrame)
|
2013-07-10 02:25:27 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2013-07-10 02:25:27 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 22:41:57 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFilter) override;
|
2013-07-10 02:25:27 +04:00
|
|
|
|
|
|
|
// nsIFrame
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override;
|
2013-07-10 02:25:27 +04:00
|
|
|
|
2014-02-28 23:52:42 +04:00
|
|
|
// Refresh the color swatch, using associated input's value
|
|
|
|
nsresult UpdateColor();
|
|
|
|
|
2013-07-10 02:25:27 +04:00
|
|
|
private:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsColorControlFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext);
|
2013-07-10 02:25:27 +04:00
|
|
|
|
2013-12-03 08:49:03 +04:00
|
|
|
nsCOMPtr<Element> mColorContent;
|
2013-07-10 02:25:27 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsColorControlFrame_h___
|