| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_page.h" | 5 #include "pdf/pdfium/pdfium_page.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "pdf/pdfium/pdfium_api_string_buffer_adapter.h" | 18 #include "pdf/pdfium/pdfium_api_string_buffer_adapter.h" |
| 18 #include "pdf/pdfium/pdfium_engine.h" | 19 #include "pdf/pdfium/pdfium_engine.h" |
| 19 | 20 |
| 20 // Used when doing hit detection. | 21 // Used when doing hit detection. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return node; | 198 return node; |
| 198 | 199 |
| 199 FPDF_PAGE page = GetPage(); | 200 FPDF_PAGE page = GetPage(); |
| 200 FPDF_TEXTPAGE text_page = GetTextPage(); | 201 FPDF_TEXTPAGE text_page = GetTextPage(); |
| 201 | 202 |
| 202 double width = FPDF_GetPageWidth(page); | 203 double width = FPDF_GetPageWidth(page); |
| 203 double height = FPDF_GetPageHeight(page); | 204 double height = FPDF_GetPageHeight(page); |
| 204 | 205 |
| 205 node->SetDouble(kPageWidth, width); | 206 node->SetDouble(kPageWidth, width); |
| 206 node->SetDouble(kPageHeight, height); | 207 node->SetDouble(kPageHeight, height); |
| 207 scoped_ptr<base::ListValue> text(new base::ListValue()); | 208 std::unique_ptr<base::ListValue> text(new base::ListValue()); |
| 208 | 209 |
| 209 int chars_count = FPDFText_CountChars(text_page); | 210 int chars_count = FPDFText_CountChars(text_page); |
| 210 pp::Rect line_rect; | 211 pp::Rect line_rect; |
| 211 pp::Rect word_rect; | 212 pp::Rect word_rect; |
| 212 bool seen_literal_text_in_word = false; | 213 bool seen_literal_text_in_word = false; |
| 213 | 214 |
| 214 // Iterate over all of the chars on the page. Explicitly run the loop | 215 // Iterate over all of the chars on the page. Explicitly run the loop |
| 215 // with |i == chars_count|, which is one past the last character, and | 216 // with |i == chars_count|, which is one past the last character, and |
| 216 // pretend it's a newline character in order to ensure we always flush | 217 // pretend it's a newline character in order to ensure we always flush |
| 217 // the last line. | 218 // the last line. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 page_->loading_count_--; | 567 page_->loading_count_--; |
| 567 } | 568 } |
| 568 | 569 |
| 569 PDFiumPage::Link::Link() { | 570 PDFiumPage::Link::Link() { |
| 570 } | 571 } |
| 571 | 572 |
| 572 PDFiumPage::Link::~Link() { | 573 PDFiumPage::Link::~Link() { |
| 573 } | 574 } |
| 574 | 575 |
| 575 } // namespace chrome_pdf | 576 } // namespace chrome_pdf |
| OLD | NEW |