OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2011 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 bool HistoryItem::hasChildren() const | 525 bool HistoryItem::hasChildren() const |
526 { | 526 { |
527 return !m_children.isEmpty(); | 527 return !m_children.isEmpty(); |
528 } | 528 } |
529 | 529 |
530 void HistoryItem::clearChildren() | 530 void HistoryItem::clearChildren() |
531 { | 531 { |
532 m_children.clear(); | 532 m_children.clear(); |
533 } | 533 } |
534 | 534 |
| 535 bool HistoryItem::isAncestorOf(const HistoryItem* item) const |
| 536 { |
| 537 for (size_t i = 0; i < m_children.size(); ++i) { |
| 538 HistoryItem* child = m_children[i].get(); |
| 539 if (child == item) |
| 540 return true; |
| 541 if (child->isAncestorOf(item)) |
| 542 return true; |
| 543 } |
| 544 return false; |
| 545 } |
| 546 |
535 // We do same-document navigation if going to a different item and if either of
the following is true: | 547 // We do same-document navigation if going to a different item and if either of
the following is true: |
536 // - The other item corresponds to the same document (for history entries create
d via pushState or fragment changes). | 548 // - The other item corresponds to the same document (for history entries create
d via pushState or fragment changes). |
537 // - The other item corresponds to the same set of documents, including frames (
for history entries created via regular navigation) | 549 // - The other item corresponds to the same set of documents, including frames (
for history entries created via regular navigation) |
538 bool HistoryItem::shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const | 550 bool HistoryItem::shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const |
539 { | 551 { |
540 if (this == otherItem) | 552 if (this == otherItem) |
541 return false; | 553 return false; |
542 | 554 |
543 if (stateObject() || otherItem->stateObject()) | 555 if (stateObject() || otherItem->stateObject()) |
544 return documentSequenceNumber() == otherItem->documentSequenceNumber(); | 556 return documentSequenceNumber() == otherItem->documentSequenceNumber(); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 } // namespace WebCore | 884 } // namespace WebCore |
873 | 885 |
874 #ifndef NDEBUG | 886 #ifndef NDEBUG |
875 | 887 |
876 int showTree(const WebCore::HistoryItem* item) | 888 int showTree(const WebCore::HistoryItem* item) |
877 { | 889 { |
878 return item->showTree(); | 890 return item->showTree(); |
879 } | 891 } |
880 | 892 |
881 #endif | 893 #endif |
OLD | NEW |