mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 8517afe50156 (bug 540456) for reftest failures.
CLOSED TREE
This commit is contained in:
parent
1ccc84a275
commit
7f25797a79
@ -38,7 +38,6 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
||||
@ -1729,90 +1728,6 @@ CanvasRenderingContext2D::Stroke()
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawSystemFocusRing(mozilla::dom::Element& aElement)
|
||||
{
|
||||
EnsureUserSpacePath();
|
||||
|
||||
if (!mPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(DrawCustomFocusRing(aElement)) {
|
||||
Save();
|
||||
|
||||
// set state to conforming focus state
|
||||
ContextState& state = CurrentState();
|
||||
state.globalAlpha = 1.0;
|
||||
state.shadowBlur = 0;
|
||||
state.shadowOffset.x = 0;
|
||||
state.shadowOffset.y = 0;
|
||||
state.op = mozilla::gfx::OP_OVER;
|
||||
|
||||
state.lineCap = CAP_BUTT;
|
||||
state.lineJoin = mozilla::gfx::JOIN_MITER_OR_BEVEL;
|
||||
state.lineWidth = 1;
|
||||
CurrentState().dash.Clear();
|
||||
|
||||
// color and style of the rings is the same as for image maps
|
||||
// set the background focus color
|
||||
CurrentState().SetColorStyle(STYLE_STROKE, NS_RGBA(255, 255, 255, 255));
|
||||
// draw the focus ring
|
||||
Stroke();
|
||||
|
||||
// set dashing for foreground
|
||||
FallibleTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
|
||||
dash.AppendElement(1);
|
||||
dash.AppendElement(1);
|
||||
|
||||
// set the foreground focus color
|
||||
CurrentState().SetColorStyle(STYLE_STROKE, NS_RGBA(0,0,0, 255));
|
||||
// draw the focus ring
|
||||
Stroke();
|
||||
|
||||
Restore();
|
||||
}
|
||||
}
|
||||
|
||||
bool CanvasRenderingContext2D::DrawCustomFocusRing(mozilla::dom::Element& aElement)
|
||||
{
|
||||
EnsureUserSpacePath();
|
||||
|
||||
HTMLCanvasElement* canvas = GetCanvas();
|
||||
|
||||
if (!canvas|| !nsContentUtils::ContentIsDescendantOf(&aElement, canvas)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
// check that the element i focused
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
fm->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (SameCOMIdentity(aElement.AsDOMNode(), focusedElement)) {
|
||||
// get the bounds of the current path
|
||||
mgfx::Rect bounds;
|
||||
bounds = mPath->GetBounds(mTarget->GetTransform());
|
||||
|
||||
// and set them as the accessible area
|
||||
nsRect rect(canvas->ClientLeft() + bounds.x, canvas->ClientTop() + bounds.y,
|
||||
bounds.width, bounds.height);
|
||||
rect.x *= AppUnitsPerCSSPixel();
|
||||
rect.y *= AppUnitsPerCSSPixel();
|
||||
rect.width *= AppUnitsPerCSSPixel();
|
||||
rect.height *= AppUnitsPerCSSPixel();
|
||||
|
||||
nsIFrame* frame = aElement.GetPrimaryFrame();
|
||||
if(frame) {
|
||||
frame->SetRect(rect);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::Clip(const CanvasWindingRule& winding)
|
||||
{
|
||||
|
@ -169,8 +169,6 @@ public:
|
||||
void BeginPath();
|
||||
void Fill(const CanvasWindingRule& winding);
|
||||
void Stroke();
|
||||
void DrawSystemFocusRing(mozilla::dom::Element& element);
|
||||
bool DrawCustomFocusRing(mozilla::dom::Element& element);
|
||||
void Clip(const CanvasWindingRule& winding);
|
||||
bool IsPointInPath(double x, double y, const CanvasWindingRule& winding);
|
||||
bool IsPointInStroke(double x, double y);
|
||||
|
@ -1,18 +0,0 @@
|
||||
<!--docytpe html-->
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
window.onload=function(){
|
||||
var c=document.getElementById("myCanvas").getContext("2d");
|
||||
c.beginPath();
|
||||
c.strokeRect(10, 10, 200, 200);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="myCanvas" height="500" width="500" style="border:1px solid black">
|
||||
|
||||
</canvas>
|
||||
|
||||
</body></html>
|
@ -1,28 +0,0 @@
|
||||
<!--docytpe html-->
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
window.onload=function(){
|
||||
var c=document.getElementById("myCanvas").getContext("2d");
|
||||
var in1=document.getElementById("in1");
|
||||
var in2=document.getElementById("in2");
|
||||
in1.focus();
|
||||
if(c.drawCustomFocusRing(in1)) {
|
||||
c.beginPath();
|
||||
c.strokeRect(10, 10, 200, 200);
|
||||
}
|
||||
if(c.drawCustomFocusRing(in2)) {
|
||||
c.beginPath();
|
||||
c.strokeRect(10, 220, 200, 200);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="myCanvas" height="500" width="500" style="border:1px solid black">
|
||||
<input id="in1" type="range" min="1" max="12">
|
||||
<input id="in2" type="range" min="1" max="12">
|
||||
</canvas>
|
||||
|
||||
</body></html>
|
@ -1,18 +0,0 @@
|
||||
<!--docytpe html-->
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
window.onload=function(){
|
||||
var c=document.getElementById("myCanvas").getContext("2d");
|
||||
c.beginPath();
|
||||
c.mozDash = [1,1];
|
||||
c.strokeRect(10, 10, 200, 200);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="myCanvas" height="500" width="500" style="border:1px solid black">
|
||||
</canvas>
|
||||
|
||||
</body></html>
|
@ -1,26 +0,0 @@
|
||||
<!--docytpe html-->
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
window.onload=function(){
|
||||
var c=document.getElementById("myCanvas").getContext("2d");
|
||||
var in1=document.getElementById("in1");
|
||||
var in2=document.getElementById("in2");
|
||||
in1.focus();
|
||||
c.beginPath();
|
||||
c.rect(10, 10, 200, 200);
|
||||
c.drawSystemFocusRing(in1);
|
||||
c.beginPath();
|
||||
c.rect(10, 220, 200, 200);
|
||||
c.drawSystemFocusRing(in2);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="myCanvas" height="500" width="500" style="border:1px solid black">
|
||||
<input id="in1" type="range" min="1" max="12">
|
||||
<input id="in2" type="range" min="1" max="12">
|
||||
</canvas>
|
||||
|
||||
</body></html>
|
@ -188,7 +188,3 @@ skip-if(!winWidget) pref(webgl.prefer-native-gl,true) pref(webgl.prefer-16bpp,tr
|
||||
|
||||
# Bug 815648
|
||||
== stroketext-shadow.html stroketext-shadow-ref.html
|
||||
|
||||
# focus rings
|
||||
pref(canvas.focusring.enabled,true) == drawSystemFocusRing.html drawSystemFocusRing-ref.html
|
||||
pref(canvas.focusring.enabled,true) == drawCustomFocusRing.html drawCustomFocusRing-ref.html
|
||||
|
@ -8,7 +8,6 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Cr = SpecialPowers.Cr;
|
||||
SpecialPowers.setBoolPref("canvas.focusring.enabled", true);
|
||||
|
||||
function IsD2DEnabled() {
|
||||
var enabled = false;
|
||||
@ -21489,66 +21488,6 @@ function test_getImageData_after_zero_canvas() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: drawCustomFocusRing</p>
|
||||
<canvas id="c687" class="output" width="100" height="50">
|
||||
<input id="button1" type="range" min="1" max="12"></input>
|
||||
<input id="button2" type="range" min="1" max="12"></input>
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function test_drawCustomFocusRing_canvas() {
|
||||
var c = document.getElementById("c687");
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.beginPath();
|
||||
var b1 = document.getElementById('button1');
|
||||
var b2 = document.getElementById('button2');
|
||||
ok(!ctx.drawCustomFocusRing(b1), "button 1 is focused");
|
||||
ok(!ctx.drawCustomFocusRing(b2), "button 2 is focused");
|
||||
b1.focus();
|
||||
ok(ctx.drawCustomFocusRing(b1), "button 1 should not be focused");
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: drawSystemFocusRing</p>
|
||||
<canvas id="c688" class="output" width="50" height="25">
|
||||
<input id="button3" type="range" min="1" max="12"></input>
|
||||
<input id="button4" type="range" min="1" max="12"></input>
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function isEmptyCanvas(ctx, w, h) {
|
||||
var imgdata = ctx.getImageData(0, 0, w, h);
|
||||
for(var x = 0; x < w*h*4; x++)
|
||||
if(imgdata.data[x] != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function test_drawSystemFocusRing_canvas() {
|
||||
var c = document.getElementById("c688");
|
||||
var ctx = c.getContext("2d");
|
||||
var b1 = document.getElementById('button3');
|
||||
var b2 = document.getElementById('button4');
|
||||
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.beginPath();
|
||||
ctx.rect(10, 10, 30, 30);
|
||||
ctx.drawSystemFocusRing(b1);
|
||||
ok(isEmptyCanvas(ctx, ctx.canvas.width, ctx.canvas.height), "focus of button 1 is drawn");
|
||||
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.beginPath();
|
||||
ctx.rect(50, 10, 30, 30);
|
||||
ctx.drawSystemFocusRing(b2);
|
||||
ok(isEmptyCanvas(ctx, ctx.canvas.width, ctx.canvas.height), "focus of button 2 is drawn");
|
||||
|
||||
b1.focus();
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.beginPath();
|
||||
ctx.rect(10, 10, 30, 30);
|
||||
ctx.drawSystemFocusRing(b1);
|
||||
ok(!isEmptyCanvas(ctx, ctx.canvas.width, ctx.canvas.height) , "focus of button 1 is not drawn");
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function asyncTestsDone() {
|
||||
@ -24845,18 +24784,6 @@ function runTests() {
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_type_replace");
|
||||
}
|
||||
try {
|
||||
test_drawCustomFocusRing_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_drawCustomFocusRing_canvas");
|
||||
}
|
||||
try {
|
||||
test_drawSystemFocusRing_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_drawSystemFocusRing_canvas");
|
||||
}
|
||||
|
||||
//run the asynchronous tests
|
||||
try {
|
||||
@ -24871,7 +24798,6 @@ function runTests() {
|
||||
}
|
||||
|
||||
setTimeout(asyncTestsDone, 500);
|
||||
SpecialPowers.setBoolPref("canvas.focusring.enabled", false);
|
||||
}
|
||||
|
||||
addLoadEvent(runTests);
|
||||
|
@ -78,10 +78,10 @@ interface CanvasRenderingContext2D {
|
||||
// NOT IMPLEMENTED void fill(Path path);
|
||||
void stroke();
|
||||
// NOT IMPLEMENTED void stroke(Path path);
|
||||
[Pref="canvas.focusring.enabled"] void drawSystemFocusRing(Element element);
|
||||
// NOT IMPLEMENTED void drawSystemFocusRing(Path path, HTMLElement element);
|
||||
[Pref="canvas.focusring.enabled"] boolean drawCustomFocusRing(Element element);
|
||||
// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, HTMLElement element);
|
||||
// NOT IMPLEMENTED void drawSystemFocusRing(Element element);
|
||||
// NOT IMPLEMENTED void drawSystemFocusRing(Path path, Element element);
|
||||
// NOT IMPLEMENTED boolean drawCustomFocusRing(Element element);
|
||||
// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, Element element);
|
||||
// NOT IMPLEMENTED void scrollPathIntoView();
|
||||
// NOT IMPLEMENTED void scrollPathIntoView(Path path);
|
||||
void clip([TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero");
|
||||
|
@ -413,9 +413,6 @@ pref("ui.scrollToClick", 0);
|
||||
pref("accessibility.tabfocus_applies_to_xul", true);
|
||||
#endif
|
||||
|
||||
// provide ability to turn on support for canvas focus rings
|
||||
pref("canvas.focusring.enabled", false);
|
||||
|
||||
// We want the ability to forcibly disable platform a11y, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
// 538530 for details about Windows; we have a pref here that allows it
|
||||
|
Loading…
Reference in New Issue
Block a user