Commit 2904f97b authored by jhoneycutt@apple.com's avatar jhoneycutt@apple.com

2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>

        Reviewed by Darin.

        Return an AccessibleDocument when our root accessible object is queried
        for.

        * AccessibleDocument.cpp: Added; represents an AccessibilityObject that
        itself represents a Document.
        (AccessibleDocument::AccessibleDocument): Initialize AccessibleBase with
        the AccessibilityObject for this Document.
        * AccessibleDocument.h: Added.
        * WebFrame.cpp:
        (WebFrame::accessible): If m_accessible is 0, or if Document in this
        frame does not match the Document in the cached m_accessible object,
        create a new AccessibleDocument for this frame's Document.
        * WebFrame.h: Swap AccessibleBase.h for AccessibleDocument.h
        * WebKit.vcproj/WebKit.vcproj: Add AccessibleDocument.{h,cpp}


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e4276d16
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "AccessibleDocument.h"
#include <WebCore/AXObjectCache.h>
#include <WebCore/Document.h>
#include <WebCore/RenderObject.h>
using namespace WebCore;
// AccessibleDocument
AccessibleDocument::AccessibleDocument(Document* doc)
: AccessibleBase(doc->axObjectCache()->get(doc->renderer()))
{
}
Document* AccessibleDocument::document() const
{
if (!m_object)
return 0;
return m_object->renderer()->document();
}
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AccessibleDocument_h
#define AccessibleDocument_h
#include "AccessibleBase.h"
#include "WebKit.h"
using WebCore::Document;
class AccessibleDocument : public AccessibleBase {
public:
AccessibleDocument(Document*);
Document* document() const;
};
#endif // AccessibleDocument_h
2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by Darin.
Return an AccessibleDocument when our root accessible object is queried
for.
* AccessibleDocument.cpp: Added; represents an AccessibilityObject that
itself represents a Document.
(AccessibleDocument::AccessibleDocument): Initialize AccessibleBase with
the AccessibilityObject for this Document.
* AccessibleDocument.h: Added.
* WebFrame.cpp:
(WebFrame::accessible): If m_accessible is 0, or if Document in this
frame does not match the Document in the cached m_accessible object,
create a new AccessibleDocument for this frame's Document.
* WebFrame.h: Swap AccessibleBase.h for AccessibleDocument.h
* WebKit.vcproj/WebKit.vcproj: Add AccessibleDocument.{h,cpp}
2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by Darin.
......
......@@ -1909,6 +1909,19 @@ WebView* WebFrame::webView() const
COMPtr<IAccessible> WebFrame::accessible() const
{
return 0;
Frame* coreFrame = core(this);
ASSERT(coreFrame);
Document* currentDocument = coreFrame->document();
if (!currentDocument)
m_accessible = 0;
else if (!m_accessible || m_accessible->document() != currentDocument) {
// Either we've never had a wrapper for this frame's top-level Document,
// the Document renderer was destroyed and its wrapper was detached, or
// the previous Document is in the page cache, and the current document
// needs to be wrapped.
m_accessible = new AccessibleDocument(currentDocument);
}
return m_accessible.get();
}
......@@ -31,6 +31,8 @@
#include "WebKit.h"
#include "WebDataSource.h"
#include "AccessibleDocument.h"
#pragma warning(push, 0)
#include <WebCore/FrameWin.h>
#include <WebCore/KURL.h>
......@@ -38,7 +40,6 @@
#include <WebCore/ResourceHandleClient.h>
#pragma warning(pop)
#include <oleacc.h>
#include <WTF/RefPtr.h>
#include <WTF/HashMap.h>
#include <WTF/OwnPtr.h>
......@@ -315,6 +316,7 @@ protected:
bool m_inPrintingMode;
Vector<WebCore::IntRect> m_pageRects;
int m_pageHeight; // height of the page adjusted by margins
mutable COMPtr<AccessibleDocument> m_accessible;
};
#endif
......@@ -598,6 +598,10 @@
RelativePath="..\AccessibleBase.h"
>
</File>
<File
RelativePath="..\AccessibleDocument.h"
>
</File>
<File
RelativePath=".\autoversion.h"
>
......@@ -862,6 +866,10 @@
RelativePath="..\AccessibleBase.cpp"
>
</File>
<File
RelativePath="..\AccessibleDocument.cpp"
>
</File>
<File
RelativePath="..\CFDictionaryPropertyBag.cpp"
>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment