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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2907663004: FrameTree::Find only searches relative to local frames. (Closed)
Patch Set: . Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 if (!page_->DeprecatedLocalMainFrame()->GetDocument()->Loader()) 2626 if (!page_->DeprecatedLocalMainFrame()->GetDocument()->Loader())
2627 return WebString(); 2627 return WebString();
2628 2628
2629 return page_->DeprecatedLocalMainFrame()->GetDocument()->EncodingName(); 2629 return page_->DeprecatedLocalMainFrame()->GetDocument()->EncodingName();
2630 } 2630 }
2631 2631
2632 WebFrame* WebViewImpl::MainFrame() { 2632 WebFrame* WebViewImpl::MainFrame() {
2633 return WebFrame::FromFrame(page_ ? page_->MainFrame() : nullptr); 2633 return WebFrame::FromFrame(page_ ? page_->MainFrame() : nullptr);
2634 } 2634 }
2635 2635
2636 WebFrame* WebViewImpl::FindFrameByName(const WebString& name,
2637 WebFrame* relative_to_frame) {
2638 // FIXME: Either this should only deal with WebLocalFrames or it should move
2639 // to WebFrame.
2640 if (!relative_to_frame)
2641 relative_to_frame = MainFrame();
2642 Frame* frame = ToWebLocalFrameBase(relative_to_frame)->GetFrame();
2643 frame = frame->Tree().Find(name);
2644 if (!frame || !frame->IsLocalFrame())
2645 return nullptr;
2646 return WebLocalFrameBase::FromFrame(ToLocalFrame(frame));
2647 }
2648
2649 WebLocalFrame* WebViewImpl::FocusedFrame() { 2636 WebLocalFrame* WebViewImpl::FocusedFrame() {
2650 Frame* frame = FocusedCoreFrame(); 2637 Frame* frame = FocusedCoreFrame();
2651 // TODO(yabinh): focusedCoreFrame() should always return a local frame, and 2638 // TODO(yabinh): focusedCoreFrame() should always return a local frame, and
2652 // the following check should be unnecessary. 2639 // the following check should be unnecessary.
2653 // See crbug.com/625068 2640 // See crbug.com/625068
2654 if (!frame || !frame->IsLocalFrame()) 2641 if (!frame || !frame->IsLocalFrame())
2655 return nullptr; 2642 return nullptr;
2656 return WebLocalFrameBase::FromFrame(ToLocalFrame(frame)); 2643 return WebLocalFrameBase::FromFrame(ToLocalFrame(frame));
2657 } 2644 }
2658 2645
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4138 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4152 return nullptr; 4139 return nullptr;
4153 return focused_frame; 4140 return focused_frame;
4154 } 4141 }
4155 4142
4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4143 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4144 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4158 } 4145 }
4159 4146
4160 } // namespace blink 4147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698