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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 #include "core/editing/FrameSelection.h" | 42 #include "core/editing/FrameSelection.h" |
43 #include "core/editing/InputMethodController.h" | 43 #include "core/editing/InputMethodController.h" |
44 #include "core/editing/TextIterator.h" | 44 #include "core/editing/TextIterator.h" |
45 #include "core/events/KeyboardEvent.h" | 45 #include "core/events/KeyboardEvent.h" |
46 #include "core/events/WheelEvent.h" | 46 #include "core/events/WheelEvent.h" |
47 #include "core/frame/EventHandlerRegistry.h" | 47 #include "core/frame/EventHandlerRegistry.h" |
48 #include "core/frame/FrameHost.h" | 48 #include "core/frame/FrameHost.h" |
49 #include "core/frame/FrameView.h" | 49 #include "core/frame/FrameView.h" |
50 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
51 #include "core/frame/PinchViewport.h" | 51 #include "core/frame/PinchViewport.h" |
52 #include "core/frame/RemoteFrame.h" | |
52 #include "core/frame/Settings.h" | 53 #include "core/frame/Settings.h" |
53 #include "core/frame/SmartClip.h" | 54 #include "core/frame/SmartClip.h" |
54 #include "core/html/HTMLInputElement.h" | 55 #include "core/html/HTMLInputElement.h" |
55 #include "core/html/HTMLMediaElement.h" | 56 #include "core/html/HTMLMediaElement.h" |
56 #include "core/html/HTMLPlugInElement.h" | 57 #include "core/html/HTMLPlugInElement.h" |
57 #include "core/html/HTMLTextAreaElement.h" | 58 #include "core/html/HTMLTextAreaElement.h" |
58 #include "core/html/ime/InputMethodContext.h" | 59 #include "core/html/ime/InputMethodContext.h" |
59 #include "core/inspector/InspectorController.h" | 60 #include "core/inspector/InspectorController.h" |
60 #include "core/loader/DocumentLoader.h" | 61 #include "core/loader/DocumentLoader.h" |
61 #include "core/loader/FrameLoader.h" | 62 #include "core/loader/FrameLoader.h" |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1577 return; | 1578 return; |
1578 | 1579 |
1579 page()->frameHost().pinchViewport().setSize(newSize); | 1580 page()->frameHost().pinchViewport().setSize(newSize); |
1580 } | 1581 } |
1581 | 1582 |
1582 void WebViewImpl::resize(const WebSize& newSize) | 1583 void WebViewImpl::resize(const WebSize& newSize) |
1583 { | 1584 { |
1584 if (m_shouldAutoResize || m_size == newSize) | 1585 if (m_shouldAutoResize || m_size == newSize) |
1585 return; | 1586 return; |
1586 | 1587 |
1588 if (!mainFrameImpl()) | |
dcheng
2014/06/20 20:49:12
Being less familiar with the rendering paths, is t
nasko
2014/06/20 21:09:53
I'll leave that for Ken to give input on.
kenrb
2014/06/23 15:21:18
Most of the places that access the top-level Frame
| |
1589 return; | |
1590 | |
1587 FrameView* view = mainFrameImpl()->frameView(); | 1591 FrameView* view = mainFrameImpl()->frameView(); |
1588 if (!view) | 1592 if (!view) |
1589 return; | 1593 return; |
1590 | 1594 |
1591 WebSize oldSize = m_size; | 1595 WebSize oldSize = m_size; |
1592 float oldPageScaleFactor = pageScaleFactor(); | 1596 float oldPageScaleFactor = pageScaleFactor(); |
1593 int oldContentsWidth = contentsSize().width(); | 1597 int oldContentsWidth = contentsSize().width(); |
1594 | 1598 |
1595 m_size = newSize; | 1599 m_size = newSize; |
1596 | 1600 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2099 return false; | 2103 return false; |
2100 *location = plainTextRange.start(); | 2104 *location = plainTextRange.start(); |
2101 *length = plainTextRange.length(); | 2105 *length = plainTextRange.length(); |
2102 return true; | 2106 return true; |
2103 } | 2107 } |
2104 | 2108 |
2105 WebTextInputInfo WebViewImpl::textInputInfo() | 2109 WebTextInputInfo WebViewImpl::textInputInfo() |
2106 { | 2110 { |
2107 WebTextInputInfo info; | 2111 WebTextInputInfo info; |
2108 | 2112 |
2109 LocalFrame* focused = toLocalFrame(focusedWebCoreFrame()); | 2113 Frame* focusedFrame = focusedWebCoreFrame(); |
2114 if (focusedFrame->isRemoteFrame()) | |
2115 return info; | |
2116 | |
2117 LocalFrame* focused = toLocalFrame(focusedFrame); | |
2110 if (!focused) | 2118 if (!focused) |
2111 return info; | 2119 return info; |
2112 | 2120 |
2113 FrameSelection& selection = focused->selection(); | 2121 FrameSelection& selection = focused->selection(); |
2114 Node* node = selection.selection().rootEditableElement(); | 2122 Node* node = selection.selection().rootEditableElement(); |
2115 if (!node) | 2123 if (!node) |
2116 return info; | 2124 return info; |
2117 | 2125 |
2118 info.inputMode = inputModeOfFocusedElement(); | 2126 info.inputMode = inputModeOfFocusedElement(); |
2119 | 2127 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2514 relativeToFrame = mainFrame(); | 2522 relativeToFrame = mainFrame(); |
2515 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); | 2523 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); |
2516 frame = frame->tree().find(name); | 2524 frame = frame->tree().find(name); |
2517 if (!frame || !frame->isLocalFrame()) | 2525 if (!frame || !frame->isLocalFrame()) |
2518 return 0; | 2526 return 0; |
2519 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | 2527 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
2520 } | 2528 } |
2521 | 2529 |
2522 WebFrame* WebViewImpl::focusedFrame() | 2530 WebFrame* WebViewImpl::focusedFrame() |
2523 { | 2531 { |
2524 return WebLocalFrameImpl::fromFrame(toLocalFrame(focusedWebCoreFrame())); | 2532 Frame* frame = focusedWebCoreFrame(); |
2533 if (frame->isRemoteFrame()) | |
dcheng
2014/06/20 20:49:12
You can use WebFrame::fromFrame now, so you don't
nasko
2014/06/20 21:09:53
Yay! ?!
| |
2534 return WebRemoteFrameImpl::fromFrame(toRemoteFrame(*frame)); | |
2535 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | |
2525 } | 2536 } |
2526 | 2537 |
2527 void WebViewImpl::setFocusedFrame(WebFrame* frame) | 2538 void WebViewImpl::setFocusedFrame(WebFrame* frame) |
2528 { | 2539 { |
2529 if (!frame) { | 2540 if (!frame) { |
2530 // Clears the focused frame if any. | 2541 // Clears the focused frame if any. |
2531 Frame* focusedFrame = focusedWebCoreFrame(); | 2542 Frame* focusedFrame = focusedWebCoreFrame(); |
2532 if (focusedFrame && focusedFrame->isLocalFrame()) | 2543 if (focusedFrame && focusedFrame->isLocalFrame()) |
2533 toLocalFrame(focusedFrame)->selection().setFocused(false); | 2544 toLocalFrame(focusedFrame)->selection().setFocused(false); |
2534 return; | 2545 return; |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4151 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4162 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
4152 | 4163 |
4153 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4164 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4154 return false; | 4165 return false; |
4155 | 4166 |
4156 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4167 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4157 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4168 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4158 } | 4169 } |
4159 | 4170 |
4160 } // namespace blink | 4171 } // namespace blink |
OLD | NEW |