Title: [93461] trunk/Source/WebCore
- Revision
- 93461
- Author
- [email protected]
- Date
- 2011-08-19 18:14:39 -0700 (Fri, 19 Aug 2011)
Log Message
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]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93460 => 93461)
--- trunk/Source/WebCore/ChangeLog 2011-08-20 00:45:52 UTC (rev 93460)
+++ trunk/Source/WebCore/ChangeLog 2011-08-20 01:14:39 UTC (rev 93461)
@@ -1,3 +1,19 @@
+2011-08-19 Chris Fleizach <[email protected]>
+
+ 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 <[email protected]>
New XML parser: text nodes outside of root element not created for document fragments
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (93460 => 93461)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-08-20 00:45:52 UTC (rev 93460)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-08-20 01:14:39 UTC (rev 93461)
@@ -984,6 +984,14 @@
return frameView->frame()->document();
}
+
+Page* AccessibilityObject::page() const
+{
+ Document* document = this->document();
+ if (!document)
+ return 0;
+ return document->page();
+}
FrameView* AccessibilityObject::documentFrameView() const
{
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (93460 => 93461)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-08-20 00:45:52 UTC (rev 93460)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-08-20 01:14:39 UTC (rev 93461)
@@ -85,6 +85,7 @@
class IntPoint;
class IntSize;
class Node;
+class Page;
class RenderObject;
class RenderListItem;
class VisibleSelection;
@@ -518,6 +519,7 @@
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;
Modified: trunk/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm (93460 => 93461)
--- trunk/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm 2011-08-20 00:45:52 UTC (rev 93460)
+++ trunk/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm 2011-08-20 01:14:39 UTC (rev 93461)
@@ -1375,27 +1375,10 @@
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 @@
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];
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes