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

Side by Side Diff: xfa/fde/css/fde_cssdatatable.cpp

Issue 1830323006: Remove FX_DWORD from XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « xfa/fde/css/fde_csscache.cpp ('k') | xfa/fde/css/fde_cssdeclaration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "xfa/fde/css/fde_cssdatatable.h" 7 #include "xfa/fde/css/fde_cssdatatable.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fgas/crt/fgas_algorithm.h" 10 #include "xfa/fgas/crt/fgas_algorithm.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (FDE_CSSLengthToFloat(pRect->right, fContainerWidth, fResult)) { 80 if (FDE_CSSLengthToFloat(pRect->right, fContainerWidth, fResult)) {
81 rect.right += fResult; 81 rect.right += fResult;
82 } 82 }
83 if (FDE_CSSLengthToFloat(pRect->bottom, fContainerWidth, fResult)) { 83 if (FDE_CSSLengthToFloat(pRect->bottom, fContainerWidth, fResult)) {
84 rect.bottom += fResult; 84 rect.bottom += fResult;
85 } 85 }
86 } 86 }
87 } 87 }
88 return rect; 88 return rect;
89 } 89 }
90 FX_DWORD FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { 90 uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) {
91 FXSYS_assert(pFontStyle != NULL); 91 FXSYS_assert(pFontStyle != NULL);
92 FX_DWORD dwFontStyle = FX_FONTSTYLE_Normal; 92 uint32_t dwFontStyle = FX_FONTSTYLE_Normal;
93 if (pFontStyle->GetFontStyle() == FDE_CSSFONTSTYLE_Italic) { 93 if (pFontStyle->GetFontStyle() == FDE_CSSFONTSTYLE_Italic) {
94 dwFontStyle |= FX_FONTSTYLE_Italic; 94 dwFontStyle |= FX_FONTSTYLE_Italic;
95 } 95 }
96 if (pFontStyle->GetFontWeight() >= 700) { 96 if (pFontStyle->GetFontWeight() >= 700) {
97 dwFontStyle |= FX_FONTSTYLE_Bold; 97 dwFontStyle |= FX_FONTSTYLE_Bold;
98 } 98 }
99 return dwFontStyle; 99 return dwFontStyle;
100 } 100 }
101 static const FDE_CSSPROPERTYTABLE g_FDE_CSSProperties[] = { 101 static const FDE_CSSPROPERTYTABLE g_FDE_CSSProperties[] = {
102 {FDE_CSSPROPERTY_WritingMode, L"writing-mode", 0x01878076, 102 {FDE_CSSPROPERTY_WritingMode, L"writing-mode", 0x01878076,
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 {FDE_CSSPERSUDO_After, L":after", 0x16EE1FEC}, 553 {FDE_CSSPERSUDO_After, L":after", 0x16EE1FEC},
554 {FDE_CSSPERSUDO_Before, L":before", 0x7DCDDE2D}, 554 {FDE_CSSPERSUDO_Before, L":before", 0x7DCDDE2D},
555 }; 555 };
556 FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) { 556 FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) {
557 return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo) 557 return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo)
558 : NULL; 558 : NULL;
559 } 559 }
560 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByName(const FX_WCHAR* pszName, 560 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByName(const FX_WCHAR* pszName,
561 int32_t iLength) { 561 int32_t iLength) {
562 FXSYS_assert(pszName != NULL && iLength > 0); 562 FXSYS_assert(pszName != NULL && iLength > 0);
563 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); 563 uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
564 int32_t iEnd = FDE_CSSPROPERTY_MAX - 1; 564 int32_t iEnd = FDE_CSSPROPERTY_MAX - 1;
565 int32_t iMid, iStart = 0; 565 int32_t iMid, iStart = 0;
566 FX_DWORD dwMid; 566 uint32_t dwMid;
567 do { 567 do {
568 iMid = (iStart + iEnd) / 2; 568 iMid = (iStart + iEnd) / 2;
569 dwMid = g_FDE_CSSProperties[iMid].dwHash; 569 dwMid = g_FDE_CSSProperties[iMid].dwHash;
570 if (dwHash == dwMid) { 570 if (dwHash == dwMid) {
571 return g_FDE_CSSProperties + iMid; 571 return g_FDE_CSSProperties + iMid;
572 } else if (dwHash > dwMid) { 572 } else if (dwHash > dwMid) {
573 iStart = iMid + 1; 573 iStart = iMid + 1;
574 } else { 574 } else {
575 iEnd = iMid - 1; 575 iEnd = iMid - 1;
576 } 576 }
577 } while (iStart <= iEnd); 577 } while (iStart <= iEnd);
578 return NULL; 578 return NULL;
579 } 579 }
580 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) { 580 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) {
581 return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) : NULL; 581 return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) : NULL;
582 } 582 }
583 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByName( 583 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByName(
584 const FX_WCHAR* pszName, 584 const FX_WCHAR* pszName,
585 int32_t iLength) { 585 int32_t iLength) {
586 FXSYS_assert(pszName != NULL && iLength > 0); 586 FXSYS_assert(pszName != NULL && iLength > 0);
587 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); 587 uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
588 int32_t iEnd = FDE_CSSPROPERTYVALUE_MAX - 1; 588 int32_t iEnd = FDE_CSSPROPERTYVALUE_MAX - 1;
589 int32_t iMid, iStart = 0; 589 int32_t iMid, iStart = 0;
590 FX_DWORD dwMid; 590 uint32_t dwMid;
591 do { 591 do {
592 iMid = (iStart + iEnd) / 2; 592 iMid = (iStart + iEnd) / 2;
593 dwMid = g_FDE_CSSPropertyValues[iMid].dwHash; 593 dwMid = g_FDE_CSSPropertyValues[iMid].dwHash;
594 if (dwHash == dwMid) { 594 if (dwHash == dwMid) {
595 return g_FDE_CSSPropertyValues + iMid; 595 return g_FDE_CSSPropertyValues + iMid;
596 } else if (dwHash > dwMid) { 596 } else if (dwHash > dwMid) {
597 iStart = iMid + 1; 597 iStart = iMid + 1;
598 } else { 598 } else {
599 iEnd = iMid - 1; 599 iEnd = iMid - 1;
600 } 600 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 iStart = iMid + 1; 644 iStart = iMid + 1;
645 } else { 645 } else {
646 iEnd = iMid - 1; 646 iEnd = iMid - 1;
647 } 647 }
648 } while (iStart <= iEnd); 648 } while (iStart <= iEnd);
649 return NULL; 649 return NULL;
650 } 650 }
651 FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const FX_WCHAR* pszName, 651 FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const FX_WCHAR* pszName,
652 int32_t iLength) { 652 int32_t iLength) {
653 FXSYS_assert(pszName != NULL && iLength > 0); 653 FXSYS_assert(pszName != NULL && iLength > 0);
654 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); 654 uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
655 int32_t iEnd = sizeof(g_FDE_CSSColors) / sizeof(FDE_CSSCOLORTABLE) - 1; 655 int32_t iEnd = sizeof(g_FDE_CSSColors) / sizeof(FDE_CSSCOLORTABLE) - 1;
656 int32_t iMid, iStart = 0; 656 int32_t iMid, iStart = 0;
657 FX_DWORD dwMid; 657 uint32_t dwMid;
658 do { 658 do {
659 iMid = (iStart + iEnd) / 2; 659 iMid = (iStart + iEnd) / 2;
660 dwMid = g_FDE_CSSColors[iMid].dwHash; 660 dwMid = g_FDE_CSSColors[iMid].dwHash;
661 if (dwHash == dwMid) { 661 if (dwHash == dwMid) {
662 return g_FDE_CSSColors + iMid; 662 return g_FDE_CSSColors + iMid;
663 } else if (dwHash > dwMid) { 663 } else if (dwHash > dwMid) {
664 iStart = iMid + 1; 664 iStart = iMid + 1;
665 } else { 665 } else {
666 iEnd = iMid - 1; 666 iEnd = iMid - 1;
667 } 667 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 } 880 }
881 while (iBracketCount > 0 && m_pCur < m_pEnd) { 881 while (iBracketCount > 0 && m_pCur < m_pEnd) {
882 if (*m_pCur == ')') { 882 if (*m_pCur == ')') {
883 iBracketCount--; 883 iBracketCount--;
884 } 884 }
885 m_pCur++; 885 m_pCur++;
886 } 886 }
887 } 887 }
888 return m_pCur - pStart; 888 return m_pCur - pStart;
889 } 889 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_csscache.cpp ('k') | xfa/fde/css/fde_cssdeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698