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

Unified Diff: pdf/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pdf/out_of_process_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index 83cb5123a4739e32d6b477783da4467c2743da40..19c7a28e17348bd0a3c4932f63db511c25dfd763 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -683,7 +683,7 @@ pp::Var Instance::GetLinkAtPosition(const pp::Point& point) {
}
pp::Var Instance::GetSelectedText(bool html) {
- if (html || !engine_->HasPermission(PDFEngine::PERMISSION_COPY))
+ if (html)
return pp::Var();
return engine_->GetSelectedText();
}
@@ -1857,7 +1857,10 @@ pp::Var Instance::CallScriptableMethod(const pp::Var& method,
v_scrollbar_.get() ? GetScrollbarReservedThickness() : 0);
}
if (method_str == kJSGetSelectedText) {
- return GetSelectedText(false);
+ std::string selected_text = engine_->GetSelectedText();
+ // Always return unix newlines to JS.
+ base::ReplaceChars(selected_text, "\r", std::string(), &selected_text);
+ return selected_text;
}
if (method_str == kJSDocumentLoadComplete) {
return pp::Var((document_load_state_ != LOAD_STATE_LOADING));
« no previous file with comments | « no previous file | pdf/out_of_process_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698