Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.cpp (205616 => 205617)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.cpp 2016-09-08 10:15:14 UTC (rev 205616)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.cpp 2016-09-08 10:17:41 UTC (rev 205617)
@@ -289,22 +289,22 @@
document->focusedElement()->dispatchFocusEvent(nullptr, FocusDirectionNone);
}
-static inline bool isFocusableElementOrScopeOwner(Element& element, KeyboardEvent* event)
+static inline bool isFocusableElementOrScopeOwner(Element& element, KeyboardEvent& event)
{
- return element.isKeyboardFocusable(*event) || isFocusScopeOwner(element);
+ return element.isKeyboardFocusable(event) || isFocusScopeOwner(element);
}
-static inline bool isNonFocusableScopeOwner(Element& element, KeyboardEvent* event)
+static inline bool isNonFocusableScopeOwner(Element& element, KeyboardEvent& event)
{
- return !element.isKeyboardFocusable(*event) && isFocusScopeOwner(element);
+ return !element.isKeyboardFocusable(event) && isFocusScopeOwner(element);
}
-static inline bool isFocusableScopeOwner(Element& element, KeyboardEvent* event)
+static inline bool isFocusableScopeOwner(Element& element, KeyboardEvent& event)
{
- return element.isKeyboardFocusable(*event) && isFocusScopeOwner(element);
+ return element.isKeyboardFocusable(event) && isFocusScopeOwner(element);
}
-static inline int shadowAdjustedTabIndex(Element& element, KeyboardEvent* event)
+static inline int shadowAdjustedTabIndex(Element& element, KeyboardEvent& event)
{
if (isNonFocusableScopeOwner(element, event)) {
if (!element.tabIndexSetExplicitly())
@@ -376,7 +376,7 @@
}
}
-Element* FocusController::findFocusableElementDescendingDownIntoFrameDocument(FocusDirection direction, Element* element, KeyboardEvent* event)
+Element* FocusController::findFocusableElementDescendingDownIntoFrameDocument(FocusDirection direction, Element* element, KeyboardEvent& event)
{
// The node we found might be a HTMLFrameOwnerElement, so descend down the tree until we find either:
// 1) a focusable node, or
@@ -394,9 +394,13 @@
return element;
}
-bool FocusController::setInitialFocus(FocusDirection direction, KeyboardEvent* event)
+bool FocusController::setInitialFocus(FocusDirection direction, KeyboardEvent* providedEvent)
{
- bool didAdvanceFocus = advanceFocus(direction, event, true);
+ RefPtr<KeyboardEvent> event = providedEvent;
+ if (!event)
+ event = KeyboardEvent::createForDummy();
+
+ bool didAdvanceFocus = advanceFocus(direction, *event, true);
// 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 change within WebCore. PostNotification is called instead
@@ -407,7 +411,7 @@
return didAdvanceFocus;
}
-bool FocusController::advanceFocus(FocusDirection direction, KeyboardEvent* event, bool initialFocus)
+bool FocusController::advanceFocus(FocusDirection direction, KeyboardEvent& event, bool initialFocus)
{
switch (direction) {
case FocusDirectionForward:
@@ -425,7 +429,7 @@
return false;
}
-bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, KeyboardEvent* event, bool initialFocus)
+bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, KeyboardEvent& event, bool initialFocus)
{
Frame& frame = focusedOrMainFrame();
Document* document = frame.document();
@@ -464,7 +468,7 @@
return true;
}
- if (is<HTMLFrameOwnerElement>(*element) && (!is<HTMLPlugInElement>(*element) || !element->isKeyboardFocusable(*event))) {
+ if (is<HTMLFrameOwnerElement>(*element) && (!is<HTMLPlugInElement>(*element) || !element->isKeyboardFocusable(event))) {
// We focus frames rather than frame owners.
// FIXME: We should not focus frames that have no scrollbars, as focusing them isn't useful to the user.
HTMLFrameOwnerElement& owner = downcast<HTMLFrameOwnerElement>(*element);
@@ -502,7 +506,7 @@
return true;
}
-Element* FocusController::findFocusableElementAcrossFocusScope(FocusDirection direction, const FocusNavigationScope& scope, Node* currentNode, KeyboardEvent* event)
+Element* FocusController::findFocusableElementAcrossFocusScope(FocusDirection direction, const FocusNavigationScope& scope, Node* currentNode, KeyboardEvent& event)
{
ASSERT(!is<Element>(currentNode) || !isNonFocusableScopeOwner(downcast<Element>(*currentNode), event));
@@ -528,7 +532,7 @@
return nullptr;
}
-Element* FocusController::findFocusableElementWithinScope(FocusDirection direction, const FocusNavigationScope& scope, Node* start, KeyboardEvent* event)
+Element* FocusController::findFocusableElementWithinScope(FocusDirection direction, const FocusNavigationScope& scope, Node* start, KeyboardEvent& event)
{
// Starting node is exclusive.
Element* candidate = direction == FocusDirectionForward
@@ -537,7 +541,7 @@
return findFocusableElementDescendingDownIntoFrameDocument(direction, candidate, event);
}
-Element* FocusController::nextFocusableElementWithinScope(const FocusNavigationScope& scope, Node* start, KeyboardEvent* event)
+Element* FocusController::nextFocusableElementWithinScope(const FocusNavigationScope& scope, Node* start, KeyboardEvent& event)
{
Element* found = nextFocusableElementOrScopeOwner(scope, start, event);
if (!found)
@@ -550,7 +554,7 @@
return found;
}
-Element* FocusController::previousFocusableElementWithinScope(const FocusNavigationScope& scope, Node* start, KeyboardEvent* event)
+Element* FocusController::previousFocusableElementWithinScope(const FocusNavigationScope& scope, Node* start, KeyboardEvent& event)
{
Element* found = previousFocusableElementOrScopeOwner(scope, start, event);
if (!found)
@@ -569,7 +573,7 @@
return found;
}
-Element* FocusController::findFocusableElementOrScopeOwner(FocusDirection direction, const FocusNavigationScope& scope, Node* node, KeyboardEvent* event)
+Element* FocusController::findFocusableElementOrScopeOwner(FocusDirection direction, const FocusNavigationScope& scope, Node* node, KeyboardEvent& event)
{
return (direction == FocusDirectionForward)
? nextFocusableElementOrScopeOwner(scope, node, event)
@@ -576,7 +580,7 @@
: previousFocusableElementOrScopeOwner(scope, node, event);
}
-Element* FocusController::findElementWithExactTabIndex(const FocusNavigationScope& scope, Node* start, int tabIndex, KeyboardEvent* event, FocusDirection direction)
+Element* FocusController::findElementWithExactTabIndex(const FocusNavigationScope& scope, Node* start, int tabIndex, KeyboardEvent& event, FocusDirection direction)
{
// Search is inclusive of start
for (Node* node = start; node; node = direction == FocusDirectionForward ? scope.nextInScope(node) : scope.previousInScope(node)) {
@@ -589,7 +593,7 @@
return nullptr;
}
-static Element* nextElementWithGreaterTabIndex(const FocusNavigationScope& scope, int tabIndex, KeyboardEvent* event)
+static Element* nextElementWithGreaterTabIndex(const FocusNavigationScope& scope, int tabIndex, KeyboardEvent& event)
{
// Search is inclusive of start
int winningTabIndex = std::numeric_limits<int>::max();
@@ -608,7 +612,7 @@
return winner;
}
-static Element* previousElementWithLowerTabIndex(const FocusNavigationScope& scope, Node* start, int tabIndex, KeyboardEvent* event)
+static Element* previousElementWithLowerTabIndex(const FocusNavigationScope& scope, Node* start, int tabIndex, KeyboardEvent& event)
{
// Search is inclusive of start
int winningTabIndex = 0;
@@ -630,7 +634,7 @@
{
// FIXME: This can return a non-focusable shadow host.
Ref<KeyboardEvent> keyEvent = KeyboardEvent::createForDummy();
- return nextFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &start, keyEvent.ptr());
+ return nextFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &start, keyEvent.get());
}
Element* FocusController::previousFocusableElement(Node& start)
@@ -637,10 +641,10 @@
{
// FIXME: This can return a non-focusable shadow host.
Ref<KeyboardEvent> keyEvent = KeyboardEvent::createForDummy();
- return previousFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &start, keyEvent.ptr());
+ return previousFocusableElementOrScopeOwner(FocusNavigationScope::scopeOf(start), &start, keyEvent.get());
}
-Element* FocusController::nextFocusableElementOrScopeOwner(const FocusNavigationScope& scope, Node* start, KeyboardEvent* event)
+Element* FocusController::nextFocusableElementOrScopeOwner(const FocusNavigationScope& scope, Node* start, KeyboardEvent& event)
{
int startTabIndex = 0;
if (start && is<Element>(*start))
@@ -677,7 +681,7 @@
return findElementWithExactTabIndex(scope, scope.firstNodeInScope(), 0, event, FocusDirectionForward);
}
-Element* FocusController::previousFocusableElementOrScopeOwner(const FocusNavigationScope& scope, Node* start, KeyboardEvent* event)
+Element* FocusController::previousFocusableElementOrScopeOwner(const FocusNavigationScope& scope, Node* start, KeyboardEvent& event)
{
Node* last = nullptr;
for (Node* node = scope.lastNodeInScope(); node; node = scope.lastChildInScope(*node))
@@ -937,7 +941,7 @@
closest = candidate;
}
-void FocusController::findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closest)
+void FocusController::findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent& event, FocusCandidate& closest)
{
Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedElement() : 0;
@@ -954,7 +958,7 @@
if (element == focusedNode)
continue;
- if (!element->isKeyboardFocusable(*event) && !element->isFrameOwnerElement() && !canScrollInDirection(element, direction))
+ if (!element->isKeyboardFocusable(event) && !element->isFrameOwnerElement() && !canScrollInDirection(element, direction))
continue;
FocusCandidate candidate = FocusCandidate(element, direction);
@@ -977,7 +981,7 @@
}
}
-bool FocusController::advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event)
+bool FocusController::advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent& event)
{
if (!container)
return false;
@@ -1047,7 +1051,7 @@
return true;
}
-bool FocusController::advanceFocusDirectionally(FocusDirection direction, KeyboardEvent* event)
+bool FocusController::advanceFocusDirectionally(FocusDirection direction, KeyboardEvent& event)
{
Document* focusedDocument = focusedOrMainFrame().document();
if (!focusedDocument)
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.h (205616 => 205617)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.h 2016-09-08 10:15:14 UTC (rev 205616)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/FocusController.h 2016-09-08 10:17:41 UTC (rev 205617)
@@ -59,7 +59,7 @@
WEBCORE_EXPORT Frame& focusedOrMainFrame() const;
WEBCORE_EXPORT bool setInitialFocus(FocusDirection, KeyboardEvent*);
- bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false);
+ bool advanceFocus(FocusDirection, KeyboardEvent&, bool initialFocus = false);
WEBCORE_EXPORT bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
@@ -85,16 +85,16 @@
void setFocusedInternal(bool);
void setIsVisibleAndActiveInternal(bool);
- bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
- bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
+ bool advanceFocusDirectionally(FocusDirection, KeyboardEvent&);
+ bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent&, bool initialFocus);
- Element* findFocusableElementAcrossFocusScope(FocusDirection, const FocusNavigationScope& startScope, Node* start, KeyboardEvent*);
+ Element* findFocusableElementAcrossFocusScope(FocusDirection, const FocusNavigationScope& startScope, Node* start, KeyboardEvent&);
- Element* findFocusableElementWithinScope(FocusDirection, const FocusNavigationScope&, Node* start, KeyboardEvent*);
- Element* nextFocusableElementWithinScope(const FocusNavigationScope&, Node* start, KeyboardEvent*);
- Element* previousFocusableElementWithinScope(const FocusNavigationScope&, Node* start, KeyboardEvent*);
+ Element* findFocusableElementWithinScope(FocusDirection, const FocusNavigationScope&, Node* start, KeyboardEvent&);
+ Element* nextFocusableElementWithinScope(const FocusNavigationScope&, Node* start, KeyboardEvent&);
+ Element* previousFocusableElementWithinScope(const FocusNavigationScope&, Node* start, KeyboardEvent&);
- Element* findFocusableElementDescendingDownIntoFrameDocument(FocusDirection, Element*, KeyboardEvent*);
+ Element* findFocusableElementDescendingDownIntoFrameDocument(FocusDirection, Element*, KeyboardEvent&);
// Searches through the given tree scope, starting from start node, for the next/previous selectable element that comes after/before start node.
// The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes
@@ -105,15 +105,15 @@
// @return The focus node that comes after/before start node.
//
// See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
- Element* findFocusableElementOrScopeOwner(FocusDirection, const FocusNavigationScope&, Node* start, KeyboardEvent*);
+ Element* findFocusableElementOrScopeOwner(FocusDirection, const FocusNavigationScope&, Node* start, KeyboardEvent&);
- Element* findElementWithExactTabIndex(const FocusNavigationScope&, Node* start, int tabIndex, KeyboardEvent*, FocusDirection);
+ Element* findElementWithExactTabIndex(const FocusNavigationScope&, Node* start, int tabIndex, KeyboardEvent&, FocusDirection);
- Element* nextFocusableElementOrScopeOwner(const FocusNavigationScope&, Node* start, KeyboardEvent*);
- Element* previousFocusableElementOrScopeOwner(const FocusNavigationScope&, Node* start, KeyboardEvent*);
+ Element* nextFocusableElementOrScopeOwner(const FocusNavigationScope&, Node* start, KeyboardEvent&);
+ Element* previousFocusableElementOrScopeOwner(const FocusNavigationScope&, Node* start, KeyboardEvent&);
- bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent*);
- void findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent*, FocusCandidate& closest);
+ bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent&);
+ void findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent&, FocusCandidate& closest);
void focusRepaintTimerFired();