Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2888203006: Move the logic to retrieve the WebPluginContainer to LocalFrame and Node. (Closed)
Patch Set: Address code review comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 anchor = local_frame->View()->ContentsToViewport(anchor); 2411 anchor = local_frame->View()->ContentsToViewport(anchor);
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) {
2422 WebPluginContainerBase* container =
2423 WebLocalFrameImpl::CurrentPluginContainer(frame);
2424 if (container && container->SupportsInputMethod())
2425 return container->Plugin();
2426 return nullptr;
2427 }
2428
2429 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2430 // well. This code needs to be refactored (http://crbug.com/629721).
2431 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start, 2421 bool WebViewImpl::SelectionTextDirection(WebTextDirection& start,
2432 WebTextDirection& end) const { 2422 WebTextDirection& end) const {
2433 const LocalFrame* frame = FocusedLocalFrameInWidget(); 2423 const LocalFrame* frame = FocusedLocalFrameInWidget();
2434 if (!frame) 2424 if (!frame)
2435 return false; 2425 return false;
2436 2426
2437 const FrameSelection& selection = frame->Selection(); 2427 const FrameSelection& selection = frame->Selection();
2438 if (!selection.IsAvailable()) { 2428 if (!selection.IsAvailable()) {
2439 // plugins/mouse-capture-inside-shadow.html reaches here. 2429 // plugins/mouse-capture-inside-shadow.html reaches here.
2440 return false; 2430 return false;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 } 2892 }
2903 2893
2904 double WebViewImpl::ZoomLevel() { 2894 double WebViewImpl::ZoomLevel() {
2905 return zoom_level_; 2895 return zoom_level_;
2906 } 2896 }
2907 2897
2908 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, 2898 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame,
2909 float zoom_factor) { 2899 float zoom_factor) {
2910 if (frame->IsLocalRoot()) { 2900 if (frame->IsLocalRoot()) {
2911 LocalFrame* local_frame = ToLocalFrame(frame); 2901 LocalFrame* local_frame = ToLocalFrame(frame);
2912 if (!WebLocalFrameImpl::PluginContainerFromFrame(local_frame)) 2902 if (!local_frame->GetWebPluginContainerBase())
2913 local_frame->SetPageZoomFactor(zoom_factor); 2903 local_frame->SetPageZoomFactor(zoom_factor);
2914 } 2904 }
2915 2905
2916 for (Frame* child = frame->Tree().FirstChild(); child; 2906 for (Frame* child = frame->Tree().FirstChild(); child;
2917 child = child->Tree().NextSibling()) 2907 child = child->Tree().NextSibling())
2918 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor); 2908 PropagateZoomFactorToLocalFrameRoots(child, zoom_factor);
2919 } 2909 }
2920 2910
2921 double WebViewImpl::SetZoomLevel(double zoom_level) { 2911 double WebViewImpl::SetZoomLevel(double zoom_level) {
2922 if (zoom_level < minimum_zoom_level_) 2912 if (zoom_level < minimum_zoom_level_)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 maximum_zoom_level_ = maximum_zoom_level; 2944 maximum_zoom_level_ = maximum_zoom_level;
2955 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_); 2945 client_->ZoomLimitsChanged(minimum_zoom_level_, maximum_zoom_level_);
2956 } 2946 }
2957 2947
2958 float WebViewImpl::TextZoomFactor() { 2948 float WebViewImpl::TextZoomFactor() {
2959 return MainFrameImpl()->GetFrame()->TextZoomFactor(); 2949 return MainFrameImpl()->GetFrame()->TextZoomFactor();
2960 } 2950 }
2961 2951
2962 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) { 2952 float WebViewImpl::SetTextZoomFactor(float text_zoom_factor) {
2963 LocalFrame* frame = MainFrameImpl()->GetFrame(); 2953 LocalFrame* frame = MainFrameImpl()->GetFrame();
2964 if (WebLocalFrameImpl::PluginContainerFromFrame(frame)) 2954 if (frame->GetWebPluginContainerBase())
2965 return 1; 2955 return 1;
2966 2956
2967 frame->SetTextZoomFactor(text_zoom_factor); 2957 frame->SetTextZoomFactor(text_zoom_factor);
2968 2958
2969 return text_zoom_factor; 2959 return text_zoom_factor;
2970 } 2960 }
2971 2961
2972 double WebView::ZoomLevelToZoomFactor(double zoom_level) { 2962 double WebView::ZoomLevelToZoomFactor(double zoom_level) {
2973 return pow(kTextSizeMultiplierRatio, zoom_level); 2963 return pow(kTextSizeMultiplierRatio, zoom_level);
2974 } 2964 }
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
4162 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4152 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4163 return nullptr; 4153 return nullptr;
4164 return focused_frame; 4154 return focused_frame;
4165 } 4155 }
4166 4156
4167 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4157 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4168 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4158 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4169 } 4159 }
4170 4160
4171 } // namespace blink 4161 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698