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 && |