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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 years, 3 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 minLogicalWidth = maxLogicalWidth = intrinsicLogicalWidth(); 662 minLogicalWidth = maxLogicalWidth = intrinsicLogicalWidth();
663 } 663 }
664 664
665 void LayoutReplaced::computePreferredLogicalWidths() 665 void LayoutReplaced::computePreferredLogicalWidths()
666 { 666 {
667 ASSERT(preferredLogicalWidthsDirty()); 667 ASSERT(preferredLogicalWidthsDirty());
668 668
669 // We cannot resolve some logical width here (i.e. percent, fill-available o r fit-content) 669 // We cannot resolve some logical width here (i.e. percent, fill-available o r fit-content)
670 // as the available logical width may not be set on our containing block. 670 // as the available logical width may not be set on our containing block.
671 const Length& logicalWidth = style()->logicalWidth(); 671 const Length& logicalWidth = style()->logicalWidth();
672 if (logicalWidth.hasPercent() || logicalWidth.isFillAvailable() || logicalWi dth.isFitContent()) 672 if (logicalWidth.isPercentOrCalc() || logicalWidth.isFillAvailable() || logi calWidth.isFitContent())
673 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 673 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
674 else 674 else
675 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplace dLogicalWidth(ComputePreferred); 675 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplace dLogicalWidth(ComputePreferred);
676 676
677 const ComputedStyle& styleToUse = styleRef(); 677 const ComputedStyle& styleToUse = styleRef();
678 if (styleToUse.logicalWidth().hasPercent() || styleToUse.logicalMaxWidth().h asPercent()) 678 if (styleToUse.logicalWidth().isPercentOrCalc() || styleToUse.logicalMaxWidt h().isPercentOrCalc())
679 m_minPreferredLogicalWidth = LayoutUnit(); 679 m_minPreferredLogicalWidth = LayoutUnit();
680 680
681 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) { 681 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) {
682 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 682 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
683 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 683 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
684 } 684 }
685 685
686 if (styleToUse.logicalMaxWidth().isFixed()) { 686 if (styleToUse.logicalMaxWidth().isFixed()) {
687 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 687 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
688 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 688 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 760 }
761 761
762 void LayoutReplaced::IntrinsicSizingInfo::transpose() 762 void LayoutReplaced::IntrinsicSizingInfo::transpose()
763 { 763 {
764 size = size.transposedSize(); 764 size = size.transposedSize();
765 aspectRatio = aspectRatio.transposedSize(); 765 aspectRatio = aspectRatio.transposedSize();
766 std::swap(hasWidth, hasHeight); 766 std::swap(hasWidth, hasHeight);
767 } 767 }
768 768
769 } // namespace blink 769 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutSlider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698