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

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

Issue 2065243003: [css-sizing] Ensure positive available size on replaced elements Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaselined test. Created 3 years, 11 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 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 minLogicalWidth = maxLogicalWidth = intrinsicLogicalWidth(); 816 minLogicalWidth = maxLogicalWidth = intrinsicLogicalWidth();
817 } 817 }
818 818
819 void LayoutReplaced::computePreferredLogicalWidths() { 819 void LayoutReplaced::computePreferredLogicalWidths() {
820 ASSERT(preferredLogicalWidthsDirty()); 820 ASSERT(preferredLogicalWidthsDirty());
821 821
822 // We cannot resolve some logical width here (i.e. percent, fill-available or 822 // We cannot resolve some logical width here (i.e. percent, fill-available or
823 // fit-content) as the available logical width may not be set on our 823 // fit-content) as the available logical width may not be set on our
824 // containing block. 824 // containing block.
825 const Length& logicalWidth = style()->logicalWidth(); 825 const Length& logicalWidth = style()->logicalWidth();
826 if (logicalWidth.isPercentOrCalc() || logicalWidth.isFillAvailable() || 826 if (logicalWidth.isLayoutDependent() ||
827 logicalWidth.isFitContent()) 827 (logicalWidth.isAuto() &&
828 (style()->logicalMinWidth().isLayoutDependent() ||
829 style()->logicalMaxWidth().isLayoutDependent())))
828 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, 830 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth,
829 m_maxPreferredLogicalWidth); 831 m_maxPreferredLogicalWidth);
830 else 832 else
831 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 833 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth =
832 computeReplacedLogicalWidth(ComputePreferred); 834 computeReplacedLogicalWidth(ComputePreferred);
833 835
834 const ComputedStyle& styleToUse = styleRef(); 836 const ComputedStyle& styleToUse = styleRef();
835 if (styleToUse.logicalWidth().isPercentOrCalc() || 837 if (styleToUse.logicalWidth().isLayoutDependent() ||
836 styleToUse.logicalMaxWidth().isPercentOrCalc()) 838 styleToUse.logicalMaxWidth().isLayoutDependent())
837 m_minPreferredLogicalWidth = LayoutUnit(); 839 m_minPreferredLogicalWidth = LayoutUnit();
838 840
839 if (styleToUse.logicalMinWidth().isFixed() && 841 if (styleToUse.logicalMinWidth().isFixed() &&
840 styleToUse.logicalMinWidth().value() > 0) { 842 styleToUse.logicalMinWidth().value() > 0) {
841 m_maxPreferredLogicalWidth = std::max( 843 m_maxPreferredLogicalWidth = std::max(
842 m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing( 844 m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(
843 styleToUse.logicalMinWidth().value())); 845 styleToUse.logicalMinWidth().value()));
844 m_minPreferredLogicalWidth = std::max( 846 m_minPreferredLogicalWidth = std::max(
845 m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing( 847 m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(
846 styleToUse.logicalMinWidth().value())); 848 styleToUse.logicalMinWidth().value()));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); 940 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone);
939 } 941 }
940 942
941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { 943 void LayoutReplaced::IntrinsicSizingInfo::transpose() {
942 size = size.transposedSize(); 944 size = size.transposedSize();
943 aspectRatio = aspectRatio.transposedSize(); 945 aspectRatio = aspectRatio.transposedSize();
944 std::swap(hasWidth, hasHeight); 946 std::swap(hasWidth, hasHeight);
945 } 947 }
946 948
947 } // namespace blink 949 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/platform/Length.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698