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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 865533002: Scroll while selecting Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/out_of_process_instance.h" 5 #include "pdf/out_of_process_instance.h"
6 6
7 #include <algorithm> // for min/max() 7 #include <algorithm> // for min/max()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 return; 1347 return;
1348 engine_->AppendBlankPages(print_preview_page_count_); 1348 engine_->AppendBlankPages(print_preview_page_count_);
1349 if (preview_pages_info_.size() > 0) 1349 if (preview_pages_info_.size() > 0)
1350 LoadAvailablePreviewPage(); 1350 LoadAvailablePreviewPage();
1351 } 1351 }
1352 1352
1353 bool OutOfProcessInstance::IsPrintPreview() { 1353 bool OutOfProcessInstance::IsPrintPreview() {
1354 return IsPrintPreviewUrl(url_); 1354 return IsPrintPreviewUrl(url_);
1355 } 1355 }
1356 1356
1357 void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
1358 pp::VarDictionary message;
1359 message.Set(kType, kJSIsSelectingType);
1360 message.Set(kJSIsSelecting, pp::Var(is_selecting);
1361 PostMessage(message);
1362 }
1363
1357 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url, 1364 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
1358 int dst_page_index) { 1365 int dst_page_index) {
1359 if (!IsPrintPreview()) 1366 if (!IsPrintPreview())
1360 return; 1367 return;
1361 1368
1362 int src_page_index = ExtractPrintPreviewPageIndex(url); 1369 int src_page_index = ExtractPrintPreviewPageIndex(url);
1363 if (src_page_index < 1) 1370 if (src_page_index < 1)
1364 return; 1371 return;
1365 1372
1366 preview_pages_info_.push(std::make_pair(url, dst_page_index)); 1373 preview_pages_info_.push(std::make_pair(url, dst_page_index));
(...skipping 28 matching lines...) Expand all
1395 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( 1402 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
1396 const pp::FloatPoint& scroll_offset) { 1403 const pp::FloatPoint& scroll_offset) {
1397 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1404 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1398 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1405 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1399 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1406 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1400 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); 1407 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f);
1401 return pp::FloatPoint(x, y); 1408 return pp::FloatPoint(x, y);
1402 } 1409 }
1403 1410
1404 } // namespace chrome_pdf 1411 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698