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

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

Issue 2944793002: Make EFlexWrap an enum class. (Closed)
Patch Set: Rebase 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 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2904 2904
2905 bool LayoutBox::IsStretchingColumnFlexItem() const { 2905 bool LayoutBox::IsStretchingColumnFlexItem() const {
2906 LayoutObject* parent = this->Parent(); 2906 LayoutObject* parent = this->Parent();
2907 if (parent->IsDeprecatedFlexibleBox() && 2907 if (parent->IsDeprecatedFlexibleBox() &&
2908 parent->Style()->BoxOrient() == EBoxOrient::kVertical && 2908 parent->Style()->BoxOrient() == EBoxOrient::kVertical &&
2909 parent->Style()->BoxAlign() == EBoxAlignment::kStretch) 2909 parent->Style()->BoxAlign() == EBoxAlignment::kStretch)
2910 return true; 2910 return true;
2911 2911
2912 // We don't stretch multiline flexboxes because they need to apply line 2912 // We don't stretch multiline flexboxes because they need to apply line
2913 // spacing (align-content) first. 2913 // spacing (align-content) first.
2914 if (parent->IsFlexibleBox() && parent->Style()->FlexWrap() == kFlexNoWrap && 2914 if (parent->IsFlexibleBox() &&
2915 parent->Style()->FlexWrap() == EFlexWrap::kNowrap &&
2915 parent->Style()->IsColumnFlexDirection() && 2916 parent->Style()->IsColumnFlexDirection() &&
2916 ColumnFlexItemHasStretchAlignment()) 2917 ColumnFlexItemHasStretchAlignment())
2917 return true; 2918 return true;
2918 return false; 2919 return false;
2919 } 2920 }
2920 2921
2921 // TODO (lajava) Can/Should we move this inside specific layout classes (flex. 2922 // TODO (lajava) Can/Should we move this inside specific layout classes (flex.
2922 // grid)? Can we refactor columnFlexItemHasStretchAlignment logic? 2923 // grid)? Can we refactor columnFlexItemHasStretchAlignment logic?
2923 bool LayoutBox::HasStretchedLogicalWidth() const { 2924 bool LayoutBox::HasStretchedLogicalWidth() const {
2924 const ComputedStyle& style = StyleRef(); 2925 const ComputedStyle& style = StyleRef();
(...skipping 28 matching lines...) Expand all
2953 return !HasStretchedLogicalWidth(); 2954 return !HasStretchedLogicalWidth();
2954 2955
2955 // Flexible box items should shrink wrap, so we lay them out at their 2956 // Flexible box items should shrink wrap, so we lay them out at their
2956 // intrinsic widths. In the case of columns that have a stretch alignment, we 2957 // intrinsic widths. In the case of columns that have a stretch alignment, we
2957 // go ahead and layout at the stretched size to avoid an extra layout when 2958 // go ahead and layout at the stretched size to avoid an extra layout when
2958 // applying alignment. 2959 // applying alignment.
2959 if (Parent()->IsFlexibleBox()) { 2960 if (Parent()->IsFlexibleBox()) {
2960 // For multiline columns, we need to apply align-content first, so we can't 2961 // For multiline columns, we need to apply align-content first, so we can't
2961 // stretch now. 2962 // stretch now.
2962 if (!Parent()->Style()->IsColumnFlexDirection() || 2963 if (!Parent()->Style()->IsColumnFlexDirection() ||
2963 Parent()->Style()->FlexWrap() != kFlexNoWrap) 2964 Parent()->Style()->FlexWrap() != EFlexWrap::kNowrap)
2964 return true; 2965 return true;
2965 if (!ColumnFlexItemHasStretchAlignment()) 2966 if (!ColumnFlexItemHasStretchAlignment())
2966 return true; 2967 return true;
2967 } 2968 }
2968 2969
2969 // Flexible horizontal boxes lay out children at their intrinsic widths. Also 2970 // Flexible horizontal boxes lay out children at their intrinsic widths. Also
2970 // vertical boxes that don't stretch their kids lay out their children at 2971 // vertical boxes that don't stretch their kids lay out their children at
2971 // their intrinsic widths. 2972 // their intrinsic widths.
2972 // FIXME: Think about writing-mode here. 2973 // FIXME: Think about writing-mode here.
2973 // https://bugs.webkit.org/show_bug.cgi?id=46473 2974 // https://bugs.webkit.org/show_bug.cgi?id=46473
(...skipping 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5948 void LayoutBox::MutableForPainting:: 5949 void LayoutBox::MutableForPainting::
5949 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5950 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5950 auto& rare_data = GetLayoutBox().EnsureRareData(); 5951 auto& rare_data = GetLayoutBox().EnsureRareData();
5951 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5952 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5952 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5953 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5953 rare_data.previous_layout_overflow_rect_ = 5954 rare_data.previous_layout_overflow_rect_ =
5954 GetLayoutBox().LayoutOverflowRect(); 5955 GetLayoutBox().LayoutOverflowRect();
5955 } 5956 }
5956 5957
5957 } // namespace blink 5958 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698