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

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

Issue 268363013: Text selection handles now take into account pinch viewport's offset. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 range = Range::create(selectedRange->endContainer()->document(), 2256 range = Range::create(selectedRange->endContainer()->document(),
2257 selectedRange->endContainer(), 2257 selectedRange->endContainer(),
2258 selectedRange->endOffset(), 2258 selectedRange->endOffset(),
2259 selectedRange->endContainer(), 2259 selectedRange->endContainer(),
2260 selectedRange->endOffset()); 2260 selectedRange->endOffset());
2261 focus = frame->editor().firstRectForRange(range.get()); 2261 focus = frame->editor().firstRectForRange(range.get());
2262 } 2262 }
2263 2263
2264 IntRect scaledAnchor(frame->view()->contentsToWindow(anchor)); 2264 IntRect scaledAnchor(frame->view()->contentsToWindow(anchor));
2265 IntRect scaledFocus(frame->view()->contentsToWindow(focus)); 2265 IntRect scaledFocus(frame->view()->contentsToWindow(focus));
2266
2267 if (pinchVirtualViewportEnabled()) {
2268 IntPoint pinchViewportOffset =
2269 roundedIntPoint(page()->frameHost().pinchViewport().visibleRect().lo cation());
2270 scaledAnchor.moveBy(-pinchViewportOffset);
2271 scaledFocus.moveBy(-pinchViewportOffset);
2272 }
2273
2266 scaledAnchor.scale(pageScaleFactor()); 2274 scaledAnchor.scale(pageScaleFactor());
2267 scaledFocus.scale(pageScaleFactor()); 2275 scaledFocus.scale(pageScaleFactor());
2268 anchor = scaledAnchor; 2276 anchor = scaledAnchor;
2269 focus = scaledFocus; 2277 focus = scaledFocus;
2270 2278
2271 if (!selection.selection().isBaseFirst()) 2279 if (!selection.selection().isBaseFirst())
2272 std::swap(anchor, focus); 2280 std::swap(anchor, focus);
2273 return true; 2281 return true;
2274 } 2282 }
2275 2283
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4117 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4110 4118
4111 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4119 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4112 return false; 4120 return false;
4113 4121
4114 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4122 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4115 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4123 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4116 } 4124 }
4117 4125
4118 } // namespace blink 4126 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698