DXR will be turned off on Tuesday, December 29th. It will redirect to Searchfox.
See the announcement on Discourse.

DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
/* 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 HTMLFrameSetElement_h
#define HTMLFrameSetElement_h
#define HTMLFrameSetElement_h

#include "mozilla/Attributes.h"
#include "mozilla/UniquePtr.h"
#include "nsGenericHTMLElement.h"


/**
 * The nsFramesetUnit enum is used to denote the type of each entry
 * in the row or column spec.
 */
enum nsFramesetUnit {
enum nsFramesetUnit {
  eFramesetUnit_Fixed = 0,
  eFramesetUnit_Percent,
  eFramesetUnit_Relative
};


/**
 * The nsFramesetSpec struct is used to hold a single entry in the
 * row or column spec.
 */
 */
struct nsFramesetSpec {
  nsFramesetUnit mUnit;
  nscoord mValue;
};


/**
 * The maximum number of entries allowed in the frame set element row
 * or column spec.
 */
#define NS_MAX_FRAMESET_SPEC_COUNT 16000
#define NS_MAX_FRAMESET_SPEC_COUNT 16000

//----------------------------------------------------------------------

namespace mozilla {
namespace dom {
namespace dom {

class OnBeforeUnloadEventHandlerNonNull;

class HTMLFrameSetElement final : public nsGenericHTMLElement {
 public:
 public:
  explicit HTMLFrameSetElement(
      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
      : nsGenericHTMLElement(std::move(aNodeInfo)),
        mNumRows(0),
        mNumCols(0),
        mNumCols(0),
        mCurrentRowColHint(NS_STYLE_HINT_REFLOW) {
    SetHasWeirdParserInsertionMode();
  }
  }


  NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFrameSetElement, frameset)

  // nsISupports
  // nsISupports
  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLFrameSetElement,
                                       nsGenericHTMLElement)

  void GetCols(DOMString& aCols) { GetHTMLAttr(nsGkAtoms::cols, aCols); }
  void SetCols(const nsAString& aCols, ErrorResult& aError) {
  void SetCols(const nsAString& aCols, ErrorResult& aError) {
    SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
  }
  void GetRows(DOMString& aRows) { GetHTMLAttr(nsGkAtoms::rows, aRows); }
  void SetRows(const nsAString& aRows, ErrorResult& aError) {
    SetHTMLAttr(nsGkAtoms::rows, aRows, aError);
  }
  }

  virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;

  // Event listener stuff; we need to declare only the ones we need to
  // forward to window that don't come from nsIDOMHTMLFrameSetElement.
  // forward to window that don't come from nsIDOMHTMLFrameSetElement.
#define EVENT(name_, id_, type_, \
              struct_) /* nothing; handled by the superclass */
#define WINDOW_EVENT_HELPER(name_, type_) \
  type_* GetOn##name_();                  \
  void SetOn##name_(type_* handler);
  void SetOn##name_(type_* handler);
#define WINDOW_EVENT(name_, id_, type_, struct_) \
  WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
  WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull)
#include "mozilla/EventNameList.h"  // IWYU pragma: keep
#include "mozilla/EventNameList.h"  // IWYU pragma: keep
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef EVENT
#undef EVENT

  /**
   * GetRowSpec is used to get the "rows" spec.
   * @param out int32_t aNumValues The number of row sizes specified.
   * @param out nsFramesetSpec* aSpecs The array of size specifications.
   * @param out nsFramesetSpec* aSpecs The array of size specifications.
            This is _not_ owned by the caller, but by the nsFrameSetElement
            implementation.  DO NOT DELETE IT.
   */
  nsresult GetRowSpec(int32_t* aNumValues, const nsFramesetSpec** aSpecs);
  /**
   * GetColSpec is used to get the "cols" spec
   * GetColSpec is used to get the "cols" spec
   * @param out int32_t aNumValues The number of row sizes specified.
   * @param out nsFramesetSpec* aSpecs The array of size specifications.
            This is _not_ owned by the caller, but by the nsFrameSetElement
            implementation.  DO NOT DELETE IT.
   */
   */
  nsresult GetColSpec(int32_t* aNumValues, const nsFramesetSpec** aSpecs);

  virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
                              const nsAString& aValue,
                              nsIPrincipal* aMaybeScriptedPrincipal,
                              nsIPrincipal* aMaybeScriptedPrincipal,
                              nsAttrValue& aResult) override;
  virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
                                              int32_t aModType) const override;

  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;

 protected:
  virtual ~HTMLFrameSetElement();

  virtual JSObject* WrapNode(JSContext* aCx,
                             JS::Handle<JSObject*> aGivenProto) override;


  virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                 const nsAttrValueOrString* aValue,
                                 bool aNotify) override;

 private:
 private:
  nsresult ParseRowCol(const nsAString& aValue, int32_t& aNumSpecs,
  nsresult ParseRowCol(const nsAString& aValue, int32_t& aNumSpecs,
                       UniquePtr<nsFramesetSpec[]>* aSpecs);

  /**
   * The number of size specs in our "rows" attr
   */
   */
  int32_t mNumRows;
  /**
   * The number of size specs in our "cols" attr
   */
  int32_t mNumCols;
  int32_t mNumCols;
  /**
   * The style hint to return for the rows/cols attrs in
   * GetAttributeChangeHint
   */
  nsChangeHint mCurrentRowColHint;
  nsChangeHint mCurrentRowColHint;
  /**
   * The parsed representation of the "rows" attribute
   */
  UniquePtr<nsFramesetSpec[]> mRowSpecs;  // parsed, non-computed dimensions
  UniquePtr<nsFramesetSpec[]> mRowSpecs;  // parsed, non-computed dimensions
  /**
   * The parsed representation of the "cols" attribute
   */
  UniquePtr<nsFramesetSpec[]> mColSpecs;  // parsed, non-computed dimensions
};
};

}  // namespace dom
}  // namespace mozilla

#endif  // HTMLFrameSetElement_h
#endif  // HTMLFrameSetElement_h