| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) | 144 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) |
| 145 { | 145 { |
| 146 while (p && p->isLayoutInline()) { | 146 while (p && p->isLayoutInline()) { |
| 147 if (p->isRelPositioned()) | 147 if (p->isRelPositioned()) |
| 148 return p; | 148 return p; |
| 149 p = p->parent(); | 149 p = p->parent(); |
| 150 } | 150 } |
| 151 return nullptr; | 151 return nullptr; |
| 152 } | 152 } |
| 153 | 153 |
| 154 static void updateStyleOfAnonymousBlockContinuations(LayoutObject* block, const
ComputedStyle& newStyle, const ComputedStyle& oldStyle) | 154 static void updateStyleOfAnonymousBlockContinuations(LayoutObject* block, const
ComputedStyle& newStyle, const ComputedStyle& oldStyle, LayoutObject* containing
BlockOfEndOfContinuation) |
| 155 { | 155 { |
| 156 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { | 156 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. |
| 157 bool updateOutline = !newStyle.isOutlineEquivalent(&oldStyle); |
| 158 bool updatePosition = newStyle.position() != oldStyle.position() && (newStyl
e.hasInFlowPosition() || oldStyle.hasInFlowPosition()); |
| 159 if (!updateOutline && !updatePosition) |
| 160 return; |
| 161 |
| 162 for (; block && block != containingBlockOfEndOfContinuation && block->isAnon
ymousBlock(); block = block->nextSibling()) { |
| 157 if (!toLayoutBlock(block)->isAnonymousBlockContinuation()) | 163 if (!toLayoutBlock(block)->isAnonymousBlockContinuation()) |
| 158 continue; | 164 continue; |
| 159 | 165 |
| 160 RefPtr<ComputedStyle> newBlockStyle; | 166 RefPtr<ComputedStyle> newBlockStyle = ComputedStyle::clone(block->styleR
ef()); |
| 161 | 167 |
| 162 if (!block->style()->isOutlineEquivalent(&newStyle)) { | 168 if (updateOutline) |
| 163 newBlockStyle = ComputedStyle::clone(block->styleRef()); | |
| 164 newBlockStyle->setOutlineFromStyle(newStyle); | 169 newBlockStyle->setOutlineFromStyle(newStyle); |
| 165 } | |
| 166 | 170 |
| 167 if (block->style()->position() != newStyle.position()) { | 171 if (updatePosition) { |
| 168 // If we are no longer in-flow positioned but our descendant block(s
) still have an in-flow positioned ancestor then | 172 // If we are no longer in-flow positioned but our descendant block(s
) still have an in-flow positioned ancestor then |
| 169 // their containing anonymous block should keep its in-flow position
ing. | 173 // their containing anonymous block should keep its in-flow position
ing. |
| 170 if (oldStyle.hasInFlowPosition() | 174 if (oldStyle.hasInFlowPosition() && inFlowPositionedInlineAncestor(t
oLayoutBlock(block)->inlineElementContinuation())) |
| 171 && inFlowPositionedInlineAncestor(toLayoutBlock(block)->inlineEl
ementContinuation())) | |
| 172 continue; | 175 continue; |
| 173 if (!newBlockStyle) | |
| 174 newBlockStyle = ComputedStyle::clone(block->styleRef()); | |
| 175 newBlockStyle->setPosition(newStyle.position()); | 176 newBlockStyle->setPosition(newStyle.position()); |
| 176 } | 177 } |
| 177 | 178 |
| 178 if (newBlockStyle) | 179 block->setStyle(newBlockStyle); |
| 179 block->setStyle(newBlockStyle); | |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 void LayoutInline::styleDidChange(StyleDifference diff, const ComputedStyle* old
Style) | 183 void LayoutInline::styleDidChange(StyleDifference diff, const ComputedStyle* old
Style) |
| 184 { | 184 { |
| 185 LayoutBoxModelObject::styleDidChange(diff, oldStyle); | 185 LayoutBoxModelObject::styleDidChange(diff, oldStyle); |
| 186 | 186 |
| 187 // Ensure that all of the split inlines pick up the new style. We | 187 // Ensure that all of the split inlines pick up the new style. We |
| 188 // only do this if we're an inline, since we don't want to propagate | 188 // only do this if we're an inline, since we don't want to propagate |
| 189 // a block's style to the other inlines. | 189 // a block's style to the other inlines. |
| 190 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before | 190 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before |
| 191 // and after the block share the same style, but the block doesn't | 191 // and after the block share the same style, but the block doesn't |
| 192 // need to pass its style on to anyone else. | 192 // need to pass its style on to anyone else. |
| 193 const ComputedStyle& newStyle = styleRef(); | 193 const ComputedStyle& newStyle = styleRef(); |
| 194 LayoutInline* continuation = inlineElementContinuation(); | 194 LayoutInline* continuation = inlineElementContinuation(); |
| 195 LayoutInline* endOfContinuation = nullptr; |
| 195 for (LayoutInline* currCont = continuation; currCont; currCont = currCont->i
nlineElementContinuation()) { | 196 for (LayoutInline* currCont = continuation; currCont; currCont = currCont->i
nlineElementContinuation()) { |
| 196 LayoutBoxModelObject* nextCont = currCont->continuation(); | 197 LayoutBoxModelObject* nextCont = currCont->continuation(); |
| 197 currCont->setContinuation(nullptr); | 198 currCont->setContinuation(nullptr); |
| 198 currCont->setStyle(mutableStyle()); | 199 currCont->setStyle(mutableStyle()); |
| 199 currCont->setContinuation(nextCont); | 200 currCont->setContinuation(nextCont); |
| 201 endOfContinuation = currCont; |
| 200 } | 202 } |
| 201 | 203 |
| 202 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. | 204 if (continuation && oldStyle) { |
| 203 // Do this by updating the styles of the descendant blocks' containing anony
mous blocks - there may be more than one. | 205 ASSERT(endOfContinuation); |
| 204 if (continuation && oldStyle | |
| 205 && (!newStyle.isOutlineEquivalent(oldStyle) | |
| 206 || (newStyle.position() != oldStyle->position() && (newStyle.hasInFl
owPosition() || oldStyle->hasInFlowPosition())))) { | |
| 207 // If any descendant blocks exist then they will be in the next anonymou
s block and its siblings. | |
| 208 LayoutObject* block = containingBlock()->nextSibling(); | 206 LayoutObject* block = containingBlock()->nextSibling(); |
| 209 if (block && block->isAnonymousBlock()) | 207 if (block && block->isAnonymousBlock()) |
| 210 updateStyleOfAnonymousBlockContinuations(block, newStyle, *oldStyle)
; | 208 updateStyleOfAnonymousBlockContinuations(block, newStyle, *oldStyle,
endOfContinuation->containingBlock()); |
| 211 } | 209 } |
| 212 | 210 |
| 213 if (!alwaysCreateLineBoxes()) { | 211 if (!alwaysCreateLineBoxes()) { |
| 214 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati
onBackground() || newStyle.hasPadding() || newStyle.hasMargin() || newStyle.hasO
utline(); | 212 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati
onBackground() || newStyle.hasPadding() || newStyle.hasMargin() || newStyle.hasO
utline(); |
| 215 if (oldStyle && alwaysCreateLineBoxesNew) { | 213 if (oldStyle && alwaysCreateLineBoxesNew) { |
| 216 dirtyLineBoxes(false); | 214 dirtyLineBoxes(false); |
| 217 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Sty
leChange); | 215 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Sty
leChange); |
| 218 } | 216 } |
| 219 setAlwaysCreateLineBoxes(alwaysCreateLineBoxesNew); | 217 setAlwaysCreateLineBoxes(alwaysCreateLineBoxesNew); |
| 220 } | 218 } |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1426 } |
| 1429 | 1427 |
| 1430 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer) const | 1428 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer) const |
| 1431 { | 1429 { |
| 1432 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r); | 1430 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r); |
| 1433 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1431 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
| 1434 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); | 1432 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); |
| 1435 } | 1433 } |
| 1436 | 1434 |
| 1437 } // namespace blink | 1435 } // namespace blink |
| OLD | NEW |