Chromium Code Reviews

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

Issue 2953193002: Move ContentsSize and HasVisibleContent methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 1274 matching lines...)
1285 LocalFrame* frame = node->GetDocument().GetFrame(); 1285 LocalFrame* frame = node->GetDocument().GetFrame();
1286 return frame->View()->ContentsToRootFrame(point_in_root_frame); 1286 return frame->View()->ContentsToRootFrame(point_in_root_frame);
1287 } 1287 }
1288 return WebRect(); 1288 return WebRect();
1289 } 1289 }
1290 1290
1291 WebRect WebViewImpl::WidenRectWithinPageBounds(const WebRect& source, 1291 WebRect WebViewImpl::WidenRectWithinPageBounds(const WebRect& source,
1292 int target_margin, 1292 int target_margin,
1293 int minimum_margin) { 1293 int minimum_margin) {
1294 WebSize max_size; 1294 WebSize max_size;
1295 if (MainFrame())
1296 max_size = MainFrame()->ContentsSize();
1297 IntSize scroll_offset; 1295 IntSize scroll_offset;
1298 if (MainFrame()) { 1296 if (MainFrame()) {
1299 // TODO(lukasza): https://crbug.com/734209: The DCHECK below holds now, but 1297 // TODO(lukasza): https://crbug.com/734209: The DCHECK below holds now, but
1300 // only because all of the callers don't support OOPIFs and exit early if 1298 // only because all of the callers don't support OOPIFs and exit early if
1301 // the main frame is not local. 1299 // the main frame is not local.
1302 DCHECK(MainFrame()->IsWebLocalFrame()); 1300 DCHECK(MainFrame()->IsWebLocalFrame());
1301 max_size = MainFrame()->ToWebLocalFrame()->ContentsSize();
1303 scroll_offset = MainFrame()->ToWebLocalFrame()->GetScrollOffset(); 1302 scroll_offset = MainFrame()->ToWebLocalFrame()->GetScrollOffset();
1304 } 1303 }
1305 int left_margin = target_margin; 1304 int left_margin = target_margin;
1306 int right_margin = target_margin; 1305 int right_margin = target_margin;
1307 1306
1308 const int absolute_source_x = source.x + scroll_offset.Width(); 1307 const int absolute_source_x = source.x + scroll_offset.Width();
1309 if (left_margin > absolute_source_x) { 1308 if (left_margin > absolute_source_x) {
1310 left_margin = absolute_source_x; 1309 left_margin = absolute_source_x;
1311 right_margin = std::max(left_margin, minimum_margin); 1310 right_margin = std::max(left_margin, minimum_margin);
1312 } 1311 }
(...skipping 2816 matching lines...)
4129 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4128 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4130 return nullptr; 4129 return nullptr;
4131 return focused_frame; 4130 return focused_frame;
4132 } 4131 }
4133 4132
4134 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4133 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4135 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4134 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4136 } 4135 }
4137 4136
4138 } // namespace blink 4137 } // namespace blink
OLDNEW

Powered by Google App Engine