AXObjectCache gets recreated during document tear-down.
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Mar 2013 07:37:37 +0000 (07:37 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Mar 2013 07:37:37 +0000 (07:37 +0000)
commit33592bb748306f876c92f169bbb32cf012bd590c
tree7b876eaf5f7c71953bff3675bd9c9dd09190cbda
parent506f51d13c7f5e90a3d4ac98a630057e2dc7b6c7
AXObjectCache gets recreated during document tear-down.
https://bugs.webkit.org/show_bug.cgi?id=112525

Reviewed by Simon Fraser.

In many cases, a document's AXObjectCache was being created after the
document had detached, which is wasteful and could potentially lead to
crashes because the AXObjectCache has a timer and relies on its document
to exist.

This patch provides a way to get the existing AX object cache, instead of
always creating a new one.
It moves the accessibilityEnabled() checks into the axObjectCache retrieval
for easier readability.
It adds a number of ASSERTs to vieryf that only the correct (top) document is used
for cache manipulation.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::stopCachingComputedObjectAttributes):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::~ContainerNode):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::clearAXObjectCache):
(WebCore::Document::existingAXObjectCache):
(WebCore::Document::axObjectCache):
(WebCore::Document::setFocusedNode):
* dom/Document.h:
(Document):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::Node::isEditableToAccessibility):
(WebCore::Node::attach):
(WebCore::Node::rootEditableElement):
(WebCore::Node::didMoveToNewDocument):
* editing/AppendNodeCommand.cpp:
(WebCore::sendAXTextChangedIgnoringLineBreaks):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doApply):
(WebCore::DeleteFromTextNodeCommand::doUnapply):
* editing/Editor.cpp:
(WebCore::Editor::respondToChangedContents):
(WebCore::Editor::markAndReplaceFor):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/atk/FrameSelectionAtk.cpp:
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* editing/chromium/FrameSelectionChromium.cpp:
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* editing/mac/FrameSelectionMac.mm:
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::optionElementChildrenChanged):
(WebCore::HTMLSelectElement::setRecalcListItems):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue):
* html/InputType.cpp:
(WebCore::InputType::applyStep):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::prepareForLoadStart):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* page/FocusController.cpp:
(WebCore::FocusController::setInitialFocus):
* page/Frame.cpp:
(WebCore::Frame::disconnectOwnerElement):
* page/FrameView.cpp:
(WebCore::FrameView::removeFromAXObjectCache):
(WebCore::FrameView::layout):
(WebCore::FrameView::scrollToAnchor):
(WebCore::FrameView::axObjectCache):
* platform/ScrollView.cpp:
(WebCore::ScrollView::setHasHorizontalScrollbar):
(WebCore::ScrollView::setHasVerticalScrollbar):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::~Scrollbar):
(WebCore):
(WebCore::Scrollbar::existingAXObjectCache):
* platform/Scrollbar.h:
(Scrollbar):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::deleteLineBoxTree):
(WebCore::RenderBlock::createRootInlineBox):
(WebCore::RenderBlock::createAndAppendRootInlineBox):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::selectionChanged):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::addChild):
(WebCore::RenderMenuList::didUpdateActiveOption):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::styleWillChange):
(WebCore::RenderObject::willBeDestroyed):
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::removeChildNode):
(WebCore::RenderObjectChildList::insertChildNode):
* rendering/RenderText.cpp:
(WebCore::RenderText::setText):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::willBeDestroyed):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@146726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/editing/AppendNodeCommand.cpp
Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
Source/WebCore/editing/InsertNodeBeforeCommand.cpp
Source/WebCore/editing/atk/FrameSelectionAtk.cpp
Source/WebCore/editing/chromium/FrameSelectionChromium.cpp
Source/WebCore/editing/mac/FrameSelectionMac.mm
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/FocusController.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/Scrollbar.cpp
Source/WebCore/platform/Scrollbar.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObjectChildList.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderWidget.cpp