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