OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) | 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) |
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) | 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) |
5 * (C) 2001 Peter Kelly (pmk@post.com) | 5 * (C) 2001 Peter Kelly (pmk@post.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 8 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 for (Node* n = FirstNode(); n != past_last; n = NodeTraversal::Next(*n)) { | 1426 for (Node* n = FirstNode(); n != past_last; n = NodeTraversal::Next(*n)) { |
1427 if (n->IsDocumentTypeNode()) { | 1427 if (n->IsDocumentTypeNode()) { |
1428 exception_state.ThrowDOMException(kHierarchyRequestError, | 1428 exception_state.ThrowDOMException(kHierarchyRequestError, |
1429 "The Range contains a doctype node."); | 1429 "The Range contains a doctype node."); |
1430 return; | 1430 return; |
1431 } | 1431 } |
1432 } | 1432 } |
1433 } | 1433 } |
1434 | 1434 |
1435 Node* Range::FirstNode() const { | 1435 Node* Range::FirstNode() const { |
1436 if (start_.Container().IsCharacterDataNode()) | 1436 return StartPosition().NodeAsRangeFirstNode(); |
1437 return &start_.Container(); | |
1438 if (Node* child = NodeTraversal::ChildAt(start_.Container(), start_.Offset())) | |
1439 return child; | |
1440 if (!start_.Offset()) | |
1441 return &start_.Container(); | |
1442 return NodeTraversal::NextSkippingChildren(start_.Container()); | |
1443 } | 1437 } |
1444 | 1438 |
1445 Node* Range::PastLastNode() const { | 1439 Node* Range::PastLastNode() const { |
1446 if (end_.Container().IsCharacterDataNode()) | 1440 return EndPosition().NodeAsRangePastLastNode(); |
1447 return NodeTraversal::NextSkippingChildren(end_.Container()); | |
1448 if (Node* child = NodeTraversal::ChildAt(end_.Container(), end_.Offset())) | |
1449 return child; | |
1450 return NodeTraversal::NextSkippingChildren(end_.Container()); | |
1451 } | 1441 } |
1452 | 1442 |
1453 IntRect Range::BoundingBox() const { | 1443 IntRect Range::BoundingBox() const { |
1454 IntRect result; | 1444 IntRect result; |
1455 Vector<IntRect> rects; | 1445 Vector<IntRect> rects; |
1456 TextRects(rects); | 1446 TextRects(rects); |
1457 for (const IntRect& rect : rects) | 1447 for (const IntRect& rect : rects) |
1458 result.Unite(rect); | 1448 result.Unite(rect); |
1459 return result; | 1449 return result; |
1460 } | 1450 } |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 .Data() | 1818 .Data() |
1829 << "start offset: " << range->startOffset() | 1819 << "start offset: " << range->startOffset() |
1830 << ", end offset: " << range->endOffset(); | 1820 << ", end offset: " << range->endOffset(); |
1831 } else { | 1821 } else { |
1832 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " | 1822 LOG(INFO) << "Cannot show tree if range is null, or if boundary points are " |
1833 "invalid."; | 1823 "invalid."; |
1834 } | 1824 } |
1835 } | 1825 } |
1836 | 1826 |
1837 #endif | 1827 #endif |
OLD | NEW |