Title: [96520] trunk
- Revision
- 96520
- Author
- [email protected]
- Date
- 2011-10-03 11:04:54 -0700 (Mon, 03 Oct 2011)
Log Message
AX: click point for AXHeadings often returns point on empty space (results in wrong context menu)
https://bugs.webkit.org/show_bug.cgi?id=69262
Source/WebCore:
When the contextual menu is opened for a heading, often it will open on empty space because
the heading is wider than the content inside. The click point should thus use the content
inside the heading as the click point.
To accomplish this we need to query whether we have children using children() which is a non-const
method, hence the removal of const from clickPoint().
Reviewed by John Sullivan.
Test: platform/mac/accessibility/heading-clickpoint.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::clickPoint):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::clickPoint):
* accessibility/AccessibilityRenderObject.h:
LayoutTests:
Reviewed by John Sullivan.
* platform/mac/accessibility/heading-clickpoint-expected.txt: Added.
* platform/mac/accessibility/heading-clickpoint.html: Added.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (96519 => 96520)
--- trunk/LayoutTests/ChangeLog 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/LayoutTests/ChangeLog 2011-10-03 18:04:54 UTC (rev 96520)
@@ -1,3 +1,13 @@
+2011-10-03 Chris Fleizach <[email protected]>
+
+ AX: click point for AXHeadings often returns point on empty space (results in wrong context menu)
+ https://bugs.webkit.org/show_bug.cgi?id=69262
+
+ Reviewed by John Sullivan.
+
+ * platform/mac/accessibility/heading-clickpoint-expected.txt: Added.
+ * platform/mac/accessibility/heading-clickpoint.html: Added.
+
2011-10-03 Adam Barth <[email protected]>
Unbork the test_expectations file.
Modified: trunk/Source/WebCore/ChangeLog (96519 => 96520)
--- trunk/Source/WebCore/ChangeLog 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/Source/WebCore/ChangeLog 2011-10-03 18:04:54 UTC (rev 96520)
@@ -1,3 +1,26 @@
+2011-10-03 Chris Fleizach <[email protected]>
+
+ AX: click point for AXHeadings often returns point on empty space (results in wrong context menu)
+ https://bugs.webkit.org/show_bug.cgi?id=69262
+
+ When the contextual menu is opened for a heading, often it will open on empty space because
+ the heading is wider than the content inside. The click point should thus use the content
+ inside the heading as the click point.
+
+ To accomplish this we need to query whether we have children using children() which is a non-const
+ method, hence the removal of const from clickPoint().
+
+ Reviewed by John Sullivan.
+
+ Test: platform/mac/accessibility/heading-clickpoint.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::clickPoint):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::clickPoint):
+ * accessibility/AccessibilityRenderObject.h:
+
2011-10-03 Sheriff Bot <[email protected]>
Unreviewed, rolling out r96500.
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (96519 => 96520)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-10-03 18:04:54 UTC (rev 96520)
@@ -399,7 +399,7 @@
|| ariaRole == ComboBoxRole || ariaRole == SliderRole;
}
-LayoutPoint AccessibilityObject::clickPoint() const
+LayoutPoint AccessibilityObject::clickPoint()
{
LayoutRect rect = elementRect();
return LayoutPoint(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (96519 => 96520)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-10-03 18:04:54 UTC (rev 96520)
@@ -507,7 +507,7 @@
virtual LayoutRect boundingBoxRect() const { return LayoutRect(); }
virtual LayoutRect elementRect() const = 0;
virtual LayoutSize size() const { return elementRect().size(); }
- virtual LayoutPoint clickPoint() const;
+ virtual LayoutPoint clickPoint();
virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
unsigned selectionStart() const { return selectedTextRange().start; }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (96519 => 96520)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-10-03 18:04:54 UTC (rev 96520)
@@ -1496,8 +1496,12 @@
return rect.size();
}
-LayoutPoint AccessibilityRenderObject::clickPoint() const
+LayoutPoint AccessibilityRenderObject::clickPoint()
{
+ // Headings are usually much wider than their textual content. If the mid point is used, often it can be wrong.
+ if (isHeading() && children().size() == 1)
+ return children()[0]->clickPoint();
+
// use the default position unless this is an editable web area, in which case we use the selection bounds.
if (!isWebArea() || isReadOnly())
return AccessibilityObject::clickPoint();
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (96519 => 96520)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2011-10-03 18:00:05 UTC (rev 96519)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2011-10-03 18:04:54 UTC (rev 96520)
@@ -166,7 +166,7 @@
virtual LayoutRect boundingBoxRect() const;
virtual LayoutRect elementRect() const;
virtual LayoutSize size() const;
- virtual LayoutPoint clickPoint() const;
+ virtual LayoutPoint clickPoint();
void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
virtual RenderObject* renderer() const { return m_renderer; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes