OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3172 ASSERT(m_node); | 3172 ASSERT(m_node); |
3173 | 3173 |
3174 // Image change notifications should not be received during paint because | 3174 // Image change notifications should not be received during paint because |
3175 // the resulting invalidations will be cleared following paint. This can als o | 3175 // the resulting invalidations will be cleared following paint. This can als o |
3176 // lead to modifying the tree out from under paint(), see: crbug.com/616700. | 3176 // lead to modifying the tree out from under paint(), see: crbug.com/616700. |
3177 DCHECK(document().lifecycle().state() != DocumentLifecycle::LifecycleState:: InPaint); | 3177 DCHECK(document().lifecycle().state() != DocumentLifecycle::LifecycleState:: InPaint); |
3178 | 3178 |
3179 imageChanged(static_cast<WrappedImagePtr>(image), rect); | 3179 imageChanged(static_cast<WrappedImagePtr>(image), rect); |
3180 } | 3180 } |
3181 | 3181 |
3182 Element* LayoutObject::offsetParent() const | 3182 Element* LayoutObject::offsetParent(const Element* unclosedBase) const |
3183 { | 3183 { |
3184 if (isDocumentElement() || isBody()) | 3184 if (isDocumentElement() || isBody()) |
3185 return nullptr; | 3185 return nullptr; |
3186 | 3186 |
3187 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) | 3187 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) |
3188 return nullptr; | 3188 return nullptr; |
3189 | 3189 |
3190 float effectiveZoom = style()->effectiveZoom(); | 3190 float effectiveZoom = style()->effectiveZoom(); |
3191 Node* node = nullptr; | 3191 Node* node = nullptr; |
3192 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { | 3192 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { |
3193 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes | 3193 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes |
3194 | 3194 |
3195 node = ancestor->node(); | 3195 node = ancestor->node(); |
3196 | 3196 |
3197 if (!node) | 3197 if (!node) |
3198 continue; | 3198 continue; |
3199 | 3199 |
3200 // TODO(kochi): If |unclosedBase| or |node| is nested deep in shadow roo ts, this loop may | |
3201 // get expensive, as isUnclosedNodeOf() can take up to O(N+M) time (N an d M are depths). | |
3202 if (unclosedBase && (!node->isUnclosedNodeOf(*unclosedBase) || (node->is InShadowTree() && node->containingShadowRoot()->type() == ShadowRootType::UserAg ent))) { | |
3203 // If 'position: fixed' node is found while traversing up, terminate the loop and | |
3204 // return null. | |
3205 if (ancestor->isOutOfFlowPositioned() && ancestor->style()->position () == FixedPosition) | |
hayato
2016/06/29 05:42:46
Could you clean up this function?
e.g. Remove L31
kochi
2016/06/29 06:24:37
Done.
| |
3206 return nullptr; | |
3207 continue; | |
3208 } | |
3209 | |
3200 if (ancestor->isPositioned()) | 3210 if (ancestor->isPositioned()) |
3201 break; | 3211 break; |
3202 | 3212 |
3203 if (isHTMLBodyElement(*node)) | 3213 if (isHTMLBodyElement(*node)) |
3204 break; | 3214 break; |
3205 | 3215 |
3206 if (!isPositioned() && (isHTMLTableElement(*node) || isHTMLTableCellElem ent(*node))) | 3216 if (!isPositioned() && (isHTMLTableElement(*node) || isHTMLTableCellElem ent(*node))) |
3207 break; | 3217 break; |
3208 | 3218 |
3209 // Webkit specific extension where offsetParent stops at zoom level chan ges. | 3219 // Webkit specific extension where offsetParent stops at zoom level chan ges. |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3636 const blink::LayoutObject* root = object1; | 3646 const blink::LayoutObject* root = object1; |
3637 while (root->parent()) | 3647 while (root->parent()) |
3638 root = root->parent(); | 3648 root = root->parent(); |
3639 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3649 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3640 } else { | 3650 } else { |
3641 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3651 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3642 } | 3652 } |
3643 } | 3653 } |
3644 | 3654 |
3645 #endif | 3655 #endif |
OLD | NEW |