Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2214 | 2214 |
| 2215 void PDFiumEngine::InvalidateAllPages() { | 2215 void PDFiumEngine::InvalidateAllPages() { |
| 2216 CancelPaints(); | 2216 CancelPaints(); |
| 2217 StopFind(); | 2217 StopFind(); |
| 2218 LoadPageInfo(true); | 2218 LoadPageInfo(true); |
| 2219 client_->Invalidate(pp::Rect(plugin_size_)); | 2219 client_->Invalidate(pp::Rect(plugin_size_)); |
| 2220 } | 2220 } |
| 2221 | 2221 |
| 2222 std::string PDFiumEngine::GetSelectedText() { | 2222 std::string PDFiumEngine::GetSelectedText() { |
| 2223 base::string16 result; | 2223 base::string16 result; |
| 2224 base::string16 new_line_char = base::UTF8ToUTF16("\n"); | |
| 2224 for (size_t i = 0; i < selection_.size(); ++i) { | 2225 for (size_t i = 0; i < selection_.size(); ++i) { |
| 2225 if (i > 0 && | 2226 if (i > 0 && |
| 2226 selection_[i - 1].page_index() > selection_[i].page_index()) { | 2227 selection_[i - 1].page_index() > selection_[i].page_index()) { |
| 2227 result = selection_[i].GetText() + result; | 2228 result = selection_[i].GetText() + new_line_char + result; |
| 2228 } else { | 2229 } else { |
| 2230 if (i > 0) | |
|
gene
2015/01/05 21:42:43
Do you want to check selections are from the diffe
Deepak
2015/01/06 03:15:35
No,We don't have to do this. Let me explain.
We ha
gene
2015/01/07 23:35:04
OK, understood
raymes
2015/01/08 00:08:57
I'm a bit confused but I *think* the answer to you
| |
| 2231 result.append(new_line_char); | |
| 2229 result.append(selection_[i].GetText()); | 2232 result.append(selection_[i].GetText()); |
| 2230 } | 2233 } |
| 2231 } | 2234 } |
| 2232 | 2235 |
| 2233 FormatStringWithHyphens(&result); | 2236 FormatStringWithHyphens(&result); |
| 2234 FormatStringForOS(&result); | 2237 FormatStringForOS(&result); |
| 2235 return base::UTF16ToUTF8(result); | 2238 return base::UTF16ToUTF8(result); |
| 2236 } | 2239 } |
| 2237 | 2240 |
| 2238 std::string PDFiumEngine::GetLinkAtPosition(const pp::Point& point) { | 2241 std::string PDFiumEngine::GetLinkAtPosition(const pp::Point& point) { |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3881 double* height) { | 3884 double* height) { |
| 3882 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3885 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 3883 if (!doc) | 3886 if (!doc) |
| 3884 return false; | 3887 return false; |
| 3885 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3888 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3886 FPDF_CloseDocument(doc); | 3889 FPDF_CloseDocument(doc); |
| 3887 return success; | 3890 return success; |
| 3888 } | 3891 } |
| 3889 | 3892 |
| 3890 } // namespace chrome_pdf | 3893 } // namespace chrome_pdf |
| OLD | NEW |