| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return firstChild; | 128 return firstChild; |
| 129 } | 129 } |
| 130 | 130 |
| 131 static inline LayoutInline* startOfContinuations(LayoutObject* r) | 131 static inline LayoutInline* startOfContinuations(LayoutObject* r) |
| 132 { | 132 { |
| 133 if (r->isInlineElementContinuation()) { | 133 if (r->isInlineElementContinuation()) { |
| 134 return toLayoutInline(r->node()->layoutObject()); | 134 return toLayoutInline(r->node()->layoutObject()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Blocks with a previous continuation always have a next continuation | 137 // Blocks with a previous continuation always have a next continuation |
| 138 if (r->isLayoutBlock() && toLayoutBlock(r)->inlineElementContinuation()) | 138 if (r->isLayoutBlockFlow() && toLayoutBlockFlow(r)->inlineElementContinuatio
n()) |
| 139 return toLayoutInline(toLayoutBlock(r)->inlineElementContinuation()->nod
e()->layoutObject()); | 139 return toLayoutInline(toLayoutBlockFlow(r)->inlineElementContinuation()-
>node()->layoutObject()); |
| 140 | 140 |
| 141 return 0; | 141 return 0; |
| 142 } | 142 } |
| 143 | 143 |
| 144 static inline LayoutObject* endOfContinuations(LayoutObject* layoutObject) | 144 static inline LayoutObject* endOfContinuations(LayoutObject* layoutObject) |
| 145 { | 145 { |
| 146 LayoutObject* prev = layoutObject; | 146 LayoutObject* prev = layoutObject; |
| 147 LayoutObject* cur = layoutObject; | 147 LayoutObject* cur = layoutObject; |
| 148 | 148 |
| 149 if (!cur->isLayoutInline() && !cur->isLayoutBlock()) | 149 if (!cur->isLayoutInline() && !cur->isLayoutBlockFlow()) |
| 150 return layoutObject; | 150 return layoutObject; |
| 151 | 151 |
| 152 while (cur) { | 152 while (cur) { |
| 153 prev = cur; | 153 prev = cur; |
| 154 if (cur->isLayoutInline()) { | 154 if (cur->isLayoutInline()) { |
| 155 cur = toLayoutInline(cur)->inlineElementContinuation(); | 155 cur = toLayoutInline(cur)->inlineElementContinuation(); |
| 156 ASSERT(cur || !toLayoutInline(prev)->continuation()); | 156 ASSERT(cur || !toLayoutInline(prev)->continuation()); |
| 157 } else { | 157 } else { |
| 158 cur = toLayoutBlock(cur)->inlineElementContinuation(); | 158 cur = toLayoutBlockFlow(cur)->inlineElementContinuation(); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 return prev; | 162 return prev; |
| 163 } | 163 } |
| 164 | 164 |
| 165 static inline bool lastChildHasContinuation(LayoutObject* layoutObject) | 165 static inline bool lastChildHasContinuation(LayoutObject* layoutObject) |
| 166 { | 166 { |
| 167 LayoutObject* lastChild = layoutObject->slowLastChild(); | 167 LayoutObject* lastChild = layoutObject->slowLastChild(); |
| 168 return lastChild && isInlineWithContinuation(lastChild); | 168 return lastChild && isInlineWithContinuation(lastChild); |
| 169 } | 169 } |
| 170 | 170 |
| 171 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) | 171 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) |
| 172 { | 172 { |
| 173 ASSERT(layoutObject); | 173 ASSERT(layoutObject); |
| 174 if (layoutObject->isLayoutInline() && !layoutObject->isAtomicInlineLevel()) | 174 if (layoutObject->isLayoutInline() && !layoutObject->isAtomicInlineLevel()) |
| 175 return toLayoutInline(layoutObject)->continuation(); | 175 return toLayoutInline(layoutObject)->continuation(); |
| 176 if (layoutObject->isLayoutBlock()) | 176 if (layoutObject->isLayoutBlockFlow()) |
| 177 return toLayoutBlock(layoutObject)->inlineElementContinuation(); | 177 return toLayoutBlockFlow(layoutObject)->inlineElementContinuation(); |
| 178 return 0; | 178 return 0; |
| 179 } | 179 } |
| 180 | 180 |
| 181 AXLayoutObject::AXLayoutObject(LayoutObject* layoutObject, AXObjectCacheImpl& ax
ObjectCache) | 181 AXLayoutObject::AXLayoutObject(LayoutObject* layoutObject, AXObjectCacheImpl& ax
ObjectCache) |
| 182 : AXNodeObject(layoutObject->node(), axObjectCache) | 182 : AXNodeObject(layoutObject->node(), axObjectCache) |
| 183 , m_layoutObject(layoutObject) | 183 , m_layoutObject(layoutObject) |
| 184 , m_cachedElementRectDirty(true) | 184 , m_cachedElementRectDirty(true) |
| 185 { | 185 { |
| 186 #if ENABLE(ASSERT) | 186 #if ENABLE(ASSERT) |
| 187 m_layoutObject->setHasAXObject(true); | 187 m_layoutObject->setHasAXObject(true); |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 return axObjectCache().getOrCreate(firstChild); | 1538 return axObjectCache().getOrCreate(firstChild); |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 AXObject* AXLayoutObject::rawNextSibling() const | 1541 AXObject* AXLayoutObject::rawNextSibling() const |
| 1542 { | 1542 { |
| 1543 if (!m_layoutObject) | 1543 if (!m_layoutObject) |
| 1544 return 0; | 1544 return 0; |
| 1545 | 1545 |
| 1546 LayoutObject* nextSibling = 0; | 1546 LayoutObject* nextSibling = 0; |
| 1547 | 1547 |
| 1548 LayoutInline* inlineContinuation = m_layoutObject->isLayoutBlock() ? toLayou
tBlock(m_layoutObject)->inlineElementContinuation() : 0; | 1548 LayoutInline* inlineContinuation = m_layoutObject->isLayoutBlockFlow() ? toL
ayoutBlockFlow(m_layoutObject)->inlineElementContinuation() : nullptr; |
| 1549 if (inlineContinuation) { | 1549 if (inlineContinuation) { |
| 1550 // Case 1: node is a block and has an inline continuation. Next sibling
is the inline continuation's first child. | 1550 // Case 1: node is a block and has an inline continuation. Next sibling
is the inline continuation's first child. |
| 1551 nextSibling = firstChildConsideringContinuation(inlineContinuation); | 1551 nextSibling = firstChildConsideringContinuation(inlineContinuation); |
| 1552 } else if (m_layoutObject->isAnonymousBlock() && lastChildHasContinuation(m_
layoutObject)) { | 1552 } else if (m_layoutObject->isAnonymousBlock() && lastChildHasContinuation(m_
layoutObject)) { |
| 1553 // Case 2: Anonymous block parent of the start of a continuation - skip
all the way to | 1553 // Case 2: Anonymous block parent of the start of a continuation - skip
all the way to |
| 1554 // after the parent of the end, since everything in between will be link
ed up via the continuation. | 1554 // after the parent of the end, since everything in between will be link
ed up via the continuation. |
| 1555 LayoutObject* lastParent = endOfContinuations(toLayoutBlock(m_layoutObje
ct)->lastChild())->parent(); | 1555 LayoutObject* lastParent = endOfContinuations(toLayoutBlock(m_layoutObje
ct)->lastChild())->parent(); |
| 1556 while (lastChildHasContinuation(lastParent)) | 1556 while (lastChildHasContinuation(lastParent)) |
| 1557 lastParent = endOfContinuations(lastParent->slowLastChild())->parent
(); | 1557 lastParent = endOfContinuations(lastParent->slowLastChild())->parent
(); |
| 1558 nextSibling = lastParent->nextSibling(); | 1558 nextSibling = lastParent->nextSibling(); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 return 0; | 2208 return 0; |
| 2209 } | 2209 } |
| 2210 | 2210 |
| 2211 LayoutObject* AXLayoutObject::layoutParentObject() const | 2211 LayoutObject* AXLayoutObject::layoutParentObject() const |
| 2212 { | 2212 { |
| 2213 if (!m_layoutObject) | 2213 if (!m_layoutObject) |
| 2214 return 0; | 2214 return 0; |
| 2215 | 2215 |
| 2216 LayoutObject* startOfConts = m_layoutObject->isLayoutBlock() ? startOfContin
uations(m_layoutObject) : 0; | 2216 LayoutObject* startOfConts = m_layoutObject->isLayoutBlockFlow() ? startOfCo
ntinuations(m_layoutObject) : nullptr; |
| 2217 if (startOfConts) { | 2217 if (startOfConts) { |
| 2218 // Case 1: node is a block and is an inline's continuation. Parent | 2218 // Case 1: node is a block and is an inline's continuation. Parent |
| 2219 // is the start of the continuation chain. | 2219 // is the start of the continuation chain. |
| 2220 return startOfConts; | 2220 return startOfConts; |
| 2221 } | 2221 } |
| 2222 | 2222 |
| 2223 LayoutObject* parent = m_layoutObject->parent(); | 2223 LayoutObject* parent = m_layoutObject->parent(); |
| 2224 startOfConts = parent && parent->isLayoutInline() ? startOfContinuations(par
ent) : 0; | 2224 startOfConts = parent && parent->isLayoutInline() ? startOfContinuations(par
ent) : 0; |
| 2225 if (startOfConts) { | 2225 if (startOfConts) { |
| 2226 // Case 2: node's parent is an inline which is some node's continuation;
parent is | 2226 // Case 2: node's parent is an inline which is some node's continuation;
parent is |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 if (label && label->layoutObject()) { | 2471 if (label && label->layoutObject()) { |
| 2472 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2472 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2473 result.unite(labelRect); | 2473 result.unite(labelRect); |
| 2474 } | 2474 } |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 return result; | 2477 return result; |
| 2478 } | 2478 } |
| 2479 | 2479 |
| 2480 } // namespace blink | 2480 } // namespace blink |
| OLD | NEW |