Chromium Code Reviews| 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..c6358c182bd004d2808f377b9fa828bce5f521a3 100644 |
| --- a/pdf/out_of_process_instance.cc |
| +++ b/pdf/out_of_process_instance.cc |
| @@ -842,7 +842,25 @@ 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 (url_copy[url_copy.length() - 1] == 0) |
|
Lei Zhang
2015/01/06 02:13:16
This looks like a bug in PDFiumPage::GetLinkTarget
Deepak
2015/01/06 05:38:22
Yes, You are right, This is not required here.
|
| + url_copy = url_copy.substr(0, url_copy.length() - 1); |
| + // 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) { |
|
Lei Zhang
2015/01/06 02:13:16
Why are we adding this block? Can't we just naviga
Deepak
2015/01/06 05:38:22
I need to add this block here as if I just pass ur
|
| + found_idx = url_copy.find('#'); |
| + 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 && |