| 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 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) | 2244 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) |
| 2245 { | 2245 { |
| 2246 LayoutObject* parent = flexitem->parent(); | 2246 LayoutObject* parent = flexitem->parent(); |
| 2247 // auto margins mean we don't stretch. Note that this function will only be
used for | 2247 // auto margins mean we don't stretch. Note that this function will only be
used for |
| 2248 // widths, so we don't have to check marginBefore/marginAfter. | 2248 // widths, so we don't have to check marginBefore/marginAfter. |
| 2249 ASSERT(parent->style()->isColumnFlexDirection()); | 2249 ASSERT(parent->style()->isColumnFlexDirection()); |
| 2250 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) | 2250 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
| 2251 return false; | 2251 return false; |
| 2252 return flexitem->style()->alignSelfPosition() == ItemPositionStretch || (fle
xitem->style()->alignSelfPosition() == ItemPositionAuto && parent->style()->alig
nItemsPosition() == ItemPositionStretch); | 2252 return flexitem->styleRef().resolvedAlignSelf(parent->styleRef(), ItemPositi
onStretch).position() == ItemPositionStretch; |
| 2253 } | 2253 } |
| 2254 | 2254 |
| 2255 static bool isStretchingColumnFlexItem(const LayoutObject* flexitem) | 2255 static bool isStretchingColumnFlexItem(const LayoutObject* flexitem) |
| 2256 { | 2256 { |
| 2257 LayoutObject* parent = flexitem->parent(); | 2257 LayoutObject* parent = flexitem->parent(); |
| 2258 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) | 2258 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) |
| 2259 return true; | 2259 return true; |
| 2260 | 2260 |
| 2261 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. | 2261 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. |
| 2262 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) | 2262 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) |
| 2263 return true; | 2263 return true; |
| 2264 return false; | 2264 return false; |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 // TODO (lajava) Can/Should we move this inside specific layout classes (flex. g
rid)? Can we refactor columnFlexItemHasStretchAlignment logic? | 2267 // TODO (lajava) Can/Should we move this inside specific layout classes (flex. g
rid)? Can we refactor columnFlexItemHasStretchAlignment logic? |
| 2268 bool LayoutBox::hasStretchedLogicalWidth() const | 2268 bool LayoutBox::hasStretchedLogicalWidth() const |
| 2269 { | 2269 { |
| 2270 const ComputedStyle& style = styleRef(); | 2270 const ComputedStyle& style = styleRef(); |
| 2271 if (!style.logicalWidth().isAuto() || style.marginStart().isAuto() || style.
marginEnd().isAuto()) | 2271 if (!style.logicalWidth().isAuto() || style.marginStart().isAuto() || style.
marginEnd().isAuto()) |
| 2272 return false; | 2272 return false; |
| 2273 LayoutBlock* cb = containingBlock(); | 2273 LayoutBlock* cb = containingBlock(); |
| 2274 if (!cb) { | 2274 if (!cb) { |
| 2275 // We are evaluating align-self/justify-self, which default to 'normal'
for the root element. | 2275 // We are evaluating align-self/justify-self, which default to 'normal'
for the root element. |
| 2276 // The 'normal' value behaves like 'start' except for Flexbox Items, whi
ch obviously should have a container. | 2276 // The 'normal' value behaves like 'start' except for Flexbox Items, whi
ch obviously should have a container. |
| 2277 return false; | 2277 return false; |
| 2278 } | 2278 } |
| 2279 if (cb->isHorizontalWritingMode() != isHorizontalWritingMode()) | 2279 if (cb->isHorizontalWritingMode() != isHorizontalWritingMode()) |
| 2280 return ComputedStyle::resolveAlignment(cb->styleRef(), style, ItemPositi
onStretch) == ItemPositionStretch; | 2280 return style.resolvedAlignSelf(cb->styleRef(), ItemPositionStretch).posi
tion() == ItemPositionStretch; |
| 2281 return ComputedStyle::resolveJustification(cb->styleRef(), style, ItemPositi
onStretch) == ItemPositionStretch; | 2281 return style.resolvedJustifySelf(cb->styleRef(), ItemPositionStretch).positi
on() == ItemPositionStretch; |
| 2282 } | 2282 } |
| 2283 | 2283 |
| 2284 bool LayoutBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const | 2284 bool LayoutBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const |
| 2285 { | 2285 { |
| 2286 if (isFloating() || isInlineBlockOrInlineTable()) | 2286 if (isFloating() || isInlineBlockOrInlineTable()) |
| 2287 return true; | 2287 return true; |
| 2288 | 2288 |
| 2289 if (isGridItem()) | 2289 if (isGridItem()) |
| 2290 return !hasStretchedLogicalWidth(); | 2290 return !hasStretchedLogicalWidth(); |
| 2291 | 2291 |
| (...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4721 } | 4721 } |
| 4722 | 4722 |
| 4723 void LayoutBox::IntrinsicSizingInfo::transpose() | 4723 void LayoutBox::IntrinsicSizingInfo::transpose() |
| 4724 { | 4724 { |
| 4725 size = size.transposedSize(); | 4725 size = size.transposedSize(); |
| 4726 aspectRatio = aspectRatio.transposedSize(); | 4726 aspectRatio = aspectRatio.transposedSize(); |
| 4727 std::swap(hasWidth, hasHeight); | 4727 std::swap(hasWidth, hasHeight); |
| 4728 } | 4728 } |
| 4729 | 4729 |
| 4730 } // namespace blink | 4730 } // namespace blink |
| OLD | NEW |