Chromium Code Reviews| 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 Apple Computer, Inc. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 struct SameSizeAsCSSProperty { | 33 struct SameSizeAsCSSProperty { |
| 34 uint32_t bitfields; | 34 uint32_t bitfields; |
| 35 void* value; | 35 void* value; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), CSSProperty _should_stay_small); | 38 COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), CSSProperty _should_stay_small); |
| 39 | 39 |
| 40 CSSPropertyID StylePropertyMetadata::shorthandID() const | |
| 41 { | |
| 42 if (!m_isSetFromShorthand) | |
| 43 return CSSPropertyInvalid; | |
| 44 | |
| 45 const Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLongh and(static_cast<CSSPropertyID>(m_propertyID)); | |
| 46 ASSERT(shorthands.size()); | |
| 47 if (shorthands.size() > 1) { | |
|
Julien - ping for review
2013/06/14 17:38:27
Do we really need this branch? m_shorthandID is 0
| |
| 48 ASSERT(m_shorthandID >= 0 && m_shorthandID < shorthands.size()); | |
| 49 return shorthands.at(m_shorthandID).id(); | |
| 50 } | |
| 51 return shorthands.at(0).id(); | |
| 52 } | |
| 53 | |
| 40 void CSSProperty::wrapValueInCommaSeparatedList() | 54 void CSSProperty::wrapValueInCommaSeparatedList() |
| 41 { | 55 { |
| 42 RefPtr<CSSValue> value = m_value.release(); | 56 RefPtr<CSSValue> value = m_value.release(); |
| 43 m_value = CSSValueList::createCommaSeparated(); | 57 m_value = CSSValueList::createCommaSeparated(); |
| 44 toCSSValueList(m_value.get())->append(value.release()); | 58 toCSSValueList(m_value.get())->append(value.release()); |
| 45 } | 59 } |
| 46 | 60 |
| 47 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; | 61 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; |
| 48 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; | 62 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; |
| 49 | 63 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE xtent logicalSide, const CSSPropertyID* properties) | 171 static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE xtent logicalSide, const CSSPropertyID* properties) |
| 158 { | 172 { |
| 159 if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWriti ngMode) | 173 if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWriti ngMode) |
| 160 return properties[logicalSide]; | 174 return properties[logicalSide]; |
| 161 return logicalSide == LogicalWidth ? properties[1] : properties[0]; | 175 return logicalSide == LogicalWidth ? properties[1] : properties[0]; |
| 162 } | 176 } |
| 163 | 177 |
| 164 static const StylePropertyShorthand& borderDirections() | 178 static const StylePropertyShorthand& borderDirections() |
| 165 { | 179 { |
| 166 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSProper tyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft }; | 180 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSProper tyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft }; |
| 167 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (properties, W TF_ARRAY_LENGTH(properties))); | 181 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBo rder, properties, WTF_ARRAY_LENGTH(properties))); |
| 168 return borderDirections; | 182 return borderDirections; |
| 169 } | 183 } |
| 170 | 184 |
| 171 CSSPropertyID CSSProperty::resolveDirectionAwareProperty(CSSPropertyID propertyI D, TextDirection direction, WritingMode writingMode) | 185 CSSPropertyID CSSProperty::resolveDirectionAwareProperty(CSSPropertyID propertyI D, TextDirection direction, WritingMode writingMode) |
| 172 { | 186 { |
| 173 switch (propertyID) { | 187 switch (propertyID) { |
| 174 case CSSPropertyWebkitMarginEnd: | 188 case CSSPropertyWebkitMarginEnd: |
| 175 return resolveToPhysicalProperty(direction, writingMode, EndSide, margin Shorthand()); | 189 return resolveToPhysicalProperty(direction, writingMode, EndSide, margin Shorthand()); |
| 176 case CSSPropertyWebkitMarginStart: | 190 case CSSPropertyWebkitMarginStart: |
| 177 return resolveToPhysicalProperty(direction, writingMode, StartSide, marg inShorthand()); | 191 return resolveToPhysicalProperty(direction, writingMode, StartSide, marg inShorthand()); |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 } | 686 } |
| 673 | 687 |
| 674 void CSSProperty::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 688 void CSSProperty::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 675 { | 689 { |
| 676 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | 690 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); |
| 677 info.addMember(m_value, "value"); | 691 info.addMember(m_value, "value"); |
| 678 info.ignoreMember(m_metadata); | 692 info.ignoreMember(m_metadata); |
| 679 } | 693 } |
| 680 | 694 |
| 681 } // namespace WebCore | 695 } // namespace WebCore |
| OLD | NEW |