| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/css/StylePropertySerializer.h" | 24 #include "core/css/StylePropertySerializer.h" |
| 25 | 25 |
| 26 #include "core/CSSValueKeywords.h" | 26 #include "core/CSSValueKeywords.h" |
| 27 #include "core/StylePropertyShorthand.h" | 27 #include "core/StylePropertyShorthand.h" |
| 28 #include "core/css/RuntimeCSSEnabled.h" | 28 #include "core/css/RuntimeCSSEnabled.h" |
| 29 #include "wtf/BitArray.h" | 29 #include "wtf/BitArray.h" |
| 30 #include "wtf/text/StringBuilder.h" | 30 #include "wtf/text/StringBuilder.h" |
| 31 | 31 |
| 32 using namespace std; | |
| 33 | |
| 34 namespace WebCore { | 32 namespace WebCore { |
| 35 | 33 |
| 36 static bool isInitialOrInherit(const String& value) | 34 static bool isInitialOrInherit(const String& value) |
| 37 { | 35 { |
| 38 DEFINE_STATIC_LOCAL(String, initial, ("initial")); | 36 DEFINE_STATIC_LOCAL(String, initial, ("initial")); |
| 39 DEFINE_STATIC_LOCAL(String, inherit, ("inherit")); | 37 DEFINE_STATIC_LOCAL(String, inherit, ("inherit")); |
| 40 return value.length() == 7 && (value == initial || value == inherit); | 38 return value.length() == 7 && (value == initial || value == inherit); |
| 41 } | 39 } |
| 42 | 40 |
| 43 StylePropertySerializer::StylePropertySerializer(const StylePropertySet& propert
ies) | 41 StylePropertySerializer::StylePropertySerializer(const StylePropertySet& propert
ies) |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 const unsigned size = shorthand.length(); | 474 const unsigned size = shorthand.length(); |
| 477 // Begin by collecting the properties into an array. | 475 // Begin by collecting the properties into an array. |
| 478 WillBeHeapVector<RefPtrWillBeMember<CSSValue> > values(size); | 476 WillBeHeapVector<RefPtrWillBeMember<CSSValue> > values(size); |
| 479 size_t numLayers = 0; | 477 size_t numLayers = 0; |
| 480 | 478 |
| 481 for (unsigned i = 0; i < size; ++i) { | 479 for (unsigned i = 0; i < size; ++i) { |
| 482 values[i] = m_propertySet.getPropertyCSSValue(shorthand.properties()[i])
; | 480 values[i] = m_propertySet.getPropertyCSSValue(shorthand.properties()[i])
; |
| 483 if (values[i]) { | 481 if (values[i]) { |
| 484 if (values[i]->isBaseValueList()) { | 482 if (values[i]->isBaseValueList()) { |
| 485 CSSValueList* valueList = toCSSValueList(values[i].get()); | 483 CSSValueList* valueList = toCSSValueList(values[i].get()); |
| 486 numLayers = max(valueList->length(), numLayers); | 484 numLayers = std::max(valueList->length(), numLayers); |
| 487 } else | 485 } else { |
| 488 numLayers = max<size_t>(1U, numLayers); | 486 numLayers = std::max<size_t>(1U, numLayers); |
| 487 } |
| 489 } | 488 } |
| 490 } | 489 } |
| 491 | 490 |
| 492 String commonValue; | 491 String commonValue; |
| 493 bool commonValueInitialized = false; | 492 bool commonValueInitialized = false; |
| 494 | 493 |
| 495 // Now stitch the properties together. Implicit initial values are flagged a
s such and | 494 // Now stitch the properties together. Implicit initial values are flagged a
s such and |
| 496 // can safely be omitted. | 495 // can safely be omitted. |
| 497 for (size_t i = 0; i < numLayers; i++) { | 496 for (size_t i = 0; i < numLayers; i++) { |
| 498 StringBuilder layerResult; | 497 StringBuilder layerResult; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 isInitialValue = false; | 863 isInitialValue = false; |
| 865 if (!value->isInheritedValue()) | 864 if (!value->isInheritedValue()) |
| 866 isInheritedValue = false; | 865 isInheritedValue = false; |
| 867 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 866 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
| 868 return false; | 867 return false; |
| 869 } | 868 } |
| 870 return isInitialValue || isInheritedValue; | 869 return isInitialValue || isInheritedValue; |
| 871 } | 870 } |
| 872 | 871 |
| 873 } | 872 } |
| OLD | NEW |