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. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
6 * All rights reserved. | 6 * All rights reserved. |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 m_hasMarginBeforeQuirk(false), | 93 m_hasMarginBeforeQuirk(false), |
94 m_hasMarginAfterQuirk(false), | 94 m_hasMarginAfterQuirk(false), |
95 m_beingDestroyed(false), | 95 m_beingDestroyed(false), |
96 m_hasMarkupTruncation(false), | 96 m_hasMarkupTruncation(false), |
97 m_widthAvailableToChildrenChanged(false), | 97 m_widthAvailableToChildrenChanged(false), |
98 m_heightAvailableToChildrenChanged(false), | 98 m_heightAvailableToChildrenChanged(false), |
99 m_isSelfCollapsing(false), | 99 m_isSelfCollapsing(false), |
100 m_descendantsWithFloatsMarkedForLayout(false), | 100 m_descendantsWithFloatsMarkedForLayout(false), |
101 m_hasPositionedObjects(false), | 101 m_hasPositionedObjects(false), |
102 m_hasPercentHeightDescendants(false), | 102 m_hasPercentHeightDescendants(false), |
103 m_paginationStateChanged(false) { | 103 m_paginationStateChanged(false), |
| 104 m_hasPreviousCaretVisualRects(false), |
| 105 m_caretsNeedPaintInvalidation(false) { |
104 // LayoutBlockFlow calls setChildrenInline(true). | 106 // LayoutBlockFlow calls setChildrenInline(true). |
105 // By default, subclasses do not have inline children. | 107 // By default, subclasses do not have inline children. |
106 } | 108 } |
107 | 109 |
108 void LayoutBlock::removeFromGlobalMaps() { | 110 void LayoutBlock::removeFromGlobalMaps() { |
109 if (hasPositionedObjects()) { | 111 if (hasPositionedObjects()) { |
110 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = | 112 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = |
111 gPositionedDescendantsMap->take(this); | 113 gPositionedDescendantsMap->take(this); |
112 ASSERT(!descendants->isEmpty()); | 114 ASSERT(!descendants->isEmpty()); |
113 for (LayoutBox* descendant : *descendants) { | 115 for (LayoutBox* descendant : *descendants) { |
(...skipping 10 matching lines...) Expand all Loading... |
124 descendant->setPercentHeightContainer(nullptr); | 126 descendant->setPercentHeightContainer(nullptr); |
125 } | 127 } |
126 } | 128 } |
127 } | 129 } |
128 | 130 |
129 LayoutBlock::~LayoutBlock() { | 131 LayoutBlock::~LayoutBlock() { |
130 removeFromGlobalMaps(); | 132 removeFromGlobalMaps(); |
131 } | 133 } |
132 | 134 |
133 void LayoutBlock::willBeDestroyed() { | 135 void LayoutBlock::willBeDestroyed() { |
| 136 BlockPaintInvalidator::blockWillBeDestroyed(*this); |
| 137 |
134 if (!documentBeingDestroyed() && parent()) | 138 if (!documentBeingDestroyed() && parent()) |
135 parent()->dirtyLinesFromChangedChild(this); | 139 parent()->dirtyLinesFromChangedChild(this); |
136 | 140 |
137 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 141 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
138 textAutosizer->destroy(this); | 142 textAutosizer->destroy(this); |
139 | 143 |
140 LayoutBox::willBeDestroyed(); | 144 LayoutBox::willBeDestroyed(); |
141 } | 145 } |
142 | 146 |
143 void LayoutBlock::styleWillChange(StyleDifference diff, | 147 void LayoutBlock::styleWillChange(StyleDifference diff, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() || | 204 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() || |
201 oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() || | 205 oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() || |
202 oldStyle.paddingTop() != newStyle.paddingTop() || | 206 oldStyle.paddingTop() != newStyle.paddingTop() || |
203 oldStyle.paddingBottom() != newStyle.paddingBottom(); | 207 oldStyle.paddingBottom() != newStyle.paddingBottom(); |
204 } | 208 } |
205 | 209 |
206 void LayoutBlock::styleDidChange(StyleDifference diff, | 210 void LayoutBlock::styleDidChange(StyleDifference diff, |
207 const ComputedStyle* oldStyle) { | 211 const ComputedStyle* oldStyle) { |
208 LayoutBox::styleDidChange(diff, oldStyle); | 212 LayoutBox::styleDidChange(diff, oldStyle); |
209 | 213 |
| 214 // Carets are painted in text color. |
| 215 if (diff.textDecorationOrColorChanged() && hasCaret()) |
| 216 setCaretsNeedPaintInvalidation(); |
| 217 |
210 const ComputedStyle& newStyle = styleRef(); | 218 const ComputedStyle& newStyle = styleRef(); |
211 | 219 |
212 if (oldStyle && parent()) { | 220 if (oldStyle && parent()) { |
213 if (oldStyle->position() != newStyle.position() && | 221 if (oldStyle->position() != newStyle.position() && |
214 newStyle.position() != StaticPosition) { | 222 newStyle.position() != StaticPosition) { |
215 // In LayoutObject::styleWillChange() we already removed ourself from our | 223 // In LayoutObject::styleWillChange() we already removed ourself from our |
216 // old containing block's positioned descendant list, and we will be | 224 // old containing block's positioned descendant list, and we will be |
217 // inserted to the new containing block's list during layout. However the | 225 // inserted to the new containing block's list during layout. However the |
218 // positioned descendant layout logic assumes layout objects to obey | 226 // positioned descendant layout logic assumes layout objects to obey |
219 // parent-child order in the list. Remove our descendants here so they | 227 // parent-child order in the list. Remove our descendants here so they |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( | 1028 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( |
1021 const PaintInvalidationState& paintInvalidationState) { | 1029 const PaintInvalidationState& paintInvalidationState) { |
1022 return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState); | 1030 return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState); |
1023 } | 1031 } |
1024 | 1032 |
1025 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( | 1033 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( |
1026 const PaintInvalidatorContext& context) const { | 1034 const PaintInvalidatorContext& context) const { |
1027 return BlockPaintInvalidator(*this, context).invalidatePaintIfNeeded(); | 1035 return BlockPaintInvalidator(*this, context).invalidatePaintIfNeeded(); |
1028 } | 1036 } |
1029 | 1037 |
| 1038 void LayoutBlock::clearPreviousVisualRects() { |
| 1039 LayoutBox::clearPreviousVisualRects(); |
| 1040 BlockPaintInvalidator::clearPreviousCaretVisualRects(*this); |
| 1041 } |
| 1042 |
1030 void LayoutBlock::removePositionedObjects( | 1043 void LayoutBlock::removePositionedObjects( |
1031 LayoutObject* o, | 1044 LayoutObject* o, |
1032 ContainingBlockState containingBlockState) { | 1045 ContainingBlockState containingBlockState) { |
1033 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); | 1046 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); |
1034 if (!positionedDescendants) | 1047 if (!positionedDescendants) |
1035 return; | 1048 return; |
1036 | 1049 |
1037 Vector<LayoutBox*, 16> deadObjects; | 1050 Vector<LayoutBox*, 16> deadObjects; |
1038 for (auto* positionedObject : *positionedDescendants) { | 1051 for (auto* positionedObject : *positionedDescendants) { |
1039 if (!o || (positionedObject->isDescendantOf(o) && o != positionedObject)) { | 1052 if (!o || (positionedObject->isDescendantOf(o) && o != positionedObject)) { |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 } | 2218 } |
2206 | 2219 |
2207 return availableHeight; | 2220 return availableHeight; |
2208 } | 2221 } |
2209 | 2222 |
2210 bool LayoutBlock::hasDefiniteLogicalHeight() const { | 2223 bool LayoutBlock::hasDefiniteLogicalHeight() const { |
2211 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); | 2224 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); |
2212 } | 2225 } |
2213 | 2226 |
2214 } // namespace blink | 2227 } // namespace blink |
OLD | NEW |