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_cssdeclaration.h" | 7 #include "xfa/fde/css/fde_cssdeclaration.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 | 10 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, | 295 IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, |
296 const FX_WCHAR* pszValue, | 296 const FX_WCHAR* pszValue, |
297 int32_t iValueLen) { | 297 int32_t iValueLen) { |
298 FX_ARGB dwColor; | 298 FX_ARGB dwColor; |
299 if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { | 299 if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { |
300 return nullptr; | 300 return nullptr; |
301 } | 301 } |
302 return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor); | 302 return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor); |
303 } | 303 } |
| 304 |
304 IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, | 305 IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, |
305 const FX_WCHAR* pszValue, | 306 const FX_WCHAR* pszValue, |
306 int32_t iValueLen) { | 307 int32_t iValueLen) { |
307 int32_t iOffset; | 308 int32_t iOffset; |
308 if (!FDE_ParseCSSURI(pszValue, iValueLen, iOffset, iValueLen)) { | 309 if (!FDE_ParseCSSURI(pszValue, &iOffset, &iValueLen)) |
309 return nullptr; | 310 return nullptr; |
310 } | 311 |
311 if (iValueLen <= 0) { | 312 if (iValueLen <= 0) |
312 return nullptr; | 313 return nullptr; |
313 } | 314 |
314 pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); | 315 pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); |
315 return pszValue | 316 return pszValue |
316 ? FXTARGET_NewWith(pArgs->pStaticStore) | 317 ? FXTARGET_NewWith(pArgs->pStaticStore) |
317 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) | 318 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) |
318 : nullptr; | 319 : nullptr; |
319 } | 320 } |
| 321 |
320 IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( | 322 IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( |
321 const FDE_CSSPROPERTYARGS* pArgs, | 323 const FDE_CSSPROPERTYARGS* pArgs, |
322 const FX_WCHAR* pszValue, | 324 const FX_WCHAR* pszValue, |
323 int32_t iValueLen) { | 325 int32_t iValueLen) { |
324 int32_t iOffset; | 326 int32_t iOffset; |
325 if (!FDE_ParseCSSString(pszValue, iValueLen, iOffset, iValueLen)) { | 327 if (!FDE_ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen)) |
326 return nullptr; | 328 return nullptr; |
327 } | 329 |
328 if (iValueLen <= 0) { | 330 if (iValueLen <= 0) |
329 return nullptr; | 331 return nullptr; |
330 } | 332 |
331 pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); | 333 pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); |
332 return pszValue | 334 return pszValue |
333 ? FXTARGET_NewWith(pArgs->pStaticStore) | 335 ? FXTARGET_NewWith(pArgs->pStaticStore) |
334 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) | 336 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) |
335 : nullptr; | 337 : nullptr; |
336 } | 338 } |
337 IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( | 339 IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( |
338 const FDE_CSSPROPERTYARGS* pArgs, | 340 const FDE_CSSPROPERTYARGS* pArgs, |
339 const FX_WCHAR* pszValue, | 341 const FX_WCHAR* pszValue, |
340 int32_t iValueLen) { | 342 int32_t iValueLen) { |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 | 1333 |
1332 if (!pOverflowY) | 1334 if (!pOverflowY) |
1333 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); | 1335 pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); |
1334 | 1336 |
1335 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, | 1337 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, |
1336 bImportant); | 1338 bImportant); |
1337 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, | 1339 AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, |
1338 bImportant); | 1340 bImportant); |
1339 return true; | 1341 return true; |
1340 } | 1342 } |
OLD | NEW |