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

Unified Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 1804943002: Remove a wrong assert and use Document directly, instead of documentElement() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/FocusController.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
index 3eec84daa522f7e18007ac77277560788d75b8d7..ddca4a63dfe4469fc61a55ac7e552e9f519809f7 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -82,6 +82,7 @@ public:
void moveToLast();
Element* owner() const;
static ScopedFocusNavigation createScopedFocusNavigation(const Element& root, const Element* current);
+ static ScopedFocusNavigation createScopedFocusNavigationForDocument(Document&);
static ScopedFocusNavigation ownedByNonFocusableFocusScopeOwner(Element&);
static ScopedFocusNavigation ownedByShadowHost(const Element&);
static ScopedFocusNavigation ownedByShadowInsertionPoint(HTMLShadowElement&);
@@ -206,7 +207,12 @@ ScopedFocusNavigation ScopedFocusNavigation::createScopedFocusNavigation(const E
{
if (SlotScopedTraversal::isSlotScoped(root))
return ScopedFocusNavigation(*SlotScopedTraversal::findScopeOwnerSlot(root), current);
- return ScopedFocusNavigation(*&root.treeScope(), current);
+ return ScopedFocusNavigation(root.treeScope(), current);
+}
+
+ScopedFocusNavigation ScopedFocusNavigation::createScopedFocusNavigationForDocument(Document& document)
+{
+ return ScopedFocusNavigation(document, nullptr);
}
ScopedFocusNavigation ScopedFocusNavigation::ownedByNonFocusableFocusScopeOwner(Element& element)
@@ -850,7 +856,6 @@ bool FocusController::advanceFocusInDocumentOrder(LocalFrame* frame, Element* st
{
ASSERT(frame);
Document* document = frame->document();
- ASSERT(document->documentElement());
document->updateDistribution();
Element* current = start;
@@ -864,7 +869,7 @@ bool FocusController::advanceFocusInDocumentOrder(LocalFrame* frame, Element* st
current = adjustToElement(frame->selection().start().anchorNode(), type);
document->updateLayoutIgnorePendingStylesheets();
- ScopedFocusNavigation scope = ScopedFocusNavigation::createScopedFocusNavigation(current ? *current : *document->documentElement(), current);
+ ScopedFocusNavigation scope = current ? ScopedFocusNavigation::createScopedFocusNavigation(*current, current) : ScopedFocusNavigation::createScopedFocusNavigationForDocument(*document);
RefPtrWillBeRawPtr<Element> element = findFocusableElementAcrossFocusScopes(type, scope);
if (!element) {
@@ -887,7 +892,7 @@ bool FocusController::advanceFocusInDocumentOrder(LocalFrame* frame, Element* st
}
// Chrome doesn't want focus, so we should wrap focus.
- ScopedFocusNavigation scope = ScopedFocusNavigation::createScopedFocusNavigation(*toLocalFrame(m_page->mainFrame())->document()->documentElement(), nullptr);
+ ScopedFocusNavigation scope = ScopedFocusNavigation::createScopedFocusNavigationForDocument(*toLocalFrame(m_page->mainFrame())->document());
element = findFocusableElementRecursively(type, scope);
element = findFocusableElementDescendingDownIntoFrameDocument(type, element.get());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698