4 <title>hover ancestor test
</title>
5 <style type=
"text/css" media=
"screen">
19 <p>This test ensures that ancestor element hover rules are not affected when we hover
20 its contained elements
</p>
21 <div class=
"foo" id=
"target">
22 <select class=
"select" id=
"testselect" size=
"3">
23 <option value=
"option1">option1
</option>
24 <option value=
"option1">option2
</option>
25 <option selected=
"selected" value=
"option2">option3
</option>
28 <input type=
"text" name=
"fname" id=
"testinput"/>
30 <textarea rows=
"2" cols=
"20" id=
"testtextarea">Textarea test.
</textarea>
32 <a id=
"testanchor" href=
"webkit.org">http://www.webkit.org
</a>
34 <button type=
"button" id=
"testbutton">Button test
</button>
37 <input type=
"radio" id=
"testradio"/>Radio test
39 <input type=
"checkbox" id=
"testcheckbox"/>Checkbox test
43 <script type=
"text/javascript">
44 if (window
.testRunner
) {
45 testRunner
.dumpAsText();
48 function getCenterFor(element
)
50 var rect
= element
.getBoundingClientRect();
51 return { x
: parseInt((rect
.left
+ rect
.right
) / 2) , y
: parseInt((rect
.top
+ rect
.bottom
) / 2)};
54 function runTest(id
) {
56 box
= document
.getElementById(id
);
57 center
= getCenterFor(box
);
58 eventSender
.mouseMoveTo(center
.x
, center
.y
);
59 var target
= document
.getElementById("target");
60 var style
= window
.getComputedStyle(target
, null);
61 var bgColor
= style
.getPropertyValue("background-color");
62 logResult(id
, bgColor
);
65 function logResult(id
, bgColor
) {
66 document
.write(id
+ ': ');
67 document
.write(bgColor
=="rgb(0, 128, 0)" ? "PASS" : "FAIL");
68 document
.write('<br>');
71 if (window
.eventSender
) {
72 runTest("testselect");
74 runTest("testtextarea");
75 runTest("testanchor");
76 runTest("testbutton");
78 runTest("testcheckbox");