| 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 "xfa/fde/css/fde_cssstylesheet.h" | 7 #include "xfa/fde/css/fde_cssstylesheet.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 L"ruby{display:ruby}rt{display:ruby-text;font-size:.5em}rb{display:ruby-" | 42 L"ruby{display:ruby}rt{display:ruby-text;font-size:.5em}rb{display:ruby-" |
| 43 L"base}rbc{display:ruby-base-group}rtc{display:ruby-text-group}" | 43 L"base}rbc{display:ruby-base-group}rtc{display:ruby-text-group}" |
| 44 L"q:before{content:open-quote}q:after{content:close-quote}" | 44 L"q:before{content:open-quote}q:after{content:close-quote}" |
| 45 L"rp{display:none}"; | 45 L"rp{display:none}"; |
| 46 return IFDE_CSSStyleSheet::LoadFromBuffer( | 46 return IFDE_CSSStyleSheet::LoadFromBuffer( |
| 47 CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); | 47 CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); |
| 48 } | 48 } |
| 49 | 49 |
| 50 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream( | 50 IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream( |
| 51 const CFX_WideString& szUrl, | 51 const CFX_WideString& szUrl, |
| 52 IFX_Stream* pStream, | 52 IFGAS_Stream* pStream, |
| 53 uint16_t wCodePage, | 53 uint16_t wCodePage, |
| 54 uint32_t dwMediaList) { | 54 uint32_t dwMediaList) { |
| 55 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); | 55 CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); |
| 56 if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) { | 56 if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) { |
| 57 pStyleSheet->Release(); | 57 pStyleSheet->Release(); |
| 58 pStyleSheet = nullptr; | 58 pStyleSheet = nullptr; |
| 59 } | 59 } |
| 60 return pStyleSheet; | 60 return pStyleSheet; |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 int32_t CFDE_CSSStyleSheet::CountRules() const { | 138 int32_t CFDE_CSSStyleSheet::CountRules() const { |
| 139 return m_RuleArray.GetSize(); | 139 return m_RuleArray.GetSize(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { | 142 IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { |
| 143 return m_RuleArray.GetAt(index); | 143 return m_RuleArray.GetAt(index); |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, | 146 bool CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, |
| 147 IFX_Stream* pStream, | 147 IFGAS_Stream* pStream, |
| 148 uint16_t wCodePage) { | 148 uint16_t wCodePage) { |
| 149 std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); | 149 std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); |
| 150 if (pStream->GetCodePage() != wCodePage) | 150 if (pStream->GetCodePage() != wCodePage) |
| 151 pStream->SetCodePage(wCodePage); | 151 pStream->SetCodePage(wCodePage); |
| 152 | 152 |
| 153 bool bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); | 153 bool bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); |
| 154 m_wCodePage = wCodePage; | 154 m_wCodePage = wCodePage; |
| 155 m_szUrl = szUrl; | 155 m_szUrl = szUrl; |
| 156 return bRet; | 156 return bRet; |
| 157 } | 157 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (!pPersudoFirst) | 577 if (!pPersudoFirst) |
| 578 return pFirst; | 578 return pFirst; |
| 579 | 579 |
| 580 pPersudoLast->SetNext(pFirst); | 580 pPersudoLast->SetNext(pFirst); |
| 581 return pPersudoFirst; | 581 return pPersudoFirst; |
| 582 } | 582 } |
| 583 | 583 |
| 584 CFDE_CSSDeclaration* CFDE_CSSFontFaceRule::GetDeclaration() { | 584 CFDE_CSSDeclaration* CFDE_CSSFontFaceRule::GetDeclaration() { |
| 585 return &m_Declaration; | 585 return &m_Declaration; |
| 586 } | 586 } |
| OLD | NEW |