Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2913093002: Revert of [css-align] Don't resolve 'auto' values for computed style. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() ||
202 old_style->JustifyItems() != new_style->JustifyItems()) 203 old_style->JustifyItems() != new_style->JustifyItems())
203 return kInherit; 204 return kInherit;
204 205
205 if (*old_style == *new_style) 206 if (*old_style == *new_style)
206 return DiffPseudoStyles(*old_style, *new_style); 207 return DiffPseudoStyles(*old_style, *new_style);
207 208
208 if (old_style->HasExplicitlyInheritedProperties()) 209 if (old_style->HasExplicitlyInheritedProperties())
209 return kInherit; 210 return kInherit;
210 211
211 return kNoInherit; 212 return kNoInherit;
212 } 213 }
213 214
214 void ComputedStyle::PropagateIndependentInheritedProperties( 215 void ComputedStyle::PropagateIndependentInheritedProperties(
215 const ComputedStyle& parent_style) { 216 const ComputedStyle& parent_style) {
216 ComputedStyleBase::PropagateIndependentInheritedProperties(parent_style); 217 ComputedStyleBase::PropagateIndependentInheritedProperties(parent_style);
217 } 218 }
218 219
219 StyleSelfAlignmentData ResolvedSelfAlignment( 220 StyleSelfAlignmentData ResolvedSelfAlignment(
220 const StyleSelfAlignmentData& value, 221 const StyleSelfAlignmentData& value,
221 ItemPosition normal_value_behavior) { 222 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.
222 if (value.GetPosition() == kItemPositionNormal || 226 if (value.GetPosition() == kItemPositionNormal ||
223 value.GetPosition() == kItemPositionAuto) 227 value.GetPosition() == kItemPositionAuto)
224 return {normal_value_behavior, kOverflowAlignmentDefault}; 228 return {normal_value_behavior, kOverflowAlignmentDefault};
225 return value; 229 return value;
226 } 230 }
227 231
228 StyleSelfAlignmentData ComputedStyle::ResolvedAlignItems( 232 StyleSelfAlignmentData ComputedStyle::ResolvedAlignItems(
229 ItemPosition normal_value_behaviour) const { 233 ItemPosition normal_value_behaviour) const {
230 // We will return the behaviour of 'normal' value if needed, which is specific 234 // We will return the behaviour of 'normal' value if needed, which is specific
231 // of each layout model. 235 // of each layout model.
232 return ResolvedSelfAlignment(AlignItems(), normal_value_behaviour); 236 return ResolvedSelfAlignment(AlignItems(), normal_value_behaviour);
233 } 237 }
234 238
235 StyleSelfAlignmentData ComputedStyle::ResolvedAlignSelf( 239 StyleSelfAlignmentData ComputedStyle::ResolvedAlignSelf(
236 ItemPosition normal_value_behaviour, 240 ItemPosition normal_value_behaviour,
237 const ComputedStyle* parent_style) const { 241 const ComputedStyle* parent_style) const {
238 // We will return the behaviour of 'normal' value if needed, which is specific 242 // We will return the behaviour of 'normal' value if needed, which is specific
239 // of each layout model. 243 // of each layout model.
240 if (!parent_style || AlignSelfPosition() != kItemPositionAuto) 244 if (!parent_style || AlignSelfPosition() != kItemPositionAuto)
241 return ResolvedSelfAlignment(AlignSelf(), normal_value_behaviour); 245 return ResolvedSelfAlignment(AlignSelf(), normal_value_behaviour);
242 246
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.
243 // The 'auto' keyword computes to the parent's align-items computed value. 250 // The 'auto' keyword computes to the parent's align-items computed value.
244 return parent_style->ResolvedAlignItems(normal_value_behaviour); 251 return parent_style->ResolvedAlignItems(normal_value_behaviour);
245 } 252 }
246 253
247 StyleSelfAlignmentData ComputedStyle::ResolvedJustifyItems( 254 StyleSelfAlignmentData ComputedStyle::ResolvedJustifyItems(
248 ItemPosition normal_value_behaviour) const { 255 ItemPosition normal_value_behaviour) const {
249 // We will return the behaviour of 'normal' value if needed, which is specific 256 // We will return the behaviour of 'normal' value if needed, which is specific
250 // of each layout model. 257 // of each layout model.
251 return ResolvedSelfAlignment(JustifyItems(), normal_value_behaviour); 258 return ResolvedSelfAlignment(JustifyItems(), normal_value_behaviour);
252 } 259 }
253 260
254 StyleSelfAlignmentData ComputedStyle::ResolvedJustifySelf( 261 StyleSelfAlignmentData ComputedStyle::ResolvedJustifySelf(
255 ItemPosition normal_value_behaviour, 262 ItemPosition normal_value_behaviour,
256 const ComputedStyle* parent_style) const { 263 const ComputedStyle* parent_style) const {
257 // We will return the behaviour of 'normal' value if needed, which is specific 264 // We will return the behaviour of 'normal' value if needed, which is specific
258 // of each layout model. 265 // of each layout model.
259 if (!parent_style || JustifySelfPosition() != kItemPositionAuto) 266 if (!parent_style || JustifySelfPosition() != kItemPositionAuto)
260 return ResolvedSelfAlignment(JustifySelf(), normal_value_behaviour); 267 return ResolvedSelfAlignment(JustifySelf(), normal_value_behaviour);
261 268
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.
262 // The auto keyword computes to the parent's justify-items computed value. 272 // The auto keyword computes to the parent's justify-items computed value.
263 return parent_style->ResolvedJustifyItems(normal_value_behaviour); 273 return parent_style->ResolvedJustifyItems(normal_value_behaviour);
264 } 274 }
265 275
266 static inline ContentPosition ResolvedContentAlignmentPosition( 276 static inline ContentPosition ResolvedContentAlignmentPosition(
267 const StyleContentAlignmentData& value, 277 const StyleContentAlignmentData& value,
268 const StyleContentAlignmentData& normal_value_behavior) { 278 const StyleContentAlignmentData& normal_value_behavior) {
269 return (value.GetPosition() == kContentPositionNormal && 279 return (value.GetPosition() == kContentPositionNormal &&
270 value.Distribution() == kContentDistributionDefault) 280 value.Distribution() == kContentDistributionDefault)
271 ? normal_value_behavior.GetPosition() 281 ? normal_value_behavior.GetPosition()
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 if (value < 0) 2430 if (value < 0)
2421 fvalue -= 0.5f; 2431 fvalue -= 0.5f;
2422 else 2432 else
2423 fvalue += 0.5f; 2433 fvalue += 0.5f;
2424 } 2434 }
2425 2435
2426 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2436 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2427 } 2437 }
2428 2438
2429 } // namespace blink 2439 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698