| 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 r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 PropertyValueForSerializer value = m_propertySet.propertyAt(index); | 347 PropertyValueForSerializer value = m_propertySet.propertyAt(index); |
| 348 | 348 |
| 349 hasImportant |= value.isImportant(); | 349 hasImportant |= value.isImportant(); |
| 350 hasNonImportant |= !value.isImportant(); | 350 hasNonImportant |= !value.isImportant(); |
| 351 longhands[i] = value.value(); | 351 longhands[i] = value.value(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (hasImportant && hasNonImportant) | 354 if (hasImportant && hasNonImportant) |
| 355 return emptyString(); | 355 return emptyString(); |
| 356 | 356 |
| 357 // TODO(timloh): This should be isCSSWideKeyword() | 357 if (longhands[0]->isCSSWideKeyword() || longhands[0]->isPendingSubstitutionV
alue()) { |
| 358 if (longhands[0]->isInitialValue() || longhands[0]->isInheritedValue() | |
| 359 || longhands[0]->isPendingSubstitutionValue()) { | |
| 360 bool success = true; | 358 bool success = true; |
| 361 for (int i = 1; i < longhandCount; i++) { | 359 for (int i = 1; i < longhandCount; i++) { |
| 362 if (!longhands[i]->equals(*longhands[0])) { | 360 if (!longhands[i]->equals(*longhands[0])) { |
| 363 // This should just return emptyString() but some shorthands cur
rently | 361 // This should just return emptyString() but some shorthands cur
rently |
| 364 // allow 'initial' for their longhands. | 362 // allow 'initial' for their longhands. |
| 365 success = false; | 363 success = false; |
| 366 break; | 364 break; |
| 367 } | 365 } |
| 368 } | 366 } |
| 369 if (success) { | 367 if (success) { |
| 370 if (longhands[0]->isPendingSubstitutionValue()) | 368 if (longhands[0]->isPendingSubstitutionValue()) |
| 371 return toCSSPendingSubstitutionValue(longhands[0])->shorthandVal
ue()->cssText(); | 369 return toCSSPendingSubstitutionValue(longhands[0])->shorthandVal
ue()->cssText(); |
| 372 return longhands[0]->cssText(); | 370 return longhands[0]->cssText(); |
| 373 } | 371 } |
| 374 } | 372 } |
| 375 | 373 |
| 376 bool allowInitial = allowInitialInShorthand(shorthand.id()); | 374 bool allowInitial = allowInitialInShorthand(shorthand.id()); |
| 377 bool allowImplicitInitial = allowInitial || allowImplicitInitialInShorthand(
shorthand.id()); | 375 bool allowImplicitInitial = allowInitial || allowImplicitInitialInShorthand(
shorthand.id()); |
| 378 for (int i = 0; i < longhandCount; i++) { | 376 for (int i = 0; i < longhandCount; i++) { |
| 379 const CSSValue& value = *longhands[i]; | 377 const CSSValue& value = *longhands[i]; |
| 380 if (value.isImplicitInitialValue()) { | 378 if (value.isImplicitInitialValue()) { |
| 381 if (allowImplicitInitial) | 379 if (allowImplicitInitial) |
| 382 continue; | 380 continue; |
| 383 return emptyString(); | 381 return emptyString(); |
| 384 } | 382 } |
| 385 if (!allowInitial && value.isInitialValue()) | 383 if (!allowInitial && value.isInitialValue()) |
| 386 return emptyString(); | 384 return emptyString(); |
| 387 // TODO(timloh): This should also check unset | 385 if (value.isInheritedValue() || value.isUnsetValue() || value.isPendingS
ubstitutionValue()) |
| 388 if (value.isInheritedValue() || value.isPendingSubstitutionValue()) | |
| 389 return emptyString(); | 386 return emptyString(); |
| 390 if (value.isVariableReferenceValue()) | 387 if (value.isVariableReferenceValue()) |
| 391 return emptyString(); | 388 return emptyString(); |
| 392 } | 389 } |
| 393 | 390 |
| 394 return String(); | 391 return String(); |
| 395 } | 392 } |
| 396 | 393 |
| 397 String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const | 394 String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const |
| 398 { | 395 { |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 builder.append(", "); | 867 builder.append(", "); |
| 871 | 868 |
| 872 const CSSValue& xValue = repeatXList ? repeatXList->item(i % repeatXList
->length()) : repeatX; | 869 const CSSValue& xValue = repeatXList ? repeatXList->item(i % repeatXList
->length()) : repeatX; |
| 873 const CSSValue& yValue = repeatYList ? repeatYList->item(i % repeatYList
->length()) : repeatY; | 870 const CSSValue& yValue = repeatYList ? repeatYList->item(i % repeatYList
->length()) : repeatY; |
| 874 appendBackgroundRepeatValue(builder, xValue, yValue); | 871 appendBackgroundRepeatValue(builder, xValue, yValue); |
| 875 } | 872 } |
| 876 return builder.toString(); | 873 return builder.toString(); |
| 877 } | 874 } |
| 878 | 875 |
| 879 } // namespace blink | 876 } // namespace blink |
| OLD | NEW |