!HAVE(ACCESSIBILITY) should be able to build without linking in any code from WebCore...
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 05:46:40 +0000 (05:46 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 05:46:40 +0000 (05:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87035

Reviewed by Chris Fleizach.

The OS(ANDROID) already builds with !HAVE(ACCESSIBILITY), but because
there are a few straggling references to objects in the
WebCore/accessibility directory, we end up pulling in a bunch of code
into the binary that we don't need.

This patch stubs out a few more functions for !HAVE(ACCESSIBILITY) so
we can link without any objects from WebCore/accessibility. This patch
also locks in that property by actually excluding the
WebCore/accessibility directory from the build on OS(ANDROID).

* WebCore.gyp/WebCore.gyp:
* accessibility/AXObjectCache.h:
(AXObjectCache):
(WebCore::AXObjectCache::enableAccessibility):
(WebCore::AXObjectCache::setEnhancedUserInterfaceAccessibility):
(WebCore::AXObjectCache::accessibilityEnabled):
(WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled):
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::get):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::rootObject):
(WebCore::AXObjectCache::rootObjectForFrame):
(WebCore::AXObjectCache::rootAXEditableElement):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::contentChanged):
(WebCore::AXObjectCache::detachWrapper):
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
(WebCore::AXObjectCache::handleScrolledToAnchor):
(WebCore::AXObjectCache::nodeTextChangeNotification):
(WebCore::AXObjectCache::nodeTextChangePlatformNotification):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::remove):
(WebCore::AXObjectCache::selectedChildrenChanged):
* accessibility/AccessibilityObject.h:
(WebCore):
(WebCore::AccessibilityObject::updateBackingStore):
(WebCore::AccessibilityObject::lineForPosition):
(WebCore::AccessibilityObject::children):

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AXObjectCache.h
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h

index 2c5735f..3ce403a 100644 (file)
@@ -1,3 +1,53 @@
+2012-05-21  Adam Barth  <abarth@webkit.org>
+
+        !HAVE(ACCESSIBILITY) should be able to build without linking in any code from WebCore/accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=87035
+
+        Reviewed by Chris Fleizach.
+
+        The OS(ANDROID) already builds with !HAVE(ACCESSIBILITY), but because
+        there are a few straggling references to objects in the
+        WebCore/accessibility directory, we end up pulling in a bunch of code
+        into the binary that we don't need.
+
+        This patch stubs out a few more functions for !HAVE(ACCESSIBILITY) so
+        we can link without any objects from WebCore/accessibility. This patch
+        also locks in that property by actually excluding the
+        WebCore/accessibility directory from the build on OS(ANDROID).
+
+        * WebCore.gyp/WebCore.gyp:
+        * accessibility/AXObjectCache.h:
+        (AXObjectCache):
+        (WebCore::AXObjectCache::enableAccessibility):
+        (WebCore::AXObjectCache::setEnhancedUserInterfaceAccessibility):
+        (WebCore::AXObjectCache::accessibilityEnabled):
+        (WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled):
+        (WebCore::AXObjectCache::AXObjectCache):
+        (WebCore::AXObjectCache::~AXObjectCache):
+        (WebCore::AXObjectCache::get):
+        (WebCore::AXObjectCache::getOrCreate):
+        (WebCore::AXObjectCache::rootObject):
+        (WebCore::AXObjectCache::rootObjectForFrame):
+        (WebCore::AXObjectCache::rootAXEditableElement):
+        (WebCore::AXObjectCache::childrenChanged):
+        (WebCore::AXObjectCache::contentChanged):
+        (WebCore::AXObjectCache::detachWrapper):
+        (WebCore::AXObjectCache::handleActiveDescendantChanged):
+        (WebCore::AXObjectCache::handleAriaRoleChanged):
+        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
+        (WebCore::AXObjectCache::handleScrolledToAnchor):
+        (WebCore::AXObjectCache::nodeTextChangeNotification):
+        (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
+        (WebCore::AXObjectCache::postNotification):
+        (WebCore::AXObjectCache::postPlatformNotification):
+        (WebCore::AXObjectCache::remove):
+        (WebCore::AXObjectCache::selectedChildrenChanged):
+        * accessibility/AccessibilityObject.h:
+        (WebCore):
+        (WebCore::AccessibilityObject::updateBackingStore):
+        (WebCore::AccessibilityObject::lineForPosition):
+        (WebCore::AccessibilityObject::children):
+
 2012-05-21  Andreas Kling  <kling@webkit.org>
 
         Use stack-allocated BitArray in StylePropertySet serialization.
index cf3ee93..ee1ca00 100644 (file)
             '<(chromium_src_dir)/build/linux/system.gyp:gtk',
           ],
         }],
+        ['OS=="android"', {
+          'sources/': [
+            ['exclude', 'accessibility/'],
+          ],
+        }],
         ['OS=="mac"', {
           'dependencies': [
             'webkit_system_interface',
index c0fb7d3..b028817 100644 (file)
@@ -27,6 +27,9 @@
  */
 
 #include "config.h"
+
+#if HAVE(ACCESSIBILITY)
+
 #include "AXObjectCache.h"
 
 #include "AccessibilityARIAGrid.h"
@@ -444,14 +447,12 @@ void AXObjectCache::removeAXID(AccessibilityObject* object)
     m_idsInUse.remove(objID);
 }
 
-#if HAVE(ACCESSIBILITY)
 void AXObjectCache::contentChanged(RenderObject* renderer)
 {
     AccessibilityObject* object = getOrCreate(renderer);
     if (object)
         object->contentChanged(); 
 }
-#endif
 
 void AXObjectCache::childrenChanged(RenderObject* renderer)
 {
@@ -491,7 +492,6 @@ void AXObjectCache::notificationPostTimerFired(Timer<AXObjectCache>*)
     m_notificationsToPost.clear();
 }
     
-#if HAVE(ACCESSIBILITY)
 void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
 {
     // Notifications for text input objects are sent to that object.
@@ -567,9 +567,6 @@ void AXObjectCache::frameLoadingEventNotification(Frame* frame, AXLoadingEvent l
     AccessibilityObject* obj = getOrCreate(contentRenderer);
     frameLoadingEventPlatformNotification(obj, loadingEvent);
 }
-#endif
-
-#if HAVE(ACCESSIBILITY)
 
 void AXObjectCache::handleScrollbarUpdate(ScrollView* view)
 {
@@ -608,7 +605,6 @@ void AXObjectCache::handleAriaRoleChanged(RenderObject* renderer)
     if (obj && obj->isAccessibilityRenderObject())
         static_cast<AccessibilityRenderObject*>(obj)->updateAccessibilityRole();
 }
-#endif
 
 VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData)
 {
@@ -695,3 +691,5 @@ bool AXObjectCache::nodeIsTextControl(const Node* node)
 }
 
 } // namespace WebCore
+
+#endif // HAVE(ACCESSIBILITY)
index 7dbe56d..e4fc195 100644 (file)
@@ -96,13 +96,20 @@ public:
     void handleScrolledToAnchor(const Node* anchorNode);
     void handleAriaExpandedChange(RenderObject*);
     void handleScrollbarUpdate(ScrollView*);
-    
+
+#if HAVE(ACCESSIBILITY)
     static void enableAccessibility() { gAccessibilityEnabled = true; }
     // Enhanced user interface accessibility can be toggled by the assistive technology.
     static void setEnhancedUserInterfaceAccessibility(bool flag) { gAccessibilityEnhancedUserInterfaceEnabled = flag; }
     
     static bool accessibilityEnabled() { return gAccessibilityEnabled; }
     static bool accessibilityEnhancedUserInterfaceEnabled() { return gAccessibilityEnhancedUserInterfaceEnabled; }
+#else
+    static void enableAccessibility() { }
+    static void setEnhancedUserInterfaceAccessibility(bool flag) { }
+    static bool accessibilityEnabled() { return false; }
+    static bool accessibilityEnhancedUserInterfaceEnabled() { return false; }
+#endif
 
     void removeAXID(AccessibilityObject*);
     bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
@@ -193,24 +200,41 @@ private:
 bool nodeHasRole(Node*, const String& role);
 
 #if !HAVE(ACCESSIBILITY)
-inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
-inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
-inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
+inline AXObjectCache::AXObjectCache(const Document*) : m_document(0), m_notificationPostTimer(this, 0) { }
+inline AXObjectCache::~AXObjectCache() { }
+inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return 0; }
+inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; }
+inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; }
+inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { return 0; }
+inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0; }
+inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; }
+inline AccessibilityObject* AXObjectCache::rootObject() { return 0; }
+inline AccessibilityObject* AXObjectCache::rootObjectForFrame(Frame*) { return 0; }
+inline Element* AXObjectCache::rootAXEditableElement(Node*) { return 0; }
+inline bool nodeHasRole(Node*, const String&) { return false; }
+inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
 inline void AXObjectCache::checkedStateChanged(RenderObject*) { }
-inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
-inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
-inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
-inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
-inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
-inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
+inline void AXObjectCache::childrenChanged(RenderObject*) { }
+inline void AXObjectCache::contentChanged(RenderObject*) { }
+inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
 inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
 inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
-inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
-inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
-inline void AXObjectCache::contentChanged(RenderObject*) { }
+inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
 inline void AXObjectCache::handleAriaExpandedChange(RenderObject*) { }
+inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
+inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
 inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
+inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
+inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
+inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
+inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
+inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
+inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
+inline void AXObjectCache::remove(AXID) { }
+inline void AXObjectCache::remove(RenderObject*) { }
+inline void AXObjectCache::remove(Widget*) { }
+inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
 #endif
 
 }
index 9441d53..8c5bd28 100644 (file)
@@ -87,7 +87,7 @@ void AccessibilityObject::detach()
 {
 #if HAVE(ACCESSIBILITY)
     setWrapper(0);
-#endif    
+#endif
 }
 
 bool AccessibilityObject::isAccessibilityObjectSearchMatch(AccessibilityObject* axObject, AccessibilitySearchCriteria* criteria)
@@ -1024,6 +1024,7 @@ AccessibilityObject* AccessibilityObject::accessibilityObjectForPosition(const V
     return obj->document()->axObjectCache()->getOrCreate(obj);
 }
 
+#if HAVE(ACCESSIBILITY)
 int AccessibilityObject::lineForPosition(const VisiblePosition& visiblePos) const
 {
     if (visiblePos.isNull() || !node())
@@ -1050,6 +1051,7 @@ int AccessibilityObject::lineForPosition(const VisiblePosition& visiblePos) cons
 
     return lineCount;
 }
+#endif
 
 // NOTE: Consider providing this utility method as AX API
 PlainTextRange AccessibilityObject::plainTextRangeForVisiblePositionRange(const VisiblePositionRange& positionRange) const
@@ -1091,13 +1093,15 @@ unsigned AccessibilityObject::doAXLineForIndex(unsigned index)
 {
     return lineForPosition(visiblePositionForIndex(index, false));
 }
-    
+
+#if HAVE(ACCESSIBILITY)
 void AccessibilityObject::updateBackingStore()
 {
     // Updating the layout may delete this object.
     if (Document* document = this->document())
         document->updateLayoutIgnorePendingStylesheets();
 }
+#endif
 
 Document* AccessibilityObject::document() const
 {
@@ -1128,13 +1132,15 @@ FrameView* AccessibilityObject::documentFrameView() const
     return object->documentFrameView();
 }
 
+#if HAVE(ACCESSIBILITY)
 const AccessibilityObject::AccessibilityChildrenVector& AccessibilityObject::children()
 {
     updateChildrenIfNecessary();
-    
+
     return m_children;
 }
-    
+#endif
+
 void AccessibilityObject::updateChildrenIfNecessary()
 {
     if (!hasChildren())
index 2e30f06..91b0e52 100644 (file)
@@ -731,6 +731,12 @@ protected:
 #endif
 };
 
+#if !HAVE(ACCESSIBILITY)
+inline void AccessibilityObject::updateBackingStore() { }
+inline int AccessibilityObject::lineForPosition(const VisiblePosition&) const { return -1; }
+inline const AccessibilityObject::AccessibilityChildrenVector& AccessibilityObject::children() { return m_children; }
+#endif
+
 } // namespace WebCore
 
 #endif // AccessibilityObject_h