Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2537)

Unified Diff: WebCore/accessibility/AccessibilityRenderObject.cpp

Issue 3176001: Merge 65095 - Removing an element from an anonymous block causes crash... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/WebKit/472/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/accessibility/AccessibilityRenderObject.cpp
===================================================================
--- WebCore/accessibility/AccessibilityRenderObject.cpp (revision 55630)
+++ WebCore/accessibility/AccessibilityRenderObject.cpp (working copy)
@@ -343,10 +343,10 @@
else if (isInlineWithContinuation(m_renderer->parent())) {
RenderObject* continuation = toRenderInline(m_renderer->parent())->continuation();
- // Case 4a: continuation is a block - in this case the block itself is the next sibling.
+ // Case 5a: continuation is a block - in this case the block itself is the next sibling.
if (continuation->isRenderBlock())
nextSibling = continuation;
- // Case 4b: continuation is an inline - in this case the inline's first child is the next sibling
+ // Case 5b: continuation is an inline - in this case the inline's first child is the next sibling
else
nextSibling = firstChildConsideringContinuation(continuation);
}
@@ -357,6 +357,13 @@
return m_renderer->document()->axObjectCache()->getOrCreate(nextSibling);
}
+static RenderBoxModelObject* nextContinuation(RenderObject* renderer)
+{
+ if (renderer->isInline() && !renderer->isReplaced())
+ return toRenderInline(renderer)->continuation();
+ return toRenderBlock(renderer)->inlineElementContinuation();
+}
+
AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const
{
if (!m_renderer)
@@ -367,6 +374,7 @@
// Case 1: node is a block and is an inline's continuation. Parent
// is the start of the continuation chain.
RenderInline* startOfConts = 0;
+ RenderObject* firstChild = 0;
if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer)))
parent = startOfConts;
@@ -375,6 +383,20 @@
else if (parent && parent->isRenderInline() && (startOfConts = startOfContinuations(parent)))
parent = startOfConts;
+ // Case 3: The first sibling is the beginning of a continuation chain. Find the origin of that continuation.
+ else if (parent && (firstChild = parent->firstChild()) && firstChild->node()) {
+ // Get the node's renderer and follow that continuation chain until the first child is found
+ RenderObject* nodeRenderFirstChild = firstChild->node()->renderer();
+ if (nodeRenderFirstChild != firstChild) {
+ for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; contsTest = nextContinuation(contsTest)) {
+ if (contsTest == firstChild) {
+ parent = nodeRenderFirstChild->parent();
+ break;
+ }
+ }
+ }
+ }
+
if (!parent)
return 0;
@@ -3286,8 +3308,10 @@
unsigned length = children.size();
for (unsigned i = 0; i < length; ++i)
m_children.append(children[i]);
- } else
+ } else {
+ ASSERT(obj->renderParentObject() == this);
m_children.append(obj);
+ }
}
// for a RenderImage, add the <area> elements as individual accessibility objects
« no previous file with comments | « WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698