| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (offset == 0) | 271 if (offset == 0) |
| 272 return Position::PositionIsBeforeAnchor; | 272 return Position::PositionIsBeforeAnchor; |
| 273 return Position::PositionIsAfterAnchor; | 273 return Position::PositionIsAfterAnchor; |
| 274 } | 274 } |
| 275 return Position::PositionIsOffsetInAnchor; | 275 return Position::PositionIsOffsetInAnchor; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // FIXME: This method is confusing (does it return anchorNode() or containerNode
()?) and should be renamed or removed | 278 // FIXME: This method is confusing (does it return anchorNode() or containerNode
()?) and should be renamed or removed |
| 279 Element* Position::element() const | 279 Element* Position::element() const |
| 280 { | 280 { |
| 281 Node* n = anchorNode(); | 281 Node* node = anchorNode(); |
| 282 while (n && !n->isElementNode()) | 282 if (!node || node->isElementNode()) |
| 283 n = n->parentNode(); | 283 return toElement(node); |
| 284 return toElement(n); | 284 return node->parentElement(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 PassRefPtrWillBeRawPtr<CSSComputedStyleDeclaration> Position::computedStyle() co
nst | 287 PassRefPtrWillBeRawPtr<CSSComputedStyleDeclaration> Position::computedStyle() co
nst |
| 288 { | 288 { |
| 289 Element* elem = element(); | 289 Element* elem = element(); |
| 290 if (!elem) | 290 if (!elem) |
| 291 return nullptr; | 291 return nullptr; |
| 292 return CSSComputedStyleDeclaration::create(elem); | 292 return CSSComputedStyleDeclaration::create(elem); |
| 293 } | 293 } |
| 294 | 294 |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 pos.showTreeForThis(); | 1304 pos.showTreeForThis(); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 void showTree(const blink::Position* pos) | 1307 void showTree(const blink::Position* pos) |
| 1308 { | 1308 { |
| 1309 if (pos) | 1309 if (pos) |
| 1310 pos->showTreeForThis(); | 1310 pos->showTreeForThis(); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 #endif | 1313 #endif |
| OLD | NEW |