#include "core/editing/FrameSelection.h"
#include "core/editing/htmlediting.h" // For firstPositionInOrBeforeNode
#include "core/events/Event.h"
-#include "core/frame/LocalDOMWindow.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLAreaElement.h"
#include "core/html/HTMLImageElement.h"
focusedElement->setFocus(true);
focusedElement->dispatchFocusEvent(0, FocusTypePage);
if (focusedElement == document->focusedElement()) {
- document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0);
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0, FocusTypePage);
if (focusedElement == document->focusedElement())
- document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0);
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0, FocusTypePage);
}
}
}
{
}
-PassOwnPtr<FocusController> FocusController::create(Page* page)
+PassOwnPtrWillBeRawPtr<FocusController> FocusController::create(Page* page)
{
- return adoptPtr(new FocusController(page));
+ return adoptPtrWillBeNoop(new FocusController(page));
}
-void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
+void FocusController::setFocusedFrame(PassRefPtrWillBeRawPtr<Frame> frame)
{
ASSERT(!frame || frame->page() == m_page);
if (m_focusedFrame == frame || m_isChangingFocusedFrame)
m_isChangingFocusedFrame = true;
- RefPtr<LocalFrame> oldFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
- RefPtr<LocalFrame> newFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> oldFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
+
+ RefPtrWillBeRawPtr<LocalFrame> newFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
m_focusedFrame = frame.get();
m_page->chrome().client().focusedFrameChanged(newFrame.get());
}
-void FocusController::focusDocumentView(PassRefPtr<Frame> frame)
+void FocusController::focusDocumentView(PassRefPtrWillBeRawPtr<Frame> frame)
{
ASSERT(!frame || frame->page() == m_page);
if (m_focusedFrame == frame)
return;
- RefPtr<LocalFrame> focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
if (focusedFrame && focusedFrame->view()) {
RefPtrWillBeRawPtr<Document> document = focusedFrame->document();
Element* focusedElement = document ? document->focusedElement() : 0;
}
}
- RefPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
if (newFocusedFrame && newFocusedFrame->view()) {
RefPtrWillBeRawPtr<Document> document = newFocusedFrame->document();
Element* focusedElement = document ? document->focusedElement() : 0;
if (focusedElement) {
focusedElement->dispatchFocusEvent(0, FocusTypePage);
if (focusedElement == document->focusedElement()) {
- document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0);
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0, FocusTypePage);
if (focusedElement == document->focusedElement())
- document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0);
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0, FocusTypePage);
}
}
}
if (shouldVisit(node) && adjustedTabIndex(node) >= 0)
return node;
}
+ } else {
+ // First try to find a node with the same tabindex as start that comes after start in the scope.
+ if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*start), tabIndex, FocusTypeForward))
+ return winner;
}
-
- // First try to find a node with the same tabindex as start that comes after start in the scope.
- if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*start), tabIndex, FocusTypeForward))
- return winner;
-
if (!tabIndex)
// We've reached the last node in the document with a tabindex of 0. This is the end of the tabbing order.
return 0;
if (shouldVisit(node) && adjustedTabIndex(node) >= 0)
return node;
}
+ } else {
+ if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIndex, FocusTypeBackward))
+ return winner;
}
- if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIndex, FocusTypeBackward))
- return winner;
-
// There are no nodes before start with the same tabindex as start, so look for a node that:
// 1) has the highest non-zero tabindex (that is less than start's tabindex), and
// 2) comes last in the scope, if there's a tie.
selection.clear();
}
-bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusType type)
+bool FocusController::setFocusedElement(Element* element, PassRefPtrWillBeRawPtr<Frame> newFocusedFrame, FocusType type)
{
- RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame());
+ RefPtrWillBeRawPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame());
RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0;
Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0;
return consumed;
}
+void FocusController::trace(Visitor* visitor)
+{
+ visitor->trace(m_page);
+ visitor->trace(m_focusedFrame);
+}
+
} // namespace blink