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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 return WebRect(); | 1287 return WebRect(); |
1288 } | 1288 } |
1289 | 1289 |
1290 WebRect WebViewImpl::WidenRectWithinPageBounds(const WebRect& source, | 1290 WebRect WebViewImpl::WidenRectWithinPageBounds(const WebRect& source, |
1291 int target_margin, | 1291 int target_margin, |
1292 int minimum_margin) { | 1292 int minimum_margin) { |
1293 WebSize max_size; | 1293 WebSize max_size; |
1294 if (MainFrame()) | 1294 if (MainFrame()) |
1295 max_size = MainFrame()->ContentsSize(); | 1295 max_size = MainFrame()->ContentsSize(); |
1296 IntSize scroll_offset; | 1296 IntSize scroll_offset; |
1297 if (MainFrame()) | 1297 if (MainFrame()) { |
1298 scroll_offset = MainFrame()->GetScrollOffset(); | 1298 // TODO(lukasza): https://crbug.com/734209: The DCHECK below holds now, but |
| 1299 // only because all of the callers don't support OOPIFs and exit early if |
| 1300 // the main frame is not local. |
| 1301 DCHECK(MainFrame()->IsWebLocalFrame()); |
| 1302 scroll_offset = MainFrame()->ToWebLocalFrame()->GetScrollOffset(); |
| 1303 } |
1299 int left_margin = target_margin; | 1304 int left_margin = target_margin; |
1300 int right_margin = target_margin; | 1305 int right_margin = target_margin; |
1301 | 1306 |
1302 const int absolute_source_x = source.x + scroll_offset.Width(); | 1307 const int absolute_source_x = source.x + scroll_offset.Width(); |
1303 if (left_margin > absolute_source_x) { | 1308 if (left_margin > absolute_source_x) { |
1304 left_margin = absolute_source_x; | 1309 left_margin = absolute_source_x; |
1305 right_margin = std::max(left_margin, minimum_margin); | 1310 right_margin = std::max(left_margin, minimum_margin); |
1306 } | 1311 } |
1307 | 1312 |
1308 const int maximum_right_margin = | 1313 const int maximum_right_margin = |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 if (!highlight_color.Alpha()) | 1513 if (!highlight_color.Alpha()) |
1509 continue; | 1514 continue; |
1510 | 1515 |
1511 link_highlights_.push_back(LinkHighlightImpl::Create(node, this)); | 1516 link_highlights_.push_back(LinkHighlightImpl::Create(node, this)); |
1512 } | 1517 } |
1513 | 1518 |
1514 UpdateAllLifecyclePhases(); | 1519 UpdateAllLifecyclePhases(); |
1515 } | 1520 } |
1516 | 1521 |
1517 void WebViewImpl::AnimateDoubleTapZoom(const IntPoint& point_in_root_frame) { | 1522 void WebViewImpl::AnimateDoubleTapZoom(const IntPoint& point_in_root_frame) { |
| 1523 // TODO(lukasza): https://crbug.com/734209: Add OOPIF support. |
1518 if (!MainFrameImpl()) | 1524 if (!MainFrameImpl()) |
1519 return; | 1525 return; |
1520 | 1526 |
1521 WebRect block_bounds = ComputeBlockBound(point_in_root_frame, false); | 1527 WebRect block_bounds = ComputeBlockBound(point_in_root_frame, false); |
1522 float scale; | 1528 float scale; |
1523 WebPoint scroll; | 1529 WebPoint scroll; |
1524 | 1530 |
1525 ComputeScaleAndScrollForBlockRect( | 1531 ComputeScaleAndScrollForBlockRect( |
1526 point_in_root_frame, block_bounds, touchPointPadding, | 1532 point_in_root_frame, block_bounds, touchPointPadding, |
1527 MinimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio, scale, | 1533 MinimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio, scale, |
(...skipping 26 matching lines...) Expand all Loading... |
1554 // checking for m_layerTreeView->hasPendingPageScaleAnimation() is because of | 1560 // checking for m_layerTreeView->hasPendingPageScaleAnimation() is because of |
1555 // fake page scale animation plumbing for testing, which doesn't actually | 1561 // fake page scale animation plumbing for testing, which doesn't actually |
1556 // initiate a page scale animation. | 1562 // initiate a page scale animation. |
1557 if (is_animating) { | 1563 if (is_animating) { |
1558 double_tap_zoom_page_scale_factor_ = scale; | 1564 double_tap_zoom_page_scale_factor_ = scale; |
1559 double_tap_zoom_pending_ = true; | 1565 double_tap_zoom_pending_ = true; |
1560 } | 1566 } |
1561 } | 1567 } |
1562 | 1568 |
1563 void WebViewImpl::ZoomToFindInPageRect(const WebRect& rect_in_root_frame) { | 1569 void WebViewImpl::ZoomToFindInPageRect(const WebRect& rect_in_root_frame) { |
| 1570 // TODO(lukasza): https://crbug.com/734209: Add OOPIF support. |
1564 if (!MainFrameImpl()) | 1571 if (!MainFrameImpl()) |
1565 return; | 1572 return; |
1566 | 1573 |
1567 WebRect block_bounds = ComputeBlockBound( | 1574 WebRect block_bounds = ComputeBlockBound( |
1568 WebPoint(rect_in_root_frame.x + rect_in_root_frame.width / 2, | 1575 WebPoint(rect_in_root_frame.x + rect_in_root_frame.width / 2, |
1569 rect_in_root_frame.y + rect_in_root_frame.height / 2), | 1576 rect_in_root_frame.y + rect_in_root_frame.height / 2), |
1570 true); | 1577 true); |
1571 | 1578 |
1572 if (block_bounds.IsEmpty()) { | 1579 if (block_bounds.IsEmpty()) { |
1573 // Keep current scale (no need to scroll as x,y will normally already | 1580 // Keep current scale (no need to scroll as x,y will normally already |
1574 // be visible). FIXME: Revisit this if it isn't always true. | 1581 // be visible). FIXME: Revisit this if it isn't always true. |
1575 return; | 1582 return; |
1576 } | 1583 } |
1577 | 1584 |
1578 float scale; | 1585 float scale; |
1579 WebPoint scroll; | 1586 WebPoint scroll; |
1580 | 1587 |
1581 ComputeScaleAndScrollForBlockRect( | 1588 ComputeScaleAndScrollForBlockRect( |
1582 WebPoint(rect_in_root_frame.x, rect_in_root_frame.y), block_bounds, | 1589 WebPoint(rect_in_root_frame.x, rect_in_root_frame.y), block_bounds, |
1583 nonUserInitiatedPointPadding, MinimumPageScaleFactor(), scale, scroll); | 1590 nonUserInitiatedPointPadding, MinimumPageScaleFactor(), scale, scroll); |
1584 | 1591 |
1585 StartPageScaleAnimation(scroll, false, scale, | 1592 StartPageScaleAnimation(scroll, false, scale, |
1586 findInPageAnimationDurationInSeconds); | 1593 findInPageAnimationDurationInSeconds); |
1587 } | 1594 } |
1588 | 1595 |
1589 bool WebViewImpl::ZoomToMultipleTargetsRect(const WebRect& rect_in_root_frame) { | 1596 bool WebViewImpl::ZoomToMultipleTargetsRect(const WebRect& rect_in_root_frame) { |
| 1597 // TODO(lukasza): https://crbug.com/734209: Add OOPIF support. |
1590 if (!MainFrameImpl()) | 1598 if (!MainFrameImpl()) |
1591 return false; | 1599 return false; |
1592 | 1600 |
1593 float scale; | 1601 float scale; |
1594 WebPoint scroll; | 1602 WebPoint scroll; |
1595 | 1603 |
1596 ComputeScaleAndScrollForBlockRect( | 1604 ComputeScaleAndScrollForBlockRect( |
1597 WebPoint(rect_in_root_frame.x, rect_in_root_frame.y), rect_in_root_frame, | 1605 WebPoint(rect_in_root_frame.x, rect_in_root_frame.y), rect_in_root_frame, |
1598 nonUserInitiatedPointPadding, MinimumPageScaleFactor(), scale, scroll); | 1606 nonUserInitiatedPointPadding, MinimumPageScaleFactor(), scale, scroll); |
1599 | 1607 |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4120 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4128 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
4121 return nullptr; | 4129 return nullptr; |
4122 return focused_frame; | 4130 return focused_frame; |
4123 } | 4131 } |
4124 | 4132 |
4125 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4133 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
4126 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4134 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
4127 } | 4135 } |
4128 | 4136 |
4129 } // namespace blink | 4137 } // namespace blink |
OLD | NEW |