Bug 1559626 - Convert getCharNumAtPosition to take a DOMPointInit r=violet r=bzbarsky

This commit is contained in:
longsonr 2019-06-16 10:12:40 +01:00
Родитель 5ea8f7e6b8
Коммит 35dbd5da16
6 изменённых файлов: 11 добавлений и 10 удалений

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

@ -191,9 +191,10 @@ float SVGTextContentElement::GetRotationOfChar(uint32_t charnum,
return rotation;
}
int32_t SVGTextContentElement::GetCharNumAtPosition(nsISVGPoint& aPoint) {
int32_t SVGTextContentElement::GetCharNumAtPosition(
const DOMPointInit& aPoint) {
SVGTextFrame* textFrame = GetSVGTextFrame();
return textFrame ? textFrame->GetCharNumAtPosition(this, &aPoint) : -1;
return textFrame ? textFrame->GetCharNumAtPosition(this, aPoint) : -1;
}
} // namespace dom

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

@ -19,6 +19,7 @@ class nsISVGPoint;
namespace dom {
struct DOMPointInit;
class SVGIRect;
typedef SVGGraphicsElement SVGTextContentElementBase;
@ -47,7 +48,7 @@ class SVGTextContentElement : public SVGTextContentElementBase {
MOZ_CAN_RUN_SCRIPT
already_AddRefed<SVGIRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
MOZ_CAN_RUN_SCRIPT float GetRotationOfChar(uint32_t charnum, ErrorResult& rv);
MOZ_CAN_RUN_SCRIPT int32_t GetCharNumAtPosition(nsISVGPoint& point);
MOZ_CAN_RUN_SCRIPT int32_t GetCharNumAtPosition(const DOMPointInit& aPoint);
protected:
explicit SVGTextContentElement(

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

@ -34,7 +34,7 @@ interface SVGTextContentElement : SVGGraphicsElement {
SVGRect getExtentOfChar(unsigned long charnum);
[Throws]
float getRotationOfChar(unsigned long charnum);
long getCharNumAtPosition(SVGPoint point);
long getCharNumAtPosition(optional DOMPointInit point);
[Throws]
void selectSubString(unsigned long charnum, unsigned long nchars);
};

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

@ -42,6 +42,7 @@
#include "nsStyleStructInlines.h"
#include "mozilla/Likely.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/SVGRect.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
@ -3925,7 +3926,7 @@ nsresult SVGTextFrame::GetSubStringLengthSlowFallback(nsIContent* aContent,
* text content element.
*/
int32_t SVGTextFrame::GetCharNumAtPosition(nsIContent* aContent,
nsISVGPoint* aPoint) {
const DOMPointInit& aPoint) {
nsIFrame* kid = PrincipalChildList().FirstChild();
if (NS_SUBTREE_DIRTY(kid)) {
// We're never reflowed if we're under a non-SVG element that is
@ -3937,7 +3938,7 @@ int32_t SVGTextFrame::GetCharNumAtPosition(nsIContent* aContent,
nsPresContext* context = PresContext();
gfxPoint p(aPoint->X(), aPoint->Y());
gfxPoint p(aPoint.mX, aPoint.mY);
int32_t result = -1;

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

@ -34,6 +34,7 @@ struct TextRenderedRun;
class TextRenderedRunIterator;
namespace dom {
struct DOMPointInit;
class SVGIRect;
class SVGGeometryElement;
} // namespace dom
@ -239,7 +240,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
nsresult GetSubStringLength(nsIContent* aContent, uint32_t charnum,
uint32_t nchars, float* aResult);
int32_t GetCharNumAtPosition(nsIContent* aContent,
mozilla::nsISVGPoint* point);
const mozilla::dom::DOMPointInit& aPoint);
nsresult GetStartPositionOfChar(nsIContent* aContent, uint32_t aCharNum,
mozilla::nsISVGPoint** aResult);

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

@ -386,9 +386,6 @@
[SVGElement interface: objects.polygon must inherit property "correspondingUseElement" with the proper type]
expected: FAIL
[SVGTextContentElement interface: operation getCharNumAtPosition(DOMPointInit)]
expected: FAIL
[SVGElement interface: objects.text must inherit property "correspondingElement" with the proper type]
expected: FAIL