mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1167423 - patch 4 - Handle return values of FallibleTArray functions in CanvasRenderingContext2D, r=smaug
This commit is contained in:
parent
4cb28b400a
commit
c89a834b25
@ -2642,7 +2642,8 @@ CanvasRenderingContext2D::Stroke(const CanvasPath& path)
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawFocusIfNeeded(mozilla::dom::Element& aElement)
|
||||
void CanvasRenderingContext2D::DrawFocusIfNeeded(mozilla::dom::Element& aElement,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
EnsureUserSpacePath();
|
||||
|
||||
@ -2674,8 +2675,12 @@ void CanvasRenderingContext2D::DrawFocusIfNeeded(mozilla::dom::Element& aElement
|
||||
|
||||
// set dashing for foreground
|
||||
FallibleTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
|
||||
dash.AppendElement(1);
|
||||
dash.AppendElement(1);
|
||||
for (uint32_t i = 0; i < 2; ++i) {
|
||||
if (!dash.AppendElement(1)) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set the foreground focus color
|
||||
CurrentState().SetColorStyle(Style::STROKE, NS_RGBA(0,0,0, 255));
|
||||
@ -3947,7 +3952,8 @@ CanvasRenderingContext2D::SetMozDashOffset(double mozDashOffset)
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::SetLineDash(const Sequence<double>& aSegments)
|
||||
CanvasRenderingContext2D::SetLineDash(const Sequence<double>& aSegments,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
FallibleTArray<mozilla::gfx::Float> dash;
|
||||
|
||||
@ -3957,11 +3963,18 @@ CanvasRenderingContext2D::SetLineDash(const Sequence<double>& aSegments)
|
||||
// taken care of by WebIDL
|
||||
return;
|
||||
}
|
||||
dash.AppendElement(aSegments[x]);
|
||||
|
||||
if (!dash.AppendElement(aSegments[x])) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aSegments.Length() % 2) { // If the number of elements is odd, concatenate again
|
||||
for (uint32_t x = 0; x < aSegments.Length(); x++) {
|
||||
dash.AppendElement(aSegments[x]);
|
||||
if (!dash.AppendElement(aSegments[x])) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
void Fill(const CanvasPath& path, const CanvasWindingRule& winding);
|
||||
void Stroke();
|
||||
void Stroke(const CanvasPath& path);
|
||||
void DrawFocusIfNeeded(mozilla::dom::Element& element);
|
||||
void DrawFocusIfNeeded(mozilla::dom::Element& element, ErrorResult& aRv);
|
||||
bool DrawCustomFocusRing(mozilla::dom::Element& element);
|
||||
void Clip(const CanvasWindingRule& winding);
|
||||
void Clip(const CanvasPath& path, const CanvasWindingRule& winding);
|
||||
@ -363,7 +363,8 @@ public:
|
||||
void SetMozDash(JSContext* cx, const JS::Value& mozDash,
|
||||
mozilla::ErrorResult& error);
|
||||
|
||||
void SetLineDash(const Sequence<double>& mSegments);
|
||||
void SetLineDash(const Sequence<double>& mSegments,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void GetLineDash(nsTArray<double>& mSegments) const;
|
||||
|
||||
void SetLineDashOffset(double mOffset);
|
||||
|
@ -92,7 +92,7 @@ interface CanvasRenderingContext2D {
|
||||
void fill(Path2D path, optional CanvasWindingRule winding = "nonzero");
|
||||
void stroke();
|
||||
void stroke(Path2D path);
|
||||
[Pref="canvas.focusring.enabled"] void drawFocusIfNeeded(Element element);
|
||||
[Pref="canvas.focusring.enabled", Throws] void drawFocusIfNeeded(Element element);
|
||||
// NOT IMPLEMENTED void drawSystemFocusRing(Path path, HTMLElement element);
|
||||
[Pref="canvas.customfocusring.enabled"] boolean drawCustomFocusRing(Element element);
|
||||
// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, HTMLElement element);
|
||||
@ -246,7 +246,7 @@ interface CanvasDrawingStyles {
|
||||
attribute double miterLimit; // (default 10)
|
||||
|
||||
// dashed lines
|
||||
[LenientFloat] void setLineDash(sequence<double> segments); // default empty
|
||||
[LenientFloat, Throws] void setLineDash(sequence<double> segments); // default empty
|
||||
sequence<double> getLineDash();
|
||||
[LenientFloat] attribute double lineDashOffset;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user