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/LayoutBlock.cpp

Issue 1656743002: Removing more implicit LayoutUnit construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix additional test Created 4 years, 10 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 } 1920 }
1921 1921
1922 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); 1922 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
1923 1923
1924 if (isHTMLMarqueeElement(node()) && toHTMLMarqueeElement(node())->isHorizont al()) 1924 if (isHTMLMarqueeElement(node()) && toHTMLMarqueeElement(node())->isHorizont al())
1925 minLogicalWidth = LayoutUnit(); 1925 minLogicalWidth = LayoutUnit();
1926 1926
1927 if (isTableCell()) { 1927 if (isTableCell()) {
1928 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( ); 1928 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( );
1929 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) 1929 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0)
1930 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(tableCellWidth.value())); 1930 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(LayoutUnit(tableCellWidth.value())));
1931 } 1931 }
1932 1932
1933 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); 1933 int scrollbarWidth = intrinsicScrollbarLogicalWidth();
1934 maxLogicalWidth += scrollbarWidth; 1934 maxLogicalWidth += scrollbarWidth;
1935 minLogicalWidth += scrollbarWidth; 1935 minLogicalWidth += scrollbarWidth;
1936 } 1936 }
1937 1937
1938 void LayoutBlock::computePreferredLogicalWidths() 1938 void LayoutBlock::computePreferredLogicalWidths()
1939 { 1939 {
1940 ASSERT(preferredLogicalWidthsDirty()); 1940 ASSERT(preferredLogicalWidthsDirty());
1941 1941
1942 m_minPreferredLogicalWidth = LayoutUnit(); 1942 m_minPreferredLogicalWidth = LayoutUnit();
1943 m_maxPreferredLogicalWidth = LayoutUnit(); 1943 m_maxPreferredLogicalWidth = LayoutUnit();
1944 1944
1945 // FIXME: The isFixed() calls here should probably be checking for isSpecifi ed since you 1945 // FIXME: The isFixed() calls here should probably be checking for isSpecifi ed since you
1946 // should be able to use percentage, calc or viewport relative values for wi dth. 1946 // should be able to use percentage, calc or viewport relative values for wi dth.
1947 const ComputedStyle& styleToUse = styleRef(); 1947 const ComputedStyle& styleToUse = styleRef();
1948 if (!isTableCell() && styleToUse.logicalWidth().isFixed() && styleToUse.logi calWidth().value() >= 0 1948 if (!isTableCell() && styleToUse.logicalWidth().isFixed() && styleToUse.logi calWidth().value() >= 0
1949 && !(isDeprecatedFlexItem() && !styleToUse.logicalWidth().intValue())) 1949 && !(isDeprecatedFlexItem() && !styleToUse.logicalWidth().intValue()))
1950 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse.logicalWidth().value()); 1950 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(LayoutUnit(styleToUse.logicalWidth().value()));
1951 else 1951 else
1952 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 1952 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
1953 1953
1954 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) { 1954 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) {
1955 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 1955 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(LayoutUnit(styleToUse.logicalMinWidth().value ())));
1956 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 1956 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(LayoutUnit(styleToUse.logicalMinWidth().value ())));
1957 } 1957 }
1958 1958
1959 if (styleToUse.logicalMaxWidth().isFixed()) { 1959 if (styleToUse.logicalMaxWidth().isFixed()) {
1960 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 1960 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(LayoutUnit(styleToUse.logicalMaxWidth().value ())));
1961 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 1961 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(LayoutUnit(styleToUse.logicalMaxWidth().value ())));
1962 } 1962 }
1963 1963
1964 // Table layout uses integers, ceil the preferred widths to ensure that they can contain the contents. 1964 // Table layout uses integers, ceil the preferred widths to ensure that they can contain the contents.
1965 if (isTableCell()) { 1965 if (isTableCell()) {
1966 m_minPreferredLogicalWidth = LayoutUnit(m_minPreferredLogicalWidth.ceil( )); 1966 m_minPreferredLogicalWidth = LayoutUnit(m_minPreferredLogicalWidth.ceil( ));
1967 m_maxPreferredLogicalWidth = LayoutUnit(m_maxPreferredLogicalWidth.ceil( )); 1967 m_maxPreferredLogicalWidth = LayoutUnit(m_maxPreferredLogicalWidth.ceil( ));
1968 } 1968 }
1969 1969
1970 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 1970 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
1971 m_minPreferredLogicalWidth += borderAndPadding; 1971 m_minPreferredLogicalWidth += borderAndPadding;
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2859 { 2859 {
2860 showLayoutObject(); 2860 showLayoutObject();
2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2863 } 2863 }
2864 2864
2865 #endif 2865 #endif
2866 2866
2867 } // namespace blink 2867 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698