Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1576033002: Merge to XFA: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/src/fpdfapi/fpdf_page/pageint.h" 7 #include "core/src/fpdfapi/fpdf_page/pageint.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 return; 489 return;
490 } 490 }
491 CFX_ByteString tag = GetString(0); 491 CFX_ByteString tag = GetString(0);
492 m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE); 492 m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE);
493 } 493 }
494 494
495 void PDF_ReplaceAbbr(CPDF_Object* pObj) { 495 void PDF_ReplaceAbbr(CPDF_Object* pObj) {
496 switch (pObj->GetType()) { 496 switch (pObj->GetType()) {
497 case PDFOBJ_DICTIONARY: { 497 case PDFOBJ_DICTIONARY: {
498 CPDF_Dictionary* pDict = pObj->AsDictionary(); 498 CPDF_Dictionary* pDict = pObj->AsDictionary();
499 FX_POSITION pos = pDict->GetStartPos(); 499 for (const auto& it : *pDict) {
500 while (pos) { 500 CFX_ByteString key = it.first;
501 CFX_ByteString key; 501 CPDF_Object* value = it.second;
502 CPDF_Object* value = pDict->GetNextElement(pos, key);
503 CFX_ByteStringC fullname = PDF_FindFullName( 502 CFX_ByteStringC fullname = PDF_FindFullName(
504 PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key); 503 PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
505 if (!fullname.IsEmpty()) { 504 if (!fullname.IsEmpty()) {
506 pDict->ReplaceKey(key, fullname); 505 pDict->ReplaceKey(key, fullname);
507 key = fullname; 506 key = fullname;
508 } 507 }
509 508
510 if (value->IsName()) { 509 if (value->IsName()) {
511 CFX_ByteString name = value->GetString(); 510 CFX_ByteString name = value->GetString();
512 fullname = PDF_FindFullName(PDF_InlineValueAbbr, 511 fullname = PDF_FindFullName(PDF_InlineValueAbbr,
(...skipping 24 matching lines...) Expand all
537 } 536 }
538 break; 537 break;
539 } 538 }
540 } 539 }
541 } 540 }
542 541
543 void PDF_ReplaceFull(CPDF_Object* pObj) { 542 void PDF_ReplaceFull(CPDF_Object* pObj) {
544 switch (pObj->GetType()) { 543 switch (pObj->GetType()) {
545 case PDFOBJ_DICTIONARY: { 544 case PDFOBJ_DICTIONARY: {
546 CPDF_Dictionary* pDict = pObj->AsDictionary(); 545 CPDF_Dictionary* pDict = pObj->AsDictionary();
547 FX_POSITION pos = pDict->GetStartPos(); 546 for (const auto& it : *pDict) {
548 while (pos) { 547 CFX_ByteString key = it.first;
549 CFX_ByteString key; 548 CPDF_Object* value = it.second;
550 CPDF_Object* value = pDict->GetNextElement(pos, key);
551 CFX_ByteStringC abbrName = PDF_FindAbbrName( 549 CFX_ByteStringC abbrName = PDF_FindAbbrName(
552 PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key); 550 PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
553 if (!abbrName.IsEmpty()) { 551 if (!abbrName.IsEmpty()) {
554 pDict->ReplaceKey(key, abbrName); 552 pDict->ReplaceKey(key, abbrName);
555 key = abbrName; 553 key = abbrName;
556 } 554 }
557 if (value->IsName()) { 555 if (value->IsName()) {
558 CFX_ByteString name = value->GetString(); 556 CFX_ByteString name = value->GetString();
559 abbrName = PDF_FindAbbrName(PDF_InlineValueAbbr, 557 abbrName = PDF_FindAbbrName(PDF_InlineValueAbbr,
560 FX_ArraySize(PDF_InlineValueAbbr), name); 558 FX_ArraySize(PDF_InlineValueAbbr), name);
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 m_pObjectList->m_ObjectList.AddTail(pPathObj); 1516 m_pObjectList->m_ObjectList.AddTail(pPathObj);
1519 } 1517 }
1520 if (PathClipType) { 1518 if (PathClipType) {
1521 if (!matrix.IsIdentity()) { 1519 if (!matrix.IsIdentity()) {
1522 Path.Transform(&matrix); 1520 Path.Transform(&matrix);
1523 matrix.SetIdentity(); 1521 matrix.SetIdentity();
1524 } 1522 }
1525 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); 1523 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE);
1526 } 1524 }
1527 } 1525 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698