Bug 927892 - Add the CanvasRenderingContext2D.filter property, preffed off by default behind canvas.filters.enabled. r=roc, r=smaug

--HG--
extra : rebase_source : d80516906bea090c4db0d5419342f470cbe8f1b4
This commit is contained in:
Markus Stange 2014-09-23 17:44:53 -04:00
parent a6b7ec3dc1
commit 5b1f56ab9a
4 changed files with 22 additions and 0 deletions

View File

@ -1610,6 +1610,16 @@ CanvasRenderingContext2D::SetShadowColor(const nsAString& shadowColor)
CurrentState().shadowColor = color;
}
//
// filters
//
void
CanvasRenderingContext2D::SetFilter(const nsAString& filter, ErrorResult& error)
{
CurrentState().filterString = filter;
}
//
// rects
//

View File

@ -231,7 +231,13 @@ public:
StyleColorToString(CurrentState().shadowColor, shadowColor);
}
void GetFilter(nsAString& filter)
{
filter = CurrentState().filterString;
}
void SetShadowColor(const nsAString& shadowColor);
void SetFilter(const nsAString& filter, mozilla::ErrorResult& error);
void ClearRect(double x, double y, double w, double h);
void FillRect(double x, double y, double w, double h);
void StrokeRect(double x, double y, double w, double h);
@ -919,6 +925,7 @@ protected:
fillRule(other.fillRule),
lineCap(other.lineCap),
lineJoin(other.lineJoin),
filterString(other.filterString),
imageSmoothingEnabled(other.imageSmoothingEnabled)
{ }
@ -977,6 +984,7 @@ protected:
mozilla::gfx::CapStyle lineCap;
mozilla::gfx::JoinStyle lineJoin;
nsString filterString;
bool imageSmoothingEnabled;
};

View File

@ -73,6 +73,9 @@ interface CanvasRenderingContext2D {
attribute double shadowBlur; // (default 0)
attribute DOMString shadowColor; // (default transparent black)
[Pref="canvas.filters.enabled", SetterThrows]
attribute DOMString filter; // (default empty string = no filter)
// rects
[LenientFloat]
void clearRect(double x, double y, double w, double h);

View File

@ -621,6 +621,7 @@ pref("ui.scrollToClick", 0);
pref("canvas.focusring.enabled", true);
pref("canvas.customfocusring.enabled", false);
pref("canvas.hitregions.enabled", false);
pref("canvas.filters.enabled", false);
// Add support for canvas path objects
pref("canvas.path.enabled", true);