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

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

Issue 331633004: Check for NULL after Frame lookup in findFrameByName (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improved the conditional Created 6 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
« no previous file with comments | « no previous file | no next file » | 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 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 } 2483 }
2484 2484
2485 WebFrame* WebViewImpl::findFrameByName( 2485 WebFrame* WebViewImpl::findFrameByName(
2486 const WebString& name, WebFrame* relativeToFrame) 2486 const WebString& name, WebFrame* relativeToFrame)
2487 { 2487 {
2488 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame. 2488 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame.
2489 if (!relativeToFrame) 2489 if (!relativeToFrame)
2490 relativeToFrame = mainFrame(); 2490 relativeToFrame = mainFrame();
2491 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); 2491 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame();
2492 frame = frame->tree().find(name); 2492 frame = frame->tree().find(name);
2493 if (!frame->isLocalFrame()) 2493 if (!frame || !frame->isLocalFrame())
2494 return 0; 2494 return 0;
2495 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); 2495 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
2496 } 2496 }
2497 2497
2498 WebFrame* WebViewImpl::focusedFrame() 2498 WebFrame* WebViewImpl::focusedFrame()
2499 { 2499 {
2500 return WebLocalFrameImpl::fromFrame(toLocalFrame(focusedWebCoreFrame())); 2500 return WebLocalFrameImpl::fromFrame(toLocalFrame(focusedWebCoreFrame()));
2501 } 2501 }
2502 2502
2503 void WebViewImpl::setFocusedFrame(WebFrame* frame) 2503 void WebViewImpl::setFocusedFrame(WebFrame* frame)
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4104 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4105 4105
4106 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4106 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4107 return false; 4107 return false;
4108 4108
4109 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4109 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4110 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4110 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4111 } 4111 }
4112 4112
4113 } // namespace blink 4113 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698