| 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 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 anchor = local_frame->View()->ContentsToViewport(anchor); | 2410 anchor = local_frame->View()->ContentsToViewport(anchor); |
| 2411 focus = local_frame->View()->ContentsToViewport(focus); | 2411 focus = local_frame->View()->ContentsToViewport(focus); |
| 2412 | 2412 |
| 2413 if (!selection.ComputeVisibleSelectionInDOMTree().IsBaseFirst()) | 2413 if (!selection.ComputeVisibleSelectionInDOMTree().IsBaseFirst()) |
| 2414 std::swap(anchor, focus); | 2414 std::swap(anchor, focus); |
| 2415 return true; | 2415 return true; |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | 2418 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as |
| 2419 // well. This code needs to be refactored (http://crbug.com/629721). | 2419 // well. This code needs to be refactored (http://crbug.com/629721). |
| 2420 WebPlugin* WebViewImpl::FocusedPluginIfInputMethodSupported(LocalFrame* frame) { | |
| 2421 WebPluginContainerBase* container = | |
| 2422 WebLocalFrameImpl::CurrentPluginContainer(frame); | |
| 2423 if (container && container->SupportsInputMethod()) | |
| 2424 return container->Plugin(); | |
| 2425 return nullptr; | |
| 2426 } | |
| 2427 | |
| 2428 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | |
| 2429 // well. This code needs to be refactored (http://crbug.com/629721). | |
| 2430 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start, | 2420 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start, |
| 2431 WebTextDirection& end) const { | 2421 WebTextDirection& end) const { |
| 2432 const LocalFrame* frame = FocusedLocalFrameInWidget(); | 2422 const LocalFrame* frame = FocusedLocalFrameInWidget(); |
| 2433 if (!frame) | 2423 if (!frame) |
| 2434 return false; | 2424 return false; |
| 2435 | 2425 |
| 2436 const FrameSelection& selection = frame->Selection(); | 2426 const FrameSelection& selection = frame->Selection(); |
| 2437 if (!selection.IsAvailable()) { | 2427 if (!selection.IsAvailable()) { |
| 2438 // plugins/mouse-capture-inside-shadow.html reaches here. | 2428 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2439 return false; | 2429 return false; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 } | 2891 } |
| 2902 | 2892 |
| 2903 double WebViewImpl::ZoomLevel() { | 2893 double WebViewImpl::ZoomLevel() { |
| 2904 return zoom_level_; | 2894 return zoom_level_; |
| 2905 } | 2895 } |
| 2906 | 2896 |
| 2907 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, | 2897 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, |
| 2908 float zoom_factor) { | 2898 float zoom_factor) { |
| 2909 if (frame->IsLocalRoot()) { | 2899 if (frame->IsLocalRoot()) { |
| 2910 LocalFrame* local_frame = ToLocalFrame(frame); | 2900 LocalFrame* local_frame = ToLocalFrame(frame); |
| 2911 if (!WebLocalFrameImpl::PluginContainerFromFrame(local_frame)) | 2901 if (!local_frame->GetWebPluginContainerBase()) |
| 2912 local_frame->SetPageZoomFactor(zoom_factor); | 2902 local_frame->SetPageZoomFactor(zoom_factor); |
| 2913 } | 2903 } |
| 2914 | 2904 |
| 2915 for (Frame* child = frame->Tree().FirstChild(); child; | 2905 for (Frame* child = frame->Tree().FirstChild(); child; |
| 2916 child = child->Tree().NextSibling()) | 2906 child = child->Tree().NextSibling()) |
| 2917 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor); | 2907 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor); |
| 2918 } | 2908 } |
| 2919 | 2909 |
| 2920 double WebViewImpl::SetZoomLevel(double zoom_level) { | 2910 double WebViewImpl::SetZoomLevel(double zoom_level) { |
| 2921 if (zoom_level < minimum_zoom_level_) | 2911 if (zoom_level < minimum_zoom_level_) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2953 maximum_zoom_level_ = maximum_zoom_level; | 2943 maximum_zoom_level_ = maximum_zoom_level; |
| 2954 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_); | 2944 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_); |
| 2955 } | 2945 } |
| 2956 | 2946 |
| 2957 float WebViewImpl::TextZoomFactor() { | 2947 float WebViewImpl::TextZoomFactor() { |
| 2958 return MainFrameImpl()->GetFrame()->TextZoomFactor(); | 2948 return MainFrameImpl()->GetFrame()->TextZoomFactor(); |
| 2959 } | 2949 } |
| 2960 | 2950 |
| 2961 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) { | 2951 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) { |
| 2962 LocalFrame* frame = MainFrameImpl()->GetFrame(); | 2952 LocalFrame* frame = MainFrameImpl()->GetFrame(); |
| 2963 if (WebLocalFrameImpl::PluginContainerFromFrame(frame)) | 2953 if (frame->GetWebPluginContainerBase()) |
| 2964 return 1; | 2954 return 1; |
| 2965 | 2955 |
| 2966 frame->SetTextZoomFactor(text_zoom_factor); | 2956 frame->SetTextZoomFactor(text_zoom_factor); |
| 2967 | 2957 |
| 2968 return text_zoom_factor; | 2958 return text_zoom_factor; |
| 2969 } | 2959 } |
| 2970 | 2960 |
| 2971 double WebView::ZoomLevelToZoomFactor(double zoom_level) { | 2961 double WebView::ZoomLevelToZoomFactor(double zoom_level) { |
| 2972 return pow(kTextSizeMultiplierRatio, zoom_level); | 2962 return pow(kTextSizeMultiplierRatio, zoom_level); |
| 2973 } | 2963 } |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4161 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4162 return nullptr; | 4152 return nullptr; |
| 4163 return focused_frame; | 4153 return focused_frame; |
| 4164 } | 4154 } |
| 4165 | 4155 |
| 4166 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4167 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4168 } | 4158 } |
| 4169 | 4159 |
| 4170 } // namespace blink | 4160 } // namespace blink |
| OLD | NEW |