Commit b8b14d32 authored by cfleizach@apple.com's avatar cfleizach@apple.com

AX WK2 Regression: WebKit outputs incorrect AX position in frames/iframes

https://bugs.webkit.org/show_bug.cgi?id=61289

Update the code to determine the position of accessibility elements on Mac for WK2,
so that elements within iframes are positioned correctly.

Reviewed by Darin Adler..

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::page):
* accessibility/AccessibilityObject.h:
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper position]):



git-svn-id: svn://svn.chromium.org/blink/trunk@93461 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b51bd679
2011-08-19 Chris Fleizach <cfleizach@apple.com>
AX WK2 Regression: WebKit outputs incorrect AX position in frames/iframes
https://bugs.webkit.org/show_bug.cgi?id=61289
Update the code to determine the position of accessibility elements on Mac for WK2,
so that elements within iframes are positioned correctly.
Reviewed by Darin Adler..
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::page):
* accessibility/AccessibilityObject.h:
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper position]):
2011-08-19 Jeffrey Pfau <jpfau@apple.com>
New XML parser: text nodes outside of root element not created for document fragments
......@@ -984,6 +984,14 @@ Document* AccessibilityObject::document() const
return frameView->frame()->document();
}
Page* AccessibilityObject::page() const
{
Document* document = this->document();
if (!document)
return 0;
return document->page();
}
FrameView* AccessibilityObject::documentFrameView() const
{
......
......@@ -85,6 +85,7 @@ class HTMLAreaElement;
class IntPoint;
class IntSize;
class Node;
class Page;
class RenderObject;
class RenderListItem;
class VisibleSelection;
......@@ -518,6 +519,7 @@ public:
const String& actionVerb() const;
virtual Widget* widget() const { return 0; }
virtual Widget* widgetForAttachmentView() const { return 0; }
Page* page() const;
virtual Document* document() const;
virtual FrameView* topDocumentFrameView() const { return 0; }
virtual FrameView* documentFrameView() const;
......
......@@ -1375,27 +1375,10 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility
NSPoint point;
FrameView* frameView = m_object->documentFrameView();
id remoteParent = [self remoteAccessibilityParentObject];
if (remoteParent) {
point = NSMakePoint(rect.x(), rect.y());
NSPoint remotePosition = [[remoteParent accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
NSSize remoteSize = [[remoteParent accessibilityAttributeValue:NSAccessibilitySizeAttribute] sizeValue];
// Get the y position of the WKView (we have to screen-flip and go from bottom left to top left).
CGFloat screenHeight = [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height;
remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height;
NSPoint scrollPosition = NSMakePoint(0, 0);
if (frameView && !m_object->isScrollbar() && !m_object->isScrollView()) {
LayoutPoint frameScrollPos = frameView->scrollPosition();
scrollPosition = NSMakePoint(frameScrollPos.x(), frameScrollPos.y());
}
point.x += remotePosition.x - scrollPosition.x;
// Set the new position, which means getting bottom y, and then flipping to screen coordinates.
point.y = screenHeight - (point.y + remotePosition.y + rect.height() - scrollPosition.y);
} else {
// WebKit1 code path... platformWidget() exists.
if (frameView && frameView->platformWidget()) {
// The Cocoa accessibility API wants the lower-left corner.
point = NSMakePoint(rect.x(), rect.maxY());
......@@ -1403,8 +1386,26 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility
NSView* view = frameView->documentView();
point = [[view window] convertBaseToScreen:[view convertPoint: point toView:nil]];
}
}
} else {
// Find the appropriate scroll view to use to convert the contents to the window.
ScrollView* scrollView = 0;
for (AccessibilityObject* parent = m_object->parentObject(); parent; parent = parent->parentObject()) {
if (parent->isAccessibilityScrollView()) {
scrollView = toAccessibilityScrollView(parent)->scrollView();
break;
}
}
if (scrollView)
rect = scrollView->contentsToWindow(rect);
if (m_object->page())
point = m_object->page()->chrome()->windowToScreen(rect).location();
else
point = rect.location();
}
return [NSValue valueWithPoint:point];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment