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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() | 193 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() |
194 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() | 194 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() |
195 || oldStyle->paddingLeft() != newStyle->paddingLeft() | 195 || oldStyle->paddingLeft() != newStyle->paddingLeft() |
196 || oldStyle->paddingRight() != newStyle->paddingRight(); | 196 || oldStyle->paddingRight() != newStyle->paddingRight(); |
197 } | 197 } |
198 | 198 |
199 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
le) | 199 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
le) |
200 { | 200 { |
201 RenderBox::styleDidChange(diff, oldStyle); | 201 RenderBox::styleDidChange(diff, oldStyle); |
202 | 202 |
203 RenderStyle* newStyle = style(); | |
204 propagateStyleToAnonymousChildren(true); | |
205 | |
206 // It's possible for our border/padding to change, but for the overall logic
al width of the block to | 203 // It's possible for our border/padding to change, but for the overall logic
al width of the block to |
207 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. | 204 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. |
208 m_hasBorderOrPaddingLogicalWidthChanged = oldStyle && diff.needsFullLayout()
&& needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle); | 205 m_hasBorderOrPaddingLogicalWidthChanged = oldStyle && diff.needsFullLayout()
&& needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, style()); |
209 } | |
210 | |
211 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) | |
212 { | |
213 if (beforeChild && beforeChild->parent() != this) { | |
214 RenderObject* beforeChildContainer = beforeChild->parent(); | |
215 ASSERT(beforeChildContainer->parent() == this); | |
216 ASSERT(beforeChildContainer->isAnonymousBlock()); | |
217 addChild(newChild, beforeChildContainer); | |
218 return; | |
219 } | |
220 | |
221 // TODO(ojan): What should we do in this case? For now we insert an anonymou
s paragraph. | |
222 // This only happens if we have a text node directly inside a non-paragraph. | |
223 if (!isRenderParagraph() && newChild->isInline()) { | |
224 RenderBlock* newBox = createAnonymousBlock(); | |
225 ASSERT(newBox->isRenderParagraph()); | |
226 RenderBox::addChild(newBox, beforeChild); | |
227 newBox->addChild(newChild); | |
228 return; | |
229 } | |
230 | |
231 RenderBox::addChild(newChild, beforeChild); | |
232 } | 206 } |
233 | 207 |
234 void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) | 208 void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) |
235 { | 209 { |
236 addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); | 210 ASSERT(isRenderParagraph() || !newChild->isInline()); |
| 211 RenderBox::addChild(newChild, beforeChild); |
237 } | 212 } |
238 | 213 |
239 void RenderBlock::deleteLineBoxTree() | 214 void RenderBlock::deleteLineBoxTree() |
240 { | 215 { |
241 ASSERT(!m_lineBoxes.firstLineBox()); | 216 ASSERT(!m_lineBoxes.firstLineBox()); |
242 } | 217 } |
243 | 218 |
244 void RenderBlock::removeChild(RenderObject* oldChild) | 219 void RenderBlock::removeChild(RenderObject* oldChild) |
245 { | 220 { |
246 RenderBox::removeChild(oldChild); | 221 RenderBox::removeChild(oldChild); |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 return "RenderBlock (inline-block)"; | 1577 return "RenderBlock (inline-block)"; |
1603 if (isOutOfFlowPositioned()) | 1578 if (isOutOfFlowPositioned()) |
1604 return "RenderBlock (positioned)"; | 1579 return "RenderBlock (positioned)"; |
1605 if (isAnonymousBlock()) | 1580 if (isAnonymousBlock()) |
1606 return "RenderBlock (anonymous)"; | 1581 return "RenderBlock (anonymous)"; |
1607 if (isAnonymous()) | 1582 if (isAnonymous()) |
1608 return "RenderBlock (generated)"; | 1583 return "RenderBlock (generated)"; |
1609 return "RenderBlock"; | 1584 return "RenderBlock"; |
1610 } | 1585 } |
1611 | 1586 |
1612 // FIXME(sky): Clean up callers now that we no longer use the EDisplay argument. | |
1613 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay) | |
1614 { | |
1615 RenderBlock* newBox = RenderParagraph::createAnonymous(parent->document()); | |
1616 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), PARAGRAPH); | |
1617 parent->updateAnonymousChildStyle(newBox, newStyle.get()); | |
1618 newBox->setStyle(newStyle.release()); | |
1619 return newBox; | |
1620 } | |
1621 | |
1622 static bool recalcNormalFlowChildOverflowIfNeeded(RenderObject* renderer) | 1587 static bool recalcNormalFlowChildOverflowIfNeeded(RenderObject* renderer) |
1623 { | 1588 { |
1624 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter
StyleChange()) | 1589 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter
StyleChange()) |
1625 return false; | 1590 return false; |
1626 | 1591 |
1627 ASSERT(renderer->isRenderBlock()); | 1592 ASSERT(renderer->isRenderBlock()); |
1628 return toRenderBlock(renderer)->recalcOverflowAfterStyleChange(); | 1593 return toRenderBlock(renderer)->recalcOverflowAfterStyleChange(); |
1629 } | 1594 } |
1630 | 1595 |
1631 bool RenderBlock::recalcChildOverflowAfterStyleChange() | 1596 bool RenderBlock::recalcChildOverflowAfterStyleChange() |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 1688 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
1724 { | 1689 { |
1725 showRenderObject(); | 1690 showRenderObject(); |
1726 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 1691 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
1727 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 1692 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
1728 } | 1693 } |
1729 | 1694 |
1730 #endif | 1695 #endif |
1731 | 1696 |
1732 } // namespace blink | 1697 } // namespace blink |
OLD | NEW |