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 "xfa/fde/css/fde_cssdatatable.h" | 9 #include "xfa/fde/css/fde_cssdatatable.h" |
10 #include "xfa/fde/css/fde_csssyntax.h" | 10 #include "xfa/fde/css/fde_csssyntax.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( | 189 FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( |
190 IFDE_CSSSyntaxParser* pSyntax) { | 190 IFDE_CSSSyntaxParser* pSyntax) { |
191 uint32_t dwMediaList = 0; | 191 uint32_t dwMediaList = 0; |
192 CFDE_CSSMediaRule* pMediaRule = NULL; | 192 CFDE_CSSMediaRule* pMediaRule = NULL; |
193 for (;;) { | 193 for (;;) { |
194 switch (pSyntax->DoSyntaxParse()) { | 194 switch (pSyntax->DoSyntaxParse()) { |
195 case FDE_CSSSYNTAXSTATUS_MediaType: { | 195 case FDE_CSSSYNTAXSTATUS_MediaType: { |
196 int32_t iLen; | 196 int32_t iLen; |
197 const FX_WCHAR* psz = pSyntax->GetCurrentString(iLen); | 197 const FX_WCHAR* psz = pSyntax->GetCurrentString(iLen); |
198 FDE_LPCCSSMEDIATYPETABLE pMediaType = | 198 FDE_LPCCSSMEDIATYPETABLE pMediaType = |
199 FDE_GetCSSMediaTypeByName(psz, iLen); | 199 FDE_GetCSSMediaTypeByName(CFX_WideStringC(psz, iLen)); |
200 if (pMediaType != NULL) { | 200 if (pMediaType != NULL) { |
201 dwMediaList |= pMediaType->wValue; | 201 dwMediaList |= pMediaType->wValue; |
202 } | 202 } |
203 } break; | 203 } break; |
204 case FDE_CSSSYNTAXSTATUS_StyleRule: | 204 case FDE_CSSSYNTAXSTATUS_StyleRule: |
205 if (pMediaRule == NULL) { | 205 if (pMediaRule == NULL) { |
206 SkipRuleSet(pSyntax); | 206 SkipRuleSet(pSyntax); |
207 } else { | 207 } else { |
208 FDE_CSSSYNTAXSTATUS eStatus = | 208 FDE_CSSSYNTAXSTATUS eStatus = |
209 LoadStyleRule(pSyntax, pMediaRule->GetArray()); | 209 LoadStyleRule(pSyntax, pMediaRule->GetArray()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 case FDE_CSSSYNTAXSTATUS_Selector: { | 242 case FDE_CSSSYNTAXSTATUS_Selector: { |
243 pszValue = pSyntax->GetCurrentString(iValueLen); | 243 pszValue = pSyntax->GetCurrentString(iValueLen); |
244 IFDE_CSSSelector* pSelector = | 244 IFDE_CSSSelector* pSelector = |
245 CFDE_CSSSelector::FromString(m_pAllocator, pszValue, iValueLen); | 245 CFDE_CSSSelector::FromString(m_pAllocator, pszValue, iValueLen); |
246 if (pSelector != NULL) { | 246 if (pSelector != NULL) { |
247 m_Selectors.Add(pSelector); | 247 m_Selectors.Add(pSelector); |
248 } | 248 } |
249 } break; | 249 } break; |
250 case FDE_CSSSYNTAXSTATUS_PropertyName: | 250 case FDE_CSSSYNTAXSTATUS_PropertyName: |
251 pszValue = pSyntax->GetCurrentString(iValueLen); | 251 pszValue = pSyntax->GetCurrentString(iValueLen); |
252 propertyArgs.pProperty = FDE_GetCSSPropertyByName(pszValue, iValueLen); | 252 propertyArgs.pProperty = |
| 253 FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen)); |
253 if (propertyArgs.pProperty == NULL) { | 254 if (propertyArgs.pProperty == NULL) { |
254 wsName = CFX_WideStringC(pszValue, iValueLen); | 255 wsName = CFX_WideStringC(pszValue, iValueLen); |
255 } | 256 } |
256 break; | 257 break; |
257 case FDE_CSSSYNTAXSTATUS_PropertyValue: | 258 case FDE_CSSSYNTAXSTATUS_PropertyValue: |
258 if (propertyArgs.pProperty != NULL) { | 259 if (propertyArgs.pProperty != NULL) { |
259 pszValue = pSyntax->GetCurrentString(iValueLen); | 260 pszValue = pSyntax->GetCurrentString(iValueLen); |
260 if (iValueLen > 0) { | 261 if (iValueLen > 0) { |
261 pStyleRule->GetDeclImp().AddProperty(&propertyArgs, pszValue, | 262 pStyleRule->GetDeclImp().AddProperty(&propertyArgs, pszValue, |
262 iValueLen); | 263 iValueLen); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const FX_WCHAR* pszValue = NULL; | 299 const FX_WCHAR* pszValue = NULL; |
299 int32_t iValueLen = 0; | 300 int32_t iValueLen = 0; |
300 FDE_CSSPROPERTYARGS propertyArgs; | 301 FDE_CSSPROPERTYARGS propertyArgs; |
301 propertyArgs.pStaticStore = m_pAllocator; | 302 propertyArgs.pStaticStore = m_pAllocator; |
302 propertyArgs.pStringCache = &m_StringCache; | 303 propertyArgs.pStringCache = &m_StringCache; |
303 propertyArgs.pProperty = NULL; | 304 propertyArgs.pProperty = NULL; |
304 for (;;) { | 305 for (;;) { |
305 switch (pSyntax->DoSyntaxParse()) { | 306 switch (pSyntax->DoSyntaxParse()) { |
306 case FDE_CSSSYNTAXSTATUS_PropertyName: | 307 case FDE_CSSSYNTAXSTATUS_PropertyName: |
307 pszValue = pSyntax->GetCurrentString(iValueLen); | 308 pszValue = pSyntax->GetCurrentString(iValueLen); |
308 propertyArgs.pProperty = FDE_GetCSSPropertyByName(pszValue, iValueLen); | 309 propertyArgs.pProperty = |
| 310 FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen)); |
309 break; | 311 break; |
310 case FDE_CSSSYNTAXSTATUS_PropertyValue: | 312 case FDE_CSSSYNTAXSTATUS_PropertyValue: |
311 if (propertyArgs.pProperty != NULL) { | 313 if (propertyArgs.pProperty != NULL) { |
312 pszValue = pSyntax->GetCurrentString(iValueLen); | 314 pszValue = pSyntax->GetCurrentString(iValueLen); |
313 if (iValueLen > 0) { | 315 if (iValueLen > 0) { |
314 pFontFaceRule->GetDeclImp().AddProperty(&propertyArgs, pszValue, | 316 pFontFaceRule->GetDeclImp().AddProperty(&propertyArgs, pszValue, |
315 iValueLen); | 317 iValueLen); |
316 } | 318 } |
317 } | 319 } |
318 break; | 320 break; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return NULL; | 503 return NULL; |
502 } | 504 } |
503 } | 505 } |
504 if (pPersudoFirst == NULL) { | 506 if (pPersudoFirst == NULL) { |
505 return pFirst; | 507 return pFirst; |
506 } else { | 508 } else { |
507 pPersudoLast->SetNext(pFirst); | 509 pPersudoLast->SetNext(pFirst); |
508 return pPersudoFirst; | 510 return pPersudoFirst; |
509 } | 511 } |
510 } | 512 } |
OLD | NEW |