[webkit-changes] cvs commit: WebCore/kwq KWQAccObject.mm

David harrison at opensource.apple.com
Tue Nov 29 14:14:09 PST 2005


harrison    05/11/29 14:14:09

  Modified:    .        ChangeLog
               kwq      KWQAccObject.mm
  Log:
          Reviewed by John Sullivan.
  
          Test cases added: None.  Manual testing is way to awkward, and automated testing
          is not possible.  See following bug...
          <rdar://problem/4256882> Need automated testing support for accessibility APIs
  
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLGenericFormElementImpl::removedFromTree):
  	Replace tab with spaces.  Remove braces from one line "if".
          * kwq/KWQAccObject.mm:
          (-[KWQAccObject detach]):
  	Send unregisterUniqueIdForUIElement unconditionally, for safety.
          (-[KWQAccObject dealloc]):
  	New.  Send [self detach] so KWQObject gets unregistered and other cleanup happens as well.
          (CreateCGColorIfDifferent):
  	Replace tab with spaces.
          (-[KWQAccObject removeAccObjectID]):
  	Early to prevent a crash if called on a detached KWQAccObject (i.e. m_renderer == 0).
  
  Revision  Changes    Path
  1.431     +21 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.430
  retrieving revision 1.431
  diff -u -r1.430 -r1.431
  --- ChangeLog	29 Nov 2005 19:55:39 -0000	1.430
  +++ ChangeLog	29 Nov 2005 22:14:05 -0000	1.431
  @@ -1,3 +1,24 @@
  +2005-11-29  David Harrison  <harrison at apple.com>
  +
  +        Reviewed by John Sullivan.
  +
  +        Test cases added: None.  Manual testing is way to awkward, and automated testing
  +        is not possible.  See following bug...
  +        <rdar://problem/4256882> Need automated testing support for accessibility APIs
  +
  +        * khtml/html/html_formimpl.cpp:
  +        (DOM::HTMLGenericFormElementImpl::removedFromTree):
  +	Replace tab with spaces.  Remove braces from one line "if".
  +        * kwq/KWQAccObject.mm:
  +        (-[KWQAccObject detach]):
  +	Send unregisterUniqueIdForUIElement unconditionally, for safety.
  +        (-[KWQAccObject dealloc]):
  +	New.  Send [self detach] so KWQObject gets unregistered and other cleanup happens as well.
  +        (CreateCGColorIfDifferent):
  +	Replace tab with spaces.
  +        (-[KWQAccObject removeAccObjectID]):
  +	Early to prevent a crash if called on a detached KWQAccObject (i.e. m_renderer == 0).
  +
   2005-11-29  Vicki Murley  <vicki at apple.com>
   
   	Changes by Mitz Pettel, reviewed by Maciej.
  
  
  
  1.87      +22 -4     WebCore/kwq/KWQAccObject.mm
  
  Index: KWQAccObject.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQAccObject.mm,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- KWQAccObject.mm	11 Nov 2005 00:24:01 -0000	1.86
  +++ KWQAccObject.mm	29 Nov 2005 22:14:09 -0000	1.87
  @@ -118,14 +118,24 @@
       return !m_renderer;
   }
   
  +// accessibilityShouldUseUniqueId is an AppKit method we override so that the canvas
  +// objects will be given a unique ID, and therefore allow AppKit to know when they
  +// become obsolete (e.g. when the user navigates to a new web page, making this one
  +// unrendered but not deallocated because it is in the back/forward cache).
  +// It is important to call NSAccessibilityUnregisterUniqueIdForUIElement in the
  +// appropriate place (e.g. dealloc) to remove these non-retained references from
  +// AppKit's id mapping tables.
   - (BOOL)accessibilityShouldUseUniqueId {
       return m_renderer && m_renderer->isCanvas();
   }
   
   -(void)detach
   {
  -    if ([self accessibilityShouldUseUniqueId])
  -        [[WebCoreViewFactory sharedFactory] unregisterUniqueIdForUIElement:self];
  +    // Send unregisterUniqueIdForUIElement unconditionally because if it is
  +    // ever accidently not done (via other bugs in our AX implementation) you
  +    // end up with a crash like <rdar://problem/4273149>.  It is safe and not
  +    // expensive to send even if the object is not registered.
  +    [[WebCoreViewFactory sharedFactory] unregisterUniqueIdForUIElement:self];
       [m_data release];
       m_data = 0;
       [self removeAccObjectID];
  @@ -133,6 +143,12 @@
       [self clearChildren];
   }
   
  +- (void)dealloc
  +{
  +    [self detach];
  +    [super dealloc];
  +}
  +
   -(id)data
   {
       return m_data;
  @@ -1184,9 +1200,8 @@
   {
       // get color information assuming NSDeviceRGBColorSpace 
       NSColor *rgbColor = [nsColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
  -    if (rgbColor == nil) {
  +    if (rgbColor == nil)
   	rgbColor = [NSColor blackColor];
  -    }
       float components[4];
       [rgbColor getRed:&components[0] green:&components[1] blue:&components[2] alpha:&components[3]];
       
  @@ -1975,6 +1990,9 @@
   
   - (void)removeAccObjectID
   {
  +    if (!m_accObjectID)
  +        return;
  +
       m_renderer->document()->getAccObjectCache()->removeAccObjectID(self);
   }
   
  
  
  



More information about the webkit-changes mailing list