Diff
Modified: trunk/LayoutTests/ChangeLog (160031 => 160032)
--- trunk/LayoutTests/ChangeLog 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/LayoutTests/ChangeLog 2013-12-03 20:58:18 UTC (rev 160032)
@@ -1,3 +1,15 @@
+2013-12-03 Samuel White <samuel_wh...@apple.com>
+
+ AXPress event coordinates are always sent as (0, 0)
+ https://bugs.webkit.org/show_bug.cgi?id=76677
+
+ Reviewed by Simon Fraser.
+
+ Make sure a press targets an element's center point.
+
+ * accessibility/press-targets-center-point-expected.txt: Added.
+ * accessibility/press-targets-center-point.html: Added.
+
2013-12-03 Dean Jackson <d...@apple.com>
[WebGL] Implement OES texture float linear
Added: trunk/LayoutTests/accessibility/press-targets-center-point-expected.txt (0 => 160032)
--- trunk/LayoutTests/accessibility/press-targets-center-point-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/press-targets-center-point-expected.txt 2013-12-03 20:58:18 UTC (rev 160032)
@@ -0,0 +1,25 @@
+target
+Actual: (89, 18)
+Expected: (89, 18)
+
+translate transform target
+Actual: (289, 266)
+Expected: (289, 266)
+
+vertical left-to-right writing mode target
+Actual: (18, 309)
+Expected: (18, 309)
+
+right-to-left direction target
+Actual: (129, 512)
+Expected: (129, 512)
+
+This tests that press targets the receiving elements center point.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/press-targets-center-point.html (0 => 160032)
--- trunk/LayoutTests/accessibility/press-targets-center-point.html (rev 0)
+++ trunk/LayoutTests/accessibility/press-targets-center-point.html 2013-12-03 20:58:18 UTC (rev 160032)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+ .result {
+ font-family:monospace;
+ }
+ .target {
+ background-color:silver;
+ border:1px solid;
+ cursor:default;
+ }
+</style>
+<title>Press Targets Center Point</title>
+</head>
+<body>
+
+<div class="target" id="t0" style="width:160px;">target</div>
+<p>Actual: <span class="result" id="a0">waiting</span><br>Expected: <span class="result" id="e0">waiting</span></p>
+
+<div class="target" id="t1" style="-webkit-transform:translate(160px, 160px); width:240px;">translate transform target</div>
+<p>Actual: <span class="result" id="a1">waiting</span><br>Expected: <span class="result" id="e1">waiting</span></p>
+
+<div class="target" id="t2" style="-webkit-writing-mode:vertical-lr;">vertical left-to-right writing mode target</div>
+<p>Actual: <span class="result" id="a2">waiting</span><br>Expected: <span class="result" id="e2">waiting</span></p>
+
+<div class="target" id="t3" style="direction:rtl; width:240px;">right-to-left direction target</div>
+<p>Actual: <span class="result" id="a3">waiting</span><br>Expected: <span class="result" id="e3">waiting</span></p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that press targets the receiving elements center point.");
+
+ var targetCount = document.getElementsByClassName("target").length;
+
+ for (var i = 0; i < targetCount; ++i) {
+ (function(i) {
+ document.getElementById("t" + i).addEventListener("click", function(e) {
+ document.getElementById("a" + i).innerHTML = "(" + e.clientX + ", " + e.clientY + ")";
+ });
+ })(i);
+
+ var targetClientRect = document.getElementById("t" + i).getBoundingClientRect();
+ var targetClientX = Math.round(targetClientRect.left + targetClientRect.width / 2);
+ var targetClientY = Math.round(targetClientRect.top + targetClientRect.height / 2);
+ document.getElementById("e" + i).innerHTML = "(" + targetClientX + ", " + targetClientY + ")";
+ }
+
+ if (window.accessibilityController) {
+ // Press all targets.
+ for (var i = 0; i < targetCount; ++i)
+ accessibilityController.accessibleElementById("t" + i).press();
+ }
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (160031 => 160032)
--- trunk/Source/WebCore/ChangeLog 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/ChangeLog 2013-12-03 20:58:18 UTC (rev 160032)
@@ -1,3 +1,26 @@
+2013-12-03 Samuel White <samuel_wh...@apple.com>
+
+ AXPress event coordinates are always sent as (0, 0)
+ https://bugs.webkit.org/show_bug.cgi?id=76677
+
+ Reviewed by Simon Fraser.
+
+ Set the coordinates of a simulated press equal to the center of the target
+ element when the simulated press does not have a related mouse event.
+
+ Test: accessibility/press-targets-center-point.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::clientRect):
+ (WebCore::Element::screenRect):
+ * dom/Element.h:
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchSimulatedClick):
+ * dom/MouseEvent.cpp:
+ (WebCore::SimulatedMouseEvent::create):
+ (WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
+ * dom/MouseEvent.h:
+
2013-12-03 Dean Jackson <d...@apple.com>
[WebGL] Implement OES texture float linear
Modified: trunk/Source/WebCore/dom/Element.cpp (160031 => 160032)
--- trunk/Source/WebCore/dom/Element.cpp 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/dom/Element.cpp 2013-12-03 20:58:18 UTC (rev 160032)
@@ -982,13 +982,19 @@
document().adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale(result, renderer()->style());
return ClientRect::create(result);
}
+
+IntRect Element::clientRect() const
+{
+ if (RenderObject* renderer = this->renderer())
+ return document().view()->contentsToRootView(renderer->absoluteBoundingBoxRect());
+ return IntRect();
+}
IntRect Element::screenRect() const
{
- if (!renderer())
- return IntRect();
- // FIXME: this should probably respect transforms
- return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRectIgnoringTransforms());
+ if (RenderObject* renderer = this->renderer())
+ return document().view()->contentsToScreen(renderer->absoluteBoundingBoxRect());
+ return IntRect();
}
const AtomicString& Element::getAttribute(const AtomicString& localName) const
Modified: trunk/Source/WebCore/dom/Element.h (160031 => 160032)
--- trunk/Source/WebCore/dom/Element.h 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/dom/Element.h 2013-12-03 20:58:18 UTC (rev 160032)
@@ -219,7 +219,9 @@
PassRefPtr<ClientRectList> getClientRects();
PassRefPtr<ClientRect> getBoundingClientRect();
- // Returns the absolute bounding box translated into screen coordinates:
+ // Returns the absolute bounding box translated into client coordinates.
+ IntRect clientRect() const;
+ // Returns the absolute bounding box translated into screen coordinates.
IntRect screenRect() const;
void removeAttribute(const AtomicString& name);
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (160031 => 160032)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2013-12-03 20:58:18 UTC (rev 160032)
@@ -218,17 +218,17 @@
return;
if (mouseEventOptions == SendMouseOverUpDownEvents)
- dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mouseoverEvent, element->document().defaultView(), underlyingEvent));
+ dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mouseoverEvent, element->document().defaultView(), underlyingEvent, element));
if (mouseEventOptions != SendNoEvents)
- dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mousedownEvent, element->document().defaultView(), underlyingEvent));
+ dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mousedownEvent, element->document().defaultView(), underlyingEvent, element));
element->setActive(true, visualOptions == ShowPressedLook);
if (mouseEventOptions != SendNoEvents)
- dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mouseupEvent, element->document().defaultView(), underlyingEvent));
+ dispatchEvent(element, SimulatedMouseEvent::create(eventNames().mouseupEvent, element->document().defaultView(), underlyingEvent, element));
element->setActive(false);
// always send click
- dispatchEvent(element, SimulatedMouseEvent::create(eventNames().clickEvent, element->document().defaultView(), underlyingEvent));
+ dispatchEvent(element, SimulatedMouseEvent::create(eventNames().clickEvent, element->document().defaultView(), underlyingEvent, element));
elementsDispatchingSimulatedClicks.remove(element);
}
Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (160031 => 160032)
--- trunk/Source/WebCore/dom/MouseEvent.cpp 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp 2013-12-03 20:58:18 UTC (rev 160032)
@@ -252,16 +252,16 @@
return clonedMouseEvent.release();
}
-PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
+PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent, Element* target)
{
- return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent));
+ return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent, target));
}
SimulatedMouseEvent::~SimulatedMouseEvent()
{
}
-SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
+SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent, Element* target)
: MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : currentTime(), view, 0, 0, 0, 0, 0,
#if ENABLE(POINTER_LOCK)
0, 0,
@@ -280,6 +280,9 @@
MouseEvent* mouseEvent = static_cast<MouseEvent*>(this->underlyingEvent());
m_screenLocation = mouseEvent->screenLocation();
initCoordinates(mouseEvent->clientLocation());
+ } else if (target) {
+ m_screenLocation = target->screenRect().center();
+ initCoordinates(LayoutPoint(target->clientRect().center()));
}
}
Modified: trunk/Source/WebCore/dom/MouseEvent.h (160031 => 160032)
--- trunk/Source/WebCore/dom/MouseEvent.h 2013-12-03 20:37:57 UTC (rev 160031)
+++ trunk/Source/WebCore/dom/MouseEvent.h 2013-12-03 20:58:18 UTC (rev 160032)
@@ -124,11 +124,11 @@
class SimulatedMouseEvent : public MouseEvent {
public:
- static PassRefPtr<SimulatedMouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
+ static PassRefPtr<SimulatedMouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent, Element* target);
virtual ~SimulatedMouseEvent();
private:
- SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
+ SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent, Element* target);
};
inline MouseEvent* toMouseEvent(Event* event)