| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
| 4 * rights reserved. | 4 * rights reserved. |
| 5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 int longhandCount = shorthand.length(); | 344 int longhandCount = shorthand.length(); |
| 345 DCHECK_LE(longhandCount, 17); | 345 DCHECK_LE(longhandCount, 17); |
| 346 const CSSValue* longhands[17] = {}; | 346 const CSSValue* longhands[17] = {}; |
| 347 | 347 |
| 348 bool hasImportant = false; | 348 bool hasImportant = false; |
| 349 bool hasNonImportant = false; | 349 bool hasNonImportant = false; |
| 350 | 350 |
| 351 for (int i = 0; i < longhandCount; i++) { | 351 for (int i = 0; i < longhandCount; i++) { |
| 352 int index = m_propertySet.findPropertyIndex(shorthand.properties()[i]); | 352 int index = m_propertySet.findPropertyIndex(shorthand.properties()[i]); |
| 353 if (index == -1) | 353 if (index == -1) |
| 354 return emptyString(); | 354 return emptyString; |
| 355 PropertyValueForSerializer value = m_propertySet.propertyAt(index); | 355 PropertyValueForSerializer value = m_propertySet.propertyAt(index); |
| 356 | 356 |
| 357 hasImportant |= value.isImportant(); | 357 hasImportant |= value.isImportant(); |
| 358 hasNonImportant |= !value.isImportant(); | 358 hasNonImportant |= !value.isImportant(); |
| 359 longhands[i] = value.value(); | 359 longhands[i] = value.value(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 if (hasImportant && hasNonImportant) | 362 if (hasImportant && hasNonImportant) |
| 363 return emptyString(); | 363 return emptyString; |
| 364 | 364 |
| 365 if (longhands[0]->isCSSWideKeyword() || | 365 if (longhands[0]->isCSSWideKeyword() || |
| 366 longhands[0]->isPendingSubstitutionValue()) { | 366 longhands[0]->isPendingSubstitutionValue()) { |
| 367 bool success = true; | 367 bool success = true; |
| 368 for (int i = 1; i < longhandCount; i++) { | 368 for (int i = 1; i < longhandCount; i++) { |
| 369 if (!longhands[i]->equals(*longhands[0])) { | 369 if (!longhands[i]->equals(*longhands[0])) { |
| 370 // This should just return emptyString() but some shorthands currently | 370 // This should just return emptyString but some shorthands currently |
| 371 // allow 'initial' for their longhands. | 371 // allow 'initial' for their longhands. |
| 372 success = false; | 372 success = false; |
| 373 break; | 373 break; |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 if (success) { | 376 if (success) { |
| 377 if (longhands[0]->isPendingSubstitutionValue()) | 377 if (longhands[0]->isPendingSubstitutionValue()) |
| 378 return toCSSPendingSubstitutionValue(longhands[0]) | 378 return toCSSPendingSubstitutionValue(longhands[0]) |
| 379 ->shorthandValue() | 379 ->shorthandValue() |
| 380 ->cssText(); | 380 ->cssText(); |
| 381 return longhands[0]->cssText(); | 381 return longhands[0]->cssText(); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool allowInitial = allowInitialInShorthand(shorthand.id()); | 385 bool allowInitial = allowInitialInShorthand(shorthand.id()); |
| 386 for (int i = 0; i < longhandCount; i++) { | 386 for (int i = 0; i < longhandCount; i++) { |
| 387 const CSSValue& value = *longhands[i]; | 387 const CSSValue& value = *longhands[i]; |
| 388 if (!allowInitial && value.isInitialValue()) | 388 if (!allowInitial && value.isInitialValue()) |
| 389 return emptyString(); | 389 return emptyString; |
| 390 if (value.isInheritedValue() || value.isUnsetValue() || | 390 if (value.isInheritedValue() || value.isUnsetValue() || |
| 391 value.isPendingSubstitutionValue()) | 391 value.isPendingSubstitutionValue()) |
| 392 return emptyString(); | 392 return emptyString; |
| 393 if (value.isVariableReferenceValue()) | 393 if (value.isVariableReferenceValue()) |
| 394 return emptyString(); | 394 return emptyString; |
| 395 } | 395 } |
| 396 | 396 |
| 397 return String(); | 397 return String(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 String StylePropertySerializer::getPropertyValue( | 400 String StylePropertySerializer::getPropertyValue( |
| 401 CSSPropertyID propertyID) const { | 401 CSSPropertyID propertyID) const { |
| 402 const StylePropertyShorthand& shorthand = shorthandForProperty(propertyID); | 402 const StylePropertyShorthand& shorthand = shorthandForProperty(propertyID); |
| 403 // TODO(timloh): This is weird, why do we call this with non-shorthands at | 403 // TODO(timloh): This is weird, why do we call this with non-shorthands at |
| 404 // all? | 404 // all? |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // Check that non-initial font-variant subproperties are not conflicting with | 593 // Check that non-initial font-variant subproperties are not conflicting with |
| 594 // this serialization. | 594 // this serialization. |
| 595 const CSSValue* ligaturesValue = fontVariantLigaturesProperty.value(); | 595 const CSSValue* ligaturesValue = fontVariantLigaturesProperty.value(); |
| 596 const CSSValue* numericValue = fontVariantNumericProperty.value(); | 596 const CSSValue* numericValue = fontVariantNumericProperty.value(); |
| 597 if ((ligaturesValue->isIdentifierValue() && | 597 if ((ligaturesValue->isIdentifierValue() && |
| 598 toCSSIdentifierValue(ligaturesValue)->getValueID() != CSSValueNormal) || | 598 toCSSIdentifierValue(ligaturesValue)->getValueID() != CSSValueNormal) || |
| 599 ligaturesValue->isValueList() || | 599 ligaturesValue->isValueList() || |
| 600 (numericValue->isIdentifierValue() && | 600 (numericValue->isIdentifierValue() && |
| 601 toCSSIdentifierValue(numericValue)->getValueID() != CSSValueNormal) || | 601 toCSSIdentifierValue(numericValue)->getValueID() != CSSValueNormal) || |
| 602 numericValue->isValueList()) | 602 numericValue->isValueList()) |
| 603 return emptyString(); | 603 return emptyString; |
| 604 | 604 |
| 605 StringBuilder result; | 605 StringBuilder result; |
| 606 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result); | 606 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result); |
| 607 | 607 |
| 608 const CSSValue* val = fontVariantCapsProperty.value(); | 608 const CSSValue* val = fontVariantCapsProperty.value(); |
| 609 if (val->isIdentifierValue() && | 609 if (val->isIdentifierValue() && |
| 610 (toCSSIdentifierValue(val)->getValueID() != CSSValueSmallCaps && | 610 (toCSSIdentifierValue(val)->getValueID() != CSSValueSmallCaps && |
| 611 toCSSIdentifierValue(val)->getValueID() != CSSValueNormal)) | 611 toCSSIdentifierValue(val)->getValueID() != CSSValueNormal)) |
| 612 return emptyString(); | 612 return emptyString; |
| 613 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result); | 613 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result); |
| 614 | 614 |
| 615 appendFontLonghandValueIfNotNormal(CSSPropertyFontWeight, result); | 615 appendFontLonghandValueIfNotNormal(CSSPropertyFontWeight, result); |
| 616 appendFontLonghandValueIfNotNormal(CSSPropertyFontStretch, result); | 616 appendFontLonghandValueIfNotNormal(CSSPropertyFontStretch, result); |
| 617 if (!result.isEmpty()) | 617 if (!result.isEmpty()) |
| 618 result.append(' '); | 618 result.append(' '); |
| 619 result.append(fontSizeProperty.value()->cssText()); | 619 result.append(fontSizeProperty.value()->cssText()); |
| 620 appendFontLonghandValueIfNotNormal(CSSPropertyLineHeight, result); | 620 appendFontLonghandValueIfNotNormal(CSSPropertyLineHeight, result); |
| 621 if (!result.isEmpty()) | 621 if (!result.isEmpty()) |
| 622 result.append(' '); | 622 result.append(' '); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 const CSSValue& xValue = | 927 const CSSValue& xValue = |
| 928 repeatXList ? repeatXList->item(i % repeatXList->length()) : repeatX; | 928 repeatXList ? repeatXList->item(i % repeatXList->length()) : repeatX; |
| 929 const CSSValue& yValue = | 929 const CSSValue& yValue = |
| 930 repeatYList ? repeatYList->item(i % repeatYList->length()) : repeatY; | 930 repeatYList ? repeatYList->item(i % repeatYList->length()) : repeatY; |
| 931 appendBackgroundRepeatValue(builder, xValue, yValue); | 931 appendBackgroundRepeatValue(builder, xValue, yValue); |
| 932 } | 932 } |
| 933 return builder.toString(); | 933 return builder.toString(); |
| 934 } | 934 } |
| 935 | 935 |
| 936 } // namespace blink | 936 } // namespace blink |
| OLD | NEW |