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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 break; | 749 break; |
750 if (tablePartToSplit->firstChild() != beforeChild) { | 750 if (tablePartToSplit->firstChild() != beforeChild) { |
751 // Get our table container. | 751 // Get our table container. |
752 RenderObject* curr = tablePartToSplit; | 752 RenderObject* curr = tablePartToSplit; |
753 while (!curr->isTable()) | 753 while (!curr->isTable()) |
754 curr = curr->parent(); | 754 curr = curr->parent(); |
755 RenderTable* table = toRenderTable(curr); | 755 RenderTable* table = toRenderTable(curr); |
756 | 756 |
757 // Create an anonymous table container next to our table container. | 757 // Create an anonymous table container next to our table container. |
758 RenderBlock* parentBlock = toRenderBlock(table->parent()); | 758 RenderBlock* parentBlock = toRenderBlock(table->parent()); |
759 RenderTable* postTable = parentBlock->createAnonymousTable(); | 759 RenderTable* postTable = RenderTable::createAnonymousWithParentRende
rer(parentBlock); |
760 parentBlock->children()->insertChildNode(parentBlock, postTable, tab
le->nextSibling()); | 760 parentBlock->children()->insertChildNode(parentBlock, postTable, tab
le->nextSibling()); |
761 | 761 |
762 // Move all the children from beforeChild to the newly created anony
mous table container. | 762 // Move all the children from beforeChild to the newly created anony
mous table container. |
763 moveAllTableChildrenTo(tablePartToSplit, postTable, beforeChild); | 763 moveAllTableChildrenTo(tablePartToSplit, postTable, beforeChild); |
764 | 764 |
765 beforeChild = postTable; | 765 beforeChild = postTable; |
766 } else | 766 } else |
767 beforeChild = tablePartToSplit; | 767 beforeChild = tablePartToSplit; |
768 } | 768 } |
769 return beforeChild; | 769 return beforeChild; |
(...skipping 5867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6637 pos = FloatPoint(additionalOffset.x() + box->x(), additional
Offset.y() + box->y()); | 6637 pos = FloatPoint(additionalOffset.x() + box->x(), additional
Offset.y() + box->y()); |
6638 box->addFocusRingRects(rects, flooredLayoutPoint(pos)); | 6638 box->addFocusRingRects(rects, flooredLayoutPoint(pos)); |
6639 } | 6639 } |
6640 } | 6640 } |
6641 } | 6641 } |
6642 | 6642 |
6643 if (inlineElementContinuation()) | 6643 if (inlineElementContinuation()) |
6644 inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint
(additionalOffset + inlineElementContinuation()->containingBlock()->location() -
location())); | 6644 inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint
(additionalOffset + inlineElementContinuation()->containingBlock()->location() -
location())); |
6645 } | 6645 } |
6646 | 6646 |
6647 RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const | |
6648 { | |
6649 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); | |
6650 | |
6651 RenderBlock* newBox = 0; | |
6652 if (isFlexibleBox) { | |
6653 newStyle->setDisplay(BOX); | |
6654 newBox = new (renderArena()) RenderDeprecatedFlexibleBox(document() /* a
nonymous box */); | |
6655 } else { | |
6656 newStyle->setDisplay(BLOCK); | |
6657 newBox = new (renderArena()) RenderBlock(document() /* anonymous box */)
; | |
6658 } | |
6659 | |
6660 newBox->setStyle(newStyle.release()); | |
6661 return newBox; | |
6662 } | |
6663 | |
6664 RenderBlock* RenderBlock::createAnonymousBlockWithSameTypeAs(RenderBlock* otherA
nonymousBlock) const | 6647 RenderBlock* RenderBlock::createAnonymousBlockWithSameTypeAs(RenderBlock* otherA
nonymousBlock) const |
6665 { | 6648 { |
6666 if (otherAnonymousBlock->isAnonymousColumnsBlock()) | 6649 if (otherAnonymousBlock->isAnonymousColumnsBlock()) |
6667 return createAnonymousColumnsBlock(); | 6650 return createAnonymousColumnsBlock(); |
6668 if (otherAnonymousBlock->isAnonymousColumnSpanBlock()) | 6651 if (otherAnonymousBlock->isAnonymousColumnSpanBlock()) |
6669 return createAnonymousColumnSpanBlock(); | 6652 return createAnonymousColumnSpanBlock(); |
6670 return createAnonymousBlock(otherAnonymousBlock->style()->display() == BOX); | 6653 return createAnonymousBlock(otherAnonymousBlock->style()->display()); |
6671 } | |
6672 | |
6673 RenderBlock* RenderBlock::createAnonymousColumnsBlock() const | |
6674 { | |
6675 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); | |
6676 newStyle->inheritColumnPropertiesFrom(style()); | |
6677 newStyle->setDisplay(BLOCK); | |
6678 | |
6679 RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymou
s box */); | |
6680 newBox->setStyle(newStyle.release()); | |
6681 return newBox; | |
6682 } | |
6683 | |
6684 RenderBlock* RenderBlock::createAnonymousColumnSpanBlock() const | |
6685 { | |
6686 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); | |
6687 newStyle->setColumnSpan(ColumnSpanAll); | |
6688 newStyle->setDisplay(BLOCK); | |
6689 | |
6690 RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymou
s box */); | |
6691 newBox->setStyle(newStyle.release()); | |
6692 return newBox; | |
6693 } | 6654 } |
6694 | 6655 |
6695 bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBou
ndaryRule) const | 6656 bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBou
ndaryRule) const |
6696 { | 6657 { |
6697 ASSERT(view()->layoutState() && view()->layoutState()->isPaginated()); | 6658 ASSERT(view()->layoutState() && view()->layoutState()->isPaginated()); |
6698 | 6659 |
6699 if (!inRenderFlowThread()) | 6660 if (!inRenderFlowThread()) |
6700 return true; // Printing and multi-column both make new pages to accommo
date content. | 6661 return true; // Printing and multi-column both make new pages to accommo
date content. |
6701 | 6662 |
6702 // See if we're in the last region. | 6663 // See if we're in the last region. |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7415 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); | 7376 run.setRenderingContext(SVGTextRunRenderingContext::create(context)); |
7416 | 7377 |
7417 return run; | 7378 return run; |
7418 } | 7379 } |
7419 | 7380 |
7420 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, c
onst String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, T
extRunFlags flags) | 7381 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, c
onst String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, T
extRunFlags flags) |
7421 { | 7382 { |
7422 return constructTextRun(context, font, string.characters(), string.length(),
style, expansion, flags); | 7383 return constructTextRun(context, font, string.characters(), string.length(),
style, expansion, flags); |
7423 } | 7384 } |
7424 | 7385 |
| 7386 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay display) |
| 7387 { |
| 7388 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->sty
le()); |
| 7389 |
| 7390 // FIXME: Do we need to cover the new flex box here ? |
| 7391 // FIXME: Do we need to convert all our inline displays to block-type in the
anonymous logic ? |
| 7392 RenderBlock* newBox = 0; |
| 7393 if (display == BOX || display == INLINE_BOX) { |
| 7394 newStyle->setDisplay(BOX); |
| 7395 newBox = new (parent->renderArena()) RenderDeprecatedFlexibleBox(parent-
>document() /* anonymous box */); |
| 7396 } else { |
| 7397 newStyle->setDisplay(BLOCK); |
| 7398 newBox = new (parent->renderArena()) RenderBlock(parent->document() /* a
nonymous box */); |
| 7399 } |
| 7400 |
| 7401 newBox->setStyle(newStyle.release()); |
| 7402 return newBox; |
| 7403 } |
| 7404 |
| 7405 RenderBlock* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderO
bject* parent) |
| 7406 { |
| 7407 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->sty
le()); |
| 7408 newStyle->inheritColumnPropertiesFrom(parent->style()); |
| 7409 newStyle->setDisplay(BLOCK); |
| 7410 |
| 7411 RenderBlock* newBox = new (parent->renderArena()) RenderBlock(parent->docume
nt() /* anonymous box */); |
| 7412 newBox->setStyle(newStyle.release()); |
| 7413 return newBox; |
| 7414 } |
| 7415 |
| 7416 RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const Rend
erObject* parent) |
| 7417 { |
| 7418 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parent->sty
le()); |
| 7419 newStyle->setColumnSpan(ColumnSpanAll); |
| 7420 newStyle->setDisplay(BLOCK); |
| 7421 |
| 7422 RenderBlock* newBox = new (parent->renderArena()) RenderBlock(parent->docume
nt() /* anonymous box */); |
| 7423 newBox->setStyle(newStyle.release()); |
| 7424 return newBox; |
| 7425 } |
| 7426 |
7425 #ifndef NDEBUG | 7427 #ifndef NDEBUG |
7426 | 7428 |
7427 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 7429 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
7428 { | 7430 { |
7429 showRenderObject(); | 7431 showRenderObject(); |
7430 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 7432 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
7431 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 7433 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
7432 } | 7434 } |
7433 | 7435 |
7434 // These helpers are only used by the PODIntervalTree for debugging purposes. | 7436 // These helpers are only used by the PODIntervalTree for debugging purposes. |
7435 String ValueToString<int>::string(const int value) | 7437 String ValueToString<int>::string(const int value) |
7436 { | 7438 { |
7437 return String::number(value); | 7439 return String::number(value); |
7438 } | 7440 } |
7439 | 7441 |
7440 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7442 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7441 { | 7443 { |
7442 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7444 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7443 } | 7445 } |
7444 | 7446 |
7445 #endif | 7447 #endif |
7446 | 7448 |
7447 } // namespace WebCore | 7449 } // namespace WebCore |
OLD | NEW |