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

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

Issue 2678683002: Delay instantiating InputDeviceCapabilities until accessed. (Closed)
Patch Set: rebased Created 3 years, 10 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
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 c75f524ac1ac4de629c2045c739a8667a6e8457c..2f3a06a6c6b0db27ecaa8f19b11767a2b04ce932 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -338,24 +338,31 @@ bool ScopedFocusNavigation::isSlotFallbackScopedForThisSlot(
inline void dispatchBlurEvent(const Document& document,
Element& focusedElement) {
- focusedElement.dispatchBlurEvent(nullptr, WebFocusTypePage);
+ focusedElement.dispatchBlurEvent(nullptr, WebFocusTypePage,
+ InputDeviceCapabilities::Null);
if (focusedElement == document.focusedElement()) {
- focusedElement.dispatchFocusOutEvent(EventTypeNames::focusout, nullptr);
- if (focusedElement == document.focusedElement())
- focusedElement.dispatchFocusOutEvent(EventTypeNames::DOMFocusOut,
- nullptr);
+ focusedElement.dispatchFocusOutEvent(EventTypeNames::focusout, nullptr,
+ InputDeviceCapabilities::Null);
+ if (focusedElement == document.focusedElement()) {
+ focusedElement.dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, nullptr,
+ InputDeviceCapabilities::Null);
+ }
}
}
inline void dispatchFocusEvent(const Document& document,
Element& focusedElement) {
- focusedElement.dispatchFocusEvent(0, WebFocusTypePage);
+ focusedElement.dispatchFocusEvent(0, WebFocusTypePage,
+ InputDeviceCapabilities::Null);
if (focusedElement == document.focusedElement()) {
focusedElement.dispatchFocusInEvent(EventTypeNames::focusin, nullptr,
- WebFocusTypePage);
- if (focusedElement == document.focusedElement())
+ WebFocusTypePage,
+ InputDeviceCapabilities::Null);
+ if (focusedElement == document.focusedElement()) {
focusedElement.dispatchFocusInEvent(EventTypeNames::DOMFocusIn, nullptr,
- WebFocusTypePage);
+ WebFocusTypePage,
+ InputDeviceCapabilities::Null);
+ }
}
}
@@ -877,7 +884,8 @@ void FocusController::setFocused(bool focused) {
}
bool FocusController::setInitialFocus(WebFocusType type) {
- bool didAdvanceFocus = advanceFocus(type, true);
+ bool didAdvanceFocus =
+ advanceFocus(type, true, InputDeviceCapabilities::Null);
// If focus is being set initially, accessibility needs to be informed that
// system focus has moved into the web area again, even if focus did not
@@ -896,7 +904,7 @@ bool FocusController::setInitialFocus(WebFocusType type) {
bool FocusController::advanceFocus(
WebFocusType type,
bool initialFocus,
- InputDeviceCapabilities* sourceCapabilities) {
+ const InputDeviceCapabilitiesValue& sourceCapabilities) {
switch (type) {
case WebFocusTypeForward:
case WebFocusTypeBackward: {
@@ -923,7 +931,7 @@ bool FocusController::advanceFocusAcrossFrames(
WebFocusType type,
RemoteFrame* from,
LocalFrame* to,
- InputDeviceCapabilities* sourceCapabilities) {
+ const InputDeviceCapabilitiesValue& sourceCapabilities) {
// If we are shifting focus from a child frame to its parent, the
// child frame has no more focusable elements, and we should continue
// looking for focusable elements in the parent, starting from the <iframe>
@@ -949,7 +957,7 @@ bool FocusController::advanceFocusInDocumentOrder(
Element* start,
WebFocusType type,
bool initialFocus,
- InputDeviceCapabilities* sourceCapabilities) {
+ const InputDeviceCapabilitiesValue& sourceCapabilities) {
DCHECK(frame);
Document* document = frame->document();
document->updateDistribution();
@@ -1098,7 +1106,8 @@ bool FocusController::setFocusedElement(Element* element,
Frame* newFocusedFrame) {
return setFocusedElement(
element, newFocusedFrame,
- FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
+ FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone,
+ InputDeviceCapabilities::Null));
}
bool FocusController::setFocusedElement(Element* element,
@@ -1350,7 +1359,8 @@ bool FocusController::advanceFocusDirectionallyInContainer(
Element* element = toElement(focusCandidate.focusableNode);
DCHECK(element);
- element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type, nullptr));
+ element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type,
+ InputDeviceCapabilities::Null));
return true;
}
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusController.h ('k') | third_party/WebKit/Source/core/svg/SVGAElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698