| 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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3255 break; | 3255 break; |
| 3256 } | 3256 } |
| 3257 | 3257 |
| 3258 return node && node->isElementNode() ? toElement(node) : nullptr; | 3258 return node && node->isElementNode() ? toElement(node) : nullptr; |
| 3259 } | 3259 } |
| 3260 | 3260 |
| 3261 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf
finity affinity) | 3261 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf
finity affinity) |
| 3262 { | 3262 { |
| 3263 // If this is a non-anonymous layoutObject in an editable area, then it's si
mple. | 3263 // If this is a non-anonymous layoutObject in an editable area, then it's si
mple. |
| 3264 if (Node* node = nonPseudoNode()) { | 3264 if (Node* node = nonPseudoNode()) { |
| 3265 if (!node->hasEditableStyle()) { | 3265 if (!hasEditableStyle(*node)) { |
| 3266 // If it can be found, we prefer a visually equivalent position that
is editable. | 3266 // If it can be found, we prefer a visually equivalent position that
is editable. |
| 3267 const Position position = Position(node, offset); | 3267 const Position position = Position(node, offset); |
| 3268 Position candidate = mostForwardCaretPosition(position, CanCrossEdit
ingBoundary); | 3268 Position candidate = mostForwardCaretPosition(position, CanCrossEdit
ingBoundary); |
| 3269 if (candidate.anchorNode()->hasEditableStyle()) | 3269 if (hasEditableStyle(*candidate.anchorNode())) |
| 3270 return PositionWithAffinity(candidate, affinity); | 3270 return PositionWithAffinity(candidate, affinity); |
| 3271 candidate = mostBackwardCaretPosition(position, CanCrossEditingBound
ary); | 3271 candidate = mostBackwardCaretPosition(position, CanCrossEditingBound
ary); |
| 3272 if (candidate.anchorNode()->hasEditableStyle()) | 3272 if (hasEditableStyle(*candidate.anchorNode())) |
| 3273 return PositionWithAffinity(candidate, affinity); | 3273 return PositionWithAffinity(candidate, affinity); |
| 3274 } | 3274 } |
| 3275 // FIXME: Eliminate legacy editing positions | 3275 // FIXME: Eliminate legacy editing positions |
| 3276 return PositionWithAffinity(Position::editingPositionOf(node, offset), a
ffinity); | 3276 return PositionWithAffinity(Position::editingPositionOf(node, offset), a
ffinity); |
| 3277 } | 3277 } |
| 3278 | 3278 |
| 3279 // We don't want to cross the boundary between editable and non-editable | 3279 // We don't want to cross the boundary between editable and non-editable |
| 3280 // regions of the document, but that is either impossible or at least | 3280 // regions of the document, but that is either impossible or at least |
| 3281 // extremely unlikely in any normal case because we stop as soon as we | 3281 // extremely unlikely in any normal case because we stop as soon as we |
| 3282 // find a single non-anonymous layoutObject. | 3282 // find a single non-anonymous layoutObject. |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3680 const blink::LayoutObject* root = object1; | 3680 const blink::LayoutObject* root = object1; |
| 3681 while (root->parent()) | 3681 while (root->parent()) |
| 3682 root = root->parent(); | 3682 root = root->parent(); |
| 3683 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3683 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3684 } else { | 3684 } else { |
| 3685 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3685 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3686 } | 3686 } |
| 3687 } | 3687 } |
| 3688 | 3688 |
| 3689 #endif | 3689 #endif |
| OLD | NEW |