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 23 matching lines...) Expand all Loading... |
34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
35 #include "core/editing/htmlediting.h" | 35 #include "core/editing/htmlediting.h" |
36 #include "core/events/OverflowEvent.h" | 36 #include "core/events/OverflowEvent.h" |
37 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 37 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
38 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
41 #include "core/layout/HitTestLocation.h" | 41 #include "core/layout/HitTestLocation.h" |
42 #include "core/layout/HitTestResult.h" | 42 #include "core/layout/HitTestResult.h" |
43 #include "core/layout/Layer.h" | 43 #include "core/layout/Layer.h" |
| 44 #include "core/layout/LayoutObject.h" |
44 #include "core/layout/LayoutTableCell.h" | 45 #include "core/layout/LayoutTableCell.h" |
45 #include "core/layout/LayoutTheme.h" | 46 #include "core/layout/LayoutTheme.h" |
46 #include "core/layout/line/InlineIterator.h" | 47 #include "core/layout/line/InlineIterator.h" |
47 #include "core/layout/line/InlineTextBox.h" | 48 #include "core/layout/line/InlineTextBox.h" |
48 #include "core/layout/shapes/ShapeOutsideInfo.h" | 49 #include "core/layout/shapes/ShapeOutsideInfo.h" |
49 #include "core/page/Page.h" | 50 #include "core/page/Page.h" |
50 #include "core/paint/BlockPainter.h" | 51 #include "core/paint/BlockPainter.h" |
51 #include "core/paint/BoxPainter.h" | 52 #include "core/paint/BoxPainter.h" |
52 #include "core/paint/RenderDrawingRecorder.h" | 53 #include "core/paint/RenderDrawingRecorder.h" |
53 #include "core/rendering/PaintInfo.h" | 54 #include "core/rendering/PaintInfo.h" |
54 #include "core/rendering/RenderCombineText.h" | 55 #include "core/rendering/RenderCombineText.h" |
55 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 56 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
56 #include "core/rendering/RenderFlexibleBox.h" | 57 #include "core/rendering/RenderFlexibleBox.h" |
57 #include "core/rendering/RenderFlowThread.h" | 58 #include "core/rendering/RenderFlowThread.h" |
58 #include "core/rendering/RenderGrid.h" | 59 #include "core/rendering/RenderGrid.h" |
59 #include "core/rendering/RenderInline.h" | 60 #include "core/rendering/RenderInline.h" |
60 #include "core/rendering/RenderObjectInlines.h" | |
61 #include "core/rendering/RenderRegion.h" | 61 #include "core/rendering/RenderRegion.h" |
62 #include "core/rendering/RenderTextControl.h" | 62 #include "core/rendering/RenderTextControl.h" |
63 #include "core/rendering/RenderTextFragment.h" | 63 #include "core/rendering/RenderTextFragment.h" |
64 #include "core/rendering/RenderView.h" | 64 #include "core/rendering/RenderView.h" |
65 #include "core/rendering/TextAutosizer.h" | 65 #include "core/rendering/TextAutosizer.h" |
66 #include "core/rendering/style/ContentData.h" | 66 #include "core/rendering/style/ContentData.h" |
67 #include "core/rendering/style/RenderStyle.h" | 67 #include "core/rendering/style/RenderStyle.h" |
68 #include "platform/geometry/FloatQuad.h" | 68 #include "platform/geometry/FloatQuad.h" |
69 #include "platform/geometry/TransformState.h" | 69 #include "platform/geometry/TransformState.h" |
70 #include "wtf/StdLibExtras.h" | 70 #include "wtf/StdLibExtras.h" |
71 #include "wtf/TemporaryChange.h" | 71 #include "wtf/TemporaryChange.h" |
72 | 72 |
73 using namespace WTF; | 73 using namespace WTF; |
74 using namespace Unicode; | 74 using namespace Unicode; |
75 | 75 |
76 namespace blink { | 76 namespace blink { |
77 | 77 |
78 using namespace HTMLNames; | 78 using namespace HTMLNames; |
79 | 79 |
80 struct SameSizeAsRenderBlock : public RenderBox { | 80 struct SameSizeAsRenderBlock : public RenderBox { |
81 RenderObjectChildList children; | 81 LayoutObjectChildList children; |
82 RenderLineBoxList lineBoxes; | 82 RenderLineBoxList lineBoxes; |
83 int pageLogicalOffset; | 83 int pageLogicalOffset; |
84 uint32_t bitfields; | 84 uint32_t bitfields; |
85 }; | 85 }; |
86 | 86 |
87 static_assert(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), "RenderBlock
should stay small"); | 87 static_assert(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), "RenderBlock
should stay small"); |
88 | 88 |
89 typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; | 89 typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; |
90 static ColumnInfoMap* gColumnInfoMap = 0; | 90 static ColumnInfoMap* gColumnInfoMap = 0; |
91 | 91 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); | 284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); |
285 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS
tyle.hasTransformRelatedProperty(); | 285 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS
tyle.hasTransformRelatedProperty(); |
286 | 286 |
287 if (oldStyleIsContainer && !newStyleIsContainer) { | 287 if (oldStyleIsContainer && !newStyleIsContainer) { |
288 // Clear our positioned objects list. Our absolutely positioned desc
endants will be | 288 // Clear our positioned objects list. Our absolutely positioned desc
endants will be |
289 // inserted into our containing block's positioned objects list duri
ng layout. | 289 // inserted into our containing block's positioned objects list duri
ng layout. |
290 removePositionedObjects(0, NewContainingBlock); | 290 removePositionedObjects(0, NewContainingBlock); |
291 } else if (!oldStyleIsContainer && newStyleIsContainer) { | 291 } else if (!oldStyleIsContainer && newStyleIsContainer) { |
292 // Remove our absolutely positioned descendants from their current c
ontaining block. | 292 // Remove our absolutely positioned descendants from their current c
ontaining block. |
293 // They will be inserted into our positioned objects list during lay
out. | 293 // They will be inserted into our positioned objects list during lay
out. |
294 RenderObject* cb = parent(); | 294 LayoutObject* cb = parent(); |
295 while (cb && (cb->style()->position() == StaticPosition || (cb->isIn
line() && !cb->isReplaced())) && !cb->isRenderView()) { | 295 while (cb && (cb->style()->position() == StaticPosition || (cb->isIn
line() && !cb->isReplaced())) && !cb->isRenderView()) { |
296 if (cb->style()->position() == RelativePosition && cb->isInline(
) && !cb->isReplaced()) { | 296 if (cb->style()->position() == RelativePosition && cb->isInline(
) && !cb->isReplaced()) { |
297 cb = cb->containingBlock(); | 297 cb = cb->containingBlock(); |
298 break; | 298 break; |
299 } | 299 } |
300 cb = cb->parent(); | 300 cb = cb->parent(); |
301 } | 301 } |
302 | 302 |
303 if (cb->isRenderBlock()) | 303 if (cb->isRenderBlock()) |
304 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl
ock); | 304 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl
ock); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 // It's possible for our border/padding to change, but for the overall logic
al width of the block to | 349 // It's possible for our border/padding to change, but for the overall logic
al width of the block to |
350 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. | 350 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. |
351 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n
eedsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle); | 351 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n
eedsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle); |
352 | 352 |
353 // If the style has unloaded images, want to notify the ResourceLoadPriority
Optimizer so that | 353 // If the style has unloaded images, want to notify the ResourceLoadPriority
Optimizer so that |
354 // network priorities can be set. | 354 // network priorities can be set. |
355 Vector<ImageResource*> images; | 355 Vector<ImageResource*> images; |
356 appendImagesFromStyle(images, *newStyle); | 356 appendImagesFromStyle(images, *newStyle); |
357 if (images.isEmpty()) | 357 if (images.isEmpty()) |
358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRe
nderObject(this); | 358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLa
youtObject(this); |
359 else | 359 else |
360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addRende
rObject(this); | 360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayou
tObject(this); |
361 } | 361 } |
362 | 362 |
363 void RenderBlock::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState
& childPaintInvalidationState) | 363 void RenderBlock::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState
& childPaintInvalidationState) |
364 { | 364 { |
365 RenderBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); | 365 RenderBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); |
366 | 366 |
367 // Take care of positioned objects. This is required as PaintInvalidationSta
te keeps a single clip rect. | 367 // Take care of positioned objects. This is required as PaintInvalidationSta
te keeps a single clip rect. |
368 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects(
)) { | 368 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects(
)) { |
369 TrackedRendererListHashSet::iterator end = positionedObjects->end(); | 369 TrackedRendererListHashSet::iterator end = positionedObjects->end(); |
370 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { | 370 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { |
(...skipping 10 matching lines...) Expand all Loading... |
381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida
tionState); | 381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida
tionState); |
382 PaintInvalidationState disabledPaintInvalidationState(childPaint
InvalidationState, *this, paintInvalidationContainerForChild); | 382 PaintInvalidationState disabledPaintInvalidationState(childPaint
InvalidationState, *this, paintInvalidationContainerForChild); |
383 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); | 383 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); |
384 continue; | 384 continue; |
385 } | 385 } |
386 | 386 |
387 // If the positioned renderer is absolutely positioned and it is ins
ide | 387 // If the positioned renderer is absolutely positioned and it is ins
ide |
388 // a relatively positioned inline element, we need to account for | 388 // a relatively positioned inline element, we need to account for |
389 // the inline elements position in PaintInvalidationState. | 389 // the inline elements position in PaintInvalidationState. |
390 if (box->style()->position() == AbsolutePosition) { | 390 if (box->style()->position() == AbsolutePosition) { |
391 RenderObject* container = box->container(&paintInvalidationConta
inerForChild, 0); | 391 LayoutObject* container = box->container(&paintInvalidationConta
inerForChild, 0); |
392 if (container->isRelPositioned() && container->isRenderInline())
{ | 392 if (container->isRelPositioned() && container->isRenderInline())
{ |
393 // FIXME: We should be able to use PaintInvalidationState fo
r this. | 393 // FIXME: We should be able to use PaintInvalidationState fo
r this. |
394 // Currently, we will place absolutely positioned elements i
nside | 394 // Currently, we will place absolutely positioned elements i
nside |
395 // relatively positioned inline blocks in the wrong location
. crbug.com/371485 | 395 // relatively positioned inline blocks in the wrong location
. crbug.com/371485 |
396 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva
lidationState); | 396 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva
lidationState); |
397 PaintInvalidationState disabledPaintInvalidationState(childP
aintInvalidationState, *this, paintInvalidationContainerForChild); | 397 PaintInvalidationState disabledPaintInvalidationState(childP
aintInvalidationState, *this, paintInvalidationContainerForChild); |
398 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); | 398 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); |
399 continue; | 399 continue; |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 box->invalidateTreeIfNeeded(childPaintInvalidationState); | 403 box->invalidateTreeIfNeeded(childPaintInvalidationState); |
404 } | 404 } |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) | 408 RenderBlock* RenderBlock::continuationBefore(LayoutObject* beforeChild) |
409 { | 409 { |
410 if (beforeChild && beforeChild->parent() == this) | 410 if (beforeChild && beforeChild->parent() == this) |
411 return this; | 411 return this; |
412 | 412 |
413 RenderBlock* curr = toRenderBlock(continuation()); | 413 RenderBlock* curr = toRenderBlock(continuation()); |
414 RenderBlock* nextToLast = this; | 414 RenderBlock* nextToLast = this; |
415 RenderBlock* last = this; | 415 RenderBlock* last = this; |
416 while (curr) { | 416 while (curr) { |
417 if (beforeChild && beforeChild->parent() == curr) { | 417 if (beforeChild && beforeChild->parent() == curr) { |
418 if (curr->firstChild() == beforeChild) | 418 if (curr->firstChild() == beforeChild) |
419 return last; | 419 return last; |
420 return curr; | 420 return curr; |
421 } | 421 } |
422 | 422 |
423 nextToLast = last; | 423 nextToLast = last; |
424 last = curr; | 424 last = curr; |
425 curr = toRenderBlock(curr->continuation()); | 425 curr = toRenderBlock(curr->continuation()); |
426 } | 426 } |
427 | 427 |
428 if (!beforeChild && !last->firstChild()) | 428 if (!beforeChild && !last->firstChild()) |
429 return nextToLast; | 429 return nextToLast; |
430 return last; | 430 return last; |
431 } | 431 } |
432 | 432 |
433 void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* b
eforeChild) | 433 void RenderBlock::addChildToContinuation(LayoutObject* newChild, LayoutObject* b
eforeChild) |
434 { | 434 { |
435 RenderBlock* flow = continuationBefore(beforeChild); | 435 RenderBlock* flow = continuationBefore(beforeChild); |
436 RenderBoxModelObject* beforeChildParent = 0; | 436 RenderBoxModelObject* beforeChildParent = 0; |
437 if (beforeChild) { | 437 if (beforeChild) { |
438 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); | 438 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); |
439 // Don't attempt to insert into something that isn't a RenderBlockFlow (
block | 439 // Don't attempt to insert into something that isn't a RenderBlockFlow (
block |
440 // container). While the DOM nodes of |beforeChild| and |newChild| are s
iblings, there may | 440 // container). While the DOM nodes of |beforeChild| and |newChild| are s
iblings, there may |
441 // be anonymous table wrapper objects around |beforeChild| on the layout
side. Therefore, | 441 // be anonymous table wrapper objects around |beforeChild| on the layout
side. Therefore, |
442 // find the nearest RenderBlockFlow. If it turns out that the new render
er doesn't belong | 442 // find the nearest RenderBlockFlow. If it turns out that the new render
er doesn't belong |
443 // inside the anonymous table, this will make sure that it's really put
on the outside. If | 443 // inside the anonymous table, this will make sure that it's really put
on the outside. If |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return; | 482 return; |
483 } | 483 } |
484 if (flowIsNormal == childIsNormal) { | 484 if (flowIsNormal == childIsNormal) { |
485 flow->addChildIgnoringContinuation(newChild, 0); // Just treat like an a
ppend. | 485 flow->addChildIgnoringContinuation(newChild, 0); // Just treat like an a
ppend. |
486 return; | 486 return; |
487 } | 487 } |
488 beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); | 488 beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); |
489 } | 489 } |
490 | 490 |
491 | 491 |
492 void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render
Object* beforeChild) | 492 void RenderBlock::addChildToAnonymousColumnBlocks(LayoutObject* newChild, Layout
Object* beforeChild) |
493 { | 493 { |
494 ASSERT(!continuation()); // We don't yet support column spans that aren't im
mediate children of the multi-column block. | 494 ASSERT(!continuation()); // We don't yet support column spans that aren't im
mediate children of the multi-column block. |
495 | 495 |
496 // The goal is to locate a suitable box in which to place our child. | 496 // The goal is to locate a suitable box in which to place our child. |
497 RenderBlock* beforeChildParent = 0; | 497 RenderBlock* beforeChildParent = 0; |
498 if (beforeChild) { | 498 if (beforeChild) { |
499 RenderObject* curr = beforeChild; | 499 LayoutObject* curr = beforeChild; |
500 while (curr && curr->parent() != this) | 500 while (curr && curr->parent() != this) |
501 curr = curr->parent(); | 501 curr = curr->parent(); |
502 beforeChildParent = toRenderBlock(curr); | 502 beforeChildParent = toRenderBlock(curr); |
503 ASSERT(beforeChildParent); | 503 ASSERT(beforeChildParent); |
504 ASSERT(beforeChildParent->isAnonymousColumnsBlock() || beforeChildParent
->isAnonymousColumnSpanBlock()); | 504 ASSERT(beforeChildParent->isAnonymousColumnsBlock() || beforeChildParent
->isAnonymousColumnSpanBlock()); |
505 } else | 505 } else |
506 beforeChildParent = toRenderBlock(lastChild()); | 506 beforeChildParent = toRenderBlock(lastChild()); |
507 | 507 |
508 // If the new child is floating or positioned it can just go in that block. | 508 // If the new child is floating or positioned it can just go in that block. |
509 if (newChild->isFloatingOrOutOfFlowPositioned()) { | 509 if (newChild->isFloatingOrOutOfFlowPositioned()) { |
(...skipping 11 matching lines...) Expand all Loading... |
521 } | 521 } |
522 | 522 |
523 if (!beforeChild) { | 523 if (!beforeChild) { |
524 // Create a new block of the correct type. | 524 // Create a new block of the correct type. |
525 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanB
lock() : createAnonymousColumnsBlock(); | 525 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanB
lock() : createAnonymousColumnsBlock(); |
526 children()->appendChildNode(this, newBox); | 526 children()->appendChildNode(this, newBox); |
527 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); | 527 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); |
528 return; | 528 return; |
529 } | 529 } |
530 | 530 |
531 RenderObject* immediateChild = beforeChild; | 531 LayoutObject* immediateChild = beforeChild; |
532 bool isPreviousBlockViable = true; | 532 bool isPreviousBlockViable = true; |
533 while (immediateChild->parent() != this) { | 533 while (immediateChild->parent() != this) { |
534 if (isPreviousBlockViable) | 534 if (isPreviousBlockViable) |
535 isPreviousBlockViable = !immediateChild->previousSibling(); | 535 isPreviousBlockViable = !immediateChild->previousSibling(); |
536 immediateChild = immediateChild->parent(); | 536 immediateChild = immediateChild->parent(); |
537 } | 537 } |
538 if (isPreviousBlockViable && immediateChild->previousSibling()) { | 538 if (isPreviousBlockViable && immediateChild->previousSibling()) { |
539 toRenderBlock(immediateChild->previousSibling())->addChildIgnoringAnonym
ousColumnBlocks(newChild, 0); // Treat like an append. | 539 toRenderBlock(immediateChild->previousSibling())->addChildIgnoringAnonym
ousColumnBlocks(newChild, 0); // Treat like an append. |
540 return; | 540 return; |
541 } | 541 } |
542 | 542 |
543 // Split our anonymous blocks. | 543 // Split our anonymous blocks. |
544 RenderObject* newBeforeChild = splitAnonymousBoxesAroundChild(beforeChild); | 544 LayoutObject* newBeforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
545 | 545 |
546 | 546 |
547 // Create a new anonymous box of the appropriate type. | 547 // Create a new anonymous box of the appropriate type. |
548 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock
() : createAnonymousColumnsBlock(); | 548 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock
() : createAnonymousColumnsBlock(); |
549 children()->insertChildNode(this, newBox, newBeforeChild); | 549 children()->insertChildNode(this, newBox, newBeforeChild); |
550 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); | 550 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); |
551 return; | 551 return; |
552 } | 552 } |
553 | 553 |
554 RenderBlockFlow* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBl
ock) | 554 RenderBlockFlow* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBl
ock) |
555 { | 555 { |
556 RenderBlock* firstChildIgnoringAnonymousWrappers = 0; | 556 RenderBlock* firstChildIgnoringAnonymousWrappers = 0; |
557 for (RenderObject* curr = this; curr; curr = curr->parent()) { | 557 for (LayoutObject* curr = this; curr; curr = curr->parent()) { |
558 if (!curr->isRenderBlock() || curr->isFloatingOrOutOfFlowPositioned() ||
curr->isTableCell() || curr->isDocumentElement() || curr->isRenderView() || cur
r->hasOverflowClip() | 558 if (!curr->isRenderBlock() || curr->isFloatingOrOutOfFlowPositioned() ||
curr->isTableCell() || curr->isDocumentElement() || curr->isRenderView() || cur
r->hasOverflowClip() |
559 || curr->isInlineBlockOrInlineTable()) | 559 || curr->isInlineBlockOrInlineTable()) |
560 return 0; | 560 return 0; |
561 | 561 |
562 // FIXME: Renderers that do special management of their children (tables
, buttons, | 562 // FIXME: Renderers that do special management of their children (tables
, buttons, |
563 // lists, flexboxes, etc.) breaks when the flow is split through them. D
isabling | 563 // lists, flexboxes, etc.) breaks when the flow is split through them. D
isabling |
564 // multi-column for them to avoid this problem.) | 564 // multi-column for them to avoid this problem.) |
565 if (!curr->isRenderBlockFlow() || curr->isListItem()) | 565 if (!curr->isRenderBlockFlow() || curr->isListItem()) |
566 return 0; | 566 return 0; |
567 | 567 |
(...skipping 11 matching lines...) Expand all Loading... |
579 } | 579 } |
580 | 580 |
581 RenderBlock* RenderBlock::clone() const | 581 RenderBlock* RenderBlock::clone() const |
582 { | 582 { |
583 RenderBlock* cloneBlock; | 583 RenderBlock* cloneBlock; |
584 if (isAnonymousBlock()) { | 584 if (isAnonymousBlock()) { |
585 cloneBlock = createAnonymousBlock(); | 585 cloneBlock = createAnonymousBlock(); |
586 cloneBlock->setChildrenInline(childrenInline()); | 586 cloneBlock->setChildrenInline(childrenInline()); |
587 } | 587 } |
588 else { | 588 else { |
589 RenderObject* cloneRenderer = toElement(node())->createRenderer(styleRef
()); | 589 LayoutObject* cloneRenderer = toElement(node())->createRenderer(styleRef
()); |
590 cloneBlock = toRenderBlock(cloneRenderer); | 590 cloneBlock = toRenderBlock(cloneRenderer); |
591 cloneBlock->setStyle(style()); | 591 cloneBlock->setStyle(style()); |
592 | 592 |
593 // This takes care of setting the right value of childrenInline in case | 593 // This takes care of setting the right value of childrenInline in case |
594 // generated content is added to cloneBlock and 'this' does not have | 594 // generated content is added to cloneBlock and 'this' does not have |
595 // generated content added yet. | 595 // generated content added yet. |
596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); | 596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); |
597 } | 597 } |
598 cloneBlock->setFlowThreadState(flowThreadState()); | 598 cloneBlock->setFlowThreadState(flowThreadState()); |
599 return cloneBlock; | 599 return cloneBlock; |
600 } | 600 } |
601 | 601 |
602 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, | 602 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, |
603 RenderBlock* middleBlock, | 603 RenderBlock* middleBlock, |
604 RenderObject* beforeChild, RenderBoxModelObject* o
ldCont) | 604 LayoutObject* beforeChild, RenderBoxModelObject* oldCont) |
605 { | 605 { |
606 ASSERT(isDescendantOf(fromBlock)); | 606 ASSERT(isDescendantOf(fromBlock)); |
607 | 607 |
608 if (!beforeChild && isAfterContent(lastChild())) | 608 if (!beforeChild && isAfterContent(lastChild())) |
609 beforeChild = lastChild(); | 609 beforeChild = lastChild(); |
610 | 610 |
611 Vector<RenderBlock*> blocksToClone; | 611 Vector<RenderBlock*> blocksToClone; |
612 for (RenderObject* o = this; o != fromBlock; o = o->parent()) | 612 for (LayoutObject* o = this; o != fromBlock; o = o->parent()) |
613 blocksToClone.append(toRenderBlock(o)); | 613 blocksToClone.append(toRenderBlock(o)); |
614 | 614 |
615 // Create a new clone of the top-most block. | 615 // Create a new clone of the top-most block. |
616 RenderBlock* topMostBlockToClone = blocksToClone.last(); | 616 RenderBlock* topMostBlockToClone = blocksToClone.last(); |
617 RenderBlock* cloneBlock = topMostBlockToClone->clone(); | 617 RenderBlock* cloneBlock = topMostBlockToClone->clone(); |
618 | 618 |
619 // Put |cloneBlock| as a child of |toBlock|. | 619 // Put |cloneBlock| as a child of |toBlock|. |
620 toBlock->children()->appendChildNode(toBlock, cloneBlock); | 620 toBlock->children()->appendChildNode(toBlock, cloneBlock); |
621 | 621 |
622 // Now take all the children after |topMostBlockToClone| and remove them fro
m the |fromBlock| | 622 // Now take all the children after |topMostBlockToClone| and remove them fro
m the |fromBlock| |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 if (!isAnonymousBlock()) { | 661 if (!isAnonymousBlock()) { |
662 cloneBlock->setContinuation(oldCont); | 662 cloneBlock->setContinuation(oldCont); |
663 middleBlock->setContinuation(cloneBlock); | 663 middleBlock->setContinuation(cloneBlock); |
664 } | 664 } |
665 | 665 |
666 // Now take all of the children from |beforeChild| to the end and remove | 666 // Now take all of the children from |beforeChild| to the end and remove |
667 // them from |this| and place them in the |cloneBlock|. | 667 // them from |this| and place them in the |cloneBlock|. |
668 moveChildrenTo(cloneBlock, beforeChild, nullptr, true); | 668 moveChildrenTo(cloneBlock, beforeChild, nullptr, true); |
669 } | 669 } |
670 | 670 |
671 void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, | 671 void RenderBlock::splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox, |
672 RenderObject* newChild, RenderBoxModelObject* oldCon
t) | 672 LayoutObject* newChild, RenderBoxModelObject* oldCont) |
673 { | 673 { |
674 RenderBlock* pre = 0; | 674 RenderBlock* pre = 0; |
675 RenderBlock* block = containingColumnsBlock(); | 675 RenderBlock* block = containingColumnsBlock(); |
676 | 676 |
677 // Delete our line boxes before we do the inline split into continuations. | 677 // Delete our line boxes before we do the inline split into continuations. |
678 block->deleteLineBoxTree(); | 678 block->deleteLineBoxTree(); |
679 | 679 |
680 bool madeNewBeforeBlock = false; | 680 bool madeNewBeforeBlock = false; |
681 if (block->isAnonymousColumnsBlock()) { | 681 if (block->isAnonymousColumnsBlock()) { |
682 // We can reuse this block and make it the preBlock of the next continua
tion. | 682 // We can reuse this block and make it the preBlock of the next continua
tion. |
683 pre = block; | 683 pre = block; |
684 pre->removePositionedObjects(0); | 684 pre->removePositionedObjects(0); |
685 if (block->isRenderBlockFlow()) | 685 if (block->isRenderBlockFlow()) |
686 toRenderBlockFlow(pre)->removeFloatingObjects(); | 686 toRenderBlockFlow(pre)->removeFloatingObjects(); |
687 block = toRenderBlock(block->parent()); | 687 block = toRenderBlock(block->parent()); |
688 } else { | 688 } else { |
689 // No anonymous block available for use. Make one. | 689 // No anonymous block available for use. Make one. |
690 pre = block->createAnonymousColumnsBlock(); | 690 pre = block->createAnonymousColumnsBlock(); |
691 pre->setChildrenInline(false); | 691 pre->setChildrenInline(false); |
692 madeNewBeforeBlock = true; | 692 madeNewBeforeBlock = true; |
693 } | 693 } |
694 | 694 |
695 RenderBlock* post = block->createAnonymousColumnsBlock(); | 695 RenderBlock* post = block->createAnonymousColumnsBlock(); |
696 post->setChildrenInline(false); | 696 post->setChildrenInline(false); |
697 | 697 |
698 RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nex
tSibling(); | 698 LayoutObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nex
tSibling(); |
699 if (madeNewBeforeBlock) | 699 if (madeNewBeforeBlock) |
700 block->children()->insertChildNode(block, pre, boxFirst); | 700 block->children()->insertChildNode(block, pre, boxFirst); |
701 block->children()->insertChildNode(block, newBlockBox, boxFirst); | 701 block->children()->insertChildNode(block, newBlockBox, boxFirst); |
702 block->children()->insertChildNode(block, post, boxFirst); | 702 block->children()->insertChildNode(block, post, boxFirst); |
703 block->setChildrenInline(false); | 703 block->setChildrenInline(false); |
704 | 704 |
705 if (madeNewBeforeBlock) | 705 if (madeNewBeforeBlock) |
706 block->moveChildrenTo(pre, boxFirst, 0, true); | 706 block->moveChildrenTo(pre, boxFirst, 0, true); |
707 | 707 |
708 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); | 708 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); |
709 | 709 |
710 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 710 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
711 // time in makeChildrenNonInline by just setting this explicitly up front. | 711 // time in makeChildrenNonInline by just setting this explicitly up front. |
712 newBlockBox->setChildrenInline(false); | 712 newBlockBox->setChildrenInline(false); |
713 | 713 |
714 newBlockBox->addChild(newChild); | 714 newBlockBox->addChild(newChild); |
715 | 715 |
716 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 716 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
717 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 717 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
718 // make new line boxes instead of leaving the old line boxes around. | 718 // make new line boxes instead of leaving the old line boxes around. |
719 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 719 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
720 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 720 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
721 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 721 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
722 } | 722 } |
723 | 723 |
724 void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, R
enderBlockFlow* newBlockBox, RenderObject* newChild) | 724 void RenderBlock::makeChildrenAnonymousColumnBlocks(LayoutObject* beforeChild, R
enderBlockFlow* newBlockBox, LayoutObject* newChild) |
725 { | 725 { |
726 RenderBlockFlow* pre = 0; | 726 RenderBlockFlow* pre = 0; |
727 RenderBlockFlow* post = 0; | 727 RenderBlockFlow* post = 0; |
728 RenderBlock* block = this; // Eventually block will not just be |this|, but
will also be a block nested inside |this|. Assign to a variable | 728 RenderBlock* block = this; // Eventually block will not just be |this|, but
will also be a block nested inside |this|. Assign to a variable |
729 // so that we don't have to patch all of the rest
of the code later on. | 729 // so that we don't have to patch all of the rest
of the code later on. |
730 | 730 |
731 // Delete the block's line boxes before we do the split. | 731 // Delete the block's line boxes before we do the split. |
732 block->deleteLineBoxTree(); | 732 block->deleteLineBoxTree(); |
733 | 733 |
734 if (beforeChild && beforeChild->parent() != this) | 734 if (beforeChild && beforeChild->parent() != this) |
735 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); | 735 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
736 | 736 |
737 if (beforeChild != firstChild()) { | 737 if (beforeChild != firstChild()) { |
738 pre = block->createAnonymousColumnsBlock(); | 738 pre = block->createAnonymousColumnsBlock(); |
739 pre->setChildrenInline(block->childrenInline()); | 739 pre->setChildrenInline(block->childrenInline()); |
740 } | 740 } |
741 | 741 |
742 if (beforeChild) { | 742 if (beforeChild) { |
743 post = block->createAnonymousColumnsBlock(); | 743 post = block->createAnonymousColumnsBlock(); |
744 post->setChildrenInline(block->childrenInline()); | 744 post->setChildrenInline(block->childrenInline()); |
745 } | 745 } |
746 | 746 |
747 RenderObject* boxFirst = block->firstChild(); | 747 LayoutObject* boxFirst = block->firstChild(); |
748 if (pre) | 748 if (pre) |
749 block->children()->insertChildNode(block, pre, boxFirst); | 749 block->children()->insertChildNode(block, pre, boxFirst); |
750 block->children()->insertChildNode(block, newBlockBox, boxFirst); | 750 block->children()->insertChildNode(block, newBlockBox, boxFirst); |
751 if (post) | 751 if (post) |
752 block->children()->insertChildNode(block, post, boxFirst); | 752 block->children()->insertChildNode(block, post, boxFirst); |
753 block->setChildrenInline(false); | 753 block->setChildrenInline(false); |
754 | 754 |
755 // The pre/post blocks always have layers, so we know to always do a full in
sert/remove (so we pass true as the last argument). | 755 // The pre/post blocks always have layers, so we know to always do a full in
sert/remove (so we pass true as the last argument). |
756 block->moveChildrenTo(pre, boxFirst, beforeChild, true); | 756 block->moveChildrenTo(pre, boxFirst, beforeChild, true); |
757 block->moveChildrenTo(post, beforeChild, 0, true); | 757 block->moveChildrenTo(post, beforeChild, 0, true); |
758 | 758 |
759 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 759 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
760 // time in makeChildrenNonInline by just setting this explicitly up front. | 760 // time in makeChildrenNonInline by just setting this explicitly up front. |
761 newBlockBox->setChildrenInline(false); | 761 newBlockBox->setChildrenInline(false); |
762 | 762 |
763 newBlockBox->addChild(newChild); | 763 newBlockBox->addChild(newChild); |
764 | 764 |
765 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 765 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
766 // get deleted properly. Because objects moved from the pre block into the
post block, we want to | 766 // get deleted properly. Because objects moved from the pre block into the
post block, we want to |
767 // make new line boxes instead of leaving the old line boxes around. | 767 // make new line boxes instead of leaving the old line boxes around. |
768 if (pre) | 768 if (pre) |
769 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 769 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
770 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 770 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
771 if (post) | 771 if (post) |
772 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 772 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
773 } | 773 } |
774 | 774 |
775 RenderBlockFlow* RenderBlock::columnsBlockForSpanningElement(RenderObject* newCh
ild) | 775 RenderBlockFlow* RenderBlock::columnsBlockForSpanningElement(LayoutObject* newCh
ild) |
776 { | 776 { |
777 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will | 777 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will |
778 // be added to in three stages: | 778 // be added to in three stages: |
779 // (1) Immediate children of a multi-column block can span. | 779 // (1) Immediate children of a multi-column block can span. |
780 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. | 780 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. |
781 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we | 781 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we |
782 // cross the streams and have to cope with both types of continuations mixed
together). | 782 // cross the streams and have to cope with both types of continuations mixed
together). |
783 // This function currently supports (1) and (2). | 783 // This function currently supports (1) and (2). |
784 RenderBlockFlow* columnsBlockAncestor = 0; | 784 RenderBlockFlow* columnsBlockAncestor = 0; |
785 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isB
eforeOrAfterContent() | 785 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isB
eforeOrAfterContent() |
786 && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isInline()
&& !newChild->isTablePart() | 786 && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isInline()
&& !newChild->isTablePart() |
787 && !isAnonymousColumnSpanBlock()) { | 787 && !isAnonymousColumnSpanBlock()) { |
788 columnsBlockAncestor = containingColumnsBlock(false); | 788 columnsBlockAncestor = containingColumnsBlock(false); |
789 if (columnsBlockAncestor) { | 789 if (columnsBlockAncestor) { |
790 // Make sure that none of the parent ancestors have a continuation. | 790 // Make sure that none of the parent ancestors have a continuation. |
791 // If yes, we do not want split the block into continuations. | 791 // If yes, we do not want split the block into continuations. |
792 RenderObject* curr = this; | 792 LayoutObject* curr = this; |
793 while (curr && curr != columnsBlockAncestor) { | 793 while (curr && curr != columnsBlockAncestor) { |
794 if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()
) { | 794 if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()
) { |
795 columnsBlockAncestor = 0; | 795 columnsBlockAncestor = 0; |
796 break; | 796 break; |
797 } | 797 } |
798 curr = curr->parent(); | 798 curr = curr->parent(); |
799 } | 799 } |
800 } | 800 } |
801 } | 801 } |
802 return columnsBlockAncestor; | 802 return columnsBlockAncestor; |
803 } | 803 } |
804 | 804 |
805 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) | 805 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(LayoutObject* newChild,
LayoutObject* beforeChild) |
806 { | 806 { |
807 if (beforeChild && beforeChild->parent() != this) { | 807 if (beforeChild && beforeChild->parent() != this) { |
808 RenderObject* beforeChildContainer = beforeChild->parent(); | 808 LayoutObject* beforeChildContainer = beforeChild->parent(); |
809 while (beforeChildContainer->parent() != this) | 809 while (beforeChildContainer->parent() != this) |
810 beforeChildContainer = beforeChildContainer->parent(); | 810 beforeChildContainer = beforeChildContainer->parent(); |
811 ASSERT(beforeChildContainer); | 811 ASSERT(beforeChildContainer); |
812 | 812 |
813 if (beforeChildContainer->isAnonymous()) { | 813 if (beforeChildContainer->isAnonymous()) { |
814 // If the requested beforeChild is not one of our children, then thi
s is because | 814 // If the requested beforeChild is not one of our children, then thi
s is because |
815 // there is an anonymous container within this object that contains
the beforeChild. | 815 // there is an anonymous container within this object that contains
the beforeChild. |
816 RenderObject* beforeChildAnonymousContainer = beforeChildContainer; | 816 LayoutObject* beforeChildAnonymousContainer = beforeChildContainer; |
817 if (beforeChildAnonymousContainer->isAnonymousBlock() | 817 if (beforeChildAnonymousContainer->isAnonymousBlock() |
818 // Full screen renderers and full screen placeholders act as ano
nymous blocks, not tables: | 818 // Full screen renderers and full screen placeholders act as ano
nymous blocks, not tables: |
819 || beforeChildAnonymousContainer->isRenderFullScreen() | 819 || beforeChildAnonymousContainer->isRenderFullScreen() |
820 || beforeChildAnonymousContainer->isRenderFullScreenPlaceholder(
) | 820 || beforeChildAnonymousContainer->isRenderFullScreenPlaceholder(
) |
821 ) { | 821 ) { |
822 // Insert the child into the anonymous block box instead of here
. | 822 // Insert the child into the anonymous block box instead of here
. |
823 if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPosit
ioned() || beforeChild->parent()->slowFirstChild() != beforeChild) | 823 if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPosit
ioned() || beforeChild->parent()->slowFirstChild() != beforeChild) |
824 beforeChild->parent()->addChild(newChild, beforeChild); | 824 beforeChild->parent()->addChild(newChild, beforeChild); |
825 else | 825 else |
826 addChild(newChild, beforeChild->parent()); | 826 addChild(newChild, beforeChild->parent()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 887 |
888 if (beforeChild && beforeChild->parent() != this) { | 888 if (beforeChild && beforeChild->parent() != this) { |
889 beforeChild = beforeChild->parent(); | 889 beforeChild = beforeChild->parent(); |
890 ASSERT(beforeChild->isAnonymousBlock()); | 890 ASSERT(beforeChild->isAnonymousBlock()); |
891 ASSERT(beforeChild->parent() == this); | 891 ASSERT(beforeChild->parent() == this); |
892 } | 892 } |
893 } else if (!childrenInline() && (newChild->isFloatingOrOutOfFlowPositioned()
|| newChild->isInline())) { | 893 } else if (!childrenInline() && (newChild->isFloatingOrOutOfFlowPositioned()
|| newChild->isInline())) { |
894 // If we're inserting an inline child but all of our children are blocks
, then we have to make sure | 894 // If we're inserting an inline child but all of our children are blocks
, then we have to make sure |
895 // it is put into an anomyous block box. We try to use an existing anony
mous box if possible, otherwise | 895 // it is put into an anomyous block box. We try to use an existing anony
mous box if possible, otherwise |
896 // a new one is created and inserted into our list of children in the ap
propriate position. | 896 // a new one is created and inserted into our list of children in the ap
propriate position. |
897 RenderObject* afterChild = beforeChild ? beforeChild->previousSibling()
: lastChild(); | 897 LayoutObject* afterChild = beforeChild ? beforeChild->previousSibling()
: lastChild(); |
898 | 898 |
899 if (afterChild && afterChild->isAnonymousBlock()) { | 899 if (afterChild && afterChild->isAnonymousBlock()) { |
900 afterChild->addChild(newChild); | 900 afterChild->addChild(newChild); |
901 return; | 901 return; |
902 } | 902 } |
903 | 903 |
904 if (newChild->isInline()) { | 904 if (newChild->isInline()) { |
905 // No suitable existing anonymous box - create a new one. | 905 // No suitable existing anonymous box - create a new one. |
906 RenderBlock* newBox = createAnonymousBlock(); | 906 RenderBlock* newBox = createAnonymousBlock(); |
907 RenderBox::addChild(newBox, beforeChild); | 907 RenderBox::addChild(newBox, beforeChild); |
908 newBox->addChild(newChild); | 908 newBox->addChild(newChild); |
909 return; | 909 return; |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 RenderBox::addChild(newChild, beforeChild); | 913 RenderBox::addChild(newChild, beforeChild); |
914 | 914 |
915 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRend
erBlock()) | 915 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRend
erBlock()) |
916 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); | 916 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
917 // this object may be dead here | 917 // this object may be dead here |
918 } | 918 } |
919 | 919 |
920 void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) | 920 void RenderBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
921 { | 921 { |
922 if (continuation() && !isAnonymousBlock()) | 922 if (continuation() && !isAnonymousBlock()) |
923 addChildToContinuation(newChild, beforeChild); | 923 addChildToContinuation(newChild, beforeChild); |
924 else | 924 else |
925 addChildIgnoringContinuation(newChild, beforeChild); | 925 addChildIgnoringContinuation(newChild, beforeChild); |
926 } | 926 } |
927 | 927 |
928 void RenderBlock::addChildIgnoringContinuation(RenderObject* newChild, RenderObj
ect* beforeChild) | 928 void RenderBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
ect* beforeChild) |
929 { | 929 { |
930 if (!isAnonymousBlock() && firstChild() && (firstChild()->isAnonymousColumns
Block() || firstChild()->isAnonymousColumnSpanBlock())) | 930 if (!isAnonymousBlock() && firstChild() && (firstChild()->isAnonymousColumns
Block() || firstChild()->isAnonymousColumnSpanBlock())) |
931 addChildToAnonymousColumnBlocks(newChild, beforeChild); | 931 addChildToAnonymousColumnBlocks(newChild, beforeChild); |
932 else | 932 else |
933 addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); | 933 addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); |
934 } | 934 } |
935 | 935 |
936 static void getInlineRun(RenderObject* start, RenderObject* boundary, | 936 static void getInlineRun(LayoutObject* start, LayoutObject* boundary, |
937 RenderObject*& inlineRunStart, | 937 LayoutObject*& inlineRunStart, |
938 RenderObject*& inlineRunEnd) | 938 LayoutObject*& inlineRunEnd) |
939 { | 939 { |
940 // Beginning at |start| we find the largest contiguous run of inlines that | 940 // Beginning at |start| we find the largest contiguous run of inlines that |
941 // we can. We denote the run with start and end points, |inlineRunStart| | 941 // we can. We denote the run with start and end points, |inlineRunStart| |
942 // and |inlineRunEnd|. Note that these two values may be the same if | 942 // and |inlineRunEnd|. Note that these two values may be the same if |
943 // we encounter only one inline. | 943 // we encounter only one inline. |
944 // | 944 // |
945 // We skip any non-inlines we encounter as long as we haven't found any | 945 // We skip any non-inlines we encounter as long as we haven't found any |
946 // inlines yet. | 946 // inlines yet. |
947 // | 947 // |
948 // |boundary| indicates a non-inclusive boundary point. Regardless of wheth
er |boundary| | 948 // |boundary| indicates a non-inclusive boundary point. Regardless of wheth
er |boundary| |
949 // is inline or not, we will not include it in a run with inlines before it.
It's as though we encountered | 949 // is inline or not, we will not include it in a run with inlines before it.
It's as though we encountered |
950 // a non-inline. | 950 // a non-inline. |
951 | 951 |
952 // Start by skipping as many non-inlines as we can. | 952 // Start by skipping as many non-inlines as we can. |
953 RenderObject * curr = start; | 953 LayoutObject * curr = start; |
954 bool sawInline; | 954 bool sawInline; |
955 do { | 955 do { |
956 while (curr && !(curr->isInline() || curr->isFloatingOrOutOfFlowPosition
ed())) | 956 while (curr && !(curr->isInline() || curr->isFloatingOrOutOfFlowPosition
ed())) |
957 curr = curr->nextSibling(); | 957 curr = curr->nextSibling(); |
958 | 958 |
959 inlineRunStart = inlineRunEnd = curr; | 959 inlineRunStart = inlineRunEnd = curr; |
960 | 960 |
961 if (!curr) | 961 if (!curr) |
962 return; // No more inline children to be found. | 962 return; // No more inline children to be found. |
963 | 963 |
964 sawInline = curr->isInline(); | 964 sawInline = curr->isInline(); |
965 | 965 |
966 curr = curr->nextSibling(); | 966 curr = curr->nextSibling(); |
967 while (curr && (curr->isInline() || curr->isFloatingOrOutOfFlowPositione
d()) && (curr != boundary)) { | 967 while (curr && (curr->isInline() || curr->isFloatingOrOutOfFlowPositione
d()) && (curr != boundary)) { |
968 inlineRunEnd = curr; | 968 inlineRunEnd = curr; |
969 if (curr->isInline()) | 969 if (curr->isInline()) |
970 sawInline = true; | 970 sawInline = true; |
971 curr = curr->nextSibling(); | 971 curr = curr->nextSibling(); |
972 } | 972 } |
973 } while (!sawInline); | 973 } while (!sawInline); |
974 } | 974 } |
975 | 975 |
976 void RenderBlock::deleteLineBoxTree() | 976 void RenderBlock::deleteLineBoxTree() |
977 { | 977 { |
978 ASSERT(!m_lineBoxes.firstLineBox()); | 978 ASSERT(!m_lineBoxes.firstLineBox()); |
979 } | 979 } |
980 | 980 |
981 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) | 981 void RenderBlock::makeChildrenNonInline(LayoutObject *insertionPoint) |
982 { | 982 { |
983 // makeChildrenNonInline takes a block whose children are *all* inline and i
t | 983 // makeChildrenNonInline takes a block whose children are *all* inline and i
t |
984 // makes sure that inline children are coalesced under anonymous | 984 // makes sure that inline children are coalesced under anonymous |
985 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for | 985 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for |
986 // the new block child that is causing us to have to wrap all the inlines.
This | 986 // the new block child that is causing us to have to wrap all the inlines.
This |
987 // means that we cannot coalesce inlines before |insertionPoint| with inline
s following | 987 // means that we cannot coalesce inlines before |insertionPoint| with inline
s following |
988 // |insertionPoint|, because the new child is going to be inserted in betwee
n the inlines, | 988 // |insertionPoint|, because the new child is going to be inserted in betwee
n the inlines, |
989 // splitting them. | 989 // splitting them. |
990 ASSERT(isInlineBlockOrInlineTable() || !isInline()); | 990 ASSERT(isInlineBlockOrInlineTable() || !isInline()); |
991 ASSERT(!insertionPoint || insertionPoint->parent() == this); | 991 ASSERT(!insertionPoint || insertionPoint->parent() == this); |
992 | 992 |
993 setChildrenInline(false); | 993 setChildrenInline(false); |
994 | 994 |
995 RenderObject *child = firstChild(); | 995 LayoutObject* child = firstChild(); |
996 if (!child) | 996 if (!child) |
997 return; | 997 return; |
998 | 998 |
999 deleteLineBoxTree(); | 999 deleteLineBoxTree(); |
1000 | 1000 |
1001 while (child) { | 1001 while (child) { |
1002 RenderObject *inlineRunStart, *inlineRunEnd; | 1002 LayoutObject* inlineRunStart; |
| 1003 LayoutObject* inlineRunEnd; |
1003 getInlineRun(child, insertionPoint, inlineRunStart, inlineRunEnd); | 1004 getInlineRun(child, insertionPoint, inlineRunStart, inlineRunEnd); |
1004 | 1005 |
1005 if (!inlineRunStart) | 1006 if (!inlineRunStart) |
1006 break; | 1007 break; |
1007 | 1008 |
1008 child = inlineRunEnd->nextSibling(); | 1009 child = inlineRunEnd->nextSibling(); |
1009 | 1010 |
1010 RenderBlock* block = createAnonymousBlock(); | 1011 RenderBlock* block = createAnonymousBlock(); |
1011 children()->insertChildNode(this, block, inlineRunStart); | 1012 children()->insertChildNode(this, block, inlineRunStart); |
1012 moveChildrenTo(block, inlineRunStart, child); | 1013 moveChildrenTo(block, inlineRunStart, child); |
1013 } | 1014 } |
1014 | 1015 |
1015 #if ENABLE(ASSERT) | 1016 #if ENABLE(ASSERT) |
1016 for (RenderObject *c = firstChild(); c; c = c->nextSibling()) | 1017 for (LayoutObject *c = firstChild(); c; c = c->nextSibling()) |
1017 ASSERT(!c->isInline()); | 1018 ASSERT(!c->isInline()); |
1018 #endif | 1019 #endif |
1019 | 1020 |
1020 setShouldDoFullPaintInvalidation(); | 1021 setShouldDoFullPaintInvalidation(); |
1021 } | 1022 } |
1022 | 1023 |
1023 void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child) | 1024 void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child) |
1024 { | 1025 { |
1025 ASSERT(child->isAnonymousBlock()); | 1026 ASSERT(child->isAnonymousBlock()); |
1026 ASSERT(!child->childrenInline()); | 1027 ASSERT(!child->childrenInline()); |
1027 | 1028 |
1028 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu
mnSpanBlock() || child->isAnonymousColumnsBlock()))) | 1029 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu
mnSpanBlock() || child->isAnonymousColumnsBlock()))) |
1029 return; | 1030 return; |
1030 | 1031 |
1031 RenderObject* firstAnChild = child->m_children.firstChild(); | 1032 LayoutObject* firstAnChild = child->m_children.firstChild(); |
1032 RenderObject* lastAnChild = child->m_children.lastChild(); | 1033 LayoutObject* lastAnChild = child->m_children.lastChild(); |
1033 if (firstAnChild) { | 1034 if (firstAnChild) { |
1034 RenderObject* o = firstAnChild; | 1035 LayoutObject* o = firstAnChild; |
1035 while (o) { | 1036 while (o) { |
1036 o->setParent(this); | 1037 o->setParent(this); |
1037 o = o->nextSibling(); | 1038 o = o->nextSibling(); |
1038 } | 1039 } |
1039 firstAnChild->setPreviousSibling(child->previousSibling()); | 1040 firstAnChild->setPreviousSibling(child->previousSibling()); |
1040 lastAnChild->setNextSibling(child->nextSibling()); | 1041 lastAnChild->setNextSibling(child->nextSibling()); |
1041 if (child->previousSibling()) | 1042 if (child->previousSibling()) |
1042 child->previousSibling()->setNextSibling(firstAnChild); | 1043 child->previousSibling()->setNextSibling(firstAnChild); |
1043 if (child->nextSibling()) | 1044 if (child->nextSibling()) |
1044 child->nextSibling()->setPreviousSibling(lastAnChild); | 1045 child->nextSibling()->setPreviousSibling(lastAnChild); |
(...skipping 24 matching lines...) Expand all Loading... |
1069 if (child->parent()->isRenderGrid()) | 1070 if (child->parent()->isRenderGrid()) |
1070 toRenderGrid(child->parent())->dirtyGrid(); | 1071 toRenderGrid(child->parent())->dirtyGrid(); |
1071 | 1072 |
1072 child->setParent(0); | 1073 child->setParent(0); |
1073 child->setPreviousSibling(0); | 1074 child->setPreviousSibling(0); |
1074 child->setNextSibling(0); | 1075 child->setNextSibling(0); |
1075 | 1076 |
1076 child->destroy(); | 1077 child->destroy(); |
1077 } | 1078 } |
1078 | 1079 |
1079 static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje
ct* prev, RenderObject* next) | 1080 static bool canMergeContiguousAnonymousBlocks(LayoutObject* oldChild, LayoutObje
ct* prev, LayoutObject* next) |
1080 { | 1081 { |
1081 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild->
virtualContinuation()) | 1082 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild->
virtualContinuation()) |
1082 return false; | 1083 return false; |
1083 | 1084 |
1084 if ((prev && (!prev->isAnonymousBlock() || toRenderBlock(prev)->continuation
() || toRenderBlock(prev)->beingDestroyed())) | 1085 if ((prev && (!prev->isAnonymousBlock() || toRenderBlock(prev)->continuation
() || toRenderBlock(prev)->beingDestroyed())) |
1085 || (next && (!next->isAnonymousBlock() || toRenderBlock(next)->continuat
ion() || toRenderBlock(next)->beingDestroyed()))) | 1086 || (next && (!next->isAnonymousBlock() || toRenderBlock(next)->continuat
ion() || toRenderBlock(next)->beingDestroyed()))) |
1086 return false; | 1087 return false; |
1087 | 1088 |
1088 if ((prev && (prev->isRubyRun() || prev->isRubyBase())) | 1089 if ((prev && (prev->isRubyRun() || prev->isRubyBase())) |
1089 || (next && (next->isRubyRun() || next->isRubyBase()))) | 1090 || (next && (next->isRubyRun() || next->isRubyBase()))) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1122 |
1122 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock*
child) | 1123 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock*
child) |
1123 { | 1124 { |
1124 // It's possible that this block's destruction may have been triggered by th
e | 1125 // It's possible that this block's destruction may have been triggered by th
e |
1125 // child's removal. Just bail if the anonymous child block is already being | 1126 // child's removal. Just bail if the anonymous child block is already being |
1126 // destroyed. See crbug.com/282088 | 1127 // destroyed. See crbug.com/282088 |
1127 if (child->beingDestroyed()) | 1128 if (child->beingDestroyed()) |
1128 return; | 1129 return; |
1129 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 1130 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
1130 parent->setChildrenInline(child->childrenInline()); | 1131 parent->setChildrenInline(child->childrenInline()); |
1131 RenderObject* nextSibling = child->nextSibling(); | 1132 LayoutObject* nextSibling = child->nextSibling(); |
1132 | 1133 |
1133 parent->children()->removeChildNode(parent, child, child->hasLayer()); | 1134 parent->children()->removeChildNode(parent, child, child->hasLayer()); |
1134 // FIXME: Get rid of the temporary disabling of continuations. This is neede
d by the old | 1135 // FIXME: Get rid of the temporary disabling of continuations. This is neede
d by the old |
1135 // multicol implementation, because of buggy block continuation handling (wh
ich is hard and | 1136 // multicol implementation, because of buggy block continuation handling (wh
ich is hard and |
1136 // rather pointless to fix at this point). Support for block continuations c
an be removed | 1137 // rather pointless to fix at this point). Support for block continuations c
an be removed |
1137 // together with the old multicol implementation. crbug.com/408123 | 1138 // together with the old multicol implementation. crbug.com/408123 |
1138 RenderBoxModelObject* temporarilyInactiveContinuation = parent->continuation
(); | 1139 RenderBoxModelObject* temporarilyInactiveContinuation = parent->continuation
(); |
1139 if (temporarilyInactiveContinuation) | 1140 if (temporarilyInactiveContinuation) |
1140 parent->setContinuation(0); | 1141 parent->setContinuation(0); |
1141 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); | 1142 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); |
1142 if (temporarilyInactiveContinuation) | 1143 if (temporarilyInactiveContinuation) |
1143 parent->setContinuation(temporarilyInactiveContinuation); | 1144 parent->setContinuation(temporarilyInactiveContinuation); |
1144 // Explicitly delete the child's line box tree, or the special anonymous | 1145 // Explicitly delete the child's line box tree, or the special anonymous |
1145 // block handling in willBeDestroyed will cause problems. | 1146 // block handling in willBeDestroyed will cause problems. |
1146 child->deleteLineBoxTree(); | 1147 child->deleteLineBoxTree(); |
1147 child->destroy(); | 1148 child->destroy(); |
1148 } | 1149 } |
1149 | 1150 |
1150 void RenderBlock::removeChild(RenderObject* oldChild) | 1151 void RenderBlock::removeChild(LayoutObject* oldChild) |
1151 { | 1152 { |
1152 // No need to waste time in merging or removing empty anonymous blocks. | 1153 // No need to waste time in merging or removing empty anonymous blocks. |
1153 // We can just bail out if our document is getting destroyed. | 1154 // We can just bail out if our document is getting destroyed. |
1154 if (documentBeingDestroyed()) { | 1155 if (documentBeingDestroyed()) { |
1155 RenderBox::removeChild(oldChild); | 1156 RenderBox::removeChild(oldChild); |
1156 return; | 1157 return; |
1157 } | 1158 } |
1158 | 1159 |
1159 // This protects against column split flows when anonymous blocks are gettin
g merged. | 1160 // This protects against column split flows when anonymous blocks are gettin
g merged. |
1160 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; | 1161 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; |
1161 | 1162 |
1162 // If this child is a block, and if our previous and next siblings are | 1163 // If this child is a block, and if our previous and next siblings are |
1163 // both anonymous blocks with inline content, then we can go ahead and | 1164 // both anonymous blocks with inline content, then we can go ahead and |
1164 // fold the inline content back together. | 1165 // fold the inline content back together. |
1165 RenderObject* prev = oldChild->previousSibling(); | 1166 LayoutObject* prev = oldChild->previousSibling(); |
1166 RenderObject* next = oldChild->nextSibling(); | 1167 LayoutObject* next = oldChild->nextSibling(); |
1167 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); | 1168 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); |
1168 if (canMergeAnonymousBlocks && prev && next) { | 1169 if (canMergeAnonymousBlocks && prev && next) { |
1169 prev->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 1170 prev->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
1170 RenderBlockFlow* nextBlock = toRenderBlockFlow(next); | 1171 RenderBlockFlow* nextBlock = toRenderBlockFlow(next); |
1171 RenderBlockFlow* prevBlock = toRenderBlockFlow(prev); | 1172 RenderBlockFlow* prevBlock = toRenderBlockFlow(prev); |
1172 | 1173 |
1173 if (prev->childrenInline() != next->childrenInline()) { | 1174 if (prev->childrenInline() != next->childrenInline()) { |
1174 RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBloc
k : nextBlock; | 1175 RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBloc
k : nextBlock; |
1175 RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock
: prevBlock; | 1176 RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock
: prevBlock; |
1176 | 1177 |
(...skipping 26 matching lines...) Expand all Loading... |
1203 | 1204 |
1204 // Delete the now-empty block's lines and nuke it. | 1205 // Delete the now-empty block's lines and nuke it. |
1205 nextBlock->deleteLineBoxTree(); | 1206 nextBlock->deleteLineBoxTree(); |
1206 nextBlock->destroy(); | 1207 nextBlock->destroy(); |
1207 next = 0; | 1208 next = 0; |
1208 } | 1209 } |
1209 } | 1210 } |
1210 | 1211 |
1211 RenderBox::removeChild(oldChild); | 1212 RenderBox::removeChild(oldChild); |
1212 | 1213 |
1213 RenderObject* child = prev ? prev : next; | 1214 LayoutObject* child = prev ? prev : next; |
1214 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { | 1215 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { |
1215 // The removal has knocked us down to containing only a single anonymous | 1216 // The removal has knocked us down to containing only a single anonymous |
1216 // box. We can go ahead and pull the content right back up into our | 1217 // box. We can go ahead and pull the content right back up into our |
1217 // box. | 1218 // box. |
1218 collapseAnonymousBlockChild(this, toRenderBlock(child)); | 1219 collapseAnonymousBlockChild(this, toRenderBlock(child)); |
1219 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | 1220 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { |
1220 // It's possible that the removal has knocked us down to a single anonym
ous | 1221 // It's possible that the removal has knocked us down to a single anonym
ous |
1221 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 1222 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
1222 // are floating, then we need to pull the content up also. | 1223 // are floating, then we need to pull the content up also. |
1223 RenderBlock* anonymousBlock = toRenderBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); | 1224 RenderBlock* anonymousBlock = toRenderBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); |
1224 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) | 1225 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) |
1225 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) | 1226 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) |
1226 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { | 1227 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { |
1227 collapseAnonymousBlockChild(this, anonymousBlock); | 1228 collapseAnonymousBlockChild(this, anonymousBlock); |
1228 } | 1229 } |
1229 } | 1230 } |
1230 | 1231 |
1231 if (!firstChild()) { | 1232 if (!firstChild()) { |
1232 // If this was our last child be sure to clear out our line boxes. | 1233 // If this was our last child be sure to clear out our line boxes. |
1233 if (childrenInline()) | 1234 if (childrenInline()) |
1234 deleteLineBoxTree(); | 1235 deleteLineBoxTree(); |
1235 | 1236 |
1236 // If we are an empty anonymous block in the continuation chain, | 1237 // If we are an empty anonymous block in the continuation chain, |
1237 // we need to remove ourself and fix the continuation chain. | 1238 // we need to remove ourself and fix the continuation chain. |
1238 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { | 1239 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { |
1239 RenderObject* containingBlockIgnoringAnonymous = containingBlock(); | 1240 LayoutObject* containingBlockIgnoringAnonymous = containingBlock(); |
1240 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymous()) | 1241 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymous()) |
1241 containingBlockIgnoringAnonymous = containingBlockIgnoringAnonym
ous->containingBlock(); | 1242 containingBlockIgnoringAnonymous = containingBlockIgnoringAnonym
ous->containingBlock(); |
1242 for (RenderObject* curr = this; curr; curr = curr->previousInPreOrde
r(containingBlockIgnoringAnonymous)) { | 1243 for (LayoutObject* curr = this; curr; curr = curr->previousInPreOrde
r(containingBlockIgnoringAnonymous)) { |
1243 if (curr->virtualContinuation() != this) | 1244 if (curr->virtualContinuation() != this) |
1244 continue; | 1245 continue; |
1245 | 1246 |
1246 // Found our previous continuation. We just need to point it to | 1247 // Found our previous continuation. We just need to point it to |
1247 // |this|'s next continuation. | 1248 // |this|'s next continuation. |
1248 RenderBoxModelObject* nextContinuation = continuation(); | 1249 RenderBoxModelObject* nextContinuation = continuation(); |
1249 if (curr->isRenderInline()) | 1250 if (curr->isRenderInline()) |
1250 toRenderInline(curr)->setContinuation(nextContinuation); | 1251 toRenderInline(curr)->setContinuation(nextContinuation); |
1251 else if (curr->isRenderBlock()) | 1252 else if (curr->isRenderBlock()) |
1252 toRenderBlock(curr)->setContinuation(nextContinuation); | 1253 toRenderBlock(curr)->setContinuation(nextContinuation); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 // If relayoutChildren is set and the child has percentage padding or an emb
edded content box, we also need to invalidate the childs pref widths. | 1549 // If relayoutChildren is set and the child has percentage padding or an emb
edded content box, we also need to invalidate the childs pref widths. |
1549 if (relayoutChildren && child.needsPreferredWidthsRecalculation()) | 1550 if (relayoutChildren && child.needsPreferredWidthsRecalculation()) |
1550 child.setPreferredLogicalWidthsDirty(MarkOnlyThis); | 1551 child.setPreferredLogicalWidthsDirty(MarkOnlyThis); |
1551 } | 1552 } |
1552 | 1553 |
1553 void RenderBlock::simplifiedNormalFlowLayout() | 1554 void RenderBlock::simplifiedNormalFlowLayout() |
1554 { | 1555 { |
1555 if (childrenInline()) { | 1556 if (childrenInline()) { |
1556 ListHashSet<RootInlineBox*> lineBoxes; | 1557 ListHashSet<RootInlineBox*> lineBoxes; |
1557 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1558 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
1558 RenderObject* o = walker.current(); | 1559 LayoutObject* o = walker.current(); |
1559 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating
())) { | 1560 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating
())) { |
1560 o->layoutIfNeeded(); | 1561 o->layoutIfNeeded(); |
1561 if (toRenderBox(o)->inlineBoxWrapper()) { | 1562 if (toRenderBox(o)->inlineBoxWrapper()) { |
1562 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo
t(); | 1563 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo
t(); |
1563 lineBoxes.add(&box); | 1564 lineBoxes.add(&box); |
1564 } | 1565 } |
1565 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { | 1566 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { |
1566 o->clearNeedsLayout(); | 1567 o->clearNeedsLayout(); |
1567 } | 1568 } |
1568 } | 1569 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 } | 1627 } |
1627 | 1628 |
1628 updateLayerTransformAfterLayout(); | 1629 updateLayerTransformAfterLayout(); |
1629 | 1630 |
1630 updateScrollInfoAfterLayout(); | 1631 updateScrollInfoAfterLayout(); |
1631 | 1632 |
1632 clearNeedsLayout(); | 1633 clearNeedsLayout(); |
1633 return true; | 1634 return true; |
1634 } | 1635 } |
1635 | 1636 |
1636 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child,
SubtreeLayoutScope& layoutScope) | 1637 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(LayoutObject* child,
SubtreeLayoutScope& layoutScope) |
1637 { | 1638 { |
1638 if (child->style()->position() != FixedPosition) | 1639 if (child->style()->position() != FixedPosition) |
1639 return; | 1640 return; |
1640 | 1641 |
1641 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHoriz
ontalWritingMode()); | 1642 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHoriz
ontalWritingMode()); |
1642 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHor
izontalWritingMode()); | 1643 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHor
izontalWritingMode()); |
1643 if (!hasStaticBlockPosition && !hasStaticInlinePosition) | 1644 if (!hasStaticBlockPosition && !hasStaticInlinePosition) |
1644 return; | 1645 return; |
1645 | 1646 |
1646 RenderObject* o = child->parent(); | 1647 LayoutObject* o = child->parent(); |
1647 while (o && !o->isRenderView() && o->style()->position() != AbsolutePosition
) | 1648 while (o && !o->isRenderView() && o->style()->position() != AbsolutePosition
) |
1648 o = o->parent(); | 1649 o = o->parent(); |
1649 if (o->style()->position() != AbsolutePosition) | 1650 if (o->style()->position() != AbsolutePosition) |
1650 return; | 1651 return; |
1651 | 1652 |
1652 RenderBox* box = toRenderBox(child); | 1653 RenderBox* box = toRenderBox(child); |
1653 if (hasStaticInlinePosition) { | 1654 if (hasStaticInlinePosition) { |
1654 LogicalExtentComputedValues computedValues; | 1655 LogicalExtentComputedValues computedValues; |
1655 box->computeLogicalWidth(computedValues); | 1656 box->computeLogicalWidth(computedValues); |
1656 LayoutUnit newLeft = computedValues.m_position; | 1657 LayoutUnit newLeft = computedValues.m_position; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 if (rootBlock != this) | 1883 if (rootBlock != this) |
1883 return containingBlock()->logicalRightSelectionOffset(rootBlock, positio
n + logicalTop()); | 1884 return containingBlock()->logicalRightSelectionOffset(rootBlock, positio
n + logicalTop()); |
1884 return logicalRightOffsetForContent(); | 1885 return logicalRightOffsetForContent(); |
1885 } | 1886 } |
1886 | 1887 |
1887 RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) con
st | 1888 RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) con
st |
1888 { | 1889 { |
1889 if (isSelectionRoot()) | 1890 if (isSelectionRoot()) |
1890 return 0; | 1891 return 0; |
1891 | 1892 |
1892 const RenderObject* object = this; | 1893 const LayoutObject* object = this; |
1893 RenderObject* sibling; | 1894 LayoutObject* sibling; |
1894 do { | 1895 do { |
1895 sibling = object->previousSibling(); | 1896 sibling = object->previousSibling(); |
1896 while (sibling && (!sibling->isRenderBlock() || toRenderBlock(sibling)->
isSelectionRoot())) | 1897 while (sibling && (!sibling->isRenderBlock() || toRenderBlock(sibling)->
isSelectionRoot())) |
1897 sibling = sibling->previousSibling(); | 1898 sibling = sibling->previousSibling(); |
1898 | 1899 |
1899 offset -= LayoutSize(toRenderBlock(object)->logicalLeft(), toRenderBlock
(object)->logicalTop()); | 1900 offset -= LayoutSize(toRenderBlock(object)->logicalLeft(), toRenderBlock
(object)->logicalTop()); |
1900 object = object->parent(); | 1901 object = object->parent(); |
1901 } while (!sibling && object && object->isRenderBlock() && !toRenderBlock(obj
ect)->isSelectionRoot()); | 1902 } while (!sibling && object && object->isRenderBlock() && !toRenderBlock(obj
ect)->isSelectionRoot()); |
1902 | 1903 |
1903 if (!sibling) | 1904 if (!sibling) |
1904 return 0; | 1905 return 0; |
1905 | 1906 |
1906 RenderBlock* beforeBlock = toRenderBlock(sibling); | 1907 RenderBlock* beforeBlock = toRenderBlock(sibling); |
1907 | 1908 |
1908 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); | 1909 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); |
1909 | 1910 |
1910 RenderObject* child = beforeBlock->lastChild(); | 1911 LayoutObject* child = beforeBlock->lastChild(); |
1911 while (child && child->isRenderBlock()) { | 1912 while (child && child->isRenderBlock()) { |
1912 beforeBlock = toRenderBlock(child); | 1913 beforeBlock = toRenderBlock(child); |
1913 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop
()); | 1914 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop
()); |
1914 child = beforeBlock->lastChild(); | 1915 child = beforeBlock->lastChild(); |
1915 } | 1916 } |
1916 return beforeBlock; | 1917 return beforeBlock; |
1917 } | 1918 } |
1918 | 1919 |
1919 void RenderBlock::setSelectionState(SelectionState state) | 1920 void RenderBlock::setSelectionState(SelectionState state) |
1920 { | 1921 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 r = *it; | 2017 r = *it; |
2017 if (!o || r->isDescendantOf(o)) { | 2018 if (!o || r->isDescendantOf(o)) { |
2018 if (containingBlockState == NewContainingBlock) { | 2019 if (containingBlockState == NewContainingBlock) { |
2019 r->setChildNeedsLayout(MarkOnlyThis); | 2020 r->setChildNeedsLayout(MarkOnlyThis); |
2020 if (r->needsPreferredWidthsRecalculation()) | 2021 if (r->needsPreferredWidthsRecalculation()) |
2021 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 2022 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
2022 } | 2023 } |
2023 | 2024 |
2024 // It is parent blocks job to add positioned child to positioned obj
ects list of its containing block | 2025 // It is parent blocks job to add positioned child to positioned obj
ects list of its containing block |
2025 // Parent layout needs to be invalidated to ensure this happens. | 2026 // Parent layout needs to be invalidated to ensure this happens. |
2026 RenderObject* p = r->parent(); | 2027 LayoutObject* p = r->parent(); |
2027 while (p && !p->isRenderBlock()) | 2028 while (p && !p->isRenderBlock()) |
2028 p = p->parent(); | 2029 p = p->parent(); |
2029 if (p) | 2030 if (p) |
2030 p->setChildNeedsLayout(); | 2031 p->setChildNeedsLayout(); |
2031 | 2032 |
2032 deadObjects.append(r); | 2033 deadObjects.append(r); |
2033 } | 2034 } |
2034 } | 2035 } |
2035 | 2036 |
2036 for (unsigned i = 0; i < deadObjects.size(); i++) | 2037 for (unsigned i = 0; i < deadObjects.size(); i++) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 | 2101 |
2101 if (!hasPercentHeightDescendant(descendant)) | 2102 if (!hasPercentHeightDescendant(descendant)) |
2102 return; | 2103 return; |
2103 | 2104 |
2104 removePercentHeightDescendant(descendant); | 2105 removePercentHeightDescendant(descendant); |
2105 } | 2106 } |
2106 | 2107 |
2107 void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) | 2108 void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) |
2108 { | 2109 { |
2109 ASSERT(gPercentHeightContainerMap); | 2110 ASSERT(gPercentHeightContainerMap); |
2110 for (RenderObject* curr = parent->slowFirstChild(); curr; curr = curr->nextI
nPreOrder(parent)) { | 2111 for (LayoutObject* curr = parent->slowFirstChild(); curr; curr = curr->nextI
nPreOrder(parent)) { |
2111 if (!curr->isBox()) | 2112 if (!curr->isBox()) |
2112 continue; | 2113 continue; |
2113 | 2114 |
2114 RenderBox* box = toRenderBox(curr); | 2115 RenderBox* box = toRenderBox(curr); |
2115 if (!hasPercentHeightDescendant(box)) | 2116 if (!hasPercentHeightDescendant(box)) |
2116 continue; | 2117 continue; |
2117 | 2118 |
2118 removePercentHeightDescendant(box); | 2119 removePercentHeightDescendant(box); |
2119 } | 2120 } |
2120 } | 2121 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 if (!box->renderer().nonPseudoNode()) | 2383 if (!box->renderer().nonPseudoNode()) |
2383 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs
et() : caretMaxOffset()); | 2384 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs
et() : caretMaxOffset()); |
2384 | 2385 |
2385 if (!box->isInlineTextBox()) | 2386 if (!box->isInlineTextBox()) |
2386 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), star
t ? box->renderer().caretMinOffset() : box->renderer().caretMaxOffset()); | 2387 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), star
t ? box->renderer().caretMinOffset() : box->renderer().caretMaxOffset()); |
2387 | 2388 |
2388 InlineTextBox* textBox = toInlineTextBox(box); | 2389 InlineTextBox* textBox = toInlineTextBox(box); |
2389 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ?
textBox->start() : textBox->start() + textBox->len()); | 2390 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ?
textBox->start() : textBox->start() + textBox->len()); |
2390 } | 2391 } |
2391 | 2392 |
2392 static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child
) | 2393 static inline bool isEditingBoundary(LayoutObject* ancestor, LayoutObject* child
) |
2393 { | 2394 { |
2394 ASSERT(!ancestor || ancestor->nonPseudoNode()); | 2395 ASSERT(!ancestor || ancestor->nonPseudoNode()); |
2395 ASSERT(child && child->nonPseudoNode()); | 2396 ASSERT(child && child->nonPseudoNode()); |
2396 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) | 2397 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) |
2397 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); | 2398 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); |
2398 } | 2399 } |
2399 | 2400 |
2400 // FIXME: This function should go on RenderObject as an instance method. Then | 2401 // FIXME: This function should go on LayoutObject as an instance method. Then |
2401 // all cases in which positionForPoint recurs could call this instead to | 2402 // all cases in which positionForPoint recurs could call this instead to |
2402 // prevent crossing editable boundaries. This would require many tests. | 2403 // prevent crossing editable boundaries. This would require many tests. |
2403 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) | 2404 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) |
2404 { | 2405 { |
2405 LayoutPoint childLocation = child->location(); | 2406 LayoutPoint childLocation = child->location(); |
2406 if (child->isRelPositioned()) | 2407 if (child->isRelPositioned()) |
2407 childLocation += child->offsetForInFlowPosition(); | 2408 childLocation += child->offsetForInFlowPosition(); |
2408 | 2409 |
2409 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. | 2410 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. |
2410 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); | 2411 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); |
2411 | 2412 |
2412 // If this is an anonymous renderer, we just recur normally | 2413 // If this is an anonymous renderer, we just recur normally |
2413 Node* childNode = child->nonPseudoNode(); | 2414 Node* childNode = child->nonPseudoNode(); |
2414 if (!childNode) | 2415 if (!childNode) |
2415 return child->positionForPoint(pointInChildCoordinates); | 2416 return child->positionForPoint(pointInChildCoordinates); |
2416 | 2417 |
2417 // Otherwise, first make sure that the editability of the parent and child a
gree. | 2418 // Otherwise, first make sure that the editability of the parent and child a
gree. |
2418 // If they don't agree, then we return a visible position just before or aft
er the child | 2419 // If they don't agree, then we return a visible position just before or aft
er the child |
2419 RenderObject* ancestor = parent; | 2420 LayoutObject* ancestor = parent; |
2420 while (ancestor && !ancestor->nonPseudoNode()) | 2421 while (ancestor && !ancestor->nonPseudoNode()) |
2421 ancestor = ancestor->parent(); | 2422 ancestor = ancestor->parent(); |
2422 | 2423 |
2423 // If we can't find an ancestor to check editability on, or editability is u
nchanged, we recur like normal | 2424 // If we can't find an ancestor to check editability on, or editability is u
nchanged, we recur like normal |
2424 if (isEditingBoundary(ancestor, child)) | 2425 if (isEditingBoundary(ancestor, child)) |
2425 return child->positionForPoint(pointInChildCoordinates); | 2426 return child->positionForPoint(pointInChildCoordinates); |
2426 | 2427 |
2427 // Otherwise return before or after the child, depending on if the click was
to the logical left or logical right of the child | 2428 // Otherwise return before or after the child, depending on if the click was
to the logical left or logical right of the child |
2428 LayoutUnit childMiddle = parent->logicalWidthForChild(*child) / 2; | 2429 LayoutUnit childMiddle = parent->logicalWidthForChild(*child) / 2; |
2429 LayoutUnit logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoo
rdinates.x() : pointInChildCoordinates.y(); | 2430 LayoutUnit logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoo
rdinates.x() : pointInChildCoordinates.y(); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3032 // resolved column-count really should be 1. | 3033 // resolved column-count really should be 1. |
3033 maxLogicalWidth = std::max(maxLogicalWidth, columnWidth) * columnCount +
gapExtra; | 3034 maxLogicalWidth = std::max(maxLogicalWidth, columnWidth) * columnCount +
gapExtra; |
3034 } | 3035 } |
3035 } | 3036 } |
3036 | 3037 |
3037 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const | 3038 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const |
3038 { | 3039 { |
3039 RenderStyle* styleToUse = style(); | 3040 RenderStyle* styleToUse = style(); |
3040 bool nowrap = styleToUse->whiteSpace() == NOWRAP; | 3041 bool nowrap = styleToUse->whiteSpace() == NOWRAP; |
3041 | 3042 |
3042 RenderObject* child = firstChild(); | 3043 LayoutObject* child = firstChild(); |
3043 RenderBlock* containingBlock = this->containingBlock(); | 3044 RenderBlock* containingBlock = this->containingBlock(); |
3044 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | 3045 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; |
3045 while (child) { | 3046 while (child) { |
3046 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max | 3047 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max |
3047 // width of the multicol container, not the flow thread. | 3048 // width of the multicol container, not the flow thread. |
3048 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { | 3049 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { |
3049 child = child->nextSibling(); | 3050 child = child->nextSibling(); |
3050 continue; | 3051 continue; |
3051 } | 3052 } |
3052 | 3053 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3290 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); | 3291 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); |
3291 return fontMetrics.ascent() | 3292 return fontMetrics.ascent() |
3292 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes)
- fontMetrics.height()) / 2 | 3293 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes)
- fontMetrics.height()) / 2 |
3293 + (lineDirection == HorizontalLine ? borderTop() + paddingTop()
: borderRight() + paddingRight()); | 3294 + (lineDirection == HorizontalLine ? borderTop() + paddingTop()
: borderRight() + paddingRight()); |
3294 } | 3295 } |
3295 } | 3296 } |
3296 | 3297 |
3297 return -1; | 3298 return -1; |
3298 } | 3299 } |
3299 | 3300 |
3300 static inline bool isRenderBlockFlowOrRenderButton(RenderObject* renderObject) | 3301 static inline bool isRenderBlockFlowOrRenderButton(LayoutObject* layoutObject) |
3301 { | 3302 { |
3302 // We include isRenderButton in this check because buttons are implemented | 3303 // We include isRenderButton in this check because buttons are implemented |
3303 // using flex box but should still support first-line|first-letter. | 3304 // using flex box but should still support first-line|first-letter. |
3304 // The flex box and grid specs require that flex box and grid do not | 3305 // The flex box and grid specs require that flex box and grid do not |
3305 // support first-line|first-letter, though. | 3306 // support first-line|first-letter, though. |
3306 // FIXME: Remove when buttons are implemented with align-items instead | 3307 // FIXME: Remove when buttons are implemented with align-items instead |
3307 // of flex box. | 3308 // of flex box. |
3308 return renderObject->isRenderBlockFlow() || renderObject->isRenderButton(); | 3309 return layoutObject->isRenderBlockFlow() || layoutObject->isRenderButton(); |
3309 } | 3310 } |
3310 | 3311 |
3311 RenderBlock* RenderBlock::firstLineBlock() const | 3312 RenderBlock* RenderBlock::firstLineBlock() const |
3312 { | 3313 { |
3313 RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); | 3314 RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); |
3314 bool hasPseudo = false; | 3315 bool hasPseudo = false; |
3315 while (true) { | 3316 while (true) { |
3316 hasPseudo = firstLineBlock->style()->hasPseudoStyle(FIRST_LINE); | 3317 hasPseudo = firstLineBlock->style()->hasPseudoStyle(FIRST_LINE); |
3317 if (hasPseudo) | 3318 if (hasPseudo) |
3318 break; | 3319 break; |
3319 RenderObject* parentBlock = firstLineBlock->parent(); | 3320 LayoutObject* parentBlock = firstLineBlock->parent(); |
3320 if (firstLineBlock->isReplaced() || firstLineBlock->isFloatingOrOutOfFlo
wPositioned() | 3321 if (firstLineBlock->isReplaced() || firstLineBlock->isFloatingOrOutOfFlo
wPositioned() |
3321 || !parentBlock | 3322 || !parentBlock |
3322 || !isRenderBlockFlowOrRenderButton(parentBlock)) | 3323 || !isRenderBlockFlowOrRenderButton(parentBlock)) |
3323 break; | 3324 break; |
3324 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock()); | 3325 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock()); |
3325 if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock) | 3326 if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock) |
3326 break; | 3327 break; |
3327 firstLineBlock = toRenderBlock(parentBlock); | 3328 firstLineBlock = toRenderBlock(parentBlock); |
3328 } | 3329 } |
3329 | 3330 |
3330 if (!hasPseudo) | 3331 if (!hasPseudo) |
3331 return 0; | 3332 return 0; |
3332 | 3333 |
3333 return firstLineBlock; | 3334 return firstLineBlock; |
3334 } | 3335 } |
3335 | 3336 |
3336 // Helper methods for obtaining the last line, computing line counts and heights
for line counts | 3337 // Helper methods for obtaining the last line, computing line counts and heights
for line counts |
3337 // (crawling into blocks). | 3338 // (crawling into blocks). |
3338 static bool shouldCheckLines(RenderObject* obj) | 3339 static bool shouldCheckLines(LayoutObject* obj) |
3339 { | 3340 { |
3340 return !obj->isFloatingOrOutOfFlowPositioned() | 3341 return !obj->isFloatingOrOutOfFlowPositioned() |
3341 && obj->isRenderBlock() && obj->style()->height().isAuto() | 3342 && obj->isRenderBlock() && obj->style()->height().isAuto() |
3342 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); | 3343 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); |
3343 } | 3344 } |
3344 | 3345 |
3345 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
int& count) | 3346 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
int& count) |
3346 { | 3347 { |
3347 if (block->style()->visibility() == VISIBLE) { | 3348 if (block->style()->visibility() == VISIBLE) { |
3348 if (block->isRenderBlockFlow() && block->childrenInline()) { | 3349 if (block->isRenderBlockFlow() && block->childrenInline()) { |
(...skipping 25 matching lines...) Expand all Loading... |
3374 ASSERT(i >= 0); | 3375 ASSERT(i >= 0); |
3375 | 3376 |
3376 if (style()->visibility() != VISIBLE) | 3377 if (style()->visibility() != VISIBLE) |
3377 return 0; | 3378 return 0; |
3378 | 3379 |
3379 if (childrenInline()) { | 3380 if (childrenInline()) { |
3380 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) | 3381 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) |
3381 if (!i--) | 3382 if (!i--) |
3382 return box; | 3383 return box; |
3383 } else { | 3384 } else { |
3384 for (RenderObject* child = firstChild(); child; child = child->nextSibli
ng()) { | 3385 for (LayoutObject* child = firstChild(); child; child = child->nextSibli
ng()) { |
3385 if (!shouldCheckLines(child)) | 3386 if (!shouldCheckLines(child)) |
3386 continue; | 3387 continue; |
3387 if (RootInlineBox* box = toRenderBlock(child)->lineAtIndex(i)) | 3388 if (RootInlineBox* box = toRenderBlock(child)->lineAtIndex(i)) |
3388 return box; | 3389 return box; |
3389 } | 3390 } |
3390 } | 3391 } |
3391 | 3392 |
3392 return 0; | 3393 return 0; |
3393 } | 3394 } |
3394 | 3395 |
3395 int RenderBlock::lineCount(const RootInlineBox* stopRootInlineBox, bool* found)
const | 3396 int RenderBlock::lineCount(const RootInlineBox* stopRootInlineBox, bool* found)
const |
3396 { | 3397 { |
3397 int count = 0; | 3398 int count = 0; |
3398 | 3399 |
3399 if (style()->visibility() == VISIBLE) { | 3400 if (style()->visibility() == VISIBLE) { |
3400 if (childrenInline()) | 3401 if (childrenInline()) |
3401 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo
x()) { | 3402 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo
x()) { |
3402 count++; | 3403 count++; |
3403 if (box == stopRootInlineBox) { | 3404 if (box == stopRootInlineBox) { |
3404 if (found) | 3405 if (found) |
3405 *found = true; | 3406 *found = true; |
3406 break; | 3407 break; |
3407 } | 3408 } |
3408 } | 3409 } |
3409 else | 3410 else |
3410 for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling()
) | 3411 for (LayoutObject* obj = firstChild(); obj; obj = obj->nextSibling()
) |
3411 if (shouldCheckLines(obj)) { | 3412 if (shouldCheckLines(obj)) { |
3412 bool recursiveFound = false; | 3413 bool recursiveFound = false; |
3413 count += toRenderBlock(obj)->lineCount(stopRootInlineBox, &r
ecursiveFound); | 3414 count += toRenderBlock(obj)->lineCount(stopRootInlineBox, &r
ecursiveFound); |
3414 if (recursiveFound) { | 3415 if (recursiveFound) { |
3415 if (found) | 3416 if (found) |
3416 *found = true; | 3417 *found = true; |
3417 break; | 3418 break; |
3418 } | 3419 } |
3419 } | 3420 } |
3420 } | 3421 } |
3421 return count; | 3422 return count; |
3422 } | 3423 } |
3423 | 3424 |
3424 int RenderBlock::heightForLineCount(int l) | 3425 int RenderBlock::heightForLineCount(int l) |
3425 { | 3426 { |
3426 int count = 0; | 3427 int count = 0; |
3427 return getHeightForLineCount(this, l, true, count); | 3428 return getHeightForLineCount(this, l, true, count); |
3428 } | 3429 } |
3429 | 3430 |
3430 void RenderBlock::clearTruncation() | 3431 void RenderBlock::clearTruncation() |
3431 { | 3432 { |
3432 if (style()->visibility() == VISIBLE) { | 3433 if (style()->visibility() == VISIBLE) { |
3433 if (childrenInline() && hasMarkupTruncation()) { | 3434 if (childrenInline() && hasMarkupTruncation()) { |
3434 setHasMarkupTruncation(false); | 3435 setHasMarkupTruncation(false); |
3435 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo
x()) | 3436 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBo
x()) |
3436 box->clearTruncation(); | 3437 box->clearTruncation(); |
3437 } else { | 3438 } else { |
3438 for (RenderObject* obj = firstChild(); obj; obj = obj->nextSibling()
) { | 3439 for (LayoutObject* obj = firstChild(); obj; obj = obj->nextSibling()
) { |
3439 if (shouldCheckLines(obj)) | 3440 if (shouldCheckLines(obj)) |
3440 toRenderBlock(obj)->clearTruncation(); | 3441 toRenderBlock(obj)->clearTruncation(); |
3441 } | 3442 } |
3442 } | 3443 } |
3443 } | 3444 } |
3444 } | 3445 } |
3445 | 3446 |
3446 void RenderBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accum
ulatedOffset) const | 3447 void RenderBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accum
ulatedOffset) const |
3447 { | 3448 { |
3448 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the | 3449 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the |
(...skipping 29 matching lines...) Expand all Loading... |
3478 } | 3479 } |
3479 | 3480 |
3480 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const LayoutLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvali
dationState* paintInvalidationState) const | 3481 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const LayoutLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvali
dationState* paintInvalidationState) const |
3481 { | 3482 { |
3482 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); | 3483 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); |
3483 if (isAnonymousBlockContinuation()) | 3484 if (isAnonymousBlockContinuation()) |
3484 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for vertica
l writing-modes. | 3485 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for vertica
l writing-modes. |
3485 return r; | 3486 return r; |
3486 } | 3487 } |
3487 | 3488 |
3488 RenderObject* RenderBlock::hoverAncestor() const | 3489 LayoutObject* RenderBlock::hoverAncestor() const |
3489 { | 3490 { |
3490 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); | 3491 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); |
3491 } | 3492 } |
3492 | 3493 |
3493 void RenderBlock::updateDragState(bool dragOn) | 3494 void RenderBlock::updateDragState(bool dragOn) |
3494 { | 3495 { |
3495 RenderBox::updateDragState(dragOn); | 3496 RenderBox::updateDragState(dragOn); |
3496 if (continuation()) | 3497 if (continuation()) |
3497 continuation()->updateDragState(dragOn); | 3498 continuation()->updateDragState(dragOn); |
3498 } | 3499 } |
3499 | 3500 |
3500 void RenderBlock::childBecameNonInline(RenderObject*) | 3501 void RenderBlock::childBecameNonInline(LayoutObject*) |
3501 { | 3502 { |
3502 makeChildrenNonInline(); | 3503 makeChildrenNonInline(); |
3503 if (isAnonymousBlock() && parent() && parent()->isRenderBlock()) | 3504 if (isAnonymousBlock() && parent() && parent()->isRenderBlock()) |
3504 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); | 3505 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
3505 // |this| may be dead here | 3506 // |this| may be dead here |
3506 } | 3507 } |
3507 | 3508 |
3508 void RenderBlock::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) | 3509 void RenderBlock::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) |
3509 { | 3510 { |
3510 if (result.innerNode()) | 3511 if (result.innerNode()) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 3588 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
3588 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 3589 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
3589 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top,
curr->width(), bottom - top); | 3590 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top,
curr->width(), bottom - top); |
3590 // It's common for this rect to be entirely contained in our box, so
exclude that simple case. | 3591 // It's common for this rect to be entirely contained in our box, so
exclude that simple case. |
3591 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))
) | 3592 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))
) |
3592 rects.append(rect); | 3593 rects.append(rect); |
3593 } | 3594 } |
3594 } | 3595 } |
3595 } | 3596 } |
3596 | 3597 |
3597 RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* par
ent) const | 3598 RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par
ent) const |
3598 { | 3599 { |
3599 if (isAnonymousColumnsBlock()) | 3600 if (isAnonymousColumnsBlock()) |
3600 return createAnonymousColumnsWithParentRenderer(parent); | 3601 return createAnonymousColumnsWithParentRenderer(parent); |
3601 if (isAnonymousColumnSpanBlock()) | 3602 if (isAnonymousColumnSpanBlock()) |
3602 return createAnonymousColumnSpanWithParentRenderer(parent); | 3603 return createAnonymousColumnSpanWithParentRenderer(parent); |
3603 return createAnonymousWithParentRendererAndDisplay(parent, style()->display(
)); | 3604 return createAnonymousWithParentRendererAndDisplay(parent, style()->display(
)); |
3604 } | 3605 } |
3605 | 3606 |
3606 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 3607 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
3607 { | 3608 { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3756 if (isAnonymousBlock()) | 3757 if (isAnonymousBlock()) |
3757 return "RenderBlock (anonymous)"; | 3758 return "RenderBlock (anonymous)"; |
3758 } | 3759 } |
3759 if (isAnonymous()) | 3760 if (isAnonymous()) |
3760 return "RenderBlock (generated)"; | 3761 return "RenderBlock (generated)"; |
3761 if (isRelPositioned()) | 3762 if (isRelPositioned()) |
3762 return "RenderBlock (relative positioned)"; | 3763 return "RenderBlock (relative positioned)"; |
3763 return "RenderBlock"; | 3764 return "RenderBlock"; |
3764 } | 3765 } |
3765 | 3766 |
3766 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay display) | 3767 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Layo
utObject* parent, EDisplay display) |
3767 { | 3768 { |
3768 // FIXME: Do we need to convert all our inline displays to block-type in the
anonymous logic ? | 3769 // FIXME: Do we need to convert all our inline displays to block-type in the
anonymous logic ? |
3769 EDisplay newDisplay; | 3770 EDisplay newDisplay; |
3770 RenderBlock* newBox = 0; | 3771 RenderBlock* newBox = 0; |
3771 if (display == FLEX || display == INLINE_FLEX) { | 3772 if (display == FLEX || display == INLINE_FLEX) { |
3772 newBox = RenderFlexibleBox::createAnonymous(&parent->document()); | 3773 newBox = RenderFlexibleBox::createAnonymous(&parent->document()); |
3773 newDisplay = FLEX; | 3774 newDisplay = FLEX; |
3774 } else { | 3775 } else { |
3775 newBox = RenderBlockFlow::createAnonymous(&parent->document()); | 3776 newBox = RenderBlockFlow::createAnonymous(&parent->document()); |
3776 newDisplay = BLOCK; | 3777 newDisplay = BLOCK; |
3777 } | 3778 } |
3778 | 3779 |
3779 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), newDisplay); | 3780 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), newDisplay); |
3780 parent->updateAnonymousChildStyle(newBox, newStyle.get()); | 3781 parent->updateAnonymousChildStyle(newBox, newStyle.get()); |
3781 newBox->setStyle(newStyle.release()); | 3782 newBox->setStyle(newStyle.release()); |
3782 return newBox; | 3783 return newBox; |
3783 } | 3784 } |
3784 | 3785 |
3785 RenderBlockFlow* RenderBlock::createAnonymousColumnsWithParentRenderer(const Ren
derObject* parent) | 3786 RenderBlockFlow* RenderBlock::createAnonymousColumnsWithParentRenderer(const Lay
outObject* parent) |
3786 { | 3787 { |
3787 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); | 3788 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); |
3788 newStyle->inheritColumnPropertiesFrom(parent->style()); | 3789 newStyle->inheritColumnPropertiesFrom(parent->style()); |
3789 | 3790 |
3790 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); | 3791 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); |
3791 parent->updateAnonymousChildStyle(newBox, newStyle.get()); | 3792 parent->updateAnonymousChildStyle(newBox, newStyle.get()); |
3792 newBox->setStyle(newStyle.release()); | 3793 newBox->setStyle(newStyle.release()); |
3793 return newBox; | 3794 return newBox; |
3794 } | 3795 } |
3795 | 3796 |
3796 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const
RenderObject* parent) | 3797 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const
LayoutObject* parent) |
3797 { | 3798 { |
3798 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); | 3799 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); |
3799 newStyle->setColumnSpan(ColumnSpanAll); | 3800 newStyle->setColumnSpan(ColumnSpanAll); |
3800 | 3801 |
3801 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); | 3802 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); |
3802 parent->updateAnonymousChildStyle(newBox, newStyle.get()); | 3803 parent->updateAnonymousChildStyle(newBox, newStyle.get()); |
3803 newBox->setStyle(newStyle.release()); | 3804 newBox->setStyle(newStyle.release()); |
3804 return newBox; | 3805 return newBox; |
3805 } | 3806 } |
3806 | 3807 |
3807 static bool recalcNormalFlowChildOverflowIfNeeded(RenderObject* renderer) | 3808 static bool recalcNormalFlowChildOverflowIfNeeded(LayoutObject* renderer) |
3808 { | 3809 { |
3809 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter
StyleChange()) | 3810 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter
StyleChange()) |
3810 return false; | 3811 return false; |
3811 | 3812 |
3812 ASSERT(renderer->isRenderBlock()); | 3813 ASSERT(renderer->isRenderBlock()); |
3813 return toRenderBlock(renderer)->recalcOverflowAfterStyleChange(); | 3814 return toRenderBlock(renderer)->recalcOverflowAfterStyleChange(); |
3814 } | 3815 } |
3815 | 3816 |
3816 bool RenderBlock::recalcChildOverflowAfterStyleChange() | 3817 bool RenderBlock::recalcChildOverflowAfterStyleChange() |
3817 { | 3818 { |
3818 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); | 3819 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); |
3819 setChildNeedsOverflowRecalcAfterStyleChange(false); | 3820 setChildNeedsOverflowRecalcAfterStyleChange(false); |
3820 | 3821 |
3821 bool childrenOverflowChanged = false; | 3822 bool childrenOverflowChanged = false; |
3822 | 3823 |
3823 if (childrenInline()) { | 3824 if (childrenInline()) { |
3824 ListHashSet<RootInlineBox*> lineBoxes; | 3825 ListHashSet<RootInlineBox*> lineBoxes; |
3825 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 3826 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
3826 RenderObject* renderer = walker.current(); | 3827 LayoutObject* renderer = walker.current(); |
3827 if (recalcNormalFlowChildOverflowIfNeeded(renderer)) { | 3828 if (recalcNormalFlowChildOverflowIfNeeded(renderer)) { |
3828 childrenOverflowChanged = true; | 3829 childrenOverflowChanged = true; |
3829 if (InlineBox* inlineBoxWrapper = toRenderBlock(renderer)->inlin
eBoxWrapper()) | 3830 if (InlineBox* inlineBoxWrapper = toRenderBlock(renderer)->inlin
eBoxWrapper()) |
3830 lineBoxes.add(&inlineBoxWrapper->root()); | 3831 lineBoxes.add(&inlineBoxWrapper->root()); |
3831 } | 3832 } |
3832 } | 3833 } |
3833 | 3834 |
3834 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. | 3835 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. |
3835 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 3836 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
3836 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { | 3837 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 if (!continuations) | 3935 if (!continuations) |
3935 return false; | 3936 return false; |
3936 | 3937 |
3937 return continuations->contains(flow); | 3938 return continuations->contains(flow); |
3938 } | 3939 } |
3939 | 3940 |
3940 #endif | 3941 #endif |
3941 | 3942 |
3942 #ifndef NDEBUG | 3943 #ifndef NDEBUG |
3943 | 3944 |
3944 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
3945 { | 3946 { |
3946 showRenderObject(); | 3947 showLayoutObject(); |
3947 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
3948 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
3949 } | 3950 } |
3950 | 3951 |
3951 #endif | 3952 #endif |
3952 | 3953 |
3953 } // namespace blink | 3954 } // namespace blink |
OLD | NEW |