| Index: Source/core/page/FocusController.cpp
|
| ===================================================================
|
| --- Source/core/page/FocusController.cpp (revision 170478)
|
| +++ Source/core/page/FocusController.cpp (working copy)
|
| @@ -87,7 +87,7 @@
|
| ShadowRoot* shadowRoot = toShadowRoot(root);
|
| return shadowRoot->isYoungest() ? shadowRoot->host() : shadowRoot->shadowInsertionPointOfYoungerShadowRoot();
|
| }
|
| - if (Frame* frame = root->document().frame())
|
| + if (LocalFrame* frame = root->document().frame())
|
| return frame->ownerElement();
|
| return 0;
|
| }
|
| @@ -231,7 +231,7 @@
|
| return adoptPtr(new FocusController(page));
|
| }
|
|
|
| -void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
|
| +void FocusController::setFocusedFrame(PassRefPtr<LocalFrame> frame)
|
| {
|
| ASSERT(!frame || frame->page() == m_page);
|
| if (m_focusedFrame == frame || m_isChangingFocusedFrame)
|
| @@ -239,10 +239,10 @@
|
|
|
| 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;
|
| + RefPtr<LocalFrame> oldFrame = m_focusedFrame;
|
| + RefPtr<LocalFrame> newFrame = frame;
|
|
|
| - m_focusedFrame = frame.get();
|
| + m_focusedFrame = newFrame;
|
|
|
| // Now that the frame is updated, fire events and update the selection focused states of both frames.
|
| if (oldFrame && oldFrame->view()) {
|
| @@ -260,9 +260,9 @@
|
| m_page->chrome().client().focusedFrameChanged(newFrame.get());
|
| }
|
|
|
| -Frame* FocusController::focusedOrMainFrame() const
|
| +LocalFrame* FocusController::focusedOrMainFrame() const
|
| {
|
| - if (Frame* frame = focusedFrame())
|
| + if (LocalFrame* frame = focusedFrame())
|
| return frame;
|
| return m_page->mainFrame();
|
| }
|
| @@ -274,17 +274,17 @@
|
|
|
| m_isFocused = focused;
|
|
|
| - if (!m_isFocused && focusedOrMainFrame()->isLocalFrame())
|
| - toLocalFrame(focusedOrMainFrame())->eventHandler().stopAutoscroll();
|
| + if (!m_isFocused)
|
| + focusedOrMainFrame()->eventHandler().stopAutoscroll();
|
|
|
| if (!m_focusedFrame)
|
| setFocusedFrame(m_page->mainFrame());
|
|
|
| // setFocusedFrame above might reject to update m_focusedFrame, or
|
| // m_focusedFrame might be changed by blur/focus event handlers.
|
| - if (m_focusedFrame && m_focusedFrame->isLocalFrame() && toLocalFrame(m_focusedFrame.get())->view()) {
|
| - toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused);
|
| - dispatchEventsOnWindowAndFocusedNode(toLocalFrame(m_focusedFrame.get())->document(), focused);
|
| + if (m_focusedFrame && m_focusedFrame->view()) {
|
| + m_focusedFrame->selection().setFocused(focused);
|
| + dispatchEventsOnWindowAndFocusedNode(m_focusedFrame->document(), focused);
|
| }
|
| }
|
|
|
| @@ -339,11 +339,7 @@
|
|
|
| bool FocusController::advanceFocusInDocumentOrder(FocusType type, bool initialFocus)
|
| {
|
| - // FIXME: Focus advancement won't work with externally rendered frames until after
|
| - // inter-frame focus control is moved out of Blink.
|
| - if (!focusedOrMainFrame()->isLocalFrame())
|
| - return false;
|
| - LocalFrame* frame = toLocalFrame(focusedOrMainFrame());
|
| + LocalFrame* frame = focusedOrMainFrame();
|
| ASSERT(frame);
|
| Document* document = frame->document();
|
|
|
| @@ -629,9 +625,9 @@
|
| selection.clear();
|
| }
|
|
|
| -bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusType type)
|
| +bool FocusController::setFocusedElement(Element* element, PassRefPtr<LocalFrame> newFocusedFrame, FocusType type)
|
| {
|
| - RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame());
|
| + RefPtr<LocalFrame> oldFocusedFrame = focusedFrame();
|
| RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0;
|
|
|
| Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0;
|
| @@ -653,7 +649,7 @@
|
| if (newDocument && oldDocument == newDocument && newDocument->focusedElement() == element)
|
| return true;
|
|
|
| - clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.get()), element);
|
| + clearSelectionIfNeeded(oldFocusedFrame.get(), newFocusedFrame.get(), element);
|
|
|
| if (oldDocument && oldDocument != newDocument)
|
| oldDocument->setFocusedElement(nullptr);
|
| @@ -685,7 +681,7 @@
|
| if (FrameView* view = m_page->mainFrame()->view())
|
| view->updateControlTints();
|
|
|
| - toLocalFrame(focusedOrMainFrame())->selection().pageActivationChanged();
|
| + focusedOrMainFrame()->selection().pageActivationChanged();
|
| }
|
|
|
| static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didShow)
|
| @@ -876,10 +872,7 @@
|
|
|
| bool FocusController::advanceFocusDirectionally(FocusType type)
|
| {
|
| - // FIXME: Directional focus changes don't yet work with RemoteFrames.
|
| - if (!focusedOrMainFrame()->isLocalFrame())
|
| - return false;
|
| - LocalFrame* curFrame = toLocalFrame(focusedOrMainFrame());
|
| + LocalFrame* curFrame = focusedOrMainFrame();
|
| ASSERT(curFrame);
|
|
|
| Document* focusedDocument = curFrame->document();
|
|
|