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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void LayoutInline::moveChildrenToIgnoringContinuation(LayoutInline* to, LayoutOb
ject* startChild) | 338 void LayoutInline::moveChildrenToIgnoringContinuation(LayoutInline* to, LayoutOb
ject* startChild) |
339 { | 339 { |
340 LayoutObject* child = startChild; | 340 LayoutObject* child = startChild; |
341 while (child) { | 341 while (child) { |
342 LayoutObject* currentChild = child; | 342 LayoutObject* currentChild = child; |
343 child = currentChild->nextSibling(); | 343 child = currentChild->nextSibling(); |
344 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); | 344 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 void LayoutInline::splitInlines(LayoutBlock* fromBlock, LayoutBlock* toBlock, | 348 void LayoutInline::splitInlines(LayoutBlockFlow* fromBlock, LayoutBlockFlow* toB
lock, |
349 LayoutBlock* middleBlock, LayoutObject* beforeChild, LayoutBoxModelObject* o
ldCont) | 349 LayoutBlockFlow* middleBlock, LayoutObject* beforeChild, LayoutBoxModelObjec
t* oldCont) |
350 { | 350 { |
351 ASSERT(isDescendantOf(fromBlock)); | 351 ASSERT(isDescendantOf(fromBlock)); |
352 | 352 |
353 // If we're splitting the inline containing the fullscreened element, | 353 // If we're splitting the inline containing the fullscreened element, |
354 // |beforeChild| may be the layoutObject for the fullscreened element. Howev
er, | 354 // |beforeChild| may be the layoutObject for the fullscreened element. Howev
er, |
355 // that layoutObject is wrapped in a LayoutFullScreen, so |this| is not its | 355 // that layoutObject is wrapped in a LayoutFullScreen, so |this| is not its |
356 // parent. Since the splitting logic expects |this| to be the parent, set | 356 // parent. Since the splitting logic expects |this| to be the parent, set |
357 // |beforeChild| to be the LayoutFullScreen. | 357 // |beforeChild| to be the LayoutFullScreen. |
358 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { | 358 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { |
359 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); | 359 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 // Hook |cloneInline| up as the continuation of the middle block. | 420 // Hook |cloneInline| up as the continuation of the middle block. |
421 cloneInline->setContinuation(oldCont); | 421 cloneInline->setContinuation(oldCont); |
422 middleBlock->setContinuation(cloneInline); | 422 middleBlock->setContinuation(cloneInline); |
423 | 423 |
424 // Now take all of the children from |beforeChild| to the end and remove | 424 // Now take all of the children from |beforeChild| to the end and remove |
425 // them from |this| and place them in the clone. | 425 // them from |this| and place them in the clone. |
426 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); | 426 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); |
427 } | 427 } |
428 | 428 |
429 void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox
, | 429 void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlockFlow* newBloc
kBox, |
430 LayoutObject* newChild, LayoutBoxModelObject* oldCont) | 430 LayoutObject* newChild, LayoutBoxModelObject* oldCont) |
431 { | 431 { |
432 LayoutBlockFlow* containingBlockFlow = toLayoutBlockFlow(containingBlock()); | 432 LayoutBlockFlow* block = toLayoutBlockFlow(containingBlock()); |
433 LayoutBlock* pre = nullptr; | 433 LayoutBlockFlow* pre = nullptr; |
434 LayoutBlock* block = containingBlockFlow; | |
435 | 434 |
436 // Delete our line boxes before we do the inline split into continuations. | 435 // Delete our line boxes before we do the inline split into continuations. |
437 containingBlockFlow->deleteLineBoxTree(); | 436 block->deleteLineBoxTree(); |
438 | 437 |
439 bool reusedAnonymousBlock = false; | 438 bool reusedAnonymousBlock = false; |
440 if (block->isAnonymousBlock()) { | 439 if (block->isAnonymousBlock()) { |
441 LayoutBlock* outerContainingBlock = block->containingBlock(); | 440 LayoutBlock* outerContainingBlock = block->containingBlock(); |
442 if (outerContainingBlock | 441 if (outerContainingBlock |
443 && outerContainingBlock->isLayoutBlockFlow() | 442 && outerContainingBlock->isLayoutBlockFlow() |
444 && !outerContainingBlock->createsAnonymousWrapper()) { | 443 && !outerContainingBlock->createsAnonymousWrapper()) { |
445 // We can reuse this block and make it the preBlock of the next cont
inuation. | 444 // We can reuse this block and make it the preBlock of the next cont
inuation. |
446 containingBlockFlow->removePositionedObjects(nullptr); | 445 block->removePositionedObjects(nullptr); |
447 containingBlockFlow->removeFloatingObjects(); | 446 block->removeFloatingObjects(); |
448 pre = containingBlockFlow; | 447 pre = block; |
449 block = outerContainingBlock; | 448 block = toLayoutBlockFlow(outerContainingBlock); |
450 reusedAnonymousBlock = true; | 449 reusedAnonymousBlock = true; |
451 } | 450 } |
452 } | 451 } |
453 if (!reusedAnonymousBlock) | 452 if (!reusedAnonymousBlock) |
454 pre = block->createAnonymousBlock(); // No anonymous block available for
use. Make one. | 453 pre = toLayoutBlockFlow(block->createAnonymousBlock()); // No anonymous
block available for use. Make one. |
455 | 454 |
456 LayoutBlock* post = toLayoutBlock(pre->createAnonymousBoxWithSameTypeAs(bloc
k)); | 455 LayoutBlockFlow* post = toLayoutBlockFlow(pre->createAnonymousBlock()); |
457 | 456 |
458 LayoutObject* boxFirst = !reusedAnonymousBlock ? block->firstChild() : pre->
nextSibling(); | 457 LayoutObject* boxFirst = !reusedAnonymousBlock ? block->firstChild() : pre->
nextSibling(); |
459 if (!reusedAnonymousBlock) | 458 if (!reusedAnonymousBlock) |
460 block->children()->insertChildNode(block, pre, boxFirst); | 459 block->children()->insertChildNode(block, pre, boxFirst); |
461 block->children()->insertChildNode(block, newBlockBox, boxFirst); | 460 block->children()->insertChildNode(block, newBlockBox, boxFirst); |
462 block->children()->insertChildNode(block, post, boxFirst); | 461 block->children()->insertChildNode(block, post, boxFirst); |
463 block->setChildrenInline(false); | 462 block->setChildrenInline(false); |
464 | 463 |
465 if (!reusedAnonymousBlock) { | 464 if (!reusedAnonymousBlock) { |
466 LayoutObject* o = boxFirst; | 465 LayoutObject* o = boxFirst; |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 void LayoutInline::updateDragState(bool dragOn) | 1127 void LayoutInline::updateDragState(bool dragOn) |
1129 { | 1128 { |
1130 LayoutBoxModelObject::updateDragState(dragOn); | 1129 LayoutBoxModelObject::updateDragState(dragOn); |
1131 if (LayoutBoxModelObject* continuation = this->continuation()) | 1130 if (LayoutBoxModelObject* continuation = this->continuation()) |
1132 continuation->updateDragState(dragOn); | 1131 continuation->updateDragState(dragOn); |
1133 } | 1132 } |
1134 | 1133 |
1135 void LayoutInline::childBecameNonInline(LayoutObject* child) | 1134 void LayoutInline::childBecameNonInline(LayoutObject* child) |
1136 { | 1135 { |
1137 // We have to split the parent flow. | 1136 // We have to split the parent flow. |
1138 LayoutBlock* newBox = containingBlock()->createAnonymousBlock(); | 1137 LayoutBlockFlow* newBox = toLayoutBlockFlow(containingBlock()->createAnonymo
usBlock()); |
1139 LayoutBoxModelObject* oldContinuation = continuation(); | 1138 LayoutBoxModelObject* oldContinuation = continuation(); |
1140 setContinuation(newBox); | 1139 setContinuation(newBox); |
1141 LayoutObject* beforeChild = child->nextSibling(); | 1140 LayoutObject* beforeChild = child->nextSibling(); |
1142 children()->removeChildNode(this, child); | 1141 children()->removeChildNode(this, child); |
1143 splitFlow(beforeChild, newBox, child, oldContinuation); | 1142 splitFlow(beforeChild, newBox, child, oldContinuation); |
1144 } | 1143 } |
1145 | 1144 |
1146 void LayoutInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) | 1145 void LayoutInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) |
1147 { | 1146 { |
1148 if (result.innerNode()) | 1147 if (result.innerNode()) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 | 1355 |
1357 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1356 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1358 { | 1357 { |
1359 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r, invalidationReason); | 1358 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r, invalidationReason); |
1360 | 1359 |
1361 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1360 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
1362 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); | 1361 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); |
1363 } | 1362 } |
1364 | 1363 |
1365 } // namespace blink | 1364 } // namespace blink |
OLD | NEW |