Bug 1647101 - Move SVGTextFrame SVGViewFrame SVGFEContainerFrame SVGFEImageFrame SVGFELeafFrame SVGFEUnstyledLeafFrame into the mozilla namespace r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D80383
This commit is contained in:
longsonr 2020-06-23 22:59:34 +00:00
Родитель 366e3067b4
Коммит 0a29054e26
19 изменённых файлов: 186 добавлений и 122 удалений

Просмотреть файл

@ -10,19 +10,19 @@
#include "SVGFilters.h"
#include "SVGAnimatedPreserveAspectRatio.h"
class SVGFEImageFrame;
nsresult NS_NewSVGFEImageElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class SVGFEImageFrame;
namespace dom {
typedef SVGFE SVGFEImageElementBase;
class SVGFEImageElement final : public SVGFEImageElementBase,
public nsImageLoadingContent {
friend class ::SVGFEImageFrame;
friend class mozilla::SVGFEImageFrame;
protected:
friend nsresult(::NS_NewSVGFEImageElement(

Просмотреть файл

@ -12,10 +12,10 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedLength.h"
class SVGTextFrame;
namespace mozilla {
class SVGTextFrame;
namespace dom {
struct DOMPointInit;
@ -25,7 +25,7 @@ class SVGRect;
typedef SVGGraphicsElement SVGTextContentElementBase;
class SVGTextContentElement : public SVGTextContentElementBase {
friend class ::SVGTextFrame;
friend class mozilla::SVGTextFrame;
public:
using FragmentOrElement::TextLength;

Просмотреть файл

@ -29,7 +29,7 @@ static const uint16_t TEXTPATH_SIDETYPE_RIGHT = 2;
typedef SVGTextContentElement SVGTextPathElementBase;
class SVGTextPathElement final : public SVGTextPathElementBase {
friend class ::SVGTextFrame;
friend class mozilla::SVGTextFrame;
protected:
friend nsresult(::NS_NewSVGTextPathElement(

Просмотреть файл

@ -11,11 +11,11 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/layout/SVGGeometryFrame.h"
#include "mozilla/layers/AnimationHelper.h"
#include "mozilla/layers/ClipManager.h"
#include "mozilla/layers/ImageClient.h"
@ -1113,7 +1113,7 @@ static bool IsItemProbablyActive(
return true;
}
case DisplayItemType::TYPE_SVG_GEOMETRY: {
auto* svgItem = static_cast<nsDisplaySVGGeometry*>(aItem);
auto* svgItem = static_cast<DisplaySVGGeometry*>(aItem);
return svgItem->ShouldBeActive(aBuilder, aResources, aSc, aManager,
aDisplayListBuilder);
}

Просмотреть файл

@ -33,6 +33,7 @@
#include "mozilla/StaticPrefs_image.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/Unused.h"
#include "mozilla/ViewportFrame.h"
#include "mozilla/ViewportUtils.h"
@ -108,7 +109,6 @@
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "SVGImageContext.h"
#include "SVGTextFrame.h"
#include "nsStyleStructInlines.h"
#include "nsStyleTransformMatrix.h"
#include "nsIFrameInlines.h"
@ -860,21 +860,22 @@ static nsRect GetDisplayPortFromMarginsData(
posAlignment = ScreenSize(1, 1);
sizeAlignment = ScreenSize(1, 1);
} else if (useWebRender) {
// With WebRender we benefit from updating the displaylist and scene less often.
// For this we need to move the displayport less often which we achieve by using
// larger alignments for the displayport's position.
// With WebRender we benefit from updating the displaylist and scene less
// often. For this we need to move the displayport less often which we
// achieve by using larger alignments for the displayport's position.
float w = screenRect.width;
float h = screenRect.height;
// Scale the alignment so that we never move by more than a quarter of the total
// unaligned displayport size. At most (1.0) we move by a screenful of content.
// Scale the alignment so that we never move by more than a quarter of the
// total unaligned displayport size. At most (1.0) we move by a screenful of
// content.
float sx = fmin(1.0, (aMarginsData->mMargins.LeftRight() + w) / w * 0.25);
float sy = fmin(1.0, (aMarginsData->mMargins.TopBottom() + h) / h * 0.25);
posAlignment.width = fmax(128.0, 512.0 * round(sx * w / 512.0));
posAlignment.height = fmax(128.0, 512.0 * round(sy * h / 512.0));
// tscrollx is very sensitive to the size of the displayport. We could just accept
// the regression and change it to something larger if need be, however smaller
// displayports also means less CPU work for most stages in webrender so we generally
// want to avoid very large displayports.
// tscrollx is very sensitive to the size of the displayport. We could just
// accept the regression and change it to something larger if need be,
// however smaller displayports also means less CPU work for most stages in
// webrender so we generally want to avoid very large displayports.
sizeAlignment = ScreenSize(128, 128);
} else if (StaticPrefs::layers_enable_tiles_AtStartup()) {
// Don't align to tiles if they are too large, because we could expand
@ -963,8 +964,10 @@ static nsRect GetDisplayPortFromMarginsData(
screenRect += scrollPosScreen;
float x = posAlignment.width * floor(screenRect.x / posAlignment.width);
float y = posAlignment.height * floor(screenRect.y / posAlignment.height);
float w = sizeAlignment.width * ceil(screenRect.width / sizeAlignment.width + 1);
float h = sizeAlignment.height * ceil(screenRect.height / sizeAlignment.height + 1);
float w =
sizeAlignment.width * ceil(screenRect.width / sizeAlignment.width + 1);
float h =
sizeAlignment.height * ceil(screenRect.height / sizeAlignment.height + 1);
screenRect = ScreenRect(x, y, w, h);
screenRect -= scrollPosScreen;

Просмотреть файл

@ -21,6 +21,7 @@
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_svg.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
#include "mozilla/BinarySearch.h"
@ -40,7 +41,6 @@
#include "nsStyleConsts.h"
#include "nsStyleStruct.h"
#include "nsStyleStructInlines.h"
#include "SVGTextFrame.h"
#include "nsCoord.h"
#include "gfxContext.h"
#include "nsTArray.h"

Просмотреть файл

@ -31,11 +31,11 @@
class nsTextPaintStyle;
struct SelectionDetails;
class nsTextFragment;
class SVGTextFrame;
namespace mozilla {
class SVGContextPaint;
};
class SVGTextFrame;
} // namespace mozilla
class nsTextFrame : public nsFrame {
typedef mozilla::LayoutDeviceRect LayoutDeviceRect;

Просмотреть файл

@ -13,15 +13,18 @@
#include "SVGObserverUtils.h"
#include "SVGFilters.h"
using namespace mozilla;
nsIFrame* NS_NewSVGFEContainerFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
/*
* This frame is used by filter primitive elements that
* have special child elements that provide parameters.
*/
class SVGFEContainerFrame final : public nsContainerFrame {
friend nsIFrame* NS_NewSVGFEContainerFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGFEContainerFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGFEContainerFrame(ComputedStyle* aStyle,
@ -62,12 +65,16 @@ class SVGFEContainerFrame final : public nsContainerFrame {
}
};
nsIFrame* NS_NewSVGFEContainerFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
} // namespace mozilla
nsIFrame* NS_NewSVGFEContainerFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
SVGFEContainerFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGFEContainerFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
#ifdef DEBUG
@ -94,3 +101,5 @@ nsresult SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
} // namespace mozilla

Просмотреть файл

@ -15,12 +15,16 @@
#include "SVGObserverUtils.h"
#include "SVGFilters.h"
using namespace mozilla;
using namespace mozilla::dom;
nsIFrame* NS_NewSVGFEImageFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
class SVGFEImageFrame final : public nsFrame {
friend nsIFrame* NS_NewSVGFEImageFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGFEImageFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGFEImageFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
@ -69,10 +73,16 @@ class SVGFEImageFrame final : public nsFrame {
}
};
nsIFrame* NS_NewSVGFEImageFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) SVGFEImageFrame(aStyle, aPresShell->GetPresContext());
} // namespace mozilla
nsIFrame* NS_NewSVGFEImageFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
mozilla::SVGFEImageFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGFEImageFrame)
/* virtual */
@ -159,3 +169,5 @@ void SVGFEImageFrame::OnVisibilityChange(
nsFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
}
} // namespace mozilla

Просмотреть файл

@ -13,15 +13,17 @@
#include "SVGObserverUtils.h"
#include "SVGFilters.h"
using namespace mozilla;
nsIFrame* NS_NewSVGFELeafFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
/*
* This frame is used by filter primitive elements that don't
* have special child elements that provide parameters.
*/
class SVGFELeafFrame final : public nsFrame {
friend nsIFrame* NS_NewSVGFELeafFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGFELeafFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGFELeafFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
@ -60,10 +62,16 @@ class SVGFELeafFrame final : public nsFrame {
}
};
nsIFrame* NS_NewSVGFELeafFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) SVGFELeafFrame(aStyle, aPresShell->GetPresContext());
} // namespace mozilla
nsIFrame* NS_NewSVGFELeafFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
mozilla::SVGFELeafFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
#ifdef DEBUG
@ -90,3 +98,5 @@ nsresult SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
} // namespace mozilla

Просмотреть файл

@ -12,11 +12,14 @@
#include "SVGObserverUtils.h"
#include "SVGFilters.h"
using namespace mozilla;
nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
class SVGFEUnstyledLeafFrame final : public nsFrame {
friend nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGFEUnstyledLeafFrame(
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
protected:
explicit SVGFEUnstyledLeafFrame(ComputedStyle* aStyle,
@ -54,12 +57,16 @@ class SVGFEUnstyledLeafFrame final : public nsFrame {
}
};
nsIFrame* NS_NewSVGFEUnstyledLeafFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
} // namespace mozilla
nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
SVGFEUnstyledLeafFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGFEUnstyledLeafFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
@ -77,3 +84,5 @@ nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
} // namespace mozilla

Просмотреть файл

@ -53,9 +53,9 @@ NS_QUERYFRAME_HEAD(SVGGeometryFrame)
NS_QUERYFRAME_ENTRY(SVGGeometryFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
void nsDisplaySVGGeometry::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
void DisplaySVGGeometry::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
SVGGeometryFrame* frame = static_cast<SVGGeometryFrame*>(mFrame);
nsPoint pointRelativeToReferenceFrame = aRect.Center();
// ToReferenceFrame() includes frame->GetPosition(), our user space position.
@ -69,8 +69,8 @@ void nsDisplaySVGGeometry::HitTest(nsDisplayListBuilder* aBuilder,
}
}
void nsDisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
void DisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
// ToReferenceFrame includes our mRect offset, but painting takes
@ -89,7 +89,7 @@ void nsDisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, imgParams.result);
}
void nsDisplaySVGGeometry::ComputeInvalidationRegion(
void DisplaySVGGeometry::ComputeInvalidationRegion(
nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) const {
auto geometry =
@ -205,7 +205,7 @@ void SVGGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
return;
}
DisplayOutline(aBuilder, aLists);
aLists.Content()->AppendNewToTop<nsDisplaySVGGeometry>(aBuilder, this);
aLists.Content()->AppendNewToTop<DisplaySVGGeometry>(aBuilder, this);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -18,12 +18,16 @@
#include "nsSVGUtils.h"
namespace mozilla {
class DisplaySVGGeometry;
class PresShell;
class SVGGeometryFrame;
class SVGMarkerObserver;
class nsDisplaySVGGeometry;
namespace gfx {
class DrawTarget;
} // namespace gfx
} // namespace mozilla
class gfxContext;
@ -33,10 +37,6 @@ class nsSVGMarkerFrame;
struct nsRect;
namespace mozilla {
class PresShell;
} // namespace mozilla
nsIFrame* NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
@ -48,7 +48,7 @@ class SVGGeometryFrame : public nsFrame, public nsSVGDisplayableFrame {
friend nsIFrame* ::NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend class nsDisplaySVGGeometry;
friend class DisplaySVGGeometry;
protected:
SVGGeometryFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
@ -124,7 +124,7 @@ class SVGGeometryFrame : public nsFrame, public nsSVGDisplayableFrame {
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder, nsDisplaySVGGeometry* aItem,
nsDisplayListBuilder* aDisplayListBuilder, DisplaySVGGeometry* aItem,
bool aDryRun) {
MOZ_RELEASE_ASSERT(aDryRun, "You shouldn't be calling this directly");
return false;
@ -140,20 +140,20 @@ class SVGGeometryFrame : public nsFrame, public nsSVGDisplayableFrame {
//----------------------------------------------------------------------
// Display list item:
class nsDisplaySVGGeometry final : public nsPaintedDisplayItem {
class DisplaySVGGeometry final : public nsPaintedDisplayItem {
typedef mozilla::image::imgDrawingParams imgDrawingParams;
public:
nsDisplaySVGGeometry(nsDisplayListBuilder* aBuilder, SVGGeometryFrame* aFrame)
DisplaySVGGeometry(nsDisplayListBuilder* aBuilder, SVGGeometryFrame* aFrame)
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplaySVGGeometry);
MOZ_COUNT_CTOR(DisplaySVGGeometry);
MOZ_ASSERT(aFrame, "Must have a frame!");
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplaySVGGeometry() { MOZ_COUNT_DTOR(nsDisplaySVGGeometry); }
virtual ~DisplaySVGGeometry() { MOZ_COUNT_DTOR(DisplaySVGGeometry); }
#endif
NS_DISPLAY_DECL_NAME("nsDisplaySVGGeometry", TYPE_SVG_GEOMETRY)
NS_DISPLAY_DECL_NAME("DisplaySVGGeometry", TYPE_SVG_GEOMETRY)
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,

Просмотреть файл

@ -54,12 +54,13 @@
#include <cmath>
#include <limits>
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::SVGTextContentElement_Binding;
using namespace mozilla::gfx;
using namespace mozilla::image;
namespace mozilla {
// ============================================================================
// Utility functions
@ -364,8 +365,6 @@ static double GetContextScale(const gfxMatrix& aMatrix) {
// ============================================================================
// Utility classes
namespace mozilla {
// ----------------------------------------------------------------------------
// TextRenderedRun
@ -2675,26 +2674,24 @@ void SVGTextDrawPathCallbacks::StrokeGeometry() {
}
}
} // namespace mozilla
// ============================================================================
// SVGTextFrame
// ----------------------------------------------------------------------------
// Display list item
class nsDisplaySVGText final : public nsPaintedDisplayItem {
class DisplaySVGText final : public nsPaintedDisplayItem {
public:
nsDisplaySVGText(nsDisplayListBuilder* aBuilder, SVGTextFrame* aFrame)
DisplaySVGText(nsDisplayListBuilder* aBuilder, SVGTextFrame* aFrame)
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplaySVGText);
MOZ_COUNT_CTOR(DisplaySVGText);
MOZ_ASSERT(aFrame, "Must have a frame!");
}
#ifdef NS_BUILD_REFCNT_LOGGING
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySVGText)
MOZ_COUNTED_DTOR_OVERRIDE(DisplaySVGText)
#endif
NS_DISPLAY_DECL_NAME("nsDisplaySVGText", TYPE_SVG_TEXT)
NS_DISPLAY_DECL_NAME("DisplaySVGText", TYPE_SVG_TEXT)
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,
@ -2712,9 +2709,9 @@ class nsDisplaySVGText final : public nsPaintedDisplayItem {
}
};
void nsDisplaySVGText::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
void DisplaySVGText::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
SVGTextFrame* frame = static_cast<SVGTextFrame*>(mFrame);
nsPoint pointRelativeToReferenceFrame = aRect.Center();
// ToReferenceFrame() includes frame->GetPosition(), our user space position.
@ -2731,7 +2728,7 @@ void nsDisplaySVGText::HitTest(nsDisplayListBuilder* aBuilder,
}
}
void nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
void DisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
@ -2761,13 +2758,18 @@ NS_QUERYFRAME_HEAD(SVGTextFrame)
NS_QUERYFRAME_ENTRY(SVGTextFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
} // namespace mozilla
// ---------------------------------------------------------------------
// Implementation
nsIFrame* NS_NewSVGTextFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) SVGTextFrame(aStyle, aPresShell->GetPresContext());
return new (aPresShell)
mozilla::SVGTextFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGTextFrame)
// ---------------------------------------------------------------------
@ -2803,7 +2805,7 @@ void SVGTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
return;
}
DisplayOutline(aBuilder, aLists);
aLists.Content()->AppendNewToTop<nsDisplaySVGText>(aBuilder, this);
aLists.Content()->AppendNewToTop<DisplaySVGText>(aBuilder, this);
}
nsresult SVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
@ -5372,3 +5374,5 @@ void SVGTextFrame::AppendDirectlyOwnedAnonBoxes(
MOZ_ASSERT(PrincipalChildList().FirstChild(), "Must have our anon box");
aResult.AppendElement(OwnedAnonBox(PrincipalChildList().FirstChild()));
}
} // namespace mozilla

Просмотреть файл

@ -20,12 +20,12 @@
#include "nsTextFrame.h"
class gfxContext;
class nsDisplaySVGText;
class SVGTextFrame;
namespace mozilla {
class CharIterator;
class DisplaySVGText;
class SVGTextFrame;
class TextFrameIterator;
class TextNodeCorrespondenceRecorder;
struct TextRenderedRun;
@ -37,6 +37,12 @@ class nsISVGPoint;
class SVGRect;
class SVGGeometryElement;
} // namespace dom
} // namespace mozilla
nsIFrame* NS_NewSVGTextFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
/**
* Information about the positioning for a single character in an SVG <text>
@ -123,8 +129,6 @@ class GlyphMetricsUpdater : public Runnable {
SVGTextFrame* mFrame;
};
} // namespace mozilla
/**
* Frame class for SVG <text> elements.
*
@ -159,22 +163,22 @@ class GlyphMetricsUpdater : public Runnable {
* PaintText so that we can fill the text geometry with SVG paint servers.
*/
class SVGTextFrame final : public nsSVGDisplayContainerFrame {
friend nsIFrame* NS_NewSVGTextFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGTextFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend class mozilla::CharIterator;
friend class mozilla::GlyphMetricsUpdater;
friend class mozilla::TextFrameIterator;
friend class mozilla::TextNodeCorrespondenceRecorder;
friend struct mozilla::TextRenderedRun;
friend class mozilla::TextRenderedRunIterator;
friend class CharIterator;
friend class DisplaySVGText;
friend class GlyphMetricsUpdater;
friend class MutationObserver;
friend class nsDisplaySVGText;
friend class TextFrameIterator;
friend class TextNodeCorrespondenceRecorder;
friend struct TextRenderedRun;
friend class TextRenderedRunIterator;
typedef gfxTextRun::Range Range;
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::Path Path;
typedef mozilla::gfx::Point Point;
typedef gfx::DrawTarget DrawTarget;
typedef gfx::Path Path;
typedef gfx::Point Point;
protected:
explicit SVGTextFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
@ -233,21 +237,23 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
uint32_t GetNumberOfChars(nsIContent* aContent);
float GetComputedTextLength(nsIContent* aContent);
void SelectSubString(nsIContent* aContent, uint32_t charnum, uint32_t nchars,
mozilla::ErrorResult& aRv);
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
float GetSubStringLength(nsIContent* aContent, uint32_t charnum,
uint32_t nchars, mozilla::ErrorResult& aRv);
uint32_t nchars, ErrorResult& aRv);
int32_t GetCharNumAtPosition(nsIContent* aContent,
const mozilla::dom::DOMPointInit& aPoint);
const dom::DOMPointInit& aPoint);
already_AddRefed<mozilla::dom::nsISVGPoint> GetStartPositionOfChar(
nsIContent* aContent, uint32_t aCharNum, mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::nsISVGPoint> GetEndPositionOfChar(
nsIContent* aContent, uint32_t aCharNum, mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::SVGRect> GetExtentOfChar(
nsIContent* aContent, uint32_t aCharNum, mozilla::ErrorResult& aRv);
already_AddRefed<dom::nsISVGPoint> GetStartPositionOfChar(
nsIContent* aContent, uint32_t aCharNum, ErrorResult& aRv);
already_AddRefed<dom::nsISVGPoint> GetEndPositionOfChar(nsIContent* aContent,
uint32_t aCharNum,
ErrorResult& aRv);
already_AddRefed<dom::SVGRect> GetExtentOfChar(nsIContent* aContent,
uint32_t aCharNum,
ErrorResult& aRv);
float GetRotationOfChar(nsIContent* aContent, uint32_t aCharNum,
mozilla::ErrorResult& aRv);
ErrorResult& aRv);
// SVGTextFrame methods:
@ -255,7 +261,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
* Handles a base or animated attribute value change to a descendant
* text content element.
*/
void HandleAttributeChangeInDescendant(mozilla::dom::Element* aElement,
void HandleAttributeChangeInDescendant(dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute);
@ -299,7 +305,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
* animated SVG-in-OpenType glyphs), in which case aReason will be eResize,
* since layout doesn't need to be recomputed.
*/
void ScheduleReflowSVGNonDisplayText(mozilla::IntrinsicDirty aReason);
void ScheduleReflowSVGNonDisplayText(IntrinsicDirty aReason);
/**
* Updates the mFontSizeScaleFactor value by looking at the range of
@ -396,8 +402,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
*/
MOZ_CAN_RUN_SCRIPT
float GetSubStringLengthSlowFallback(nsIContent* aContent, uint32_t charnum,
uint32_t nchars,
mozilla::ErrorResult& aRv);
uint32_t nchars, ErrorResult& aRv);
/**
* Converts the specified index into mPositions to an addressable
@ -527,7 +532,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
/**
* Computed position information for each DOM character within the <text>.
*/
nsTArray<mozilla::CharPosition> mPositions;
nsTArray<CharPosition> mPositions;
/**
* mFontSizeScaleFactor is used to cause the nsTextFrames to create text
@ -567,4 +572,6 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
float mLengthAdjustScaleFactor;
};
} // namespace mozilla
#endif

Просмотреть файл

@ -12,9 +12,13 @@
#include "nsGkAtoms.h"
#include "nsSVGOuterSVGFrame.h"
using namespace mozilla;
using namespace mozilla::dom;
nsIFrame* NS_NewSVGViewFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
namespace mozilla {
/**
* While views are not directly rendered in SVG they can be linked to
* and thereby override attributes of an <svg> element via a fragment
@ -22,8 +26,8 @@ using namespace mozilla::dom;
* the view receives to the overridden <svg> element (if there is one).
**/
class SVGViewFrame final : public nsFrame {
friend nsIFrame* NS_NewSVGViewFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
friend nsIFrame* ::NS_NewSVGViewFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGViewFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
@ -62,10 +66,16 @@ class SVGViewFrame final : public nsFrame {
}
};
nsIFrame* NS_NewSVGViewFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) SVGViewFrame(aStyle, aPresShell->GetPresContext());
} // namespace mozilla
nsIFrame* NS_NewSVGViewFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle) {
return new (aPresShell)
mozilla::SVGViewFrame(aStyle, aPresShell->GetPresContext());
}
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGViewFrame)
#ifdef DEBUG
@ -104,3 +114,5 @@ nsresult SVGViewFrame::AttributeChanged(int32_t aNameSpaceID,
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
} // namespace mozilla

Просмотреть файл

@ -30,10 +30,8 @@ EXPORTS += [
EXPORTS.mozilla += [
'SVGContextPaint.h',
]
EXPORTS.mozilla.layout += [
'SVGGeometryFrame.h',
'SVGTextFrame.h'
]
UNIFIED_SOURCES += [

Просмотреть файл

@ -408,7 +408,7 @@ bool nsSVGImageFrame::CreateWebRenderCommands(
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder, nsDisplaySVGGeometry* aItem,
nsDisplayListBuilder* aDisplayListBuilder, DisplaySVGGeometry* aItem,
bool aDryRun) {
if (!StyleVisibility()->IsVisible()) {
return true;

Просмотреть файл

@ -56,7 +56,7 @@ class nsSVGImageFrame final : public mozilla::SVGGeometryFrame,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder,
mozilla::nsDisplaySVGGeometry* aItem, bool aDryRun) override;
mozilla::DisplaySVGGeometry* aItem, bool aDryRun) override;
protected:
explicit nsSVGImageFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)