| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 style.setJustifySelf(parentStyle.justifyItems()); | 282 style.setJustifySelf(parentStyle.justifyItems()); |
| 283 } | 283 } |
| 284 | 284 |
| 285 // The 'auto' keyword computes to: | 285 // The 'auto' keyword computes to: |
| 286 // - 'stretch' for flex containers and grid containers, | 286 // - 'stretch' for flex containers and grid containers, |
| 287 // - 'start' for everything else. | 287 // - 'start' for everything else. |
| 288 if (style.alignItemsPosition() == ItemPositionAuto) { | 288 if (style.alignItemsPosition() == ItemPositionAuto) { |
| 289 if (isFlexOrGrid) | 289 if (isFlexOrGrid) |
| 290 style.setAlignItemsPosition(ItemPositionStretch); | 290 style.setAlignItemsPosition(ItemPositionStretch); |
| 291 } | 291 } |
| 292 | |
| 293 // Block Containers: For table cells, the behavior of the 'auto' depends on
the computed | |
| 294 // value of 'vertical-align', otherwise behaves as 'start'. | |
| 295 // Flex Containers: 'auto' computes to 'flex-start'. | |
| 296 // Grid Containers: 'auto' computes to 'start', and 'stretch' behaves like '
start'. | |
| 297 if ((style.justifyContentPosition() == ContentPositionAuto) && (style.justif
yContentDistribution() == ContentDistributionDefault)) { | |
| 298 if (style.isDisplayFlexibleOrGridBox()) { | |
| 299 if (style.isDisplayFlexibleBox()) | |
| 300 style.setJustifyContentPosition(ContentPositionFlexStart); | |
| 301 else | |
| 302 style.setJustifyContentPosition(ContentPositionStart); | |
| 303 } | |
| 304 } | |
| 305 | |
| 306 // Block Containers: For table cells, the behavior of the 'auto' depends on
the computed | |
| 307 // value of 'vertical-align', otherwise behaves as 'start'. | |
| 308 // Flex Containers: 'auto' computes to 'stretch'. | |
| 309 // Grid Containers: 'auto' computes to 'start', and 'stretch' behaves like '
start'. | |
| 310 if (style.alignContentPosition() == ContentPositionAuto && style.alignConten
tDistribution() == ContentDistributionDefault) { | |
| 311 if (style.isDisplayFlexibleOrGridBox()) { | |
| 312 if (style.isDisplayFlexibleBox()) | |
| 313 style.setAlignContentDistribution(ContentDistributionStretch); | |
| 314 else | |
| 315 style.setAlignContentPosition(ContentPositionStart); | |
| 316 } | |
| 317 } | |
| 318 } | 292 } |
| 319 | 293 |
| 320 void StyleAdjuster::adjustStyleForHTMLElement(ComputedStyle& style, const Comput
edStyle& parentStyle, HTMLElement& element) | 294 void StyleAdjuster::adjustStyleForHTMLElement(ComputedStyle& style, const Comput
edStyle& parentStyle, HTMLElement& element) |
| 321 { | 295 { |
| 322 // <div> and <span> are the most common elements on the web, we skip all the
work for them. | 296 // <div> and <span> are the most common elements on the web, we skip all the
work for them. |
| 323 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) | 297 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) |
| 324 return; | 298 return; |
| 325 | 299 |
| 326 if (isHTMLTableCellElement(element)) { | 300 if (isHTMLTableCellElement(element)) { |
| 327 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it
in html.css instead. | 301 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it
in html.css instead. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // We want to count vertical percentage paddings/margins on flex items b
ecause our current | 431 // We want to count vertical percentage paddings/margins on flex items b
ecause our current |
| 458 // behavior is different from the spec and we want to gather compatibili
ty data. | 432 // behavior is different from the spec and we want to gather compatibili
ty data. |
| 459 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen
t()) | 433 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen
t()) |
| 460 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); | 434 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); |
| 461 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) | 435 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) |
| 462 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); | 436 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); |
| 463 } | 437 } |
| 464 } | 438 } |
| 465 | 439 |
| 466 } // namespace blink | 440 } // namespace blink |
| OLD | NEW |