Make AccessibilityObject::size non-virtual and fix platform accessibility code's...
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 20:56:47 +0000 (20:56 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 20:56:47 +0000 (20:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83803

Reviewed by Eric Seidel.

AccessibilityObject::size was virtual with a number of overloads, but all the implementations were
redundant. Avoiding the virtual thunk and code duplication by declaring it non-virtual and only
implementing it in AccessibilityObject.

Also adding a pixelSnappedSize method that returns an IntSize, and using it in platform
accessibility code.

No new tests. No change in behavior.

* accessibility/AccessibilityMenuListOption.h:
(WebCore::AccessibilityMenuListOption::canHaveChildren):
* accessibility/AccessibilityMenuListPopup.h:
(WebCore::AccessibilityMenuListPopup::elementRect):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::size):
(WebCore::AccessibilityObject::pixelSnappedSize):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):
* accessibility/AccessibilitySlider.cpp:
(WebCore):
* accessibility/AccessibilitySlider.h:
(AccessibilitySliderThumb):
* accessibility/AccessibilityTableColumn.cpp:
(WebCore):
* accessibility/AccessibilityTableColumn.h:
(AccessibilityTableColumn):
* accessibility/AccessibilityTableHeaderContainer.cpp:
(WebCore):
* accessibility/AccessibilityTableHeaderContainer.h:
(AccessibilityTableHeaderContainer):
* accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp:
(webkitAccessibleComponentGetExtents):
* accessibility/gtk/WebKitAccessibleInterfaceImage.cpp:
(webkitAccessibleImageGetImagePosition):
(webkitAccessibleImageGetImageSize):
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(-[WebAccessibilityObjectWrapper position]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityMenuListOption.h
Source/WebCore/accessibility/AccessibilityMenuListPopup.h
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/AccessibilitySlider.cpp
Source/WebCore/accessibility/AccessibilitySlider.h
Source/WebCore/accessibility/AccessibilityTableColumn.cpp
Source/WebCore/accessibility/AccessibilityTableColumn.h
Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h
Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp
Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm

index b5bd805..f6810ea 100644 (file)
@@ -1,3 +1,51 @@
+2012-04-12  Levi Weintraub  <leviw@chromium.org>
+
+        Make AccessibilityObject::size non-virtual and fix platform accessibility code's LayoutUnit usage
+        https://bugs.webkit.org/show_bug.cgi?id=83803
+
+        Reviewed by Eric Seidel.
+
+        AccessibilityObject::size was virtual with a number of overloads, but all the implementations were
+        redundant. Avoiding the virtual thunk and code duplication by declaring it non-virtual and only
+        implementing it in AccessibilityObject.
+
+        Also adding a pixelSnappedSize method that returns an IntSize, and using it in platform
+        accessibility code.
+
+        No new tests. No change in behavior.
+
+        * accessibility/AccessibilityMenuListOption.h:
+        (WebCore::AccessibilityMenuListOption::canHaveChildren):
+        * accessibility/AccessibilityMenuListPopup.h:
+        (WebCore::AccessibilityMenuListPopup::elementRect):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::size):
+        (WebCore::AccessibilityObject::pixelSnappedSize):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore):
+        * accessibility/AccessibilityRenderObject.h:
+        (AccessibilityRenderObject):
+        * accessibility/AccessibilitySlider.cpp:
+        (WebCore):
+        * accessibility/AccessibilitySlider.h:
+        (AccessibilitySliderThumb):
+        * accessibility/AccessibilityTableColumn.cpp:
+        (WebCore):
+        * accessibility/AccessibilityTableColumn.h:
+        (AccessibilityTableColumn):
+        * accessibility/AccessibilityTableHeaderContainer.cpp:
+        (WebCore):
+        * accessibility/AccessibilityTableHeaderContainer.h:
+        (AccessibilityTableHeaderContainer):
+        * accessibility/gtk/WebKitAccessibleInterfaceComponent.cpp:
+        (webkitAccessibleComponentGetExtents):
+        * accessibility/gtk/WebKitAccessibleInterfaceImage.cpp:
+        (webkitAccessibleImageGetImagePosition):
+        (webkitAccessibleImageGetImageSize):
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (-[WebAccessibilityObjectWrapper position]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2012-04-12  Anna Cavender  <annacc@chromium.org>
 
         Update HTMLMediaElement's index of cues when TextTrack.mode changes to
index d2c4613..e37bd8b 100644 (file)
@@ -46,7 +46,6 @@ private:
 
     virtual AccessibilityRole roleValue() const { return MenuListOptionRole; }
     virtual bool canHaveChildren() const { return false; }
-    virtual LayoutSize size() const { return elementRect().size(); }
 
     virtual Element* actionElement() const;
     virtual bool isEnabled() const;
index 2a03211..826cb31 100644 (file)
@@ -50,7 +50,6 @@ private:
     virtual bool isMenuListPopup() const { return true; }
 
     virtual LayoutRect elementRect() const { return LayoutRect(); }
-    virtual LayoutSize size() const { return LayoutSize(); }
     virtual AccessibilityRole roleValue() const { return MenuListPopupRole; }
 
     virtual bool isVisible() const;
index 0852a15..c935709 100644 (file)
@@ -506,7 +506,8 @@ public:
     virtual LayoutRect boundingBoxRect() const { return LayoutRect(); }
     IntRect pixelSnappedBoundingBoxRect() const { return pixelSnappedIntRect(boundingBoxRect()); }
     virtual LayoutRect elementRect() const = 0;
-    virtual LayoutSize size() const { return elementRect().size(); }
+    LayoutSize size() const { return elementRect().size(); }
+    IntSize pixelSnappedSize() const { return elementRect().pixelSnappedSize(); }
     virtual IntPoint clickPoint();
     static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&);
     
index 9bd478f..92b5a17 100644 (file)
@@ -1523,12 +1523,6 @@ LayoutRect AccessibilityRenderObject::elementRect() const
     return boundingBoxRect();
 }
 
-LayoutSize AccessibilityRenderObject::size() const
-{
-    LayoutRect rect = elementRect();
-    return rect.size();
-}
-
 IntPoint AccessibilityRenderObject::clickPoint()
 {
     // Headings are usually much wider than their textual content. If the mid point is used, often it can be wrong.
index 6b6f720..4d66e55 100644 (file)
@@ -166,7 +166,6 @@ public:
     
     virtual LayoutRect boundingBoxRect() const;
     virtual LayoutRect elementRect() const;
-    virtual LayoutSize size() const;
     virtual IntPoint clickPoint();
     
     void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
index b4ccd03..56cef7f 100644 (file)
@@ -178,11 +178,6 @@ LayoutRect AccessibilitySliderThumb::elementRect() const
     return sliderThumbElementOf(sliderRenderer->node())->getRect();
 }
 
-LayoutSize AccessibilitySliderThumb::size() const
-{
-    return elementRect().size();
-}
-
 bool AccessibilitySliderThumb::accessibilityIsIgnored() const
 {
     AccessibilityObjectInclusion decision = accessibilityPlatformIncludesObject();
index 4b2d54b..81fe918 100644 (file)
@@ -75,7 +75,6 @@ public:
 
     virtual AccessibilityRole roleValue() const { return SliderThumbRole; }
 
-    virtual LayoutSize size() const;
     virtual LayoutRect elementRect() const;
 
     virtual bool accessibilityIsIgnored() const;
index c94521b..d8af046 100644 (file)
@@ -68,11 +68,6 @@ LayoutRect AccessibilityTableColumn::elementRect() const
     return m_columnRect;
 }
 
-LayoutSize AccessibilityTableColumn::size() const
-{
-    return elementRect().size();
-}
 AccessibilityObject* AccessibilityTableColumn::headerObject()
 {
     if (!m_parent)
index 014f32d..632097e 100644 (file)
@@ -57,7 +57,6 @@ public:
     virtual void addChildren();
     virtual void setParent(AccessibilityObject*);
     
-    virtual LayoutSize size() const;
     virtual LayoutRect elementRect() const;
     
 private:    
index ff959cd..a85e53a 100644 (file)
@@ -55,11 +55,6 @@ LayoutRect AccessibilityTableHeaderContainer::elementRect() const
     return m_headerRect;
 }
 
-LayoutSize AccessibilityTableHeaderContainer::size() const
-{
-    return elementRect().size();
-}
-
 bool AccessibilityTableHeaderContainer::accessibilityIsIgnored() const
 {
     if (!m_parent)
index 3cffd28..625e1dd 100644 (file)
@@ -47,7 +47,6 @@ public:
     
     virtual void addChildren();
     
-    virtual LayoutSize size() const;
     virtual LayoutRect elementRect() const;
     
 private:
index a494fee..3969f14 100644 (file)
@@ -77,7 +77,7 @@ static AtkObject* webkitAccessibleComponentRefAccessibleAtPoint(AtkComponent* co
 
 static void webkitAccessibleComponentGetExtents(AtkComponent* component, gint* x, gint* y, gint* width, gint* height, AtkCoordType coordType)
 {
-    IntRect rect = core(component)->elementRect();
+    IntRect rect = pixelSnappedIntRect(core(component)->elementRect());
     contentsRelativeToAtkCoordinateType(core(component), coordType, rect, x, y, width, height);
 }
 
index 4deb137..f9e42b8 100644 (file)
@@ -48,7 +48,7 @@ static AccessibilityObject* core(AtkImage* image)
 
 static void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint* y, AtkCoordType coordType)
 {
-    IntRect rect = core(image)->elementRect();
+    IntRect rect = pixelSnappedIntRect(core(image)->elementRect());
     contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y);
 }
 
@@ -59,7 +59,7 @@ static const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image)
 
 static void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint* height)
 {
-    IntSize size = core(image)->size();
+    IntSize size = core(image)->pixelSnappedSize();
 
     if (width)
         *width = size.width();
index 7dce99b..b5d6895 100644 (file)
@@ -1409,7 +1409,7 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility
 
 - (NSValue *)position
 {
-    LayoutRect rect = m_object->elementRect();
+    IntRect rect = pixelSnappedIntRect(m_object->elementRect());
     NSPoint point;
     
     FrameView* frameView = m_object->documentFrameView();
@@ -2025,7 +2025,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return [NSNumber numberWithBool: m_object->isEnabled()];
 
     if ([attributeName isEqualToString: NSAccessibilitySizeAttribute]) {
-        LayoutSize s = m_object->size();
+        IntSize s = m_object->pixelSnappedSize();
         return [NSValue valueWithSize: NSMakeSize(s.width(), s.height())];
     }