Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.cpp

Issue 2146013003: Rename adjustPointerLockElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename function and update comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // - InsertionPoint 381 // - InsertionPoint
382 // - shadow host 382 // - shadow host
383 // - Document::focusedElement() 383 // - Document::focusedElement()
384 // So, it's safe to do toElement(). 384 // So, it's safe to do toElement().
385 return toElement(eventPath->at(i).target()->toNode()); 385 return toElement(eventPath->at(i).target()->toNode());
386 } 386 }
387 } 387 }
388 return nullptr; 388 return nullptr;
389 } 389 }
390 390
391 Element* TreeScope::adjustedPointerLockElement(const Element& target) const 391 Element* TreeScope::adjustedElement(const Element& target) const
392 { 392 {
393 const Element* adjustedTarget = ⌖ 393 const Element* adjustedTarget = ⌖
394 // Unless the target is in the same TreeScope as |scope|, traverse up shadow trees to
395 // find a shadow host that is in the same TreeScope as |scope|.
396 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) { 394 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) {
397 // Exception is that if the host has V0 or UA shadow, skip the adjustmen t because 395 // This adjustment is done only for V1 shadows, and is skipped for V0 or UA shadows,
398 // .pointerLockElement is not available for non-V1 shadows. 396 // because .pointerLockElement and .(webkit)fullscreenElement is not ava ilable for
399 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for 397 // non-V1 shadow roots.
400 // Shadow DOM V1. 398 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for V1.
401 if (ancestor->shadowRootIfV1()) 399 if (ancestor->shadowRootIfV1())
402 adjustedTarget = ancestor; 400 adjustedTarget = ancestor;
403 if (this == ancestor->treeScope()) 401 if (this == ancestor->treeScope())
404 return const_cast<Element*>(adjustedTarget); 402 return const_cast<Element*>(adjustedTarget);
405 } 403 }
406 return nullptr; 404 return nullptr;
407 } 405 }
406
408 unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const 407 unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
409 { 408 {
410 if (otherScope == this) 409 if (otherScope == this)
411 return Node::DOCUMENT_POSITION_EQUIVALENT; 410 return Node::DOCUMENT_POSITION_EQUIVALENT;
412 411
413 HeapVector<Member<const TreeScope>, 16> chain1; 412 HeapVector<Member<const TreeScope>, 16> chain1;
414 HeapVector<Member<const TreeScope>, 16> chain2; 413 HeapVector<Member<const TreeScope>, 16> chain2;
415 const TreeScope* current; 414 const TreeScope* current;
416 for (current = this; current; current = current->parentTreeScope()) 415 for (current = this; current; current = current->parentTreeScope())
417 chain1.append(current); 416 chain1.append(current);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 visitor->trace(m_parentTreeScope); 517 visitor->trace(m_parentTreeScope);
519 visitor->trace(m_idTargetObserverRegistry); 518 visitor->trace(m_idTargetObserverRegistry);
520 visitor->trace(m_selection); 519 visitor->trace(m_selection);
521 visitor->trace(m_elementsById); 520 visitor->trace(m_elementsById);
522 visitor->trace(m_imageMapsByName); 521 visitor->trace(m_imageMapsByName);
523 visitor->trace(m_scopedStyleResolver); 522 visitor->trace(m_scopedStyleResolver);
524 visitor->trace(m_radioButtonGroupScope); 523 visitor->trace(m_radioButtonGroupScope);
525 } 524 }
526 525
527 } // namespace blink 526 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698