OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 return axObjectCache()->getOrCreate(firstChild); | 1371 return axObjectCache()->getOrCreate(firstChild); |
1372 } | 1372 } |
1373 | 1373 |
1374 AXObject* AXRenderObject::nextSibling() const | 1374 AXObject* AXRenderObject::nextSibling() const |
1375 { | 1375 { |
1376 if (!m_renderer) | 1376 if (!m_renderer) |
1377 return 0; | 1377 return 0; |
1378 | 1378 |
1379 RenderObject* nextSibling = 0; | 1379 RenderObject* nextSibling = 0; |
1380 | 1380 |
1381 RenderInline* inlineContinuation; | 1381 RenderInline* inlineContinuation = m_renderer->isRenderBlock() ? toRenderBlo
ck(m_renderer)->inlineElementContinuation() : 0; |
1382 if (m_renderer->isRenderBlock() && (inlineContinuation = toRenderBlock(m_ren
derer)->inlineElementContinuation())) { | 1382 if (inlineContinuation) { |
1383 // Case 1: node is a block and has an inline continuation. Next sibling
is the inline continuation's first child. | 1383 // Case 1: node is a block and has an inline continuation. Next sibling
is the inline continuation's first child. |
1384 nextSibling = firstChildConsideringContinuation(inlineContinuation); | 1384 nextSibling = firstChildConsideringContinuation(inlineContinuation); |
1385 } else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_rend
erer)) { | 1385 } else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_rend
erer)) { |
1386 // Case 2: Anonymous block parent of the start of a continuation - skip
all the way to | 1386 // Case 2: Anonymous block parent of the start of a continuation - skip
all the way to |
1387 // after the parent of the end, since everything in between will be link
ed up via the continuation. | 1387 // after the parent of the end, since everything in between will be link
ed up via the continuation. |
1388 RenderObject* lastParent = endOfContinuations(toRenderBlock(m_renderer)-
>lastChild())->parent(); | 1388 RenderObject* lastParent = endOfContinuations(toRenderBlock(m_renderer)-
>lastChild())->parent(); |
1389 while (lastChildHasContinuation(lastParent)) | 1389 while (lastChildHasContinuation(lastParent)) |
1390 lastParent = endOfContinuations(lastParent->slowLastChild())->parent
(); | 1390 lastParent = endOfContinuations(lastParent->slowLastChild())->parent
(); |
1391 nextSibling = lastParent->nextSibling(); | 1391 nextSibling = lastParent->nextSibling(); |
1392 } else if (RenderObject* ns = m_renderer->nextSibling()) { | 1392 } else if (RenderObject* ns = m_renderer->nextSibling()) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 return true; | 1946 return true; |
1947 | 1947 |
1948 return false; | 1948 return false; |
1949 } | 1949 } |
1950 | 1950 |
1951 RenderObject* AXRenderObject::renderParentObject() const | 1951 RenderObject* AXRenderObject::renderParentObject() const |
1952 { | 1952 { |
1953 if (!m_renderer) | 1953 if (!m_renderer) |
1954 return 0; | 1954 return 0; |
1955 | 1955 |
1956 RenderObject* parent = m_renderer->parent(); | 1956 RenderObject* startOfConts = m_renderer->isRenderBlock() ? startOfContinuati
ons(m_renderer) : 0; |
1957 | 1957 if (startOfConts) { |
1958 RenderObject* startOfConts = 0; | |
1959 RenderObject* firstChild = 0; | |
1960 if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_re
nderer))) { | |
1961 // Case 1: node is a block and is an inline's continuation. Parent | 1958 // Case 1: node is a block and is an inline's continuation. Parent |
1962 // is the start of the continuation chain. | 1959 // is the start of the continuation chain. |
1963 parent = startOfConts; | 1960 return startOfConts; |
1964 } else if (parent && parent->isRenderInline() && (startOfConts = startOfCont
inuations(parent))) { | 1961 } |
| 1962 |
| 1963 RenderObject* parent = m_renderer->parent(); |
| 1964 startOfConts = parent && parent->isRenderInline() ? startOfContinuations(par
ent) : 0; |
| 1965 if (startOfConts) { |
1965 // Case 2: node's parent is an inline which is some node's continuation;
parent is | 1966 // Case 2: node's parent is an inline which is some node's continuation;
parent is |
1966 // the earliest node in the continuation chain. | 1967 // the earliest node in the continuation chain. |
1967 parent = startOfConts; | 1968 return startOfConts; |
1968 } else if (parent && (firstChild = parent->slowFirstChild()) && firstChild->
node()) { | 1969 } |
| 1970 |
| 1971 RenderObject* firstChild = parent ? parent->slowFirstChild() : 0; |
| 1972 if (firstChild && firstChild->node()) { |
1969 // Case 3: The first sibling is the beginning of a continuation chain. F
ind the origin of that continuation. | 1973 // Case 3: The first sibling is the beginning of a continuation chain. F
ind the origin of that continuation. |
1970 // Get the node's renderer and follow that continuation chain until the
first child is found. | 1974 // Get the node's renderer and follow that continuation chain until the
first child is found. |
1971 RenderObject* nodeRenderFirstChild = firstChild->node()->renderer(); | 1975 for (RenderObject* nodeRenderFirstChild = firstChild->node()->renderer()
; nodeRenderFirstChild != firstChild; nodeRenderFirstChild = firstChild->node()-
>renderer()) { |
1972 while (nodeRenderFirstChild != firstChild) { | |
1973 for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; cont
sTest = nextContinuation(contsTest)) { | 1976 for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; cont
sTest = nextContinuation(contsTest)) { |
1974 if (contsTest == firstChild) { | 1977 if (contsTest == firstChild) { |
1975 parent = nodeRenderFirstChild->parent(); | 1978 parent = nodeRenderFirstChild->parent(); |
1976 break; | 1979 break; |
1977 } | 1980 } |
1978 } | 1981 } |
1979 RenderObject* newFirstChild = parent->slowFirstChild(); | 1982 RenderObject* newFirstChild = parent->slowFirstChild(); |
1980 if (firstChild == newFirstChild) | 1983 if (firstChild == newFirstChild) |
1981 break; | 1984 break; |
1982 firstChild = newFirstChild; | 1985 firstChild = newFirstChild; |
1983 if (!firstChild->node()) | 1986 if (!firstChild->node()) |
1984 break; | 1987 break; |
1985 nodeRenderFirstChild = firstChild->node()->renderer(); | |
1986 } | 1988 } |
1987 } | 1989 } |
1988 | 1990 |
1989 return parent; | 1991 return parent; |
1990 } | 1992 } |
1991 | 1993 |
1992 bool AXRenderObject::isDescendantOfElementType(const QualifiedName& tagName) con
st | 1994 bool AXRenderObject::isDescendantOfElementType(const QualifiedName& tagName) con
st |
1993 { | 1995 { |
1994 for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->p
arent()) { | 1996 for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->p
arent()) { |
1995 if (parent->node() && parent->node()->hasTagName(tagName)) | 1997 if (parent->node() && parent->node()->hasTagName(tagName)) |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 if (label && label->renderer()) { | 2314 if (label && label->renderer()) { |
2313 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2315 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2314 result.unite(labelRect); | 2316 result.unite(labelRect); |
2315 } | 2317 } |
2316 } | 2318 } |
2317 | 2319 |
2318 return result; | 2320 return result; |
2319 } | 2321 } |
2320 | 2322 |
2321 } // namespace WebCore | 2323 } // namespace WebCore |
OLD | NEW |