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 | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 bool independent_equal = old_style->IndependentInheritedEqual(*new_style); | 192 bool independent_equal = old_style->IndependentInheritedEqual(*new_style); |
193 bool non_independent_equal = | 193 bool non_independent_equal = |
194 old_style->NonIndependentInheritedEqual(*new_style); | 194 old_style->NonIndependentInheritedEqual(*new_style); |
195 if (!independent_equal || !non_independent_equal) { | 195 if (!independent_equal || !non_independent_equal) { |
196 if (non_independent_equal && !old_style->HasExplicitlyInheritedProperties()) | 196 if (non_independent_equal && !old_style->HasExplicitlyInheritedProperties()) |
197 return kIndependentInherit; | 197 return kIndependentInherit; |
198 return kInherit; | 198 return kInherit; |
199 } | 199 } |
200 | 200 |
201 if (!old_style->LoadingCustomFontsEqual(*new_style) || | 201 if (!old_style->LoadingCustomFontsEqual(*new_style) || |
202 old_style->AlignItems() != new_style->AlignItems() || | |
203 old_style->JustifyItems() != new_style->JustifyItems()) | 202 old_style->JustifyItems() != new_style->JustifyItems()) |
204 return kInherit; | 203 return kInherit; |
205 | 204 |
206 if (*old_style == *new_style) | 205 if (*old_style == *new_style) |
207 return DiffPseudoStyles(*old_style, *new_style); | 206 return DiffPseudoStyles(*old_style, *new_style); |
208 | 207 |
209 if (old_style->HasExplicitlyInheritedProperties()) | 208 if (old_style->HasExplicitlyInheritedProperties()) |
210 return kInherit; | 209 return kInherit; |
211 | 210 |
212 return kNoInherit; | 211 return kNoInherit; |
213 } | 212 } |
214 | 213 |
215 void ComputedStyle::PropagateIndependentInheritedProperties( | 214 void ComputedStyle::PropagateIndependentInheritedProperties( |
216 const ComputedStyle& parent_style) { | 215 const ComputedStyle& parent_style) { |
217 ComputedStyleBase::PropagateIndependentInheritedProperties(parent_style); | 216 ComputedStyleBase::PropagateIndependentInheritedProperties(parent_style); |
218 } | 217 } |
219 | 218 |
220 StyleSelfAlignmentData ResolvedSelfAlignment( | 219 StyleSelfAlignmentData ResolvedSelfAlignment( |
221 const StyleSelfAlignmentData& value, | 220 const StyleSelfAlignmentData& value, |
222 ItemPosition normal_value_behavior) { | 221 ItemPosition normal_value_behavior) { |
223 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' | |
224 // flag to not just mean 'auto' prior to running the StyleAdjuster but also | |
225 // mean 'normal' after running it. | |
226 if (value.GetPosition() == kItemPositionNormal || | 222 if (value.GetPosition() == kItemPositionNormal || |
227 value.GetPosition() == kItemPositionAuto) | 223 value.GetPosition() == kItemPositionAuto) |
228 return {normal_value_behavior, kOverflowAlignmentDefault}; | 224 return {normal_value_behavior, kOverflowAlignmentDefault}; |
229 return value; | 225 return value; |
230 } | 226 } |
231 | 227 |
232 StyleSelfAlignmentData ComputedStyle::ResolvedAlignItems( | 228 StyleSelfAlignmentData ComputedStyle::ResolvedAlignItems( |
233 ItemPosition normal_value_behaviour) const { | 229 ItemPosition normal_value_behaviour) const { |
234 // We will return the behaviour of 'normal' value if needed, which is specific | 230 // We will return the behaviour of 'normal' value if needed, which is specific |
235 // of each layout model. | 231 // of each layout model. |
236 return ResolvedSelfAlignment(AlignItems(), normal_value_behaviour); | 232 return ResolvedSelfAlignment(AlignItems(), normal_value_behaviour); |
237 } | 233 } |
238 | 234 |
239 StyleSelfAlignmentData ComputedStyle::ResolvedAlignSelf( | 235 StyleSelfAlignmentData ComputedStyle::ResolvedAlignSelf( |
240 ItemPosition normal_value_behaviour, | 236 ItemPosition normal_value_behaviour, |
241 const ComputedStyle* parent_style) const { | 237 const ComputedStyle* parent_style) const { |
242 // We will return the behaviour of 'normal' value if needed, which is specific | 238 // We will return the behaviour of 'normal' value if needed, which is specific |
243 // of each layout model. | 239 // of each layout model. |
244 if (!parent_style || AlignSelfPosition() != kItemPositionAuto) | 240 if (!parent_style || AlignSelfPosition() != kItemPositionAuto) |
245 return ResolvedSelfAlignment(AlignSelf(), normal_value_behaviour); | 241 return ResolvedSelfAlignment(AlignSelf(), normal_value_behaviour); |
246 | 242 |
247 // We shouldn't need to resolve any 'auto' value in post-adjusment | |
248 // ComputedStyle, but some layout models can generate anonymous boxes that may | |
249 // need 'auto' value resolution during layout. | |
250 // The 'auto' keyword computes to the parent's align-items computed value. | 243 // The 'auto' keyword computes to the parent's align-items computed value. |
251 return parent_style->ResolvedAlignItems(normal_value_behaviour); | 244 return parent_style->ResolvedAlignItems(normal_value_behaviour); |
252 } | 245 } |
253 | 246 |
254 StyleSelfAlignmentData ComputedStyle::ResolvedJustifyItems( | 247 StyleSelfAlignmentData ComputedStyle::ResolvedJustifyItems( |
255 ItemPosition normal_value_behaviour) const { | 248 ItemPosition normal_value_behaviour) const { |
256 // We will return the behaviour of 'normal' value if needed, which is specific | 249 // We will return the behaviour of 'normal' value if needed, which is specific |
257 // of each layout model. | 250 // of each layout model. |
258 return ResolvedSelfAlignment(JustifyItems(), normal_value_behaviour); | 251 return ResolvedSelfAlignment(JustifyItems(), normal_value_behaviour); |
259 } | 252 } |
260 | 253 |
261 StyleSelfAlignmentData ComputedStyle::ResolvedJustifySelf( | 254 StyleSelfAlignmentData ComputedStyle::ResolvedJustifySelf( |
262 ItemPosition normal_value_behaviour, | 255 ItemPosition normal_value_behaviour, |
263 const ComputedStyle* parent_style) const { | 256 const ComputedStyle* parent_style) const { |
264 // We will return the behaviour of 'normal' value if needed, which is specific | 257 // We will return the behaviour of 'normal' value if needed, which is specific |
265 // of each layout model. | 258 // of each layout model. |
266 if (!parent_style || JustifySelfPosition() != kItemPositionAuto) | 259 if (!parent_style || JustifySelfPosition() != kItemPositionAuto) |
267 return ResolvedSelfAlignment(JustifySelf(), normal_value_behaviour); | 260 return ResolvedSelfAlignment(JustifySelf(), normal_value_behaviour); |
268 | 261 |
269 // We shouldn't need to resolve any 'auto' value in post-adjusment | |
270 // ComputedStyle, but some layout models can generate anonymous boxes that may | |
271 // need 'auto' value resolution during layout. | |
272 // The auto keyword computes to the parent's justify-items computed value. | 262 // The auto keyword computes to the parent's justify-items computed value. |
273 return parent_style->ResolvedJustifyItems(normal_value_behaviour); | 263 return parent_style->ResolvedJustifyItems(normal_value_behaviour); |
274 } | 264 } |
275 | 265 |
276 static inline ContentPosition ResolvedContentAlignmentPosition( | 266 static inline ContentPosition ResolvedContentAlignmentPosition( |
277 const StyleContentAlignmentData& value, | 267 const StyleContentAlignmentData& value, |
278 const StyleContentAlignmentData& normal_value_behavior) { | 268 const StyleContentAlignmentData& normal_value_behavior) { |
279 return (value.GetPosition() == kContentPositionNormal && | 269 return (value.GetPosition() == kContentPositionNormal && |
280 value.Distribution() == kContentDistributionDefault) | 270 value.Distribution() == kContentDistributionDefault) |
281 ? normal_value_behavior.GetPosition() | 271 ? normal_value_behavior.GetPosition() |
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 if (value < 0) | 2420 if (value < 0) |
2431 fvalue -= 0.5f; | 2421 fvalue -= 0.5f; |
2432 else | 2422 else |
2433 fvalue += 0.5f; | 2423 fvalue += 0.5f; |
2434 } | 2424 } |
2435 | 2425 |
2436 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2426 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2437 } | 2427 } |
2438 | 2428 |
2439 } // namespace blink | 2429 } // namespace blink |
OLD | NEW |