| 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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
| 8 #include "fde_csssyntax.h" | 8 #include "fde_csssyntax.h" |
| 9 #include "fde_cssdatatable.h" | 9 #include "fde_cssdatatable.h" |
| 10 #include "fde_cssstylesheet.h" | 10 #include "fde_cssstylesheet.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 L"rp{display:none}"; | 41 L"rp{display:none}"; |
| 42 return IFDE_CSSStyleSheet::LoadFromBuffer( | 42 return IFDE_CSSStyleSheet::LoadFromBuffer( |
| 43 CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); | 43 CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); |
| 44 } | 44 } |
| 45 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream( | 45 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream( |
| 46 const CFX_WideString& szUrl, | 46 const CFX_WideString& szUrl, |
| 47 IFX_Stream* pStream, | 47 IFX_Stream* pStream, |
| 48 FX_WORD wCodePage, | 48 FX_WORD wCodePage, |
| 49 FX_DWORD dwMediaList) { | 49 FX_DWORD dwMediaList) { |
| 50 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); | 50 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); |
| 51 if (pStyleSheet == NULL) { | |
| 52 return NULL; | |
| 53 } | |
| 54 if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) { | 51 if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) { |
| 55 pStyleSheet->Release(); | 52 pStyleSheet->Release(); |
| 56 pStyleSheet = NULL; | 53 pStyleSheet = NULL; |
| 57 } | 54 } |
| 58 return pStyleSheet; | 55 return pStyleSheet; |
| 59 } | 56 } |
| 60 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromBuffer( | 57 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromBuffer( |
| 61 const CFX_WideString& szUrl, | 58 const CFX_WideString& szUrl, |
| 62 const FX_WCHAR* pBuffer, | 59 const FX_WCHAR* pBuffer, |
| 63 int32_t iBufSize, | 60 int32_t iBufSize, |
| 64 FX_WORD wCodePage, | 61 FX_WORD wCodePage, |
| 65 FX_DWORD dwMediaList) { | 62 FX_DWORD dwMediaList) { |
| 66 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); | 63 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); |
| 67 if (pStyleSheet == NULL) { | |
| 68 return NULL; | |
| 69 } | |
| 70 if (!pStyleSheet->LoadFromBuffer(szUrl, pBuffer, iBufSize, wCodePage)) { | 64 if (!pStyleSheet->LoadFromBuffer(szUrl, pBuffer, iBufSize, wCodePage)) { |
| 71 pStyleSheet->Release(); | 65 pStyleSheet->Release(); |
| 72 pStyleSheet = NULL; | 66 pStyleSheet = NULL; |
| 73 } | 67 } |
| 74 return pStyleSheet; | 68 return pStyleSheet; |
| 75 } | 69 } |
| 76 CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(FX_DWORD dwMediaList) | 70 CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(FX_DWORD dwMediaList) |
| 77 : m_wCodePage(FX_CODEPAGE_UTF8), | 71 : m_wCodePage(FX_CODEPAGE_UTF8), |
| 78 m_wRefCount(1), | 72 m_wRefCount(1), |
| 79 m_dwMediaList(dwMediaList), | 73 m_dwMediaList(dwMediaList), |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 return NULL; | 496 return NULL; |
| 503 } | 497 } |
| 504 } | 498 } |
| 505 if (pPersudoFirst == NULL) { | 499 if (pPersudoFirst == NULL) { |
| 506 return pFirst; | 500 return pFirst; |
| 507 } else { | 501 } else { |
| 508 pPersudoLast->SetNext(pFirst); | 502 pPersudoLast->SetNext(pFirst); |
| 509 return pPersudoFirst; | 503 return pPersudoFirst; |
| 510 } | 504 } |
| 511 } | 505 } |
| OLD | NEW |