Chromium Code Reviews| Index: pdf/pdfium/pdfium_engine.cc |
| diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
| index 3ffd098b5757a43f7e66a31eeff9a1009388af5f..d66a0a1172ccfc0b949ee9e2c115ad78a543b946 100644 |
| --- a/pdf/pdfium/pdfium_engine.cc |
| +++ b/pdf/pdfium/pdfium_engine.cc |
| @@ -857,10 +857,10 @@ void PDFiumEngine::AddSegment(FX_DOWNLOADHINTS* param, |
| bool PDFiumEngine::New(const char* url, |
| const char* headers) { |
| url_ = url; |
| - if (!headers) |
| - headers_.clear(); |
| - else |
| + if (headers) |
| headers_ = headers; |
| + else |
| + headers_.clear(); |
| return true; |
| } |
| @@ -3161,9 +3161,9 @@ void PDFiumEngine::DeviceToPage(int page_index, |
| double* page_x, |
| double* page_y) { |
| *page_x = *page_y = 0; |
| - int temp_x = static_cast<int>((device_x + position_.x())/ current_zoom_ - |
| + int temp_x = static_cast<int>((device_x + position_.x()) / current_zoom_ - |
| pages_[page_index]->rect().x()); |
| - int temp_y = static_cast<int>((device_y + position_.y())/ current_zoom_ - |
| + int temp_y = static_cast<int>((device_y + position_.y()) / current_zoom_ - |
| pages_[page_index]->rect().y()); |
| FPDF_DeviceToPage( |
| pages_[page_index]->GetPage(), 0, 0, |
| @@ -3182,6 +3182,7 @@ int PDFiumEngine::GetVisiblePageIndex(FPDF_PAGE page) { |
| void PDFiumEngine::SetCurrentPage(int index) { |
| if (index == most_visible_page_ || !form_) |
| return; |
| + |
| if (most_visible_page_ != -1 && called_do_document_action_) { |
| FPDF_PAGE old_page = pages_[most_visible_page_]->GetPage(); |
| FORM_DoPageAAction(old_page, form_, FPDFPAGE_AACTION_CLOSE); |
| @@ -3363,13 +3364,21 @@ void PDFiumEngine::RotateInternal() { |
| else |
| resume_find_index_.Invalidate(); |
| + // Save the current page. |
| + int most_visible_page = most_visible_page_; |
| + |
| InvalidateAllPages(); |
| + // Restore find results. |
| if (!current_find_text.empty()) { |
| // Clear the UI. |
| client_->NotifyNumberOfFindResultsChanged(0, false); |
| StartFind(current_find_text, false); |
| } |
| + |
| + // Restore current page. After a rotation, the page heights have changed but |
| + // the scroll position has not. Readjust. |
|
raymes
2016/08/22 01:09:30
Possibly add a note that we should restore the pos
Lei Zhang
2016/08/22 19:08:44
Done.
|
| + client_->ScrollToPage(most_visible_page); |
| } |
| void PDFiumEngine::SetSelecting(bool selecting) { |