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 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 // FIXME: Either this should only deal with WebLocalFrames or it should move
to WebFrame. | 2889 // FIXME: Either this should only deal with WebLocalFrames or it should move
to WebFrame. |
2890 if (!relativeToFrame) | 2890 if (!relativeToFrame) |
2891 relativeToFrame = mainFrame(); | 2891 relativeToFrame = mainFrame(); |
2892 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); | 2892 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); |
2893 frame = frame->tree().find(name); | 2893 frame = frame->tree().find(name); |
2894 if (!frame || !frame->isLocalFrame()) | 2894 if (!frame || !frame->isLocalFrame()) |
2895 return nullptr; | 2895 return nullptr; |
2896 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | 2896 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
2897 } | 2897 } |
2898 | 2898 |
2899 WebFrame* WebViewImpl::focusedFrame() | 2899 WebLocalFrame* WebViewImpl::focusedFrame() |
2900 { | 2900 { |
2901 return WebFrame::fromFrame(focusedCoreFrame()); | 2901 Frame* frame = focusedCoreFrame(); |
| 2902 // TODO(yabinh): focusedCoreFrame() should always return a local frame, and |
| 2903 // the following check should be unnecessary. |
| 2904 // See crbug.com/625068 |
| 2905 if (!frame || !frame->isLocalFrame()) |
| 2906 return nullptr; |
| 2907 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
2902 } | 2908 } |
2903 | 2909 |
2904 void WebViewImpl::setFocusedFrame(WebFrame* frame) | 2910 void WebViewImpl::setFocusedFrame(WebFrame* frame) |
2905 { | 2911 { |
2906 if (!frame) { | 2912 if (!frame) { |
2907 // Clears the focused frame if any. | 2913 // Clears the focused frame if any. |
2908 Frame* focusedFrame = focusedCoreFrame(); | 2914 Frame* focusedFrame = focusedCoreFrame(); |
2909 if (focusedFrame && focusedFrame->isLocalFrame()) | 2915 if (focusedFrame && focusedFrame->isLocalFrame()) |
2910 toLocalFrame(focusedFrame)->selection().setFocused(false); | 2916 toLocalFrame(focusedFrame)->selection().setFocused(false); |
2911 return; | 2917 return; |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4533 { | 4539 { |
4534 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4540 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4535 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4541 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4536 if (!page()) | 4542 if (!page()) |
4537 return 1; | 4543 return 1; |
4538 | 4544 |
4539 return page()->deviceScaleFactor(); | 4545 return page()->deviceScaleFactor(); |
4540 } | 4546 } |
4541 | 4547 |
4542 } // namespace blink | 4548 } // namespace blink |
OLD | NEW |