tor-browser

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

HTMLFrameElement.cpp (1987B)


      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 #include "mozilla/dom/HTMLFrameElement.h"
      8 
      9 #include "mozilla/dom/HTMLFrameElementBinding.h"
     10 
     11 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame)
     12 
     13 namespace mozilla::dom {
     14 
     15 HTMLFrameElement::HTMLFrameElement(
     16    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
     17    FromParser aFromParser)
     18    : nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser) {}
     19 
     20 HTMLFrameElement::~HTMLFrameElement() = default;
     21 
     22 NS_IMPL_ELEMENT_CLONE(HTMLFrameElement)
     23 
     24 bool HTMLFrameElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
     25                                      const nsAString& aValue,
     26                                      nsIPrincipal* aMaybeScriptedPrincipal,
     27                                      nsAttrValue& aResult) {
     28  if (aNamespaceID == kNameSpaceID_None) {
     29    if (aAttribute == nsGkAtoms::bordercolor) {
     30      return aResult.ParseColor(aValue);
     31    }
     32    if (aAttribute == nsGkAtoms::frameborder) {
     33      return ParseFrameborderValue(aValue, aResult);
     34    }
     35    if (aAttribute == nsGkAtoms::marginwidth) {
     36      return aResult.ParseNonNegativeIntValue(aValue);
     37    }
     38    if (aAttribute == nsGkAtoms::marginheight) {
     39      return aResult.ParseNonNegativeIntValue(aValue);
     40    }
     41    if (aAttribute == nsGkAtoms::scrolling) {
     42      return ParseScrollingValue(aValue, aResult);
     43    }
     44  }
     45 
     46  return nsGenericHTMLFrameElement::ParseAttribute(
     47      aNamespaceID, aAttribute, aValue, aMaybeScriptedPrincipal, aResult);
     48 }
     49 
     50 JSObject* HTMLFrameElement::WrapNode(JSContext* aCx,
     51                                     JS::Handle<JSObject*> aGivenProto) {
     52  return HTMLFrameElement_Binding::Wrap(aCx, this, aGivenProto);
     53 }
     54 
     55 }  // namespace mozilla::dom