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

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

Issue 1433103002: Use FocusParams in FocusController::setFocusedElement and Document::setFocusedElement arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 2369
2370 // Slide the focus to its inner node. 2370 // Slide the focus to its inner node.
2371 Element* next = document().page()->focusController().findFocusableElemen t(WebFocusTypeForward, *this); 2371 Element* next = document().page()->focusController().findFocusableElemen t(WebFocusTypeForward, *this);
2372 if (next && containsIncludingShadowDOM(next)) { 2372 if (next && containsIncludingShadowDOM(next)) {
2373 next->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTyp eForward, nullptr)); 2373 next->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTyp eForward, nullptr));
2374 return; 2374 return;
2375 } 2375 }
2376 } 2376 }
2377 2377
2378 RefPtrWillBeRawPtr<Node> protect(this); 2378 RefPtrWillBeRawPtr<Node> protect(this);
2379 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params.type, params.sourceCapabilities)) 2379 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params))
2380 return; 2380 return;
2381 2381
2382 // Setting the focused node above might have invalidated the layout due to s cripts. 2382 // Setting the focused node above might have invalidated the layout due to s cripts.
2383 document().updateLayoutIgnorePendingStylesheets(); 2383 document().updateLayoutIgnorePendingStylesheets();
2384 if (!isFocusable()) 2384 if (!isFocusable())
2385 return; 2385 return;
2386 2386
2387 cancelFocusAppearanceUpdate(); 2387 cancelFocusAppearanceUpdate();
2388 updateFocusAppearance(params.selectionBehavior); 2388 updateFocusAppearance(params.selectionBehavior);
2389 2389
(...skipping 30 matching lines...) Expand all
2420 } 2420 }
2421 2421
2422 void Element::blur() 2422 void Element::blur()
2423 { 2423 {
2424 cancelFocusAppearanceUpdate(); 2424 cancelFocusAppearanceUpdate();
2425 if (treeScope().adjustedFocusedElement() == this) { 2425 if (treeScope().adjustedFocusedElement() == this) {
2426 Document& doc = document(); 2426 Document& doc = document();
2427 if (doc.page()) 2427 if (doc.page())
2428 doc.page()->focusController().setFocusedElement(0, doc.frame()); 2428 doc.page()->focusController().setFocusedElement(0, doc.frame());
2429 else 2429 else
2430 doc.setFocusedElement(nullptr); 2430 doc.clearFocusedElement();
2431 } 2431 }
2432 } 2432 }
2433 2433
2434 bool Element::supportsFocus() const 2434 bool Element::supportsFocus() const
2435 { 2435 {
2436 // FIXME: supportsFocus() can be called when layout is not up to date. 2436 // FIXME: supportsFocus() can be called when layout is not up to date.
2437 // Logic that deals with the layoutObject should be moved to layoutObjectIsF ocusable(). 2437 // Logic that deals with the layoutObject should be moved to layoutObjectIsF ocusable().
2438 // But supportsFocus must return true when the element is editable, or else 2438 // But supportsFocus must return true when the element is editable, or else
2439 // it won't be focusable. Furthermore, supportsFocus cannot just return true 2439 // it won't be focusable. Furthermore, supportsFocus cannot just return true
2440 // always or else tabIndex() will change for all HTML elements. 2440 // always or else tabIndex() will change for all HTML elements.
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 { 3573 {
3574 #if ENABLE(OILPAN) 3574 #if ENABLE(OILPAN)
3575 if (hasRareData()) 3575 if (hasRareData())
3576 visitor->trace(elementRareData()); 3576 visitor->trace(elementRareData());
3577 visitor->trace(m_elementData); 3577 visitor->trace(m_elementData);
3578 #endif 3578 #endif
3579 ContainerNode::trace(visitor); 3579 ContainerNode::trace(visitor);
3580 } 3580 }
3581 3581
3582 } // namespace blink 3582 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698