mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Backed out 7 changesets (bug 966591) for mochitest leaks on a CLOSED TREE.
Backed out changeset b44289e756fc (bug 966591) Backed out changeset c428b424ef95 (bug 966591) Backed out changeset 9ac56da10646 (bug 966591) Backed out changeset 81ba9bddd84e (bug 966591) Backed out changeset 0c66968c2edd (bug 966591) Backed out changeset 261a1ca9045c (bug 966591) Backed out changeset 895728963f16 (bug 966591)
This commit is contained in:
parent
b27e259f1e
commit
ef5131cd0b
@ -919,27 +919,7 @@ void
|
||||
Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame && mContent) {
|
||||
nsRect* hitRegionRect = static_cast<nsRect*>(mContent->GetProperty(nsGkAtoms::hitregion));
|
||||
|
||||
if (hitRegionRect) {
|
||||
// This is for canvas fallback content
|
||||
// Find a canvas frame the found hit region is relative to.
|
||||
nsIFrame* canvasFrame = frame->GetParent();
|
||||
while (canvasFrame && (canvasFrame->GetType() != nsGkAtoms::HTMLCanvasFrame))
|
||||
canvasFrame = canvasFrame->GetParent();
|
||||
|
||||
// make the canvas the bounding frame
|
||||
if (canvasFrame) {
|
||||
*aBoundingFrame = canvasFrame;
|
||||
|
||||
nsPresContext* presContext = mDoc->PresContext();
|
||||
aTotalBounds = *hitRegionRect;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
|
||||
aTotalBounds = nsLayoutUtils::
|
||||
GetAllInFlowRectsUnion(frame, *aBoundingFrame,
|
||||
|
@ -5,4 +5,3 @@
|
||||
[test_listbox.xul]
|
||||
[test_nsApplicationAcc.html]
|
||||
[test_plugin.html]
|
||||
[test_canvas.html]
|
||||
|
@ -1,55 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Accessible boundaries for hit regions</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../layout.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
|
||||
|
||||
function doTest()
|
||||
{
|
||||
var canv = document.getElementById("c");
|
||||
var context = canv.getContext('2d');
|
||||
var element = document.getElementById("showA");
|
||||
context.beginPath();
|
||||
context.rect(10, 10, 150, 100);
|
||||
context.addHitRegion({control: element});
|
||||
var input = getAccessible("showA");
|
||||
var input = getAccessible("showA");
|
||||
var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv);
|
||||
var [accX, accY, accWidth, accHeight] = getBounds(input);
|
||||
is(accX, cnvX + 10, "accX should be 10 and not " + accX);
|
||||
is(accY, cnvY + 10, "accY should be 10 and not " + accY);
|
||||
is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
|
||||
is(accHeight, 100, "accHeight should be 100 and not " + accHeight);
|
||||
|
||||
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<canvas id="c">
|
||||
<input id="showA" type="checkbox"><label for="showA"> Show As </label>
|
||||
</canvas>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -2161,7 +2161,6 @@ GK_ATOM(eventFromInput, "event-from-input")
|
||||
GK_ATOM(grammar, "grammar")
|
||||
GK_ATOM(gridcell, "gridcell")
|
||||
GK_ATOM(heading, "heading")
|
||||
GK_ATOM(hitregion, "hitregion")
|
||||
GK_ATOM(InlineBlockFrame, "InlineBlockFrame")
|
||||
GK_ATOM(inlinevalue, "inline")
|
||||
GK_ATOM(invalid, "invalid")
|
||||
|
@ -2355,78 +2355,6 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
|
||||
return new TextMetrics(width);
|
||||
}
|
||||
|
||||
// Callback function, for freeing hit regions bounds values stored in property table
|
||||
static void
|
||||
ReleaseBBoxPropertyValue(void* aObject, /* unused */
|
||||
nsIAtom* aPropertyName, /* unused */
|
||||
void* aPropertyValue,
|
||||
void* aData /* unused */)
|
||||
{
|
||||
nsRect* valPtr =
|
||||
static_cast<nsRect*>(aPropertyValue);
|
||||
delete valPtr;
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorResult& error)
|
||||
{
|
||||
// remove old hit region first
|
||||
RemoveHitRegion(options.mId);
|
||||
|
||||
// for now, we require a fallback element
|
||||
if (options.mControl == NULL) {
|
||||
error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// check if the control is a descendant of our canvas
|
||||
HTMLCanvasElement* canvas = GetCanvas();
|
||||
bool isDescendant = true;
|
||||
if (!canvas || !nsContentUtils::ContentIsDescendantOf(options.mControl, canvas)) {
|
||||
isDescendant = false;
|
||||
}
|
||||
|
||||
// check if the path is valid
|
||||
EnsureUserSpacePath(CanvasWindingRule::Nonzero);
|
||||
if(!mPath) {
|
||||
error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the bounds of the current path. They are relative to the canvas
|
||||
mgfx::Rect bounds(mPath->GetBounds(mTarget->GetTransform()));
|
||||
if ((bounds.width == 0) || (bounds.height == 0) || !bounds.IsFinite()) {
|
||||
// The specified region has no pixels.
|
||||
error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDescendant) {
|
||||
nsRect* nsBounds = new nsRect();
|
||||
gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
*nsBounds = nsLayoutUtils::RoundGfxRectToAppRect(rect, AppUnitsPerCSSPixel());
|
||||
options.mControl->SetProperty(nsGkAtoms::hitregion, nsBounds,
|
||||
ReleaseBBoxPropertyValue, true);
|
||||
}
|
||||
|
||||
// finally, add the region to the list if it has an ID
|
||||
if (options.mId.Length() != 0) {
|
||||
mHitRegionsOptions.PutEntry(options.mId)->mElement = options.mControl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::RemoveHitRegion(const nsAString& id)
|
||||
{
|
||||
RegionInfo* info = mHitRegionsOptions.GetEntry(id);
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
|
||||
info->mElement->UnsetProperty(nsGkAtoms::hitregion);
|
||||
mHitRegionsOptions.RemoveEntry(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for nsBidiPresUtils::ProcessText
|
||||
*/
|
||||
|
@ -186,9 +186,6 @@ public:
|
||||
TextMetrics*
|
||||
MeasureText(const nsAString& rawText, mozilla::ErrorResult& error);
|
||||
|
||||
void AddHitRegion(const HitRegionOptions& options, mozilla::ErrorResult& error);
|
||||
void RemoveHitRegion(const nsAString& id);
|
||||
|
||||
void DrawImage(const HTMLImageOrCanvasOrVideoElement& image,
|
||||
double dx, double dy, mozilla::ErrorResult& error)
|
||||
{
|
||||
@ -684,26 +681,6 @@ protected:
|
||||
uint32_t mInvalidateCount;
|
||||
static const uint32_t kCanvasMaxInvalidateCount = 100;
|
||||
|
||||
/**
|
||||
* State information for hit regions
|
||||
*/
|
||||
|
||||
struct RegionInfo : public nsStringHashKey
|
||||
{
|
||||
RegionInfo(const nsAString& aKey) :
|
||||
nsStringHashKey(&aKey)
|
||||
{
|
||||
}
|
||||
RegionInfo(const nsAString *aKey) :
|
||||
nsStringHashKey(aKey)
|
||||
{
|
||||
}
|
||||
|
||||
nsRefPtr<Element> mElement;
|
||||
};
|
||||
|
||||
nsTHashtable<RegionInfo> mHitRegionsOptions;
|
||||
|
||||
/**
|
||||
* Returns true if a shadow should be drawn along with a
|
||||
* drawing operation.
|
||||
|
@ -8,7 +8,6 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Cr = SpecialPowers.Cr;
|
||||
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
|
||||
|
||||
function IsD2DEnabled() {
|
||||
var enabled = false;
|
||||
@ -21578,46 +21577,6 @@ function test_linedash() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: hit regions</p>
|
||||
<canvas id="c688" width="150" height="50">
|
||||
<a id="c688_a"></a>
|
||||
</canvas>
|
||||
<a id="c688_b"></a>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_hitregions() {
|
||||
var c = document.getElementById("c688");
|
||||
var d = document.getElementById("c688_a");
|
||||
var e = document.getElementById("c688_b");
|
||||
|
||||
var ctx = c.getContext("2d");
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
ctx.rect(10,10,100,100);
|
||||
ctx.addHitRegion({control: d});
|
||||
ctx.addHitRegion({control: e});
|
||||
ctx.addHitRegion({id: "a", control: d});
|
||||
ctx.addHitRegion({id: "a", control: d});
|
||||
|
||||
ctx.removeHitRegion("a");
|
||||
ctx.removeHitRegion("a");
|
||||
ctx.removeHitRegion("b");
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
|
||||
|
||||
var _thrown = undefined; try {
|
||||
ctx.beginPath();
|
||||
ctx.addHitRegion({control: d});
|
||||
} catch (ex) { _thrown = ex };
|
||||
|
||||
ok(_thrown && _thrown.name == "NotSupportedError", "should throw NotSupportedError");
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function asyncTestsDone() {
|
||||
@ -24914,12 +24873,6 @@ function runTests() {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_linedash");
|
||||
}
|
||||
try {
|
||||
test_hitregions();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_linedash");
|
||||
}
|
||||
try {
|
||||
// run this test last since it replaces the getContext method
|
||||
test_type_replace();
|
||||
@ -24940,7 +24893,6 @@ function runTests() {
|
||||
}
|
||||
|
||||
setTimeout(asyncTestsDone, 500);
|
||||
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
|
||||
}
|
||||
|
||||
addLoadEvent(runTests);
|
||||
|
@ -11,6 +11,8 @@
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
interface HitRegionOptions;
|
||||
|
||||
enum CanvasWindingRule { "nonzero", "evenodd" };
|
||||
|
||||
dictionary ContextAttributes2D {
|
||||
@ -18,11 +20,6 @@ dictionary ContextAttributes2D {
|
||||
boolean willReadFrequently = false;
|
||||
};
|
||||
|
||||
dictionary HitRegionOptions {
|
||||
DOMString id = "";
|
||||
Element? control = null;
|
||||
};
|
||||
|
||||
interface CanvasRenderingContext2D {
|
||||
|
||||
// back-reference to the canvas. Might be null if we're not
|
||||
@ -116,8 +113,7 @@ interface CanvasRenderingContext2D {
|
||||
void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
|
||||
|
||||
// hit regions
|
||||
[Pref="canvas.hitregions.enabled", Throws] void addHitRegion(optional HitRegionOptions options);
|
||||
[Pref="canvas.hitregions.enabled"] void removeHitRegion(DOMString id);
|
||||
// NOT IMPLEMENTED void addHitRegion(HitRegionOptions options);
|
||||
|
||||
// pixel manipulation
|
||||
[NewObject, Throws]
|
||||
|
@ -432,7 +432,6 @@ pref("accessibility.tabfocus_applies_to_xul", true);
|
||||
// provide ability to turn on support for canvas focus rings
|
||||
pref("canvas.focusring.enabled", false);
|
||||
pref("canvas.customfocusring.enabled", false);
|
||||
pref("canvas.hitregions.enabled", false);
|
||||
|
||||
// We want the ability to forcibly disable platform a11y, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
|
Loading…
Reference in New Issue
Block a user