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 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3252 return hitTestResultForWindowPos(scaledPoint); | 3252 return hitTestResultForWindowPos(scaledPoint); |
3253 } | 3253 } |
3254 | 3254 |
3255 void WebViewImpl::copyImageAt(const WebPoint& point) | 3255 void WebViewImpl::copyImageAt(const WebPoint& point) |
3256 { | 3256 { |
3257 if (!m_page) | 3257 if (!m_page) |
3258 return; | 3258 return; |
3259 | 3259 |
3260 HitTestResult result = hitTestResultForWindowPos(point); | 3260 HitTestResult result = hitTestResultForWindowPos(point); |
3261 | 3261 |
3262 if (result.absoluteImageURL().isEmpty()) { | 3262 if (result.absoluteImageURLIncludingCanvasDataURL().isEmpty()) { |
3263 // There isn't actually an image at these coordinates. Might be because | 3263 // There isn't actually an image at these coordinates. Might be because |
3264 // the window scrolled while the context menu was open or because the pa
ge | 3264 // the window scrolled while the context menu was open or because the pa
ge |
3265 // changed itself between when we thought there was an image here and wh
en | 3265 // changed itself between when we thought there was an image here and wh
en |
3266 // we actually tried to retreive the image. | 3266 // we actually tried to retreive the image. |
3267 // | 3267 // |
3268 // FIXME: implement a cache of the most recent HitTestResult to avoid ha
ving | 3268 // FIXME: implement a cache of the most recent HitTestResult to avoid ha
ving |
3269 // to do two hit tests. | 3269 // to do two hit tests. |
3270 return; | 3270 return; |
3271 } | 3271 } |
3272 | 3272 |
3273 m_page->deprecatedLocalMainFrame()->editor().copyImage(result); | 3273 m_page->deprecatedLocalMainFrame()->editor().copyImage(result); |
3274 } | 3274 } |
3275 | 3275 |
3276 void WebViewImpl::saveImageAt(const WebPoint& point) | 3276 void WebViewImpl::saveImageAt(const WebPoint& point) |
3277 { | 3277 { |
3278 if (!m_page) | 3278 if (!m_page) |
3279 return; | 3279 return; |
3280 | 3280 |
3281 KURL url = hitTestResultForWindowPos(point).absoluteImageURL(); | 3281 KURL url = hitTestResultForWindowPos(point).absoluteImageURLIncludingCanvasD
ataURL(); |
3282 | 3282 |
3283 if (url.isEmpty()) | 3283 if (url.isEmpty()) |
3284 return; | 3284 return; |
3285 | 3285 |
3286 ResourceRequest request(url); | 3286 ResourceRequest request(url); |
3287 request.setRequestContext(blink::WebURLRequest::RequestContextDownload); | 3287 request.setRequestContext(blink::WebURLRequest::RequestContextDownload); |
3288 m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally( | 3288 m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally( |
3289 request, NavigationPolicyDownloadTo, WebString()); | 3289 request, NavigationPolicyDownloadTo, WebString()); |
3290 } | 3290 } |
3291 | 3291 |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4261 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4261 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4262 | 4262 |
4263 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4263 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4264 return false; | 4264 return false; |
4265 | 4265 |
4266 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4266 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4267 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4267 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4268 } | 4268 } |
4269 | 4269 |
4270 } // namespace blink | 4270 } // namespace blink |
OLD | NEW |