Bug 1182824 - Part 2: Make ContextState::dash a nsTArray. r=mattwoodrow

This commit is contained in:
Birunthan Mohanathas 2015-07-12 23:19:12 -07:00
parent f226209a68
commit d6bac5d93d
3 changed files with 7 additions and 17 deletions

View File

@ -2715,7 +2715,7 @@ void CanvasRenderingContext2D::DrawFocusIfNeeded(mozilla::dom::Element& aElement
Stroke();
// set dashing for foreground
FallibleTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
nsTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
for (uint32_t i = 0; i < 2; ++i) {
if (!dash.AppendElement(1, fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
@ -3970,7 +3970,7 @@ CanvasRenderingContext2D::SetMozDash(JSContext* cx,
const JS::Value& mozDash,
ErrorResult& error)
{
FallibleTArray<Float> dash;
nsTArray<Float> dash;
error = JSValToDashArray(cx, mozDash, dash);
if (!error.Failed()) {
ContextState& state = CurrentState();
@ -4002,7 +4002,7 @@ void
CanvasRenderingContext2D::SetLineDash(const Sequence<double>& aSegments,
ErrorResult& aRv)
{
FallibleTArray<mozilla::gfx::Float> dash;
nsTArray<mozilla::gfx::Float> dash;
for (uint32_t x = 0; x < aSegments.Length(); x++) {
if (aSegments[x] < 0.0) {
@ -4030,7 +4030,7 @@ CanvasRenderingContext2D::SetLineDash(const Sequence<double>& aSegments,
void
CanvasRenderingContext2D::GetLineDash(nsTArray<double>& aSegments) const {
const FallibleTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
const nsTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
aSegments.Clear();
for (uint32_t x = 0; x < dash.Length(); x++) {

View File

@ -991,7 +991,7 @@ protected:
mozilla::gfx::Float miterLimit;
mozilla::gfx::Float globalAlpha;
mozilla::gfx::Float shadowBlur;
FallibleTArray<mozilla::gfx::Float> dash;
nsTArray<mozilla::gfx::Float> dash;
mozilla::gfx::Float dashOffset;
mozilla::gfx::CompositionOp op;

View File

@ -84,20 +84,10 @@ inline bool FloatValidate (double f1, double f2, double f3, double f4, double f5
#undef VALIDATE
template<typename T>
nsresult
JSValToDashArray(JSContext* cx, const JS::Value& val,
FallibleTArray<T>& dashArray);
template<typename T>
JS::Value
DashArrayToJSVal(FallibleTArray<T>& dashArray,
JSContext* cx, mozilla::ErrorResult& rv);
template<typename T>
nsresult
JSValToDashArray(JSContext* cx, const JS::Value& patternArray,
FallibleTArray<T>& dashes)
nsTArray<T>& dashes)
{
// The cap is pretty arbitrary. 16k should be enough for
// anybody...
@ -149,7 +139,7 @@ JSValToDashArray(JSContext* cx, const JS::Value& patternArray,
template<typename T>
void
DashArrayToJSVal(FallibleTArray<T>& dashes,
DashArrayToJSVal(nsTArray<T>& dashes,
JSContext* cx,
JS::MutableHandle<JS::Value> retval,
mozilla::ErrorResult& rv)