Chromium Code Reviews| 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 #ifndef PDF_PDFIUM_PDFIUM_PAGE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_PAGE_H_ |
| 6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ | 6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 89 |
| 90 int index() const { return index_; } | 90 int index() const { return index_; } |
| 91 pp::Rect rect() const { return rect_; } | 91 pp::Rect rect() const { return rect_; } |
| 92 void set_rect(const pp::Rect& r) { rect_ = r; } | 92 void set_rect(const pp::Rect& r) { rect_ = r; } |
| 93 bool available() const { return available_; } | 93 bool available() const { return available_; } |
| 94 void set_available(bool available) { available_ = available; } | 94 void set_available(bool available) { available_ = available; } |
| 95 void set_calculated_links(bool calculated_links) { | 95 void set_calculated_links(bool calculated_links) { |
| 96 calculated_links_ = calculated_links; | 96 calculated_links_ = calculated_links; |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::vector<pp::Rect> GetLinkRects(); | |
|
Lei Zhang
2016/07/08 18:02:36
nit: Put this above the simple accessors, around l
jaepark
2016/07/08 20:58:16
Done.
| |
| 100 | |
| 99 private: | 101 private: |
| 100 // Returns a link index if the given character index is over a link, or -1 | 102 // Returns a link index if the given character index is over a link, or -1 |
| 101 // otherwise. | 103 // otherwise. |
| 102 int GetLink(int char_index, LinkTarget* target); | 104 int GetLink(int char_index, LinkTarget* target); |
| 103 // Returns the link indices if the given rect intersects a link rect, or an | 105 // Returns the link indices if the given rect intersects a link rect, or an |
| 104 // empty vector otherwise. | 106 // empty vector otherwise. |
| 105 std::vector<int> GetLinks(pp::Rect text_area, | 107 std::vector<int> GetLinks(pp::Rect text_area, |
| 106 std::vector<LinkTarget>* targets); | 108 std::vector<LinkTarget>* targets); |
| 107 // Calculate the locations of any links on the page. | 109 // Calculate the locations of any links on the page. |
| 108 void CalculateLinks(); | 110 void CalculateLinks(); |
| 109 // Returns link type and target associated with a link. Returns | 111 // Returns link type and target associated with a link. Returns |
| 110 // NONSELECTABLE_AREA if link detection failed. | 112 // NONSELECTABLE_AREA if link detection failed. |
| 111 Area GetLinkTarget(FPDF_LINK link, LinkTarget* target) const; | 113 Area GetLinkTarget(FPDF_LINK link, LinkTarget* target) const; |
| 112 // Returns target associated with a destination. | 114 // Returns target associated with a destination. |
| 113 Area GetDestinationTarget(FPDF_DEST destination, LinkTarget* target) const; | 115 Area GetDestinationTarget(FPDF_DEST destination, LinkTarget* target) const; |
| 114 | 116 |
| 117 pp::Rect UnionLinkCharRects(const std::vector<pp::Rect> rects); | |
|
Lei Zhang
2016/07/08 18:02:36
This method doesn't use any class members. Put it
Lei Zhang
2016/07/08 18:02:36
The parameter should be passed by const ref, not b
jaepark
2016/07/08 20:58:17
Done.
jaepark
2016/07/08 20:58:17
Done.
| |
| 118 | |
| 115 class ScopedLoadCounter { | 119 class ScopedLoadCounter { |
| 116 public: | 120 public: |
| 117 explicit ScopedLoadCounter(PDFiumPage* page); | 121 explicit ScopedLoadCounter(PDFiumPage* page); |
| 118 ~ScopedLoadCounter(); | 122 ~ScopedLoadCounter(); |
| 119 | 123 |
| 120 private: | 124 private: |
| 121 PDFiumPage* const page_; | 125 PDFiumPage* const page_; |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 struct Link { | 128 struct Link { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 137 int loading_count_; | 141 int loading_count_; |
| 138 pp::Rect rect_; | 142 pp::Rect rect_; |
| 139 bool calculated_links_; | 143 bool calculated_links_; |
| 140 std::vector<Link> links_; | 144 std::vector<Link> links_; |
| 141 bool available_; | 145 bool available_; |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 } // namespace chrome_pdf | 148 } // namespace chrome_pdf |
| 145 | 149 |
| 146 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ | 150 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ |
| OLD | NEW |