author L10n Bumper Bot <>
Thu, 08 Nov 2018 03:00:11 -0800
changeset 501100 1cd4f2d571554c4dc89cf1be1d98683c0d14f797
parent 471906 e0fe3a00acc70b4f413cd8906576ec02f87cc6c7
child 506368 a1e826769668287bd7250e85fa529a6c66bfb495
permissions -rw-r--r--
no bug - Bumping Fennec l10n changesets r=release a=l10n-bump DONTBUILD an -> 336e061995b9 ar -> f6834a7d7374 as -> d2c76e616a66 ast -> fcb8f3455237 az -> c4caf3b07cf2 be -> 697eb1022498 bg -> 7bf1f448f743 bn-BD -> 5f7a87adee06 bn-IN -> 49ce3195c4c2 br -> 41cf35b7c5b5 bs -> 4a14aee27904 ca -> 9373e8ce86d4 cak -> a40d767541ba cs -> 4b99defb0525 cy -> 4c948fed2584 de -> 017a7e7a267a dsb -> aadebeccf5ba el -> 2d28a78dcef5 en-CA -> 55ad9171a9f0 en-GB -> 296422b495e9 en-ZA -> c1b5d2128914 eo -> c68e87667d9f es-AR -> bff0a788c711 es-CL -> 1d3efd2532ea es-ES -> 4d1feb70b0e2 es-MX -> fceda607d0f4 et -> 58a8262a0cc7 eu -> 7cebfd46208b fa -> cbc040d58476 ff -> 46f5aec275ea fi -> 235ab13d261e fr -> 8ee417b64f99

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */

/* This class wraps an SVG document, for use by VectorImage objects. */

#ifndef mozilla_image_SVGDocumentWrapper_h
#define mozilla_image_SVGDocumentWrapper_h

#include "mozilla/Attributes.h"

#include "nsCOMPtr.h"
#include "nsIStreamListener.h"
#include "nsIObserver.h"
#include "nsIContentViewer.h"
#include "nsWeakReference.h"
#include "nsSize.h"

class nsIPresShell;
class nsIRequest;
class nsILoadGroup;
class nsIFrame;

#define OBSERVER_SVC_CID ";1"

// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
#undef GetCurrentTime

namespace mozilla {
namespace dom {
class SVGSVGElement;
class SVGDocument;
} // namespace dom

namespace image {

class SVGDocumentWrapper final : public nsIStreamListener,
                                 public nsIObserver,


  enum Dimension {

   * Returns the wrapped document, or nullptr on failure. (No AddRef.)
  mozilla::dom::SVGDocument* GetDocument();

   * Returns the root <svg> element for the wrapped document, or nullptr on
   * failure.
  mozilla::dom::SVGSVGElement* GetRootSVGElem();

   * Returns the root nsIFrame* for the wrapped document, or nullptr on failure.
   * @return the root nsIFrame* for the wrapped document, or nullptr on failure.
  nsIFrame* GetRootLayoutFrame();

   * Returns (by reference) the nsIPresShell for the wrapped document.
   * @param[out] aPresShell On success, this will be populated with a pointer
   *                        to the wrapped document's nsIPresShell.
   * @return NS_OK on success, or an error code on failure.
  inline nsresult  GetPresShell(nsIPresShell** aPresShell)
    { return mViewer->GetPresShell(aPresShell); }

   * Modifier to update the viewport dimensions of the wrapped document. This
   * method performs a synchronous "FlushType::Layout" on the wrapped document,
   * since a viewport-change affects layout.
   * @param aViewportSize The new viewport dimensions.
  void UpdateViewportBounds(const nsIntSize& aViewportSize);

   * If an SVG image's helper document has a pending notification for an
   * override on the root node's "preserveAspectRatio" attribute, then this
   * method will flush that notification so that the image can paint correctly.
   * (First, though, it sets the mIgnoreInvalidation flag so that we won't
   * notify the image's observers and trigger unwanted repaint-requests.)
  void FlushImageTransformInvalidation();

   * Returns a bool indicating whether the document has any SMIL animations.
   * @return true if the document has any SMIL animations. Else, false.
  bool      IsAnimated();

   * Indicates whether we should currently ignore rendering invalidations sent
   * from the wrapped SVG doc.
   * @return true if we should ignore invalidations sent from this SVG doc.
  bool ShouldIgnoreInvalidation() { return mIgnoreInvalidation; }

   * Methods to control animation.
  void StartAnimation();
  void StopAnimation();
  void ResetAnimation();
  float GetCurrentTime();
  void SetCurrentTime(float aTime);
  void TickRefreshDriver();

   * Force a layout flush of the underlying SVG document.
  void FlushLayout();


  nsresult SetupViewer(nsIRequest* aRequest,
                       nsIContentViewer** aViewer,
                       nsILoadGroup** aLoadGroup);
  void     DestroyViewer();
  void     RegisterForXPCOMShutdown();
  void     UnregisterForXPCOMShutdown();

  nsCOMPtr<nsIContentViewer>  mViewer;
  nsCOMPtr<nsILoadGroup>      mLoadGroup;
  nsCOMPtr<nsIStreamListener> mListener;
  bool                        mIgnoreInvalidation;
  bool                        mRegisteredForXPCOMShutdown;

} // namespace image
} // namespace mozilla

#endif // mozilla_image_SVGDocumentWrapper_h