| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "config.h" | 21 #include "config.h" |
| 22 #include "core/css/CSSProperty.h" | 22 #include "core/css/CSSProperty.h" |
| 23 | 23 |
| 24 #include "core/StylePropertyShorthand.h" | 24 #include "core/StylePropertyShorthand.h" |
| 25 #include "core/css/CSSValueList.h" | |
| 26 #include "core/style/ComputedStyleConstants.h" | 25 #include "core/style/ComputedStyleConstants.h" |
| 27 | 26 |
| 28 namespace blink { | 27 namespace blink { |
| 29 | 28 |
| 30 struct SameSizeAsCSSProperty { | 29 struct SameSizeAsCSSProperty { |
| 31 uint32_t bitfields; | 30 uint32_t bitfields; |
| 32 void* value; | 31 void* value; |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 static_assert(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), "CSSProperty
should stay small"); | 34 static_assert(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), "CSSProperty
should stay small"); |
| 36 | 35 |
| 37 CSSPropertyID StylePropertyMetadata::shorthandID() const | 36 CSSPropertyID StylePropertyMetadata::shorthandID() const |
| 38 { | 37 { |
| 39 if (!m_isSetFromShorthand) | 38 if (!m_isSetFromShorthand) |
| 40 return CSSPropertyInvalid; | 39 return CSSPropertyInvalid; |
| 41 | 40 |
| 42 Vector<StylePropertyShorthand, 4> shorthands; | 41 Vector<StylePropertyShorthand, 4> shorthands; |
| 43 getMatchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID), &
shorthands); | 42 getMatchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID), &
shorthands); |
| 44 ASSERT(shorthands.size() && m_indexInShorthandsVector >= 0 && m_indexInShort
handsVector < shorthands.size()); | 43 ASSERT(shorthands.size() && m_indexInShorthandsVector >= 0 && m_indexInShort
handsVector < shorthands.size()); |
| 45 return shorthands.at(m_indexInShorthandsVector).id(); | 44 return shorthands.at(m_indexInShorthandsVector).id(); |
| 46 } | 45 } |
| 47 | 46 |
| 48 void CSSProperty::wrapValueInCommaSeparatedList() | |
| 49 { | |
| 50 RefPtrWillBeRawPtr<CSSValue> value = m_value.release(); | |
| 51 m_value = CSSValueList::createCommaSeparated(); | |
| 52 toCSSValueList(m_value.get())->append(value.release()); | |
| 53 } | |
| 54 | |
| 55 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; | 47 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; |
| 56 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; | 48 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; |
| 57 | 49 |
| 58 static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingM
ode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& short
hand) | 50 static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingM
ode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& short
hand) |
| 59 { | 51 { |
| 60 if (direction == LTR) { | 52 if (direction == LTR) { |
| 61 if (writingMode == TopToBottomWritingMode) { | 53 if (writingMode == TopToBottomWritingMode) { |
| 62 // The common case. The logical and physical box sides match. | 54 // The common case. The logical and physical box sides match. |
| 63 // Left = Start, Right = End, Before = Top, After = Bottom | 55 // Left = Start, Right = End, Before = Top, After = Bottom |
| 64 return shorthand.properties()[logicalSide]; | 56 return shorthand.properties()[logicalSide]; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // all shorthand spec says: | 256 // all shorthand spec says: |
| 265 // The all property is a shorthand that resets all CSS properties except | 257 // The all property is a shorthand that resets all CSS properties except |
| 266 // direction and unicode-bidi. It only accepts the CSS-wide keywords. | 258 // direction and unicode-bidi. It only accepts the CSS-wide keywords. |
| 267 // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand | 259 // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand |
| 268 // So CSSPropertyUnicodeBidi and CSSPropertyDirection are not | 260 // So CSSPropertyUnicodeBidi and CSSPropertyDirection are not |
| 269 // affected by all property. | 261 // affected by all property. |
| 270 return propertyID != CSSPropertyUnicodeBidi && propertyID != CSSPropertyDire
ction; | 262 return propertyID != CSSPropertyUnicodeBidi && propertyID != CSSPropertyDire
ction; |
| 271 } | 263 } |
| 272 | 264 |
| 273 } // namespace blink | 265 } // namespace blink |
| OLD | NEW |