OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 unsigned m_bitfields[2]; | 63 unsigned m_bitfields[2]; |
64 } inherited_flags; | 64 } inherited_flags; |
65 | 65 |
66 struct NonInheritedFlags { | 66 struct NonInheritedFlags { |
67 unsigned m_bitfields[2]; | 67 unsigned m_bitfields[2]; |
68 } noninherited_flags; | 68 } noninherited_flags; |
69 }; | 69 }; |
70 | 70 |
71 static_assert(sizeof(LayoutStyle) == sizeof(SameSizeAsLayoutStyle), "LayoutStyle
should stay small"); | 71 static_assert(sizeof(LayoutStyle) == sizeof(SameSizeAsLayoutStyle), "LayoutStyle
should stay small"); |
72 | 72 |
73 inline LayoutStyle* defaultStyle() | |
74 { | |
75 DEFINE_STATIC_REF(LayoutStyle, s_defaultStyle, (LayoutStyle::createDefaultSt
yle())); | |
76 return s_defaultStyle; | |
77 } | |
78 | |
79 PassRefPtr<LayoutStyle> LayoutStyle::create() | 73 PassRefPtr<LayoutStyle> LayoutStyle::create() |
80 { | 74 { |
81 return adoptRef(new LayoutStyle()); | 75 return adoptRef(new LayoutStyle()); |
82 } | 76 } |
83 | 77 |
84 PassRefPtr<LayoutStyle> LayoutStyle::createDefaultStyle() | 78 PassRefPtr<LayoutStyle> LayoutStyle::createInitialStyle() |
85 { | 79 { |
86 return adoptRef(new LayoutStyle(DefaultStyle)); | 80 return adoptRef(new LayoutStyle(InitialStyle)); |
87 } | 81 } |
88 | 82 |
89 PassRefPtr<LayoutStyle> LayoutStyle::createAnonymousStyleWithDisplay(const Layou
tStyle& parentStyle, EDisplay display) | 83 PassRefPtr<LayoutStyle> LayoutStyle::createAnonymousStyleWithDisplay(const Layou
tStyle& parentStyle, EDisplay display) |
90 { | 84 { |
91 RefPtr<LayoutStyle> newStyle = LayoutStyle::create(); | 85 RefPtr<LayoutStyle> newStyle = LayoutStyle::create(); |
92 newStyle->inheritFrom(parentStyle); | 86 newStyle->inheritFrom(parentStyle); |
93 newStyle->inheritUnicodeBidiFrom(parentStyle); | 87 newStyle->inheritUnicodeBidiFrom(parentStyle); |
94 newStyle->setDisplay(display); | 88 newStyle->setDisplay(display); |
95 return newStyle; | 89 return newStyle; |
96 } | 90 } |
97 | 91 |
98 PassRefPtr<LayoutStyle> LayoutStyle::clone(const LayoutStyle& other) | 92 PassRefPtr<LayoutStyle> LayoutStyle::clone(const LayoutStyle& other) |
99 { | 93 { |
100 return adoptRef(new LayoutStyle(other)); | 94 return adoptRef(new LayoutStyle(other)); |
101 } | 95 } |
102 | 96 |
103 ALWAYS_INLINE LayoutStyle::LayoutStyle() | 97 ALWAYS_INLINE LayoutStyle::LayoutStyle() |
104 : m_box(defaultStyle()->m_box) | 98 : m_box(initialStyle()->m_box) |
105 , visual(defaultStyle()->visual) | 99 , visual(initialStyle()->visual) |
106 , m_background(defaultStyle()->m_background) | 100 , m_background(initialStyle()->m_background) |
107 , surround(defaultStyle()->surround) | 101 , surround(initialStyle()->surround) |
108 , rareNonInheritedData(defaultStyle()->rareNonInheritedData) | 102 , rareNonInheritedData(initialStyle()->rareNonInheritedData) |
109 , rareInheritedData(defaultStyle()->rareInheritedData) | 103 , rareInheritedData(initialStyle()->rareInheritedData) |
110 , inherited(defaultStyle()->inherited) | 104 , inherited(initialStyle()->inherited) |
111 , m_svgStyle(defaultStyle()->m_svgStyle) | 105 , m_svgStyle(initialStyle()->m_svgStyle) |
112 { | 106 { |
113 setBitDefaults(); // Would it be faster to copy this from the default style? | 107 setBitDefaults(); // Would it be faster to copy this from the default style? |
114 static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags should not grow
"); | 108 static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags should not grow
"); |
115 static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags should no
t grow"); | 109 static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags should no
t grow"); |
116 } | 110 } |
117 | 111 |
118 ALWAYS_INLINE LayoutStyle::LayoutStyle(DefaultStyleTag) | 112 ALWAYS_INLINE LayoutStyle::LayoutStyle(InitialStyleTag) |
119 { | 113 { |
120 setBitDefaults(); | 114 setBitDefaults(); |
121 | 115 |
122 m_box.init(); | 116 m_box.init(); |
123 visual.init(); | 117 visual.init(); |
124 m_background.init(); | 118 m_background.init(); |
125 surround.init(); | 119 surround.init(); |
126 rareNonInheritedData.init(); | 120 rareNonInheritedData.init(); |
127 rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); | 121 rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); |
128 rareNonInheritedData.access()->m_flexibleBox.init(); | 122 rareNonInheritedData.access()->m_flexibleBox.init(); |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 horizontal || includeLogicalRightEdge); | 1715 horizontal || includeLogicalRightEdge); |
1722 | 1716 |
1723 edges[BSLeft] = BorderEdge(borderLeftWidth(), | 1717 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
1724 visitedDependentColor(CSSPropertyBorderLeftColor), | 1718 visitedDependentColor(CSSPropertyBorderLeftColor), |
1725 borderLeftStyle(), | 1719 borderLeftStyle(), |
1726 borderLeftIsTransparent(), | 1720 borderLeftIsTransparent(), |
1727 !horizontal || includeLogicalLeftEdge); | 1721 !horizontal || includeLogicalLeftEdge); |
1728 } | 1722 } |
1729 | 1723 |
1730 } // namespace blink | 1724 } // namespace blink |
OLD | NEW |