OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "platform/geometry/FloatRoundedRect.h" | 64 #include "platform/geometry/FloatRoundedRect.h" |
65 #include "wtf/PtrUtil.h" | 65 #include "wtf/PtrUtil.h" |
66 #include <algorithm> | 66 #include <algorithm> |
67 #include <math.h> | 67 #include <math.h> |
68 | 68 |
69 namespace blink { | 69 namespace blink { |
70 | 70 |
71 // Used by flexible boxes when flexing this element and by table cells. | 71 // Used by flexible boxes when flexing this element and by table cells. |
72 typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap; | 72 typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap; |
73 | 73 |
74 // Used by grid elements to properly size their grid items. | |
75 // FIXME: Move these into LayoutBoxRareData. | |
76 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = nullptr; | |
77 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = nullptr; | |
78 static OverrideSizeMap* gExtraInlineOffsetMap = nullptr; | 74 static OverrideSizeMap* gExtraInlineOffsetMap = nullptr; |
79 static OverrideSizeMap* gExtraBlockOffsetMap = nullptr; | 75 static OverrideSizeMap* gExtraBlockOffsetMap = nullptr; |
80 | 76 |
81 | 77 |
82 // Size of border belt for autoscroll. When mouse pointer in border belt, | 78 // Size of border belt for autoscroll. When mouse pointer in border belt, |
83 // autoscroll is started. | 79 // autoscroll is started. |
84 static const int autoscrollBeltSize = 20; | 80 static const int autoscrollBeltSize = 20; |
85 static const unsigned backgroundObscurationTestMaxDepth = 4; | 81 static const unsigned backgroundObscurationTestMaxDepth = 4; |
86 | 82 |
87 struct SameSizeAsLayoutBox : public LayoutBoxModelObject { | 83 struct SameSizeAsLayoutBox : public LayoutBoxModelObject { |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 | 1128 |
1133 LayoutUnit LayoutBox::overrideLogicalContentHeight() const | 1129 LayoutUnit LayoutBox::overrideLogicalContentHeight() const |
1134 { | 1130 { |
1135 ASSERT(hasOverrideLogicalContentHeight()); | 1131 ASSERT(hasOverrideLogicalContentHeight()); |
1136 return m_rareData->m_overrideLogicalContentHeight; | 1132 return m_rareData->m_overrideLogicalContentHeight; |
1137 } | 1133 } |
1138 | 1134 |
1139 // TODO (lajava) Now that we have implemented these functions based on physical
direction, we'd rather remove the logical ones. | 1135 // TODO (lajava) Now that we have implemented these functions based on physical
direction, we'd rather remove the logical ones. |
1140 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalWidth() const | 1136 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalWidth() const |
1141 { | 1137 { |
1142 ASSERT(hasOverrideContainingBlockLogicalWidth()); | 1138 DCHECK(hasOverrideContainingBlockLogicalWidth()); |
1143 return gOverrideContainingBlockLogicalWidthMap->get(this); | 1139 return m_rareData->m_overrideContainingBlockContentLogicalWidth; |
1144 } | 1140 } |
1145 | 1141 |
1146 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1142 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1147 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalHeight() const | 1143 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalHeight() const |
1148 { | 1144 { |
1149 ASSERT(hasOverrideContainingBlockLogicalHeight()); | 1145 DCHECK(hasOverrideContainingBlockLogicalHeight()); |
1150 return gOverrideContainingBlockLogicalHeightMap->get(this); | 1146 return m_rareData->m_overrideContainingBlockContentLogicalHeight; |
1151 } | 1147 } |
1152 | 1148 |
1153 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1149 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1154 bool LayoutBox::hasOverrideContainingBlockLogicalWidth() const | 1150 bool LayoutBox::hasOverrideContainingBlockLogicalWidth() const |
1155 { | 1151 { |
1156 return gOverrideContainingBlockLogicalWidthMap && gOverrideContainingBlockLo
gicalWidthMap->contains(this); | 1152 return m_rareData && m_rareData->m_hasOverrideContainingBlockContentLogicalW
idth; |
1157 } | 1153 } |
1158 | 1154 |
1159 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1155 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1160 bool LayoutBox::hasOverrideContainingBlockLogicalHeight() const | 1156 bool LayoutBox::hasOverrideContainingBlockLogicalHeight() const |
1161 { | 1157 { |
1162 return gOverrideContainingBlockLogicalHeightMap && gOverrideContainingBlockL
ogicalHeightMap->contains(this); | 1158 return m_rareData && m_rareData->m_hasOverrideContainingBlockContentLogicalH
eight; |
1163 } | 1159 } |
1164 | 1160 |
1165 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1161 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1166 void LayoutBox::setOverrideContainingBlockContentLogicalWidth(LayoutUnit logical
Width) | 1162 void LayoutBox::setOverrideContainingBlockContentLogicalWidth(LayoutUnit logical
Width) |
1167 { | 1163 { |
1168 if (!gOverrideContainingBlockLogicalWidthMap) | 1164 ensureRareData().m_overrideContainingBlockContentLogicalWidth = logicalWidth
; |
1169 gOverrideContainingBlockLogicalWidthMap = new OverrideSizeMap; | 1165 ensureRareData().m_hasOverrideContainingBlockContentLogicalWidth = true; |
1170 gOverrideContainingBlockLogicalWidthMap->set(this, logicalWidth); | |
1171 } | 1166 } |
1172 | 1167 |
1173 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1168 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1174 void LayoutBox::setOverrideContainingBlockContentLogicalHeight(LayoutUnit logica
lHeight) | 1169 void LayoutBox::setOverrideContainingBlockContentLogicalHeight(LayoutUnit logica
lHeight) |
1175 { | 1170 { |
1176 if (!gOverrideContainingBlockLogicalHeightMap) | 1171 ensureRareData().m_overrideContainingBlockContentLogicalHeight = logicalHeig
ht; |
1177 gOverrideContainingBlockLogicalHeightMap = new OverrideSizeMap; | 1172 ensureRareData().m_hasOverrideContainingBlockContentLogicalHeight = true; |
1178 gOverrideContainingBlockLogicalHeightMap->set(this, logicalHeight); | |
1179 } | 1173 } |
1180 | 1174 |
1181 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1175 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1182 void LayoutBox::clearContainingBlockOverrideSize() | 1176 void LayoutBox::clearContainingBlockOverrideSize() |
1183 { | 1177 { |
1184 if (gOverrideContainingBlockLogicalWidthMap) | 1178 if (!m_rareData) |
1185 gOverrideContainingBlockLogicalWidthMap->remove(this); | 1179 return; |
1186 clearOverrideContainingBlockContentLogicalHeight(); | 1180 ensureRareData().m_hasOverrideContainingBlockContentLogicalWidth = false; |
| 1181 ensureRareData().m_hasOverrideContainingBlockContentLogicalHeight = false; |
1187 } | 1182 } |
1188 | 1183 |
1189 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. | 1184 // TODO (lajava) Shouldn't we implement these functions based on physical direct
ion ?. |
1190 void LayoutBox::clearOverrideContainingBlockContentLogicalHeight() | 1185 void LayoutBox::clearOverrideContainingBlockContentLogicalHeight() |
1191 { | 1186 { |
1192 if (gOverrideContainingBlockLogicalHeightMap) | 1187 if (!m_rareData) |
1193 gOverrideContainingBlockLogicalHeightMap->remove(this); | 1188 return; |
| 1189 ensureRareData().m_hasOverrideContainingBlockContentLogicalHeight = false; |
1194 } | 1190 } |
1195 | 1191 |
1196 LayoutUnit LayoutBox::extraInlineOffset() const | 1192 LayoutUnit LayoutBox::extraInlineOffset() const |
1197 { | 1193 { |
1198 return gExtraInlineOffsetMap ? gExtraInlineOffsetMap->get(this) : LayoutUnit
(); | 1194 return gExtraInlineOffsetMap ? gExtraInlineOffsetMap->get(this) : LayoutUnit
(); |
1199 } | 1195 } |
1200 | 1196 |
1201 LayoutUnit LayoutBox::extraBlockOffset() const | 1197 LayoutUnit LayoutBox::extraBlockOffset() const |
1202 { | 1198 { |
1203 return gExtraBlockOffsetMap ? gExtraBlockOffsetMap->get(this) : LayoutUnit()
; | 1199 return gExtraBlockOffsetMap ? gExtraBlockOffsetMap->get(this) : LayoutUnit()
; |
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4831 m_rareData->m_snapAreas->remove(&snapArea); | 4827 m_rareData->m_snapAreas->remove(&snapArea); |
4832 } | 4828 } |
4833 } | 4829 } |
4834 | 4830 |
4835 SnapAreaSet* LayoutBox::snapAreas() const | 4831 SnapAreaSet* LayoutBox::snapAreas() const |
4836 { | 4832 { |
4837 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4833 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
4838 } | 4834 } |
4839 | 4835 |
4840 } // namespace blink | 4836 } // namespace blink |
OLD | NEW |