| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/paint/ObjectPainter.h" | 39 #include "core/paint/ObjectPainter.h" |
| 40 #include "core/rendering/RenderBlock.h" | 40 #include "core/rendering/RenderBlock.h" |
| 41 #include "core/rendering/RenderFullScreen.h" | 41 #include "core/rendering/RenderFullScreen.h" |
| 42 #include "core/rendering/RenderView.h" | 42 #include "core/rendering/RenderView.h" |
| 43 #include "platform/geometry/FloatQuad.h" | 43 #include "platform/geometry/FloatQuad.h" |
| 44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
| 45 #include "platform/graphics/paint/DisplayItemList.h" | 45 #include "platform/graphics/paint/DisplayItemList.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 struct SameSizeAsRenderInline : public RenderBoxModelObject { | 49 struct SameSizeAsRenderInline : public LayoutBoxModelObject { |
| 50 virtual ~SameSizeAsRenderInline() { } | 50 virtual ~SameSizeAsRenderInline() { } |
| 51 LayoutObjectChildList m_children; | 51 LayoutObjectChildList m_children; |
| 52 RenderLineBoxList m_lineBoxes; | 52 RenderLineBoxList m_lineBoxes; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 static_assert(sizeof(RenderInline) == sizeof(SameSizeAsRenderInline), "RenderInl
ine should stay small"); | 55 static_assert(sizeof(RenderInline) == sizeof(SameSizeAsRenderInline), "RenderInl
ine should stay small"); |
| 56 | 56 |
| 57 RenderInline::RenderInline(Element* element) | 57 RenderInline::RenderInline(Element* element) |
| 58 : RenderBoxModelObject(element) | 58 : LayoutBoxModelObject(element) |
| 59 { | 59 { |
| 60 setChildrenInline(true); | 60 setChildrenInline(true); |
| 61 } | 61 } |
| 62 | 62 |
| 63 RenderInline* RenderInline::createAnonymous(Document* document) | 63 RenderInline* RenderInline::createAnonymous(Document* document) |
| 64 { | 64 { |
| 65 RenderInline* renderer = new RenderInline(0); | 65 RenderInline* renderer = new RenderInline(0); |
| 66 renderer->setDocumentForAnonymous(document); | 66 renderer->setDocumentForAnonymous(document); |
| 67 return renderer; | 67 return renderer; |
| 68 } | 68 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 // Make sure to destroy anonymous children first while they are still connec
ted to the rest of the tree, so that they will | 85 // Make sure to destroy anonymous children first while they are still connec
ted to the rest of the tree, so that they will |
| 86 // properly dirty line boxes that they are removed from. Effects that do :b
efore/:after only on hover could crash otherwise. | 86 // properly dirty line boxes that they are removed from. Effects that do :b
efore/:after only on hover could crash otherwise. |
| 87 children()->destroyLeftoverChildren(); | 87 children()->destroyLeftoverChildren(); |
| 88 | 88 |
| 89 // Destroy our continuation before anything other than anonymous children. | 89 // Destroy our continuation before anything other than anonymous children. |
| 90 // The reason we don't destroy it before anonymous children is that they may | 90 // The reason we don't destroy it before anonymous children is that they may |
| 91 // have continuations of their own that are anonymous children of our contin
uation. | 91 // have continuations of their own that are anonymous children of our contin
uation. |
| 92 RenderBoxModelObject* continuation = this->continuation(); | 92 LayoutBoxModelObject* continuation = this->continuation(); |
| 93 if (continuation) { | 93 if (continuation) { |
| 94 continuation->destroy(); | 94 continuation->destroy(); |
| 95 setContinuation(0); | 95 setContinuation(0); |
| 96 } | 96 } |
| 97 | 97 |
| 98 if (!documentBeingDestroyed()) { | 98 if (!documentBeingDestroyed()) { |
| 99 if (firstLineBox()) { | 99 if (firstLineBox()) { |
| 100 // We can't wait for RenderBoxModelObject::destroy to clear the sele
ction, | 100 // We can't wait for LayoutBoxModelObject::destroy to clear the sele
ction, |
| 101 // because by then we will have nuked the line boxes. | 101 // because by then we will have nuked the line boxes. |
| 102 // FIXME: The FrameSelection should be responsible for this when it | 102 // FIXME: The FrameSelection should be responsible for this when it |
| 103 // is notified of DOM mutations. | 103 // is notified of DOM mutations. |
| 104 if (isSelectionBorder()) | 104 if (isSelectionBorder()) |
| 105 view()->clearSelection(); | 105 view()->clearSelection(); |
| 106 | 106 |
| 107 // If line boxes are contained inside a root, that means we're an in
line. | 107 // If line boxes are contained inside a root, that means we're an in
line. |
| 108 // In that case, we need to remove all the line boxes so that the pa
rent | 108 // In that case, we need to remove all the line boxes so that the pa
rent |
| 109 // lines aren't pointing to deleted children. If the first line box
does | 109 // lines aren't pointing to deleted children. If the first line box
does |
| 110 // not have a parent that means they are either already disconnected
or | 110 // not have a parent that means they are either already disconnected
or |
| 111 // root lines that can just be destroyed without disconnecting. | 111 // root lines that can just be destroyed without disconnecting. |
| 112 if (firstLineBox()->parent()) { | 112 if (firstLineBox()->parent()) { |
| 113 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) | 113 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) |
| 114 box->remove(); | 114 box->remove(); |
| 115 } | 115 } |
| 116 } else if (parent()) | 116 } else if (parent()) |
| 117 parent()->dirtyLinesFromChangedChild(this); | 117 parent()->dirtyLinesFromChangedChild(this); |
| 118 } | 118 } |
| 119 | 119 |
| 120 m_lineBoxes.deleteLineBoxes(); | 120 m_lineBoxes.deleteLineBoxes(); |
| 121 | 121 |
| 122 RenderBoxModelObject::willBeDestroyed(); | 122 LayoutBoxModelObject::willBeDestroyed(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 RenderInline* RenderInline::inlineElementContinuation() const | 125 RenderInline* RenderInline::inlineElementContinuation() const |
| 126 { | 126 { |
| 127 RenderBoxModelObject* continuation = this->continuation(); | 127 LayoutBoxModelObject* continuation = this->continuation(); |
| 128 if (!continuation || continuation->isInline()) | 128 if (!continuation || continuation->isInline()) |
| 129 return toRenderInline(continuation); | 129 return toRenderInline(continuation); |
| 130 return toRenderBlock(continuation)->inlineElementContinuation(); | 130 return toRenderBlock(continuation)->inlineElementContinuation(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void RenderInline::updateFromStyle() | 133 void RenderInline::updateFromStyle() |
| 134 { | 134 { |
| 135 RenderBoxModelObject::updateFromStyle(); | 135 LayoutBoxModelObject::updateFromStyle(); |
| 136 | 136 |
| 137 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons
idered a block display type. | 137 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons
idered a block display type. |
| 138 setInline(true); | 138 setInline(true); |
| 139 | 139 |
| 140 // FIXME: Support transforms and reflections on inline flows someday. | 140 // FIXME: Support transforms and reflections on inline flows someday. |
| 141 setHasTransformRelatedProperty(false); | 141 setHasTransformRelatedProperty(false); |
| 142 setHasReflection(false); | 142 setHasReflection(false); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) | 145 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 176 newBlockStyle->setPosition(newStyle.position()); | 176 newBlockStyle->setPosition(newStyle.position()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 if (newBlockStyle) | 179 if (newBlockStyle) |
| 180 block->setStyle(newBlockStyle); | 180 block->setStyle(newBlockStyle); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 void RenderInline::styleDidChange(StyleDifference diff, const LayoutStyle* oldSt
yle) | 184 void RenderInline::styleDidChange(StyleDifference diff, const LayoutStyle* oldSt
yle) |
| 185 { | 185 { |
| 186 RenderBoxModelObject::styleDidChange(diff, oldStyle); | 186 LayoutBoxModelObject::styleDidChange(diff, oldStyle); |
| 187 | 187 |
| 188 // Ensure that all of the split inlines pick up the new style. We | 188 // Ensure that all of the split inlines pick up the new style. We |
| 189 // only do this if we're an inline, since we don't want to propagate | 189 // only do this if we're an inline, since we don't want to propagate |
| 190 // a block's style to the other inlines. | 190 // a block's style to the other inlines. |
| 191 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before | 191 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before |
| 192 // and after the block share the same style, but the block doesn't | 192 // and after the block share the same style, but the block doesn't |
| 193 // need to pass its style on to anyone else. | 193 // need to pass its style on to anyone else. |
| 194 const LayoutStyle& newStyle = styleRef(); | 194 const LayoutStyle& newStyle = styleRef(); |
| 195 RenderInline* continuation = inlineElementContinuation(); | 195 RenderInline* continuation = inlineElementContinuation(); |
| 196 for (RenderInline* currCont = continuation; currCont; currCont = currCont->i
nlineElementContinuation()) { | 196 for (RenderInline* currCont = continuation; currCont; currCont = currCont->i
nlineElementContinuation()) { |
| 197 RenderBoxModelObject* nextCont = currCont->continuation(); | 197 LayoutBoxModelObject* nextCont = currCont->continuation(); |
| 198 currCont->setContinuation(0); | 198 currCont->setContinuation(0); |
| 199 currCont->setStyle(style()); | 199 currCont->setStyle(style()); |
| 200 currCont->setContinuation(nextCont); | 200 currCont->setContinuation(nextCont); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. | 203 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. |
| 204 // Do this by updating the styles of the descendant blocks' containing anony
mous blocks - there may be more than one. | 204 // Do this by updating the styles of the descendant blocks' containing anony
mous blocks - there may be more than one. |
| 205 if (continuation && oldStyle | 205 if (continuation && oldStyle |
| 206 && (!newStyle.isOutlineEquivalent(oldStyle) | 206 && (!newStyle.isOutlineEquivalent(oldStyle) |
| 207 || (newStyle.position() != oldStyle->position() && (newStyle.hasInFl
owPosition() || oldStyle->hasInFlowPosition())))) { | 207 || (newStyle.position() != oldStyle->position() && (newStyle.hasInFl
owPosition() || oldStyle->hasInFlowPosition())))) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return caretRect; | 281 return caretRect; |
| 282 } | 282 } |
| 283 | 283 |
| 284 void RenderInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) | 284 void RenderInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
| 285 { | 285 { |
| 286 if (continuation()) | 286 if (continuation()) |
| 287 return addChildToContinuation(newChild, beforeChild); | 287 return addChildToContinuation(newChild, beforeChild); |
| 288 return addChildIgnoringContinuation(newChild, beforeChild); | 288 return addChildIgnoringContinuation(newChild, beforeChild); |
| 289 } | 289 } |
| 290 | 290 |
| 291 static RenderBoxModelObject* nextContinuation(LayoutObject* renderer) | 291 static LayoutBoxModelObject* nextContinuation(LayoutObject* renderer) |
| 292 { | 292 { |
| 293 if (renderer->isInline() && !renderer->isReplaced()) | 293 if (renderer->isInline() && !renderer->isReplaced()) |
| 294 return toRenderInline(renderer)->continuation(); | 294 return toRenderInline(renderer)->continuation(); |
| 295 return toRenderBlock(renderer)->inlineElementContinuation(); | 295 return toRenderBlock(renderer)->inlineElementContinuation(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 RenderBoxModelObject* RenderInline::continuationBefore(LayoutObject* beforeChild
) | 298 LayoutBoxModelObject* RenderInline::continuationBefore(LayoutObject* beforeChild
) |
| 299 { | 299 { |
| 300 if (beforeChild && beforeChild->parent() == this) | 300 if (beforeChild && beforeChild->parent() == this) |
| 301 return this; | 301 return this; |
| 302 | 302 |
| 303 RenderBoxModelObject* curr = nextContinuation(this); | 303 LayoutBoxModelObject* curr = nextContinuation(this); |
| 304 RenderBoxModelObject* nextToLast = this; | 304 LayoutBoxModelObject* nextToLast = this; |
| 305 RenderBoxModelObject* last = this; | 305 LayoutBoxModelObject* last = this; |
| 306 while (curr) { | 306 while (curr) { |
| 307 if (beforeChild && beforeChild->parent() == curr) { | 307 if (beforeChild && beforeChild->parent() == curr) { |
| 308 if (curr->slowFirstChild() == beforeChild) | 308 if (curr->slowFirstChild() == beforeChild) |
| 309 return last; | 309 return last; |
| 310 return curr; | 310 return curr; |
| 311 } | 311 } |
| 312 | 312 |
| 313 nextToLast = last; | 313 nextToLast = last; |
| 314 last = curr; | 314 last = curr; |
| 315 curr = nextContinuation(curr); | 315 curr = nextContinuation(curr); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 337 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. | 337 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. |
| 338 if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) | 338 if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) |
| 339 newStyle->setPosition(positionedAncestor->style()->position()); | 339 newStyle->setPosition(positionedAncestor->style()->position()); |
| 340 | 340 |
| 341 // Push outline style to the block continuation. | 341 // Push outline style to the block continuation. |
| 342 if (!newStyle->isOutlineEquivalent(style())) | 342 if (!newStyle->isOutlineEquivalent(style())) |
| 343 newStyle->setOutlineFromStyle(*style()); | 343 newStyle->setOutlineFromStyle(*style()); |
| 344 | 344 |
| 345 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&document()); | 345 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&document()); |
| 346 newBox->setStyle(newStyle.release()); | 346 newBox->setStyle(newStyle.release()); |
| 347 RenderBoxModelObject* oldContinuation = continuation(); | 347 LayoutBoxModelObject* oldContinuation = continuation(); |
| 348 setContinuation(newBox); | 348 setContinuation(newBox); |
| 349 | 349 |
| 350 splitFlow(beforeChild, newBox, newChild, oldContinuation); | 350 splitFlow(beforeChild, newBox, newChild, oldContinuation); |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 | 353 |
| 354 RenderBoxModelObject::addChild(newChild, beforeChild); | 354 LayoutBoxModelObject::addChild(newChild, beforeChild); |
| 355 | 355 |
| 356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 RenderInline* RenderInline::clone() const | 359 RenderInline* RenderInline::clone() const |
| 360 { | 360 { |
| 361 RenderInline* cloneInline = new RenderInline(node()); | 361 RenderInline* cloneInline = new RenderInline(node()); |
| 362 cloneInline->setStyle(style()); | 362 cloneInline->setStyle(style()); |
| 363 cloneInline->setFlowThreadState(flowThreadState()); | 363 cloneInline->setFlowThreadState(flowThreadState()); |
| 364 return cloneInline; | 364 return cloneInline; |
| 365 } | 365 } |
| 366 | 366 |
| 367 void RenderInline::moveChildrenToIgnoringContinuation(RenderInline* to, LayoutOb
ject* startChild) | 367 void RenderInline::moveChildrenToIgnoringContinuation(RenderInline* to, LayoutOb
ject* startChild) |
| 368 { | 368 { |
| 369 LayoutObject* child = startChild; | 369 LayoutObject* child = startChild; |
| 370 while (child) { | 370 while (child) { |
| 371 LayoutObject* currentChild = child; | 371 LayoutObject* currentChild = child; |
| 372 child = currentChild->nextSibling(); | 372 child = currentChild->nextSibling(); |
| 373 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); | 373 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, | 377 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, |
| 378 RenderBlock* middleBlock, | 378 RenderBlock* middleBlock, |
| 379 LayoutObject* beforeChild, RenderBoxModelObject*
oldCont) | 379 LayoutObject* beforeChild, LayoutBoxModelObject*
oldCont) |
| 380 { | 380 { |
| 381 ASSERT(isDescendantOf(fromBlock)); | 381 ASSERT(isDescendantOf(fromBlock)); |
| 382 | 382 |
| 383 // If we're splitting the inline containing the fullscreened element, | 383 // If we're splitting the inline containing the fullscreened element, |
| 384 // |beforeChild| may be the renderer for the fullscreened element. However, | 384 // |beforeChild| may be the renderer for the fullscreened element. However, |
| 385 // that renderer is wrapped in a RenderFullScreen, so |this| is not its | 385 // that renderer is wrapped in a RenderFullScreen, so |this| is not its |
| 386 // parent. Since the splitting logic expects |this| to be the parent, set | 386 // parent. Since the splitting logic expects |this| to be the parent, set |
| 387 // |beforeChild| to be the RenderFullScreen. | 387 // |beforeChild| to be the RenderFullScreen. |
| 388 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { | 388 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { |
| 389 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); | 389 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 418 fromBlock->moveChildrenTo(toBlock, topMostInline->nextSibling(), nullptr, tr
ue); | 418 fromBlock->moveChildrenTo(toBlock, topMostInline->nextSibling(), nullptr, tr
ue); |
| 419 | 419 |
| 420 RenderInline* currentParent = topMostInlineToClone; | 420 RenderInline* currentParent = topMostInlineToClone; |
| 421 RenderInline* cloneInlineParent = cloneInline; | 421 RenderInline* cloneInlineParent = cloneInline; |
| 422 | 422 |
| 423 // Clone the inlines from top to down to ensure any new object will be added
into a rooted tree. | 423 // Clone the inlines from top to down to ensure any new object will be added
into a rooted tree. |
| 424 // Note that we have already cloned the top-most one, so the loop begins fro
m size - 2 (except if | 424 // Note that we have already cloned the top-most one, so the loop begins fro
m size - 2 (except if |
| 425 // we have reached |cMaxDepth| in which case we sacrifice correct rendering
for performance). | 425 // we have reached |cMaxDepth| in which case we sacrifice correct rendering
for performance). |
| 426 for (int i = static_cast<int>(inlinesToClone.size()) - 2; i >= 0; --i) { | 426 for (int i = static_cast<int>(inlinesToClone.size()) - 2; i >= 0; --i) { |
| 427 // Hook the clone up as a continuation of |currentInline|. | 427 // Hook the clone up as a continuation of |currentInline|. |
| 428 RenderBoxModelObject* oldCont = currentParent->continuation(); | 428 LayoutBoxModelObject* oldCont = currentParent->continuation(); |
| 429 currentParent->setContinuation(cloneInline); | 429 currentParent->setContinuation(cloneInline); |
| 430 cloneInline->setContinuation(oldCont); | 430 cloneInline->setContinuation(oldCont); |
| 431 | 431 |
| 432 // Create a new clone. | 432 // Create a new clone. |
| 433 RenderInline* current = inlinesToClone[i]; | 433 RenderInline* current = inlinesToClone[i]; |
| 434 cloneInline = current->clone(); | 434 cloneInline = current->clone(); |
| 435 | 435 |
| 436 // Insert our |cloneInline| as the first child of |cloneInlineParent|. | 436 // Insert our |cloneInline| as the first child of |cloneInlineParent|. |
| 437 cloneInlineParent->addChildIgnoringContinuation(cloneInline, nullptr); | 437 cloneInlineParent->addChildIgnoringContinuation(cloneInline, nullptr); |
| 438 | 438 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 450 // Hook |cloneInline| up as the continuation of the middle block. | 450 // Hook |cloneInline| up as the continuation of the middle block. |
| 451 cloneInline->setContinuation(oldCont); | 451 cloneInline->setContinuation(oldCont); |
| 452 middleBlock->setContinuation(cloneInline); | 452 middleBlock->setContinuation(cloneInline); |
| 453 | 453 |
| 454 // Now take all of the children from |beforeChild| to the end and remove | 454 // Now take all of the children from |beforeChild| to the end and remove |
| 455 // them from |this| and place them in the clone. | 455 // them from |this| and place them in the clone. |
| 456 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); | 456 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void RenderInline::splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox
, | 459 void RenderInline::splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox
, |
| 460 LayoutObject* newChild, RenderBoxModelObject* oldCont) | 460 LayoutObject* newChild, LayoutBoxModelObject* oldCont) |
| 461 { | 461 { |
| 462 RenderBlock* pre = 0; | 462 RenderBlock* pre = 0; |
| 463 RenderBlock* block = containingBlock(); | 463 RenderBlock* block = containingBlock(); |
| 464 | 464 |
| 465 // Delete our line boxes before we do the inline split into continuations. | 465 // Delete our line boxes before we do the inline split into continuations. |
| 466 block->deleteLineBoxTree(); | 466 block->deleteLineBoxTree(); |
| 467 | 467 |
| 468 bool madeNewBeforeBlock = false; | 468 bool madeNewBeforeBlock = false; |
| 469 if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->crea
tesAnonymousWrapper())) { | 469 if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->crea
tesAnonymousWrapper())) { |
| 470 // We can reuse this block and make it the preBlock of the next continua
tion. | 470 // We can reuse this block and make it the preBlock of the next continua
tion. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 509 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
| 510 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 510 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
| 511 // make new line boxes instead of leaving the old line boxes around. | 511 // make new line boxes instead of leaving the old line boxes around. |
| 512 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 512 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 513 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 513 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 514 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 514 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 515 } | 515 } |
| 516 | 516 |
| 517 void RenderInline::addChildToContinuation(LayoutObject* newChild, LayoutObject*
beforeChild) | 517 void RenderInline::addChildToContinuation(LayoutObject* newChild, LayoutObject*
beforeChild) |
| 518 { | 518 { |
| 519 RenderBoxModelObject* flow = continuationBefore(beforeChild); | 519 LayoutBoxModelObject* flow = continuationBefore(beforeChild); |
| 520 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); | 520 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); |
| 521 RenderBoxModelObject* beforeChildParent = 0; | 521 LayoutBoxModelObject* beforeChildParent = 0; |
| 522 if (beforeChild) | 522 if (beforeChild) |
| 523 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); | 523 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); |
| 524 else { | 524 else { |
| 525 RenderBoxModelObject* cont = nextContinuation(flow); | 525 LayoutBoxModelObject* cont = nextContinuation(flow); |
| 526 if (cont) | 526 if (cont) |
| 527 beforeChildParent = cont; | 527 beforeChildParent = cont; |
| 528 else | 528 else |
| 529 beforeChildParent = flow; | 529 beforeChildParent = flow; |
| 530 } | 530 } |
| 531 | 531 |
| 532 if (newChild->isFloatingOrOutOfFlowPositioned()) | 532 if (newChild->isFloatingOrOutOfFlowPositioned()) |
| 533 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeC
hild); | 533 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeC
hild); |
| 534 | 534 |
| 535 // A continuation always consists of two potential candidates: an inline or
an anonymous | 535 // A continuation always consists of two potential candidates: an inline or
an anonymous |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 // FIXME: Does not deal with relative positioned inlines (should it?) | 836 // FIXME: Does not deal with relative positioned inlines (should it?) |
| 837 RenderBlock* cb = containingBlock(); | 837 RenderBlock* cb = containingBlock(); |
| 838 if (firstLineBox()) { | 838 if (firstLineBox()) { |
| 839 // This inline actually has a line box. We must have clicked in the bor
der/padding of one of these boxes. We | 839 // This inline actually has a line box. We must have clicked in the bor
der/padding of one of these boxes. We |
| 840 // should try to find a result by asking our containing block. | 840 // should try to find a result by asking our containing block. |
| 841 return cb->positionForPoint(point); | 841 return cb->positionForPoint(point); |
| 842 } | 842 } |
| 843 | 843 |
| 844 // Translate the coords from the pre-anonymous block to the post-anonymous b
lock. | 844 // Translate the coords from the pre-anonymous block to the post-anonymous b
lock. |
| 845 LayoutPoint parentBlockPoint = cb->location() + point; | 845 LayoutPoint parentBlockPoint = cb->location() + point; |
| 846 RenderBoxModelObject* c = continuation(); | 846 LayoutBoxModelObject* c = continuation(); |
| 847 while (c) { | 847 while (c) { |
| 848 RenderBox* contBlock = c->isInline() ? c->containingBlock() : toRenderBl
ock(c); | 848 RenderBox* contBlock = c->isInline() ? c->containingBlock() : toRenderBl
ock(c); |
| 849 if (c->isInline() || c->slowFirstChild()) | 849 if (c->isInline() || c->slowFirstChild()) |
| 850 return c->positionForPoint(parentBlockPoint - contBlock->locationOff
set()); | 850 return c->positionForPoint(parentBlockPoint - contBlock->locationOff
set()); |
| 851 c = toRenderBlock(c)->inlineElementContinuation(); | 851 c = toRenderBlock(c)->inlineElementContinuation(); |
| 852 } | 852 } |
| 853 | 853 |
| 854 return RenderBoxModelObject::positionForPoint(point); | 854 return LayoutBoxModelObject::positionForPoint(point); |
| 855 } | 855 } |
| 856 | 856 |
| 857 namespace { | 857 namespace { |
| 858 | 858 |
| 859 class LinesBoundingBoxGeneratorContext { | 859 class LinesBoundingBoxGeneratorContext { |
| 860 public: | 860 public: |
| 861 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { } | 861 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { } |
| 862 void operator()(const FloatRect& rect) | 862 void operator()(const FloatRect& rect) |
| 863 { | 863 { |
| 864 m_rect.uniteIfNonZero(rect); | 864 m_rect.uniteIfNonZero(rect); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 | 1077 |
| 1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) | 1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) |
| 1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); | 1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 return overflowRect; | 1082 return overflowRect; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const | 1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const |
| 1086 { | 1086 { |
| 1087 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); | 1087 LayoutRect r(LayoutBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); |
| 1088 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 1088 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
| 1089 if (!curr->isText()) | 1089 if (!curr->isText()) |
| 1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); | 1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); |
| 1091 } | 1091 } |
| 1092 return r; | 1092 return r; |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void RenderInline::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const | 1095 void RenderInline::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const |
| 1096 { | 1096 { |
| 1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1215 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
| 1216 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | 1216 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); |
| 1217 return; | 1217 return; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed, paintInvalidationState); | 1220 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed, paintInvalidationState); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 void RenderInline::updateDragState(bool dragOn) | 1223 void RenderInline::updateDragState(bool dragOn) |
| 1224 { | 1224 { |
| 1225 RenderBoxModelObject::updateDragState(dragOn); | 1225 LayoutBoxModelObject::updateDragState(dragOn); |
| 1226 if (continuation()) | 1226 if (continuation()) |
| 1227 continuation()->updateDragState(dragOn); | 1227 continuation()->updateDragState(dragOn); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void RenderInline::childBecameNonInline(LayoutObject* child) | 1230 void RenderInline::childBecameNonInline(LayoutObject* child) |
| 1231 { | 1231 { |
| 1232 // We have to split the parent flow. | 1232 // We have to split the parent flow. |
| 1233 RenderBlock* newBox = containingBlock()->createAnonymousBlock(); | 1233 RenderBlock* newBox = containingBlock()->createAnonymousBlock(); |
| 1234 RenderBoxModelObject* oldContinuation = continuation(); | 1234 LayoutBoxModelObject* oldContinuation = continuation(); |
| 1235 setContinuation(newBox); | 1235 setContinuation(newBox); |
| 1236 LayoutObject* beforeChild = child->nextSibling(); | 1236 LayoutObject* beforeChild = child->nextSibling(); |
| 1237 children()->removeChildNode(this, child); | 1237 children()->removeChildNode(this, child); |
| 1238 splitFlow(beforeChild, newBox, child, oldContinuation); | 1238 splitFlow(beforeChild, newBox, child, oldContinuation); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) | 1241 void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) |
| 1242 { | 1242 { |
| 1243 if (result.innerNode()) | 1243 if (result.innerNode()) |
| 1244 return; | 1244 return; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 | 1446 |
| 1447 FloatPoint absPos = container->localToAbsolute(); | 1447 FloatPoint absPos = container->localToAbsolute(); |
| 1448 region.bounds.setX(absPos.x() + region.bounds.x()); | 1448 region.bounds.setX(absPos.x() + region.bounds.x()); |
| 1449 region.bounds.setY(absPos.y() + region.bounds.y()); | 1449 region.bounds.setY(absPos.y() + region.bounds.y()); |
| 1450 | 1450 |
| 1451 regions.append(region); | 1451 regions.append(region); |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const | 1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const |
| 1455 { | 1455 { |
| 1456 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); | 1456 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); |
| 1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
| 1458 displayItemList->invalidate(box->displayItemClient()); | 1458 displayItemList->invalidate(box->displayItemClient()); |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 } // namespace blink | 1461 } // namespace blink |
| OLD | NEW |