Chromium Code Reviews| 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 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after 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::offsetParentForBinding() const | |
|
eae
2016/06/09 13:19:42
How about a more descriptive name like nearestUncl
kochi
2016/06/09 16:04:27
I chose "unclosedOffsetParent()", as it still retu
| |
| 3283 { | |
| 3284 Element* element = offsetParent(); | |
| 3285 | |
| 3286 while (element && (!element->isUnclosedNodeOf(*node()) || (element->isInShad owTree() && element->containingShadowRoot()->type() == ShadowRootType::UserAgent ))) | |
| 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 |