| 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 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 // regions of the document, but that is either impossible or at least | 3006 // regions of the document, but that is either impossible or at least |
| 3007 // extremely unlikely in any normal case because we stop as soon as we | 3007 // extremely unlikely in any normal case because we stop as soon as we |
| 3008 // find a single non-anonymous layoutObject. | 3008 // find a single non-anonymous layoutObject. |
| 3009 | 3009 |
| 3010 // Find a nearby non-anonymous layoutObject. | 3010 // Find a nearby non-anonymous layoutObject. |
| 3011 LayoutObject* child = this; | 3011 LayoutObject* child = this; |
| 3012 while (LayoutObject* parent = child->parent()) { | 3012 while (LayoutObject* parent = child->parent()) { |
| 3013 // Find non-anonymous content after. | 3013 // Find non-anonymous content after. |
| 3014 for (LayoutObject* layoutObject = child->nextInPreOrder(parent); layoutO
bject; layoutObject = layoutObject->nextInPreOrder(parent)) { | 3014 for (LayoutObject* layoutObject = child->nextInPreOrder(parent); layoutO
bject; layoutObject = layoutObject->nextInPreOrder(parent)) { |
| 3015 if (Node* node = layoutObject->nonPseudoNode()) | 3015 if (Node* node = layoutObject->nonPseudoNode()) |
| 3016 return PositionWithAffinity(firstPositionInOrBeforeNode(node), D
OWNSTREAM); | 3016 return PositionWithAffinity(firstPositionInOrBeforeNode(node)); |
| 3017 } | 3017 } |
| 3018 | 3018 |
| 3019 // Find non-anonymous content before. | 3019 // Find non-anonymous content before. |
| 3020 for (LayoutObject* layoutObject = child->previousInPreOrder(); layoutObj
ect; layoutObject = layoutObject->previousInPreOrder()) { | 3020 for (LayoutObject* layoutObject = child->previousInPreOrder(); layoutObj
ect; layoutObject = layoutObject->previousInPreOrder()) { |
| 3021 if (layoutObject == parent) | 3021 if (layoutObject == parent) |
| 3022 break; | 3022 break; |
| 3023 if (Node* node = layoutObject->nonPseudoNode()) | 3023 if (Node* node = layoutObject->nonPseudoNode()) |
| 3024 return PositionWithAffinity(lastPositionInOrAfterNode(node), DOW
NSTREAM); | 3024 return PositionWithAffinity(lastPositionInOrAfterNode(node)); |
| 3025 } | 3025 } |
| 3026 | 3026 |
| 3027 // Use the parent itself unless it too is anonymous. | 3027 // Use the parent itself unless it too is anonymous. |
| 3028 if (Node* node = parent->nonPseudoNode()) | 3028 if (Node* node = parent->nonPseudoNode()) |
| 3029 return PositionWithAffinity(firstPositionInOrBeforeNode(node), DOWNS
TREAM); | 3029 return PositionWithAffinity(firstPositionInOrBeforeNode(node)); |
| 3030 | 3030 |
| 3031 // Repeat at the next level up. | 3031 // Repeat at the next level up. |
| 3032 child = parent; | 3032 child = parent; |
| 3033 } | 3033 } |
| 3034 | 3034 |
| 3035 // Everything was anonymous. Give up. | 3035 // Everything was anonymous. Give up. |
| 3036 return PositionWithAffinity(); | 3036 return PositionWithAffinity(); |
| 3037 } | 3037 } |
| 3038 | 3038 |
| 3039 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po
sition) | 3039 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po
sition) |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3397 const blink::LayoutObject* root = object1; | 3397 const blink::LayoutObject* root = object1; |
| 3398 while (root->parent()) | 3398 while (root->parent()) |
| 3399 root = root->parent(); | 3399 root = root->parent(); |
| 3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3401 } else { | 3401 } else { |
| 3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3403 } | 3403 } |
| 3404 } | 3404 } |
| 3405 | 3405 |
| 3406 #endif | 3406 #endif |
| OLD | NEW |