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

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

Issue 1870583002: Update the behavior of ShadowRoot.activeElement to match the latest spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 Element* TreeScope::adjustedFocusedElement() const 423 Element* TreeScope::adjustedFocusedElement() const
424 { 424 {
425 Document& document = rootNode().document(); 425 Document& document = rootNode().document();
426 Element* element = document.focusedElement(); 426 Element* element = document.focusedElement();
427 if (!element && document.page()) 427 if (!element && document.page())
428 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame()); 428 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame());
429 if (!element) 429 if (!element)
430 return nullptr; 430 return nullptr;
431 431
432 if (rootNode().isInV1ShadowTree()) {
433 if (Node* retargeted = rootNode().retarget(*element)) {
434 DCHECK(retargeted->isElementNode());
435 return this == &retargeted->treeScope() ? toElement(retargeted) : nu llptr;
436 }
437 return nullptr;
438 }
439
432 RawPtr<EventPath> eventPath = new EventPath(*element); 440 RawPtr<EventPath> eventPath = new EventPath(*element);
433 for (size_t i = 0; i < eventPath->size(); ++i) { 441 for (size_t i = 0; i < eventPath->size(); ++i) {
434 if (eventPath->at(i).node() == rootNode()) { 442 if (eventPath->at(i).node() == rootNode()) {
435 // eventPath->at(i).target() is one of the followings: 443 // eventPath->at(i).target() is one of the followings:
436 // - InsertionPoint 444 // - InsertionPoint
437 // - shadow host 445 // - shadow host
438 // - Document::focusedElement() 446 // - Document::focusedElement()
439 // So, it's safe to do toElement(). 447 // So, it's safe to do toElement().
440 return toElement(eventPath->at(i).target()->toNode()); 448 return toElement(eventPath->at(i).target()->toNode());
441 } 449 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 visitor->trace(m_idTargetObserverRegistry); 584 visitor->trace(m_idTargetObserverRegistry);
577 visitor->trace(m_selection); 585 visitor->trace(m_selection);
578 visitor->trace(m_elementsById); 586 visitor->trace(m_elementsById);
579 visitor->trace(m_imageMapsByName); 587 visitor->trace(m_imageMapsByName);
580 visitor->trace(m_labelsByForAttribute); 588 visitor->trace(m_labelsByForAttribute);
581 visitor->trace(m_scopedStyleResolver); 589 visitor->trace(m_scopedStyleResolver);
582 visitor->trace(m_radioButtonGroupScope); 590 visitor->trace(m_radioButtonGroupScope);
583 } 591 }
584 592
585 } // namespace blink 593 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698