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

Unified Diff: pdf/out_of_process_instance.cc

Issue 830433002: Navigation to relative fragments does not work correctly for OOP pdf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Reviewer's comments. 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 59b04394419410bc1eda3518839f2323169bbe94..fb1a67dc750492f77395d07cfd2a808ca0bb00cf 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -842,7 +842,23 @@ void OutOfProcessInstance::NavigateTo(const std::string& url,
// If |url_copy| starts with '#', then it's for the same URL with a
// different URL fragment.
if (url_copy[0] == '#') {
- url_copy = url_ + url_copy;
+ // if '#' is already present in |url_| then remove old tag and add new
+ // |url_copy| tag.
+ std::size_t found_idx = url_.find('#');
+ if (found_idx != std::string::npos)
+ url_copy = url_.substr(0, found_idx) + url_copy;
+ else
+ url_copy = url_ + url_copy;
+
+ if (!open_in_new_tab) {
+ found_idx = url_copy.find('#');
Lei Zhang 2015/01/07 23:08:43 There's some weird problems with OOP PDF. Without
+ if (found_idx != std::string::npos) {
+ int page_number =
+ engine_->GetNamedDestinationPage(url_copy.substr(found_idx + 1));
+ if (page_number >= 0)
+ ScrollToPage(page_number);
+ }
+ }
}
// If there's no scheme, add http.
if (url_copy.find("://") == std::string::npos &&
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698