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

Unified Diff: third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp

Issue 1467123003: Create base class for common functionality of Web{Local,Remote}Frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 1 month 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/web/RemoteFrameClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
index e67b4f4aa35ae9c0fa31cca6defc7b385a87523b..9250810f9b499386d64091271555082cdbe6dd4a 100644
--- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
@@ -21,6 +21,21 @@
namespace blink {
+namespace {
+
+// Convenience helper for frame tree helpers in FrameClient to reduce the amount
+// of null-checking boilerplate code. Since the frame tree is maintained in the
+// web/ layer, the frame tree helpers often have to deal with null WebFrames:
+// for example, a frame with no parent will return null for WebFrame::parent().
+// TODO(dcheng): Remove duplication between FrameLoaderClientImpl and
+// RemoteFrameClientImpl somehow...
+Frame* toCoreFrame(WebFrame* frame)
+{
+ return frame ? frame->toImplBase()->frame() : nullptr;
+}
+
+} // namespace
+
RemoteFrameClientImpl::RemoteFrameClientImpl(WebRemoteFrameImpl* webFrame)
: m_webFrame(webFrame)
{
@@ -147,7 +162,7 @@ void RemoteFrameClientImpl::forwardInputEvent(Event* event)
// implemented, since this code path will need to be removed or refactored
// anyway.
// See https://crbug.com/520705.
- if (!toCoreFrame(m_webFrame)->ownerLayoutObject())
+ if (!m_webFrame->toImplBase()->frame()->ownerLayoutObject())
return;
// This is only called when we have out-of-process iframes, which
@@ -157,9 +172,9 @@ void RemoteFrameClientImpl::forwardInputEvent(Event* event)
if (event->isKeyboardEvent())
webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event)));
else if (event->isMouseEvent())
- webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event)));
+ webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view(), m_webFrame->toImplBase()->frame()->ownerLayoutObject(), *static_cast<MouseEvent*>(event)));
else if (event->isWheelEvent())
- webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->view(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(event)));
+ webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->view(), m_webFrame->toImplBase()->frame()->ownerLayoutObject(), *static_cast<WheelEvent*>(event)));
// Other or internal Blink events should not be forwarded.
if (!webEvent || webEvent->type == WebInputEvent::Undefined)
« no previous file with comments | « third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp ('k') | third_party/WebKit/Source/web/WebDOMMessageEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698