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

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

Issue 23671002: Refactoring: Add toWebFrameImpl() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected as per review commments. Created 7 years, 3 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
« no previous file with comments | « Source/web/WebSharedWorkerImpl.cpp ('k') | Source/web/mac/WebSubstringUtil.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 WebFrame* WebViewImpl::mainFrame() 2579 WebFrame* WebViewImpl::mainFrame()
2580 { 2580 {
2581 return mainFrameImpl(); 2581 return mainFrameImpl();
2582 } 2582 }
2583 2583
2584 WebFrame* WebViewImpl::findFrameByName( 2584 WebFrame* WebViewImpl::findFrameByName(
2585 const WebString& name, WebFrame* relativeToFrame) 2585 const WebString& name, WebFrame* relativeToFrame)
2586 { 2586 {
2587 if (!relativeToFrame) 2587 if (!relativeToFrame)
2588 relativeToFrame = mainFrame(); 2588 relativeToFrame = mainFrame();
2589 Frame* frame = static_cast<WebFrameImpl*>(relativeToFrame)->frame(); 2589 Frame* frame = toWebFrameImpl(relativeToFrame)->frame();
2590 frame = frame->tree()->find(name); 2590 frame = frame->tree()->find(name);
2591 return WebFrameImpl::fromFrame(frame); 2591 return WebFrameImpl::fromFrame(frame);
2592 } 2592 }
2593 2593
2594 WebFrame* WebViewImpl::focusedFrame() 2594 WebFrame* WebViewImpl::focusedFrame()
2595 { 2595 {
2596 return WebFrameImpl::fromFrame(focusedWebCoreFrame()); 2596 return WebFrameImpl::fromFrame(focusedWebCoreFrame());
2597 } 2597 }
2598 2598
2599 void WebViewImpl::setFocusedFrame(WebFrame* frame) 2599 void WebViewImpl::setFocusedFrame(WebFrame* frame)
2600 { 2600 {
2601 if (!frame) { 2601 if (!frame) {
2602 // Clears the focused frame if any. 2602 // Clears the focused frame if any.
2603 Frame* frame = focusedWebCoreFrame(); 2603 Frame* frame = focusedWebCoreFrame();
2604 if (frame) 2604 if (frame)
2605 frame->selection()->setFocused(false); 2605 frame->selection()->setFocused(false);
2606 return; 2606 return;
2607 } 2607 }
2608 WebFrameImpl* frameImpl = static_cast<WebFrameImpl*>(frame); 2608 Frame* webcoreFrame = toWebFrameImpl(frame)->frame();
2609 Frame* webcoreFrame = frameImpl->frame();
2610 webcoreFrame->page()->focusController().setFocusedFrame(webcoreFrame); 2609 webcoreFrame->page()->focusController().setFocusedFrame(webcoreFrame);
2611 } 2610 }
2612 2611
2613 void WebViewImpl::setInitialFocus(bool reverse) 2612 void WebViewImpl::setInitialFocus(bool reverse)
2614 { 2613 {
2615 if (!m_page) 2614 if (!m_page)
2616 return; 2615 return;
2617 Frame* frame = page()->focusController().focusedOrMainFrame(); 2616 Frame* frame = page()->focusController().focusedOrMainFrame();
2618 if (Document* document = frame->document()) 2617 if (Document* document = frame->document())
2619 document->setFocusedElement(0); 2618 document->setFocusedElement(0);
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 } 4110 }
4112 4111
4113 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4112 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4114 { 4113 {
4115 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4114 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4116 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4115 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4117 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4116 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4118 } 4117 }
4119 4118
4120 } // namespace WebKit 4119 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebSharedWorkerImpl.cpp ('k') | Source/web/mac/WebSubstringUtil.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698