mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 856472: Convert TextMetrics to WebIDL r=bz
* * * Bug 857439 Part 4: Fix MediaStreamList wrapping r=bz
This commit is contained in:
parent
6d27540aee
commit
7235cdcd53
@ -95,6 +95,7 @@
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "mozilla/dom/HTMLVideoElement.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
||||
#include "mozilla/dom/TextMetrics.h"
|
||||
|
||||
#ifdef USE_SKIA_GPU
|
||||
#include "GLContext.h"
|
||||
@ -2206,7 +2207,7 @@ CanvasRenderingContext2D::StrokeText(const nsAString& text, double x,
|
||||
error = DrawOrMeasureText(text, x, y, maxWidth, TEXT_DRAW_OPERATION_STROKE, nullptr);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMTextMetrics>
|
||||
TextMetrics*
|
||||
CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
|
||||
ErrorResult& error)
|
||||
{
|
||||
@ -2217,9 +2218,7 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<nsIDOMTextMetrics> textMetrics = new TextMetrics(width);
|
||||
|
||||
return textMetrics.forget();
|
||||
return new TextMetrics(width);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,8 @@ class SourceSurface;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
class TextMetrics;
|
||||
|
||||
extern const mozilla::gfx::Float SIGMA_MAX;
|
||||
|
||||
template<typename T> class Optional;
|
||||
@ -252,7 +254,7 @@ public:
|
||||
void StrokeText(const nsAString& text, double x, double y,
|
||||
const mozilla::dom::Optional<double>& maxWidth,
|
||||
mozilla::ErrorResult& error);
|
||||
already_AddRefed<nsIDOMTextMetrics>
|
||||
TextMetrics*
|
||||
MeasureText(const nsAString& rawText, mozilla::ErrorResult& error);
|
||||
|
||||
void DrawImage(const HTMLImageOrCanvasOrVideoElement& image,
|
||||
|
@ -6,48 +6,40 @@
|
||||
#ifndef mozilla_dom_TextMetrics_h
|
||||
#define mozilla_dom_TextMetrics_h
|
||||
|
||||
#include "nsIDOMTextMetrics.h"
|
||||
|
||||
#define NS_TEXTMETRICSAZURE_PRIVATE_IID \
|
||||
{0x9793f9e7, 0x9dc1, 0x4e9c, {0x81, 0xc8, 0xfc, 0xa7, 0x14, 0xf4, 0x30, 0x79}}
|
||||
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
||||
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TextMetrics : public nsIDOMTextMetrics
|
||||
class TextMetrics MOZ_FINAL : public NonRefcountedDOMObject
|
||||
{
|
||||
public:
|
||||
TextMetrics(float w) : width(w) { }
|
||||
|
||||
virtual ~TextMetrics() { }
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEXTMETRICSAZURE_PRIVATE_IID)
|
||||
|
||||
NS_IMETHOD GetWidth(float* w)
|
||||
TextMetrics(float w) : width(w)
|
||||
{
|
||||
*w = width;
|
||||
return NS_OK;
|
||||
MOZ_COUNT_CTOR(TextMetrics);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
~TextMetrics()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TextMetrics);
|
||||
}
|
||||
|
||||
float Width() const
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTookOwnership)
|
||||
{
|
||||
return TextMetricsBinding::Wrap(aCx, aScope, this, aTookOwnership);
|
||||
}
|
||||
|
||||
private:
|
||||
float width;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(TextMetrics)
|
||||
NS_IMPL_RELEASE(TextMetrics)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(TextMetrics)
|
||||
NS_INTERFACE_MAP_ENTRY(mozilla::dom::TextMetrics)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTextMetrics)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TextMetrics)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
DOMCI_DATA(TextMetrics, mozilla::dom::TextMetrics)
|
||||
|
||||
#endif // mozilla_dom_TextMetrics_h
|
||||
|
@ -733,8 +733,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CanvasPattern, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(TextMetrics, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozCanvasPrintState, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -2032,10 +2030,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCanvasPattern)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(TextMetrics, nsIDOMTextMetrics)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTextMetrics)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozCanvasPrintState, nsIDOMMozCanvasPrintState)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCanvasPrintState)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -121,7 +121,6 @@ DOMCI_CLASS(SVGZoomEvent)
|
||||
// Canvas
|
||||
DOMCI_CLASS(CanvasGradient)
|
||||
DOMCI_CLASS(CanvasPattern)
|
||||
DOMCI_CLASS(TextMetrics)
|
||||
DOMCI_CLASS(MozCanvasPrintState)
|
||||
|
||||
// WindowUtils
|
||||
|
@ -148,7 +148,7 @@ DOMInterfaces = {
|
||||
'createImageData', 'getImageData', 'strokeStyle',
|
||||
'fillStyle', 'mozDash'
|
||||
],
|
||||
'resultNotAddRefed': [ 'canvas' ],
|
||||
'resultNotAddRefed': [ 'canvas', 'measureText' ],
|
||||
'binaryNames': {
|
||||
'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
|
||||
'mozFillRule': 'fillRule'
|
||||
@ -992,7 +992,12 @@ DOMInterfaces = {
|
||||
'implicitJSContext': [ 'encode' ],
|
||||
}],
|
||||
|
||||
'TimeRanges': {
|
||||
'TextMetrics': {
|
||||
'wrapperCache': False,
|
||||
'nativeOwnership': 'owned',
|
||||
},
|
||||
|
||||
'TimeRanges': {
|
||||
'wrapperCache': False
|
||||
},
|
||||
|
||||
@ -1520,7 +1525,6 @@ addExternalIface('SVGAnimatedNumber')
|
||||
addExternalIface('SVGAnimatedString')
|
||||
addExternalIface('SVGLength')
|
||||
addExternalIface('SVGNumber')
|
||||
addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h')
|
||||
addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h')
|
||||
addExternalIface('TouchList', headerFile='nsIDOMTouchEvent.h')
|
||||
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
|
||||
|
@ -16,12 +16,6 @@ interface nsIDOMCanvasPattern : nsISupports
|
||||
{
|
||||
};
|
||||
|
||||
[scriptable, uuid(2d01715c-ec7d-424a-ab85-e0fd70c8665c)]
|
||||
interface nsIDOMTextMetrics : nsISupports
|
||||
{
|
||||
readonly attribute float width;
|
||||
};
|
||||
|
||||
/**
|
||||
* This interface remains only for the constants, for a context, use the
|
||||
* WebIDL/Paris bindings instead (CanvasRenderingContext2D.webidl).
|
||||
|
@ -14,7 +14,6 @@
|
||||
interface CanvasGradient;
|
||||
interface CanvasPattern;
|
||||
interface HitRegionOptions;
|
||||
interface TextMetrics;
|
||||
interface Window;
|
||||
|
||||
enum CanvasWindingRule { "nonzero", "evenodd" };
|
||||
@ -101,7 +100,7 @@ interface CanvasRenderingContext2D {
|
||||
void fillText(DOMString text, double x, double y, optional double maxWidth);
|
||||
[Throws, LenientFloat]
|
||||
void strokeText(DOMString text, double x, double y, optional double maxWidth);
|
||||
[Throws]
|
||||
[Creator, Throws]
|
||||
TextMetrics measureText(DOMString text);
|
||||
|
||||
// drawing images
|
||||
@ -264,3 +263,29 @@ interface CanvasPathMethods {
|
||||
void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false);
|
||||
// NOT IMPLEMENTED [LenientFloat] void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise);
|
||||
};
|
||||
|
||||
interface TextMetrics {
|
||||
|
||||
// x-direction
|
||||
readonly attribute double width; // advance width
|
||||
|
||||
/*
|
||||
* NOT IMPLEMENTED YET
|
||||
|
||||
readonly attribute double actualBoundingBoxLeft;
|
||||
readonly attribute double actualBoundingBoxRight;
|
||||
|
||||
// y-direction
|
||||
readonly attribute double fontBoundingBoxAscent;
|
||||
readonly attribute double fontBoundingBoxDescent;
|
||||
readonly attribute double actualBoundingBoxAscent;
|
||||
readonly attribute double actualBoundingBoxDescent;
|
||||
readonly attribute double emHeightAscent;
|
||||
readonly attribute double emHeightDescent;
|
||||
readonly attribute double hangingBaseline;
|
||||
readonly attribute double alphabeticBaseline;
|
||||
readonly attribute double ideographicBaseline;
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,6 @@ members = [
|
||||
# dom/interfaces/canvas
|
||||
#
|
||||
# canvas friends
|
||||
'nsIDOMTextMetrics.*',
|
||||
'nsIDOMCanvasGradient.*',
|
||||
'nsIDOMCanvasPattern.*',
|
||||
|
||||
@ -147,7 +146,6 @@ members = [
|
||||
#
|
||||
irregularFilenames = {
|
||||
# stowaways
|
||||
'nsIDOMTextMetrics': 'nsIDOMCanvasRenderingContext2D',
|
||||
'nsIDOMCanvasGradient': 'nsIDOMCanvasRenderingContext2D',
|
||||
'nsIDOMCanvasPattern': 'nsIDOMCanvasRenderingContext2D',
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user