Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2899 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame. | 2899 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame. |
| 2900 if (!relativeToFrame) | 2900 if (!relativeToFrame) |
| 2901 relativeToFrame = mainFrame(); | 2901 relativeToFrame = mainFrame(); |
| 2902 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); | 2902 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); |
| 2903 frame = frame->tree().find(name); | 2903 frame = frame->tree().find(name); |
| 2904 if (!frame || !frame->isLocalFrame()) | 2904 if (!frame || !frame->isLocalFrame()) |
| 2905 return nullptr; | 2905 return nullptr; |
| 2906 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | 2906 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
| 2907 } | 2907 } |
| 2908 | 2908 |
| 2909 WebFrame* WebViewImpl::focusedFrame() | 2909 WebLocalFrame* WebViewImpl::focusedFrame() |
| 2910 { | 2910 { |
| 2911 return WebFrame::fromFrame(focusedCoreFrame()); | 2911 Frame* frame = focusedCoreFrame(); |
| 2912 if (!frame || !frame->isLocalFrame()) | |
|
dcheng
2016/06/13 17:29:45
Let's just assert that this is local. All the retu
| |
| 2913 return nullptr; | |
| 2914 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | |
| 2912 } | 2915 } |
| 2913 | 2916 |
| 2914 void WebViewImpl::setFocusedFrame(WebFrame* frame) | 2917 void WebViewImpl::setFocusedFrame(WebFrame* frame) |
| 2915 { | 2918 { |
| 2916 if (!frame) { | 2919 if (!frame) { |
| 2917 // Clears the focused frame if any. | 2920 // Clears the focused frame if any. |
| 2918 Frame* focusedFrame = focusedCoreFrame(); | 2921 Frame* focusedFrame = focusedCoreFrame(); |
| 2919 if (focusedFrame && focusedFrame->isLocalFrame()) | 2922 if (focusedFrame && focusedFrame->isLocalFrame()) |
| 2920 toLocalFrame(focusedFrame)->selection().setFocused(false); | 2923 toLocalFrame(focusedFrame)->selection().setFocused(false); |
| 2921 return; | 2924 return; |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4567 { | 4570 { |
| 4568 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than | 4571 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than |
| 4569 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4572 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4570 if (!page()) | 4573 if (!page()) |
| 4571 return 1; | 4574 return 1; |
| 4572 | 4575 |
| 4573 return page()->deviceScaleFactor(); | 4576 return page()->deviceScaleFactor(); |
| 4574 } | 4577 } |
| 4575 | 4578 |
| 4576 } // namespace blink | 4579 } // namespace blink |
| OLD | NEW |