| OLD | NEW |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 LayoutBlock::LayoutBlock(ContainerNode* node) | 128 LayoutBlock::LayoutBlock(ContainerNode* node) |
| 129 : LayoutBox(node) | 129 : LayoutBox(node) |
| 130 , m_hasMarginBeforeQuirk(false) | 130 , m_hasMarginBeforeQuirk(false) |
| 131 , m_hasMarginAfterQuirk(false) | 131 , m_hasMarginAfterQuirk(false) |
| 132 , m_beingDestroyed(false) | 132 , m_beingDestroyed(false) |
| 133 , m_hasMarkupTruncation(false) | 133 , m_hasMarkupTruncation(false) |
| 134 , m_widthAvailableToChildrenChanged(false) | 134 , m_widthAvailableToChildrenChanged(false) |
| 135 , m_hasOnlySelfCollapsingChildren(false) | 135 , m_hasOnlySelfCollapsingChildren(false) |
| 136 , m_descendantsWithFloatsMarkedForLayout(false) | 136 , m_descendantsWithFloatsMarkedForLayout(false) |
| 137 , m_needsRecalcLogicalWidthAfterLayoutChildren(false) | |
| 138 { | 137 { |
| 139 // LayoutBlockFlow calls setChildrenInline(true). | 138 // LayoutBlockFlow calls setChildrenInline(true). |
| 140 // By default, subclasses do not have inline children. | 139 // By default, subclasses do not have inline children. |
| 141 } | 140 } |
| 142 | 141 |
| 143 static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) | 142 static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) |
| 144 { | 143 { |
| 145 if (OwnPtr<TrackedLayoutBoxListHashSet> descendantSet = descendantMap->take(
block)) { | 144 if (OwnPtr<TrackedLayoutBoxListHashSet> descendantSet = descendantMap->take(
block)) { |
| 146 for (auto& descendant : *descendantSet) { | 145 for (auto& descendant : *descendantSet) { |
| 147 TrackedContainerMap::iterator it = containerMap->find(descendant); | 146 TrackedContainerMap::iterator it = containerMap->find(descendant); |
| (...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 | 2104 |
| 2106 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const | 2105 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const |
| 2107 { | 2106 { |
| 2108 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { | 2107 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { |
| 2109 // If the child is an orthogonal flow, child's height determines the wid
th, but the height is not available until layout. | 2108 // If the child is an orthogonal flow, child's height determines the wid
th, but the height is not available until layout. |
| 2110 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit | 2109 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit |
| 2111 if (!child.needsLayout()) { | 2110 if (!child.needsLayout()) { |
| 2112 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch
ild).logicalHeight(); | 2111 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch
ild).logicalHeight(); |
| 2113 return; | 2112 return; |
| 2114 } | 2113 } |
| 2115 m_needsRecalcLogicalWidthAfterLayoutChildren = true; | |
| 2116 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); | 2114 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); |
| 2117 return; | 2115 return; |
| 2118 } | 2116 } |
| 2119 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); | 2117 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
| 2120 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); | 2118 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
| 2121 | 2119 |
| 2122 // For non-replaced blocks if the inline size is min|max-content or a defini
te size the min|max-content contribution | 2120 // For non-replaced blocks if the inline size is min|max-content or a defini
te size the min|max-content contribution |
| 2123 // is that size plus border, padding and margin https://drafts.csswg.org/css
-sizing/#block-intrinsic | 2121 // is that size plus border, padding and margin https://drafts.csswg.org/css
-sizing/#block-intrinsic |
| 2124 if (child.isLayoutBlock()) { | 2122 if (child.isLayoutBlock()) { |
| 2125 const Length& computedInlineSize = child.styleRef().logicalWidth(); | 2123 const Length& computedInlineSize = child.styleRef().logicalWidth(); |
| 2126 if (computedInlineSize.isMaxContent()) | 2124 if (computedInlineSize.isMaxContent()) |
| 2127 minPreferredLogicalWidth = maxPreferredLogicalWidth; | 2125 minPreferredLogicalWidth = maxPreferredLogicalWidth; |
| 2128 else if (computedInlineSize.isMinContent()) | 2126 else if (computedInlineSize.isMinContent()) |
| 2129 maxPreferredLogicalWidth = minPreferredLogicalWidth; | 2127 maxPreferredLogicalWidth = minPreferredLogicalWidth; |
| 2130 } | 2128 } |
| 2131 | |
| 2132 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft
erLayoutChildren()) | |
| 2133 m_needsRecalcLogicalWidthAfterLayoutChildren = true; | |
| 2134 } | 2129 } |
| 2135 | 2130 |
| 2136 bool LayoutBlock::hasLineIfEmpty() const | 2131 bool LayoutBlock::hasLineIfEmpty() const |
| 2137 { | 2132 { |
| 2138 if (!node()) | 2133 if (!node()) |
| 2139 return false; | 2134 return false; |
| 2140 | 2135 |
| 2141 if (node()->isRootEditableElement()) | 2136 if (node()->isRootEditableElement()) |
| 2142 return true; | 2137 return true; |
| 2143 | 2138 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2895 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2890 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2896 { | 2891 { |
| 2897 showLayoutObject(); | 2892 showLayoutObject(); |
| 2898 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2893 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2899 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2894 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2900 } | 2895 } |
| 2901 | 2896 |
| 2902 #endif | 2897 #endif |
| 2903 | 2898 |
| 2904 } // namespace blink | 2899 } // namespace blink |
| OLD | NEW |