float SVGTextContentElement::GetRotationOfChar(uint32_t charnum, ErrorResult& rv) { float rotation; if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); if (!textFrame) { rv.Throw(NS_ERROR_FAILURE); return 0.0f; } rv = textFrame->GetRotationOfChar(this, charnum, &rotation); } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); if (!metrics) { rv.Throw(NS_ERROR_FAILURE); return 0.0f; } rv = metrics->GetRotationOfChar(charnum, &rotation); } return rotation; }
float SVGTextContentElement::GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv) { if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); if (!textFrame) return 0.0f; uint32_t charcount = textFrame->GetNumberOfChars(this); if (charcount <= charnum || nchars > charcount - charnum) { rv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); return 0.0f; } if (nchars == 0) return 0.0f; return textFrame->GetSubStringLength(this, charnum, nchars); } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); if (!metrics) return 0.0f; uint32_t charcount = metrics->GetNumberOfChars(); if (charcount <= charnum || nchars > charcount - charnum) { rv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); return 0.0f; } if (nchars == 0) return 0.0f; return metrics->GetSubStringLength(charnum, nchars); } }
already_AddRefed<nsIDOMSVGRect> SVGTextContentElement::GetExtentOfChar(uint32_t charnum, ErrorResult& rv) { nsCOMPtr<nsIDOMSVGRect> rect; if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); if (!textFrame) { rv.Throw(NS_ERROR_FAILURE); return nullptr; } rv = textFrame->GetExtentOfChar(this, charnum, getter_AddRefs(rect)); } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); if (!metrics) { rv.Throw(NS_ERROR_FAILURE); return nullptr; } rv = metrics->GetExtentOfChar(charnum, getter_AddRefs(rect)); } return rect.forget(); }
void SVGTextContentElement::SelectSubString(uint32_t charnum, uint32_t nchars, ErrorResult& rv) { SVGTextFrame* textFrame = GetSVGTextFrame(); if (!textFrame) return; rv = textFrame->SelectSubString(this, charnum, nchars); }
float SVGTextContentElement::GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv) { SVGTextFrame* textFrame = GetSVGTextFrame(); if (!textFrame) return 0.0f; float length = 0.0f; rv = textFrame->GetSubStringLength(this, charnum, nchars, &length); return length; }
int32_t SVGTextContentElement::GetNumberOfChars() { Maybe<int32_t> num = GetNonLayoutDependentNumberOfChars(); if (num) { return *num; } SVGTextFrame* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetNumberOfChars(this) : 0; }
float SVGTextContentElement::GetComputedTextLength() { if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetComputedTextLength(this) : 0.0f; } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); return metrics ? metrics->GetComputedTextLength() : 0.0f; } }
int32_t SVGTextContentElement::GetNumberOfChars() { if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetNumberOfChars(this) : 0; } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); return metrics ? metrics->GetNumberOfChars() : 0; } }
int32_t SVGTextContentElement::GetCharNumAtPosition(nsISVGPoint& aPoint) { if (FrameIsSVGText()) { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetCharNumAtPosition(this, &aPoint) : -1; } else { nsSVGTextContainerFrame* metrics = GetTextContainerFrame(); return metrics ? metrics->GetCharNumAtPosition(&aPoint) : -1; } }
already_AddRefed<nsISVGPoint> SVGTextContentElement::GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv) { SVGTextFrame* textFrame = GetSVGTextFrame(); if (!textFrame) { rv.Throw(NS_ERROR_FAILURE); return nullptr; } nsCOMPtr<nsISVGPoint> point; rv = textFrame->GetEndPositionOfChar(this, charnum, getter_AddRefs(point)); return point.forget(); }
float SVGTextContentElement::GetRotationOfChar(uint32_t charnum, ErrorResult& rv) { SVGTextFrame* textFrame = GetSVGTextFrame(); if (!textFrame) { rv.Throw(NS_ERROR_FAILURE); return 0.0f; } float rotation; rv = textFrame->GetRotationOfChar(this, charnum, &rotation); return rotation; }
already_AddRefed<SVGIRect> SVGTextContentElement::GetExtentOfChar(uint32_t charnum, ErrorResult& rv) { SVGTextFrame* textFrame = GetSVGTextFrame(); if (!textFrame) { rv.Throw(NS_ERROR_FAILURE); return nullptr; } RefPtr<SVGIRect> rect; rv = textFrame->GetExtentOfChar(this, charnum, getter_AddRefs(rect)); return rect.forget(); }
int32_t SVGTextContentElement::GetCharNumAtPosition(nsISVGPoint& aPoint) { SVGTextFrame* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetCharNumAtPosition(this, &aPoint) : -1; }
float SVGTextContentElement::GetComputedTextLength() { SVGTextFrame* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetComputedTextLength(this) : 0.0f; }
int32_t SVGTextContentElement::GetNumberOfChars() { nsSVGTextFrame2* textFrame = GetSVGTextFrame(); return textFrame ? textFrame->GetNumberOfChars(this) : 0; }