OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 CFX_ByteString type = m_pDict->GetStringBy("S"); | 31 CFX_ByteString type = m_pDict->GetStringBy("S"); |
32 if (type != "GoTo" && type != "GoToR") { | 32 if (type != "GoTo" && type != "GoToR") { |
33 return CPDF_Dest(); | 33 return CPDF_Dest(); |
34 } | 34 } |
35 CPDF_Object* pDest = m_pDict->GetDirectObjectBy("D"); | 35 CPDF_Object* pDest = m_pDict->GetDirectObjectBy("D"); |
36 if (!pDest) { | 36 if (!pDest) { |
37 return CPDF_Dest(); | 37 return CPDF_Dest(); |
38 } | 38 } |
39 if (pDest->IsString() || pDest->IsName()) { | 39 if (pDest->IsString() || pDest->IsName()) { |
40 CPDF_NameTree name_tree(pDoc, "Dests"); | 40 CPDF_NameTree name_tree(pDoc, "Dests"); |
41 CFX_ByteStringC name = pDest->GetString(); | 41 return CPDF_Dest( |
42 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); | 42 name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC())); |
43 } | 43 } |
44 if (CPDF_Array* pArray = pDest->AsArray()) | 44 if (CPDF_Array* pArray = pDest->AsArray()) |
45 return CPDF_Dest(pArray); | 45 return CPDF_Dest(pArray); |
46 return CPDF_Dest(); | 46 return CPDF_Dest(); |
47 } | 47 } |
48 | 48 |
49 CPDF_Action::ActionType CPDF_Action::GetType() const { | 49 CPDF_Action::ActionType CPDF_Action::GetType() const { |
50 if (!m_pDict) | 50 if (!m_pDict) |
51 return Unknown; | 51 return Unknown; |
52 | 52 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if (!ToDictionary(pAction)) { | 294 if (!ToDictionary(pAction)) { |
295 return CPDF_Action(); | 295 return CPDF_Action(); |
296 } | 296 } |
297 return CPDF_Action(pAction->GetDict()); | 297 return CPDF_Action(pAction->GetDict()); |
298 } | 298 } |
299 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { | 299 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { |
300 ASSERT(m_pDocument); | 300 ASSERT(m_pDocument); |
301 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); | 301 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); |
302 return name_tree.GetIndex(csName); | 302 return name_tree.GetIndex(csName); |
303 } | 303 } |
OLD | NEW |