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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2915773002: Reland of [css-align] Don't resolve 'auto' values for computed style. (Closed)
Patch Set: Applied suggested changes 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 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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 bool LayoutBox::ColumnFlexItemHasStretchAlignment() const { 2842 bool LayoutBox::ColumnFlexItemHasStretchAlignment() const {
2843 // auto margins mean we don't stretch. Note that this function will only be 2843 // auto margins mean we don't stretch. Note that this function will only be
2844 // used for widths, so we don't have to check marginBefore/marginAfter. 2844 // used for widths, so we don't have to check marginBefore/marginAfter.
2845 const auto& parent_style = Parent()->StyleRef(); 2845 const auto& parent_style = Parent()->StyleRef();
2846 DCHECK(parent_style.IsColumnFlexDirection()); 2846 DCHECK(parent_style.IsColumnFlexDirection());
2847 if (StyleRef().MarginStart().IsAuto() || StyleRef().MarginEnd().IsAuto()) 2847 if (StyleRef().MarginStart().IsAuto() || StyleRef().MarginEnd().IsAuto())
2848 return false; 2848 return false;
2849 return StyleRef() 2849 return StyleRef()
2850 .ResolvedAlignSelf( 2850 .ResolvedAlignSelf(
2851 ContainingBlock()->SelfAlignmentNormalBehavior(), 2851 ContainingBlock()->SelfAlignmentNormalBehavior(),
2852 IsAnonymous() ? &parent_style : nullptr) 2852 &parent_style)
2853 .GetPosition() == kItemPositionStretch; 2853 .GetPosition() == kItemPositionStretch;
2854 } 2854 }
2855 2855
2856 bool LayoutBox::IsStretchingColumnFlexItem() const { 2856 bool LayoutBox::IsStretchingColumnFlexItem() const {
2857 LayoutObject* parent = this->Parent(); 2857 LayoutObject* parent = this->Parent();
2858 if (parent->IsDeprecatedFlexibleBox() && 2858 if (parent->IsDeprecatedFlexibleBox() &&
2859 parent->Style()->BoxOrient() == VERTICAL && 2859 parent->Style()->BoxOrient() == VERTICAL &&
2860 parent->Style()->BoxAlign() == BSTRETCH) 2860 parent->Style()->BoxAlign() == BSTRETCH)
2861 return true; 2861 return true;
2862 2862
(...skipping 13 matching lines...) Expand all
2876 if (!style.LogicalWidth().IsAuto() || style.MarginStart().IsAuto() || 2876 if (!style.LogicalWidth().IsAuto() || style.MarginStart().IsAuto() ||
2877 style.MarginEnd().IsAuto()) 2877 style.MarginEnd().IsAuto())
2878 return false; 2878 return false;
2879 LayoutBlock* cb = ContainingBlock(); 2879 LayoutBlock* cb = ContainingBlock();
2880 if (!cb) { 2880 if (!cb) {
2881 // We are evaluating align-self/justify-self, which default to 'normal' for 2881 // We are evaluating align-self/justify-self, which default to 'normal' for
2882 // the root element. The 'normal' value behaves like 'start' except for 2882 // the root element. The 'normal' value behaves like 'start' except for
2883 // Flexbox Items, which obviously should have a container. 2883 // Flexbox Items, which obviously should have a container.
2884 return false; 2884 return false;
2885 } 2885 }
2886 const ComputedStyle* parent_style = IsAnonymous() ? cb->Style() : nullptr;
2887 if (cb->IsHorizontalWritingMode() != IsHorizontalWritingMode()) 2886 if (cb->IsHorizontalWritingMode() != IsHorizontalWritingMode())
2888 return style 2887 return style
2889 .ResolvedAlignSelf(cb->SelfAlignmentNormalBehavior(this), 2888 .ResolvedAlignSelf(cb->SelfAlignmentNormalBehavior(this),
2890 parent_style) 2889 cb->Style())
2891 .GetPosition() == kItemPositionStretch; 2890 .GetPosition() == kItemPositionStretch;
2892 return style 2891 return style
2893 .ResolvedJustifySelf(cb->SelfAlignmentNormalBehavior(this), 2892 .ResolvedJustifySelf(cb->SelfAlignmentNormalBehavior(this),
2894 parent_style) 2893 cb->Style())
2895 .GetPosition() == kItemPositionStretch; 2894 .GetPosition() == kItemPositionStretch;
2896 } 2895 }
2897 2896
2898 bool LayoutBox::SizesLogicalWidthToFitContent( 2897 bool LayoutBox::SizesLogicalWidthToFitContent(
2899 const Length& logical_width) const { 2898 const Length& logical_width) const {
2900 if (IsFloating() || IsInlineBlockOrInlineTable() || 2899 if (IsFloating() || IsInlineBlockOrInlineTable() ||
2901 StyleRef().HasOutOfFlowPosition()) 2900 StyleRef().HasOutOfFlowPosition())
2902 return true; 2901 return true;
2903 2902
2904 if (IsGridItem()) 2903 if (IsGridItem())
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
5893 void LayoutBox::MutableForPainting:: 5892 void LayoutBox::MutableForPainting::
5894 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5893 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5895 auto& rare_data = GetLayoutBox().EnsureRareData(); 5894 auto& rare_data = GetLayoutBox().EnsureRareData();
5896 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5895 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5897 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5896 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5898 rare_data.previous_layout_overflow_rect_ = 5897 rare_data.previous_layout_overflow_rect_ =
5899 GetLayoutBox().LayoutOverflowRect(); 5898 GetLayoutBox().LayoutOverflowRect();
5900 } 5899 }
5901 5900
5902 } // namespace blink 5901 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698