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 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2412 focus = local_frame->View()->ContentsToViewport(focus); | 2412 focus = local_frame->View()->ContentsToViewport(focus); |
2413 | 2413 |
2414 if (!selection.ComputeVisibleSelectionInDOMTree().IsBaseFirst()) | 2414 if (!selection.ComputeVisibleSelectionInDOMTree().IsBaseFirst()) |
2415 std::swap(anchor, focus); | 2415 std::swap(anchor, focus); |
2416 return true; | 2416 return true; |
2417 } | 2417 } |
2418 | 2418 |
2419 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | 2419 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as |
2420 // well. This code needs to be refactored (http://crbug.com/629721). | 2420 // well. This code needs to be refactored (http://crbug.com/629721). |
2421 WebPlugin* WebViewImpl::FocusedPluginIfInputMethodSupported(LocalFrame* frame) { | 2421 WebPlugin* WebViewImpl::FocusedPluginIfInputMethodSupported(LocalFrame* frame) { |
2422 WebPluginContainerBase* container = | 2422 if (frame) { |
dcheng
2017/05/19 09:07:02
Ditto: I think this is actually unused now
slangley
2017/05/21 23:53:33
Deleted.
| |
2423 WebLocalFrameImpl::CurrentPluginContainer(frame); | 2423 WebPluginContainerBase* container = frame->GetWebPluginContainerBase(); |
2424 if (container && container->SupportsInputMethod()) | 2424 if (container && container->SupportsInputMethod()) |
2425 return container->Plugin(); | 2425 return container->Plugin(); |
2426 } | |
2426 return nullptr; | 2427 return nullptr; |
2427 } | 2428 } |
2428 | 2429 |
2429 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | 2430 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as |
2430 // well. This code needs to be refactored (http://crbug.com/629721). | 2431 // well. This code needs to be refactored (http://crbug.com/629721). |
2431 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start, | 2432 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start, |
2432 WebTextDirection& end) const { | 2433 WebTextDirection& end) const { |
2433 const LocalFrame* frame = FocusedLocalFrameInWidget(); | 2434 const LocalFrame* frame = FocusedLocalFrameInWidget(); |
2434 if (!frame) | 2435 if (!frame) |
2435 return false; | 2436 return false; |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2902 } | 2903 } |
2903 | 2904 |
2904 double WebViewImpl::ZoomLevel() { | 2905 double WebViewImpl::ZoomLevel() { |
2905 return zoom_level_; | 2906 return zoom_level_; |
2906 } | 2907 } |
2907 | 2908 |
2908 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, | 2909 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, |
2909 float zoom_factor) { | 2910 float zoom_factor) { |
2910 if (frame->IsLocalRoot()) { | 2911 if (frame->IsLocalRoot()) { |
2911 LocalFrame* local_frame = ToLocalFrame(frame); | 2912 LocalFrame* local_frame = ToLocalFrame(frame); |
2912 if (!WebLocalFrameImpl::PluginContainerFromFrame(local_frame)) | 2913 if (!local_frame->GetWebPluginContainerBase()) |
2913 local_frame->SetPageZoomFactor(zoom_factor); | 2914 local_frame->SetPageZoomFactor(zoom_factor); |
2914 } | 2915 } |
2915 | 2916 |
2916 for (Frame* child = frame->Tree().FirstChild(); child; | 2917 for (Frame* child = frame->Tree().FirstChild(); child; |
2917 child = child->Tree().NextSibling()) | 2918 child = child->Tree().NextSibling()) |
2918 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor); | 2919 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor); |
2919 } | 2920 } |
2920 | 2921 |
2921 double WebViewImpl::SetZoomLevel(double zoom_level) { | 2922 double WebViewImpl::SetZoomLevel(double zoom_level) { |
2922 if (zoom_level < minimum_zoom_level_) | 2923 if (zoom_level < minimum_zoom_level_) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2954 maximum_zoom_level_ = maximum_zoom_level; | 2955 maximum_zoom_level_ = maximum_zoom_level; |
2955 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_); | 2956 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_); |
2956 } | 2957 } |
2957 | 2958 |
2958 float WebViewImpl::TextZoomFactor() { | 2959 float WebViewImpl::TextZoomFactor() { |
2959 return MainFrameImpl()->GetFrame()->TextZoomFactor(); | 2960 return MainFrameImpl()->GetFrame()->TextZoomFactor(); |
2960 } | 2961 } |
2961 | 2962 |
2962 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) { | 2963 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) { |
2963 LocalFrame* frame = MainFrameImpl()->GetFrame(); | 2964 LocalFrame* frame = MainFrameImpl()->GetFrame(); |
2964 if (WebLocalFrameImpl::PluginContainerFromFrame(frame)) | 2965 if (frame->GetWebPluginContainerBase()) |
2965 return 1; | 2966 return 1; |
2966 | 2967 |
2967 frame->SetTextZoomFactor(text_zoom_factor); | 2968 frame->SetTextZoomFactor(text_zoom_factor); |
2968 | 2969 |
2969 return text_zoom_factor; | 2970 return text_zoom_factor; |
2970 } | 2971 } |
2971 | 2972 |
2972 double WebView::ZoomLevelToZoomFactor(double zoom_level) { | 2973 double WebView::ZoomLevelToZoomFactor(double zoom_level) { |
2973 return pow(kTextSizeMultiplierRatio, zoom_level); | 2974 return pow(kTextSizeMultiplierRatio, zoom_level); |
2974 } | 2975 } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4160 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4161 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
4161 return nullptr; | 4162 return nullptr; |
4162 return focused_frame; | 4163 return focused_frame; |
4163 } | 4164 } |
4164 | 4165 |
4165 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4166 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
4166 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4167 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
4167 } | 4168 } |
4168 | 4169 |
4169 } // namespace blink | 4170 } // namespace blink |
OLD | NEW |