| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 || oldStyle.paddingLeft() != newStyle.paddingLeft() | 242 || oldStyle.paddingLeft() != newStyle.paddingLeft() |
| 243 || oldStyle.paddingRight() != newStyle.paddingRight(); | 243 || oldStyle.paddingRight() != newStyle.paddingRight(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() | 246 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() |
| 247 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() | 247 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() |
| 248 || oldStyle.paddingTop() != newStyle.paddingTop() | 248 || oldStyle.paddingTop() != newStyle.paddingTop() |
| 249 || oldStyle.paddingBottom() != newStyle.paddingBottom(); | 249 || oldStyle.paddingBottom() != newStyle.paddingBottom(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) | |
| 253 { | |
| 254 return block->isAnonymousBlock() && !block->continuation() && !block->beingD
estroyed() && !block->isRubyRun() && !block->isRubyBase(); | |
| 255 } | |
| 256 | |
| 257 bool LayoutBlock::mergeSiblingContiguousAnonymousBlock(LayoutBlockFlow* siblingT
hatMayBeDeleted) | |
| 258 { | |
| 259 if (!isLayoutBlockFlow()) | |
| 260 return false; | |
| 261 | |
| 262 // Note: |this| and |siblingThatMayBeDeleted| may not be adjacent siblings a
t this point. There | |
| 263 // may be an object between them which is about to be removed. | |
| 264 | |
| 265 if (!isMergeableAnonymousBlock(toLayoutBlockFlow(this)) || !isMergeableAnony
mousBlock(siblingThatMayBeDeleted)) | |
| 266 return false; | |
| 267 | |
| 268 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidation
Reason::AnonymousBlockChange); | |
| 269 | |
| 270 // If the inlineness of children of the two block don't match, we'd need spe
cial code here | |
| 271 // (but there should be no need for it). | |
| 272 ASSERT(siblingThatMayBeDeleted->childrenInline() == childrenInline()); | |
| 273 // Take all the children out of the |next| block and put them in | |
| 274 // the |prev| block. | |
| 275 siblingThatMayBeDeleted->moveAllChildrenIncludingFloatsTo(this, siblingThatM
ayBeDeleted->hasLayer() || hasLayer()); | |
| 276 // Delete the now-empty block's lines and nuke it. | |
| 277 siblingThatMayBeDeleted->deleteLineBoxTree(); | |
| 278 siblingThatMayBeDeleted->destroy(); | |
| 279 return true; | |
| 280 } | |
| 281 | |
| 282 void LayoutBlock::reparentSubsequentFloatingOrOutOfFlowSiblings() | |
| 283 { | |
| 284 if (!parent() || !parent()->isLayoutBlockFlow()) | |
| 285 return; | |
| 286 if (beingDestroyed() || documentBeingDestroyed()) | |
| 287 return; | |
| 288 LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent()); | |
| 289 LayoutObject* child = nextSibling(); | |
| 290 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
| 291 LayoutObject* sibling = child->nextSibling(); | |
| 292 parentBlockFlow->moveChildTo(this, child, nullptr, false); | |
| 293 child = sibling; | |
| 294 } | |
| 295 | |
| 296 if (LayoutObject* next = nextSibling()) { | |
| 297 if (next->isLayoutBlockFlow()) | |
| 298 mergeSiblingContiguousAnonymousBlock(toLayoutBlockFlow(next)); | |
| 299 } | |
| 300 } | |
| 301 | |
| 302 void LayoutBlock::reparentPrecedingFloatingOrOutOfFlowSiblings() | |
| 303 { | |
| 304 if (!parent() || !parent()->isLayoutBlockFlow()) | |
| 305 return; | |
| 306 if (beingDestroyed() || documentBeingDestroyed()) | |
| 307 return; | |
| 308 LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent()); | |
| 309 LayoutObject* child = previousSibling(); | |
| 310 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
| 311 LayoutObject* sibling = child->previousSibling(); | |
| 312 parentBlockFlow->moveChildTo(this, child, firstChild(), false); | |
| 313 child = sibling; | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) | 252 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) |
| 318 { | 253 { |
| 319 LayoutBox::styleDidChange(diff, oldStyle); | 254 LayoutBox::styleDidChange(diff, oldStyle); |
| 320 | 255 |
| 321 const ComputedStyle& newStyle = styleRef(); | 256 const ComputedStyle& newStyle = styleRef(); |
| 322 | 257 |
| 323 if (oldStyle && parent()) { | 258 if (oldStyle && parent()) { |
| 324 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { | 259 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { |
| 325 // Remove our absolute and fixed positioned descendants from their n
ew containing block, | 260 // Remove our absolute and fixed positioned descendants from their n
ew containing block, |
| 326 // in case containingBlock() changes by the change to the position p
roperty. | 261 // in case containingBlock() changes by the change to the position p
roperty. |
| (...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 2123 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
| 2189 LayoutBox* currBox = *it; | 2124 LayoutBox* currBox = *it; |
| 2190 ASSERT(!currBox->needsLayout()); | 2125 ASSERT(!currBox->needsLayout()); |
| 2191 } | 2126 } |
| 2192 } | 2127 } |
| 2193 } | 2128 } |
| 2194 | 2129 |
| 2195 #endif | 2130 #endif |
| 2196 | 2131 |
| 2197 } // namespace blink | 2132 } // namespace blink |
| OLD | NEW |