Chromium Code Reviews| Index: Source/core/css/StylePropertySet.cpp |
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp |
| index c58aaa973909c3427734ff4fcddeb35bc357a0b6..c97360c6e4d656273493c32b94e68b9cd14fb3c0 100644 |
| --- a/Source/core/css/StylePropertySet.cpp |
| +++ b/Source/core/css/StylePropertySet.cpp |
| @@ -2,6 +2,7 @@ |
| * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| + * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| * |
| * This library is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU Library General Public |
| @@ -51,7 +52,7 @@ static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap() |
| static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) |
| { |
| - return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count; |
| + return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(uint16_t) * count; |
| } |
| PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode) |
| @@ -79,10 +80,11 @@ MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, |
| ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properties, unsigned length, CSSParserMode cssParserMode) |
| : StylePropertySet(cssParserMode, length) |
| { |
| - StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(this->metadataArray()); |
| + uint16_t* metadataArray = const_cast<uint16_t*>(this->metadataArray()); |
| CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray()); |
| for (unsigned i = 0; i < length; ++i) { |
| - metadataArray[i] = properties[i].metadata(); |
| + StylePropertyMetadata metadata = properties[i].metadata(); |
| + metadataArray[i] = *(reinterpret_cast<uint16_t*>(&metadata)); |
|
Jeffrey Yasskin
2013/06/21 19:56:27
That reinterpret_cast is undefined behavior; use m
|
| valueArray[i] = properties[i].value(); |
| valueArray[i]->ref(); |
| } |