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

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 2960753002: Fix bug where Chromium crashes in PDFiumEngine::OnMouseUp(). (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) 1850 if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE)
1851 return false; 1851 return false;
1852 1852
1853 if (page_index != -1) { 1853 if (page_index != -1) {
1854 double page_x, page_y; 1854 double page_x, page_y;
1855 pp::Point point = event.GetPosition(); 1855 pp::Point point = event.GetPosition();
1856 DeviceToPage(page_index, point.x(), point.y(), &page_x, &page_y); 1856 DeviceToPage(page_index, point.x(), point.y(), &page_x, &page_y);
1857 FORM_OnLButtonUp(form_, pages_[page_index]->GetPage(), 0, page_x, page_y); 1857 FORM_OnLButtonUp(form_, pages_[page_index]->GetPage(), 0, page_x, page_y);
1858 } 1858 }
1859 1859
1860 if (area == PDFiumPage::FORM_TEXT_AREA) 1860 if (area == PDFiumPage::FORM_TEXT_AREA && last_page_mouse_down_ != -1)
Lei Zhang 2017/06/27 01:26:51 This will definitely fix the crash, but another qu
dsinclair 2017/06/27 15:24:21 FORM_GetSelectedText returns the text from a text
1861 SetFormSelectedText(form_, pages_[last_page_mouse_down_]->GetPage()); 1861 SetFormSelectedText(form_, pages_[last_page_mouse_down_]->GetPage());
1862 1862
1863 if (!selecting_) 1863 if (!selecting_)
1864 return false; 1864 return false;
1865 1865
1866 SetSelecting(false); 1866 SetSelecting(false);
1867 return true; 1867 return true;
1868 } 1868 }
1869 1869
1870 bool PDFiumEngine::OnMouseMove(const pp::MouseInputEvent& event) { 1870 bool PDFiumEngine::OnMouseMove(const pp::MouseInputEvent& event) {
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 FPDF_DOCUMENT doc = 4192 FPDF_DOCUMENT doc =
4193 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 4193 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
4194 if (!doc) 4194 if (!doc)
4195 return false; 4195 return false;
4196 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4196 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4197 FPDF_CloseDocument(doc); 4197 FPDF_CloseDocument(doc);
4198 return success; 4198 return success;
4199 } 4199 }
4200 4200
4201 } // namespace chrome_pdf 4201 } // namespace chrome_pdf
OLDNEW
« 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