tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsColorControlFrame.h (1699B)


      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/. */
      6 
      7 #ifndef nsColorControlFrame_h___
      8 #define nsColorControlFrame_h___
      9 
     10 #include "ButtonControlFrame.h"
     11 #include "nsCOMPtr.h"
     12 
     13 namespace mozilla {
     14 class PresShell;
     15 }  // namespace mozilla
     16 
     17 // Class which implements the input type=color
     18 
     19 class nsColorControlFrame final : public mozilla::ButtonControlFrame {
     20  typedef mozilla::dom::Element Element;
     21 
     22 public:
     23  friend nsIFrame* NS_NewColorControlFrame(mozilla::PresShell* aPresShell,
     24                                           ComputedStyle* aStyle);
     25 
     26  void Destroy(DestroyContext&) override;
     27 
     28  NS_DECL_QUERYFRAME
     29  NS_DECL_FRAMEARENA_HELPERS(nsColorControlFrame)
     30 
     31 #ifdef DEBUG_FRAME_DUMP
     32  nsresult GetFrameName(nsAString& aResult) const override {
     33    return MakeFrameName(u"ColorControl"_ns, aResult);
     34  }
     35 #endif
     36 
     37  // nsIAnonymousContentCreator
     38  nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
     39  void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
     40                                uint32_t aFilter) override;
     41 
     42  // nsIFrame
     43  nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
     44                            AttrModType aModType) override;
     45 
     46  // Refresh the color swatch, using associated input's value
     47  void UpdateColor();
     48 
     49 private:
     50  nsColorControlFrame(ComputedStyle*, nsPresContext*);
     51 
     52  nsCOMPtr<Element> mColorContent;
     53 };
     54 
     55 #endif  // nsColorControlFrame_h___