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 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3237 ASSERT(m_node); | 3237 ASSERT(m_node); |
3238 | 3238 |
3239 // Image change notifications should not be received during paint because | 3239 // Image change notifications should not be received during paint because |
3240 // the resulting invalidations will be cleared following paint. This can als o | 3240 // the resulting invalidations will be cleared following paint. This can als o |
3241 // lead to modifying the tree out from under paint(), see: crbug.com/616700. | 3241 // lead to modifying the tree out from under paint(), see: crbug.com/616700. |
3242 DCHECK(document().lifecycle().state() != DocumentLifecycle::LifecycleState:: InPaint); | 3242 DCHECK(document().lifecycle().state() != DocumentLifecycle::LifecycleState:: InPaint); |
3243 | 3243 |
3244 imageChanged(static_cast<WrappedImagePtr>(image), rect); | 3244 imageChanged(static_cast<WrappedImagePtr>(image), rect); |
3245 } | 3245 } |
3246 | 3246 |
3247 Element* LayoutObject::offsetParent() const | 3247 Element* LayoutObject::offsetParentInternal() const |
3248 { | 3248 { |
3249 if (isDocumentElement() || isBody()) | 3249 if (isDocumentElement() || isBody()) |
3250 return nullptr; | 3250 return nullptr; |
3251 | 3251 |
3252 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) | 3252 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) |
3253 return nullptr; | 3253 return nullptr; |
3254 | 3254 |
3255 float effectiveZoom = style()->effectiveZoom(); | 3255 float effectiveZoom = style()->effectiveZoom(); |
3256 Node* node = nullptr; | 3256 Node* node = nullptr; |
3257 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { | 3257 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { |
(...skipping 14 matching lines...) Expand all Loading... | |
3272 break; | 3272 break; |
3273 | 3273 |
3274 // Webkit specific extension where offsetParent stops at zoom level chan ges. | 3274 // Webkit specific extension where offsetParent stops at zoom level chan ges. |
3275 if (effectiveZoom != ancestor->style()->effectiveZoom()) | 3275 if (effectiveZoom != ancestor->style()->effectiveZoom()) |
3276 break; | 3276 break; |
3277 } | 3277 } |
3278 | 3278 |
3279 return node && node->isElementNode() ? toElement(node) : nullptr; | 3279 return node && node->isElementNode() ? toElement(node) : nullptr; |
3280 } | 3280 } |
3281 | 3281 |
3282 Element* LayoutObject::offsetParent() const | |
hayato
2016/06/09 08:22:03
A binding layer is the only client for this method
kochi
2016/06/09 13:09:28
Good catch!
Currently Element::offsetParent() is
| |
3283 { | |
3284 Element* element = offsetParentInternal(); | |
3285 | |
3286 while (element && !element->isUnclosedNodeOf(*node())) | |
3287 element = element->layoutObject()->offsetParent(); | |
3288 | |
3289 return element; | |
3290 } | |
3291 | |
3282 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf finity affinity) | 3292 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf finity affinity) |
3283 { | 3293 { |
3284 // If this is a non-anonymous layoutObject in an editable area, then it's si mple. | 3294 // If this is a non-anonymous layoutObject in an editable area, then it's si mple. |
3285 if (Node* node = nonPseudoNode()) { | 3295 if (Node* node = nonPseudoNode()) { |
3286 if (!node->hasEditableStyle()) { | 3296 if (!node->hasEditableStyle()) { |
3287 // If it can be found, we prefer a visually equivalent position that is editable. | 3297 // If it can be found, we prefer a visually equivalent position that is editable. |
3288 const Position position = Position(node, offset); | 3298 const Position position = Position(node, offset); |
3289 Position candidate = mostForwardCaretPosition(position, CanCrossEdit ingBoundary); | 3299 Position candidate = mostForwardCaretPosition(position, CanCrossEdit ingBoundary); |
3290 if (candidate.anchorNode()->hasEditableStyle()) | 3300 if (candidate.anchorNode()->hasEditableStyle()) |
3291 return PositionWithAffinity(candidate, affinity); | 3301 return PositionWithAffinity(candidate, affinity); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3708 const blink::LayoutObject* root = object1; | 3718 const blink::LayoutObject* root = object1; |
3709 while (root->parent()) | 3719 while (root->parent()) |
3710 root = root->parent(); | 3720 root = root->parent(); |
3711 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3721 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3712 } else { | 3722 } else { |
3713 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3723 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3714 } | 3724 } |
3715 } | 3725 } |
3716 | 3726 |
3717 #endif | 3727 #endif |
OLD | NEW |