Chromium Code Reviews| Index: pdf/pdfium/pdfium_page.cc |
| diff --git a/pdf/pdfium/pdfium_page.cc b/pdf/pdfium/pdfium_page.cc |
| index 7d85d36aa315e5447995c168c4e4a86caf7a9d5d..32a1a854255ace9bbf4566f2765103c132546954 100644 |
| --- a/pdf/pdfium/pdfium_page.cc |
| +++ b/pdf/pdfium/pdfium_page.cc |
| @@ -264,7 +264,7 @@ PDFiumPage::Area PDFiumPage::GetCharIndex(const pp::Point& point, |
| DCHECK_NE(control_z_order, link_z_order); |
| if (control_z_order > link_z_order) { |
| *form_type = control; |
| - return PDFiumPage::NONSELECTABLE_AREA; |
| + return FormTypeToArea(*form_type); |
| } |
| // We don't handle all possible link types of the PDF. For example, |
| @@ -283,7 +283,7 @@ PDFiumPage::Area PDFiumPage::GetCharIndex(const pp::Point& point, |
| return area; |
| } else if (control > FPDF_FORMFIELD_UNKNOWN) { |
| *form_type = control; |
| - return PDFiumPage::NONSELECTABLE_AREA; |
| + return FormTypeToArea(*form_type); |
| } |
| if (rv < 0) |
| @@ -292,6 +292,17 @@ PDFiumPage::Area PDFiumPage::GetCharIndex(const pp::Point& point, |
| return GetLink(*char_index, target) != -1 ? WEBLINK_AREA : TEXT_AREA; |
| } |
| +PDFiumPage::Area PDFiumPage::FormTypeToArea(int form_type) { |
|
Lei Zhang
2017/06/21 00:19:46
If we make this a static method, we like to make a
drgage
2017/06/21 01:30:24
Done.
|
| + switch (form_type) { |
| + case FPDF_FORMFIELD_TEXTFIELD: |
| + return PDFiumPage::FORM_TEXT_AREA; |
|
Lei Zhang
2017/06/21 00:19:45
We can omit this return and just let it fall throu
drgage
2017/06/21 01:30:24
Done.
|
| + case FPDF_FORMFIELD_COMBOBOX: |
|
Lei Zhang
2017/06/21 00:19:45
Let's put this value first, since it appears earli
drgage
2017/06/21 01:30:24
Done.
|
| + return PDFiumPage::FORM_TEXT_AREA; |
| + default: |
| + return PDFiumPage::NONSELECTABLE_AREA; |
| + } |
| +} |
| + |
| base::char16 PDFiumPage::GetCharAtIndex(int index) { |
| if (!available_) |
| return L'\0'; |