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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 845203002: Don't return Windows newlines through the PDF GetSelectedText JS API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@addMissingFeatures
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 | « pdf/instance.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 pp::Var OutOfProcessInstance::GetLinkAtPosition( 561 pp::Var OutOfProcessInstance::GetLinkAtPosition(
562 const pp::Point& point) { 562 const pp::Point& point) {
563 pp::Point offset_point(point); 563 pp::Point offset_point(point);
564 ScalePoint(device_scale_, &offset_point); 564 ScalePoint(device_scale_, &offset_point);
565 offset_point.set_x(offset_point.x() - available_area_.x()); 565 offset_point.set_x(offset_point.x() - available_area_.x());
566 return engine_->GetLinkAtPosition(offset_point); 566 return engine_->GetLinkAtPosition(offset_point);
567 } 567 }
568 568
569 pp::Var OutOfProcessInstance::GetSelectedText(bool html) { 569 pp::Var OutOfProcessInstance::GetSelectedText(bool html) {
570 if (html || !engine_->HasPermission(PDFEngine::PERMISSION_COPY)) 570 if (html)
571 return pp::Var(); 571 return pp::Var();
572 return engine_->GetSelectedText(); 572 return engine_->GetSelectedText();
573 } 573 }
574 574
575 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { 575 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() {
576 return engine_->QuerySupportedPrintOutputFormats(); 576 return engine_->QuerySupportedPrintOutputFormats();
577 } 577 }
578 578
579 int32_t OutOfProcessInstance::PrintBegin( 579 int32_t OutOfProcessInstance::PrintBegin(
580 const PP_PrintSettings_Dev& print_settings) { 580 const PP_PrintSettings_Dev& print_settings) {
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( 1382 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
1383 const pp::FloatPoint& scroll_offset) { 1383 const pp::FloatPoint& scroll_offset) {
1384 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1384 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1385 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1385 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1386 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1386 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1387 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); 1387 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f);
1388 return pp::FloatPoint(x, y); 1388 return pp::FloatPoint(x, y);
1389 } 1389 }
1390 1390
1391 } // namespace chrome_pdf 1391 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/instance.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698