tor-browser

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

SVGGFrame.cpp (2045B)


      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 // Main header first:
      8 #include "SVGGFrame.h"
      9 
     10 // Keep others in (case-insensitive) order:
     11 #include "mozilla/PresShell.h"
     12 #include "mozilla/dom/SVGElement.h"
     13 #include "nsGkAtoms.h"
     14 #include "nsIFrame.h"
     15 
     16 using namespace mozilla::dom;
     17 
     18 //----------------------------------------------------------------------
     19 // Implementation
     20 
     21 nsIFrame* NS_NewSVGGFrame(mozilla::PresShell* aPresShell,
     22                          mozilla::ComputedStyle* aStyle) {
     23  return new (aPresShell)
     24      mozilla::SVGGFrame(aStyle, aPresShell->GetPresContext());
     25 }
     26 
     27 namespace mozilla {
     28 
     29 NS_IMPL_FRAMEARENA_HELPERS(SVGGFrame)
     30 
     31 #ifdef DEBUG
     32 void SVGGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
     33                     nsIFrame* aPrevInFlow) {
     34  NS_ASSERTION(aContent->IsSVGElement() &&
     35                   static_cast<SVGElement*>(aContent)->IsTransformable(),
     36               "The element is not transformable");
     37 
     38  SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
     39 }
     40 #endif /* DEBUG */
     41 
     42 //----------------------------------------------------------------------
     43 // ISVGDisplayableFrame methods
     44 
     45 nsresult SVGGFrame::AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
     46                                     AttrModType aModType) {
     47  if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::transform) {
     48    // We don't invalidate for transform changes (the layers code does that).
     49    // Also note that SVGTransformableElement::GetAttributeChangeHint will
     50    // return nsChangeHint_UpdateOverflow for "transform" attribute changes
     51    // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
     52    NotifySVGChanged(ChangeFlag::TransformChanged);
     53  }
     54 
     55  return NS_OK;
     56 }
     57 
     58 }  // namespace mozilla