OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 for (const TreeScope* tree = &other; tree; tree = tree->parentTreeScope()) | 477 for (const TreeScope* tree = &other; tree; tree = tree->parentTreeScope()) |
478 otherChain.append(tree); | 478 otherChain.append(tree); |
479 | 479 |
480 // Keep popping out the last elements of these chains until a mismatched pair | 480 // Keep popping out the last elements of these chains until a mismatched pair |
481 // is found. If |this| and |other| belong to different documents, null will be | 481 // is found. If |this| and |other| belong to different documents, null will be |
482 // returned. | 482 // returned. |
483 const TreeScope* lastAncestor = nullptr; | 483 const TreeScope* lastAncestor = nullptr; |
484 while (!thisChain.isEmpty() && !otherChain.isEmpty() && | 484 while (!thisChain.isEmpty() && !otherChain.isEmpty() && |
485 thisChain.last() == otherChain.last()) { | 485 thisChain.last() == otherChain.last()) { |
486 lastAncestor = thisChain.last(); | 486 lastAncestor = thisChain.last(); |
487 thisChain.removeLast(); | 487 thisChain.pop_back(); |
488 otherChain.removeLast(); | 488 otherChain.pop_back(); |
489 } | 489 } |
490 return lastAncestor; | 490 return lastAncestor; |
491 } | 491 } |
492 | 492 |
493 TreeScope* TreeScope::commonAncestorTreeScope(TreeScope& other) { | 493 TreeScope* TreeScope::commonAncestorTreeScope(TreeScope& other) { |
494 return const_cast<TreeScope*>( | 494 return const_cast<TreeScope*>( |
495 static_cast<const TreeScope&>(*this).commonAncestorTreeScope(other)); | 495 static_cast<const TreeScope&>(*this).commonAncestorTreeScope(other)); |
496 } | 496 } |
497 | 497 |
498 bool TreeScope::isInclusiveAncestorOf(const TreeScope& scope) const { | 498 bool TreeScope::isInclusiveAncestorOf(const TreeScope& scope) const { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 visitor->trace(m_parentTreeScope); | 541 visitor->trace(m_parentTreeScope); |
542 visitor->trace(m_idTargetObserverRegistry); | 542 visitor->trace(m_idTargetObserverRegistry); |
543 visitor->trace(m_selection); | 543 visitor->trace(m_selection); |
544 visitor->trace(m_elementsById); | 544 visitor->trace(m_elementsById); |
545 visitor->trace(m_imageMapsByName); | 545 visitor->trace(m_imageMapsByName); |
546 visitor->trace(m_scopedStyleResolver); | 546 visitor->trace(m_scopedStyleResolver); |
547 visitor->trace(m_radioButtonGroupScope); | 547 visitor->trace(m_radioButtonGroupScope); |
548 } | 548 } |
549 | 549 |
550 } // namespace blink | 550 } // namespace blink |
OLD | NEW |