tor-browser

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

ButtonInputTypes.h (2126B)


      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 mozilla_dom_ButtonInputTypes_h__
      8 #define mozilla_dom_ButtonInputTypes_h__
      9 
     10 #include "mozilla/dom/InputType.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 class ButtonInputTypeBase : public InputType {
     15 public:
     16  ~ButtonInputTypeBase() override = default;
     17 
     18 protected:
     19  explicit ButtonInputTypeBase(HTMLInputElement* aInputElement)
     20      : InputType(aInputElement) {}
     21 };
     22 
     23 // input type=button
     24 class ButtonInputType : public ButtonInputTypeBase {
     25 public:
     26  static InputType* Create(HTMLInputElement* aInputElement, void* aMemory) {
     27    return new (aMemory) ButtonInputType(aInputElement);
     28  }
     29 
     30 private:
     31  explicit ButtonInputType(HTMLInputElement* aInputElement)
     32      : ButtonInputTypeBase(aInputElement) {}
     33 };
     34 
     35 // input type=image
     36 class ImageInputType : public ButtonInputTypeBase {
     37 public:
     38  static InputType* Create(HTMLInputElement* aInputElement, void* aMemory) {
     39    return new (aMemory) ImageInputType(aInputElement);
     40  }
     41 
     42 private:
     43  explicit ImageInputType(HTMLInputElement* aInputElement)
     44      : ButtonInputTypeBase(aInputElement) {}
     45 };
     46 
     47 // input type=reset
     48 class ResetInputType : public ButtonInputTypeBase {
     49 public:
     50  static InputType* Create(HTMLInputElement* aInputElement, void* aMemory) {
     51    return new (aMemory) ResetInputType(aInputElement);
     52  }
     53 
     54 private:
     55  explicit ResetInputType(HTMLInputElement* aInputElement)
     56      : ButtonInputTypeBase(aInputElement) {}
     57 };
     58 
     59 // input type=submit
     60 class SubmitInputType : public ButtonInputTypeBase {
     61 public:
     62  static InputType* Create(HTMLInputElement* aInputElement, void* aMemory) {
     63    return new (aMemory) SubmitInputType(aInputElement);
     64  }
     65 
     66 private:
     67  explicit SubmitInputType(HTMLInputElement* aInputElement)
     68      : ButtonInputTypeBase(aInputElement) {}
     69 };
     70 
     71 }  // namespace mozilla::dom
     72 
     73 #endif /* mozilla_dom_ButtonInputTypes_h__ */