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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 LayoutBlock::LayoutBlock(ContainerNode* node) | 100 LayoutBlock::LayoutBlock(ContainerNode* node) |
101 : LayoutBox(node) | 101 : LayoutBox(node) |
102 , m_hasMarginBeforeQuirk(false) | 102 , m_hasMarginBeforeQuirk(false) |
103 , m_hasMarginAfterQuirk(false) | 103 , m_hasMarginAfterQuirk(false) |
104 , m_beingDestroyed(false) | 104 , m_beingDestroyed(false) |
105 , m_hasMarkupTruncation(false) | 105 , m_hasMarkupTruncation(false) |
106 , m_widthAvailableToChildrenChanged(false) | 106 , m_widthAvailableToChildrenChanged(false) |
107 , m_hasOnlySelfCollapsingChildren(false) | 107 , m_hasOnlySelfCollapsingChildren(false) |
108 , m_descendantsWithFloatsMarkedForLayout(false) | 108 , m_descendantsWithFloatsMarkedForLayout(false) |
| 109 , m_needsRecalcLogicalWidthAfterLayoutChildren(false) |
109 { | 110 { |
110 // LayoutBlockFlow calls setChildrenInline(true). | 111 // LayoutBlockFlow calls setChildrenInline(true). |
111 // By default, subclasses do not have inline children. | 112 // By default, subclasses do not have inline children. |
112 } | 113 } |
113 | 114 |
114 static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) | 115 static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) |
115 { | 116 { |
116 if (OwnPtr<TrackedLayoutBoxListHashSet> descendantSet = descendantMap->take(
block)) { | 117 if (OwnPtr<TrackedLayoutBoxListHashSet> descendantSet = descendantMap->take(
block)) { |
117 for (auto& descendant : *descendantSet) { | 118 for (auto& descendant : *descendantSet) { |
118 TrackedContainerMap::iterator it = containerMap->find(descendant); | 119 TrackedContainerMap::iterator it = containerMap->find(descendant); |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 // Always make sure these values are non-negative. | 2143 // Always make sure these values are non-negative. |
2143 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); | 2144 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); |
2144 maxLogicalWidth = std::max<LayoutUnit>(0, maxLogicalWidth); | 2145 maxLogicalWidth = std::max<LayoutUnit>(0, maxLogicalWidth); |
2145 | 2146 |
2146 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth
); | 2147 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth
); |
2147 } | 2148 } |
2148 | 2149 |
2149 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const | 2150 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const |
2150 { | 2151 { |
2151 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { | 2152 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { |
| 2153 // If the child is an orthogonal flow, child's height determines the wid
th, but the height is not available until layout. |
| 2154 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit |
| 2155 if (!child.needsLayout()) { |
| 2156 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch
ild).logicalHeight(); |
| 2157 return; |
| 2158 } |
| 2159 m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
2152 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); | 2160 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); |
2153 return; | 2161 return; |
2154 } | 2162 } |
2155 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); | 2163 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
2156 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); | 2164 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
| 2165 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft
erLayoutChildren()) |
| 2166 m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
2157 } | 2167 } |
2158 | 2168 |
2159 bool LayoutBlock::hasLineIfEmpty() const | 2169 bool LayoutBlock::hasLineIfEmpty() const |
2160 { | 2170 { |
2161 if (!node()) | 2171 if (!node()) |
2162 return false; | 2172 return false; |
2163 | 2173 |
2164 if (node()->isRootEditableElement()) | 2174 if (node()->isRootEditableElement()) |
2165 return true; | 2175 return true; |
2166 | 2176 |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2928 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2919 { | 2929 { |
2920 showLayoutObject(); | 2930 showLayoutObject(); |
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2931 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2932 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2923 } | 2933 } |
2924 | 2934 |
2925 #endif | 2935 #endif |
2926 | 2936 |
2927 } // namespace blink | 2937 } // namespace blink |
OLD | NEW |