|
Lines 77-84
static PercentHeightDescendantsMap* gPer
WebCore/rendering/RenderBlock.cpp_sec1
|
| 77 |
|
77 |
|
| 78 |
typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightContainerMap; |
78 |
typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightContainerMap; |
| 79 |
static PercentHeightContainerMap* gPercentHeightContainerMap = 0; |
79 |
static PercentHeightContainerMap* gPercentHeightContainerMap = 0; |
| 80 |
|
|
|
| 81 |
typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutlineTableMap; |
| 82 |
|
80 |
|
| 83 |
typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
81 |
typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
| 84 |
static int gDelayUpdateScrollInfo = 0; |
82 |
static int gDelayUpdateScrollInfo = 0; |
|
Lines 91-97
RenderBlock::MarginInfo::MarginInfo(Rend
WebCore/rendering/RenderBlock.cpp_sec2
|
| 91 |
// if we had any border/padding (obviously), if we're the root or HTML elements, or if |
89 |
// if we had any border/padding (obviously), if we're the root or HTML elements, or if |
| 92 |
// we're positioned, floating, a table cell. |
90 |
// we're positioned, floating, a table cell. |
| 93 |
m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() && |
91 |
m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() && |
| 94 |
!block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable(); |
92 |
!block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && (!block->isInlineBlockOrInlineTable() || block->isAnonymousInlineBlock()); |
| 95 |
|
93 |
|
| 96 |
m_canCollapseTopWithChildren = m_canCollapseWithChildren && (top == 0) && block->style()->marginTopCollapse() != MSEPARATE; |
94 |
m_canCollapseTopWithChildren = m_canCollapseWithChildren && (top == 0) && block->style()->marginTopCollapse() != MSEPARATE; |
| 97 |
|
95 |
|
|
Lines 120-126
RenderBlock::RenderBlock(Node* node)
WebCore/rendering/RenderBlock.cpp_sec3
|
| 120 |
: RenderBox(node) |
118 |
: RenderBox(node) |
| 121 |
, m_floatingObjects(0) |
119 |
, m_floatingObjects(0) |
| 122 |
, m_positionedObjects(0) |
120 |
, m_positionedObjects(0) |
| 123 |
, m_inlineContinuation(0) |
|
|
| 124 |
, m_maxMargin(0) |
121 |
, m_maxMargin(0) |
| 125 |
, m_lineHeight(-1) |
122 |
, m_lineHeight(-1) |
| 126 |
{ |
123 |
{ |
|
Lines 161-174
void RenderBlock::destroy()
WebCore/rendering/RenderBlock.cpp_sec4
|
| 161 |
// Make sure to destroy anonymous children first while they are still connected to the rest of the tree, so that they will |
158 |
// Make sure to destroy anonymous children first while they are still connected to the rest of the tree, so that they will |
| 162 |
// properly dirty line boxes that they are removed from. Effects that do :before/:after only on hover could crash otherwise. |
159 |
// properly dirty line boxes that they are removed from. Effects that do :before/:after only on hover could crash otherwise. |
| 163 |
children()->destroyLeftoverChildren(); |
160 |
children()->destroyLeftoverChildren(); |
| 164 |
|
|
|
| 165 |
// Destroy our continuation before anything other than anonymous children. |
| 166 |
// The reason we don't destroy it before anonymous children is that they may |
| 167 |
// have continuations of their own that are anonymous children of our continuation. |
| 168 |
if (m_inlineContinuation) { |
| 169 |
m_inlineContinuation->destroy(); |
| 170 |
m_inlineContinuation = 0; |
| 171 |
} |
| 172 |
|
161 |
|
| 173 |
if (!documentBeingDestroyed()) { |
162 |
if (!documentBeingDestroyed()) { |
| 174 |
if (firstLineBox()) { |
163 |
if (firstLineBox()) { |
|
Lines 316-322
void RenderBlock::addChild(RenderObject*
WebCore/rendering/RenderBlock.cpp_sec5
|
| 316 |
} |
305 |
} |
| 317 |
} else if (!childrenInline() && (newChild->isFloatingOrPositioned() || newChild->isInline())) { |
306 |
} else if (!childrenInline() && (newChild->isFloatingOrPositioned() || newChild->isInline())) { |
| 318 |
// If we're inserting an inline child but all of our children are blocks, then we have to make sure |
307 |
// If we're inserting an inline child but all of our children are blocks, then we have to make sure |
| 319 |
// it is put into an anomyous block box. We try to use an existing anonymous box if possible, otherwise |
308 |
// it is put into an anonymous block box. We try to use an existing anonymous box if possible, otherwise |
| 320 |
// a new one is created and inserted into our list of children in the appropriate position. |
309 |
// a new one is created and inserted into our list of children in the appropriate position. |
| 321 |
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); |
310 |
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); |
| 322 |
|
311 |
|
|
Lines 490-498
void RenderBlock::removeLeftoverAnonymou
WebCore/rendering/RenderBlock.cpp_sec6
|
| 490 |
ASSERT(child->isAnonymousBlock()); |
479 |
ASSERT(child->isAnonymousBlock()); |
| 491 |
ASSERT(!child->childrenInline()); |
480 |
ASSERT(!child->childrenInline()); |
| 492 |
|
481 |
|
| 493 |
if (child->inlineContinuation()) |
|
|
| 494 |
return; |
| 495 |
|
| 496 |
RenderObject* firstAnChild = child->m_children.firstChild(); |
482 |
RenderObject* firstAnChild = child->m_children.firstChild(); |
| 497 |
RenderObject* lastAnChild = child->m_children.lastChild(); |
483 |
RenderObject* lastAnChild = child->m_children.lastChild(); |
| 498 |
if (firstAnChild) { |
484 |
if (firstAnChild) { |
|
Lines 535-541
void RenderBlock::removeChild(RenderObje
WebCore/rendering/RenderBlock.cpp_sec7
|
| 535 |
RenderObject* prev = oldChild->previousSibling(); |
521 |
RenderObject* prev = oldChild->previousSibling(); |
| 536 |
RenderObject* next = oldChild->nextSibling(); |
522 |
RenderObject* next = oldChild->nextSibling(); |
| 537 |
bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline() && |
523 |
bool canDeleteAnonymousBlocks = !documentBeingDestroyed() && !isInline() && !oldChild->isInline() && |
| 538 |
(!oldChild->isRenderBlock() || !toRenderBlock(oldChild)->inlineContinuation()) && |
524 |
!oldChild->isRenderBlock() && |
| 539 |
(!prev || (prev->isAnonymousBlock() && prev->childrenInline())) && |
525 |
(!prev || (prev->isAnonymousBlock() && prev->childrenInline())) && |
| 540 |
(!next || (next->isAnonymousBlock() && next->childrenInline())); |
526 |
(!next || (next->isAnonymousBlock() && next->childrenInline())); |
| 541 |
if (canDeleteAnonymousBlocks && prev && next) { |
527 |
if (canDeleteAnonymousBlocks && prev && next) { |
|
Lines 598-606
bool RenderBlock::isSelfCollapsingBlock(
WebCore/rendering/RenderBlock.cpp_sec8
|
| 598 |
// on whether we have content that is all self-collapsing or not. |
584 |
// on whether we have content that is all self-collapsing or not. |
| 599 |
if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().isZero())) { |
585 |
if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().isZero())) { |
| 600 |
// If the block has inline children, see if we generated any line boxes. If we have any |
586 |
// If the block has inline children, see if we generated any line boxes. If we have any |
| 601 |
// line boxes, then we can't be self-collapsing, since we have content. |
587 |
// line boxes, then we can only be self-collapsing if we have nothing but anonymous inline blocks |
| 602 |
if (childrenInline()) |
588 |
// that are also self-collapsing inside us. |
| 603 |
return !firstLineBox(); |
589 |
if (childrenInline()) { |
|
|
590 |
for (RootInlineBox* child = firstRootBox(); child; child = child->nextRootBox()) { |
| 591 |
if (!child->anonymousInlineBlock() || !child->anonymousInlineBlock()->isSelfCollapsingBlock()) |
| 592 |
return false; |
| 593 |
} |
| 594 |
return true; // We have no line boxes, so we must be self-collapsing. |
| 595 |
} |
| 604 |
|
596 |
|
| 605 |
// Whether or not we collapse is dependent on whether all our normal flow children |
597 |
// Whether or not we collapse is dependent on whether all our normal flow children |
| 606 |
// are also self-collapsing. |
598 |
// are also self-collapsing. |
|
Lines 855-861
void RenderBlock::addOverflowFromFloats(
WebCore/rendering/RenderBlock.cpp_sec9
|
| 855 |
|
847 |
|
| 856 |
bool RenderBlock::expandsToEncloseOverhangingFloats() const |
848 |
bool RenderBlock::expandsToEncloseOverhangingFloats() const |
| 857 |
{ |
849 |
{ |
| 858 |
return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCell() || isFieldset(); |
850 |
return isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCell() || isFieldset() || |
|
|
851 |
(isInlineBlockOrInlineTable() && !isAnonymousInlineBlock()); |
| 859 |
} |
852 |
} |
| 860 |
|
853 |
|
| 861 |
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) |
854 |
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) |
|
Lines 1001-1019
bool RenderBlock::handleRunInChild(Rende
WebCore/rendering/RenderBlock.cpp_sec10
|
| 1001 |
int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) |
994 |
int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) |
| 1002 |
{ |
995 |
{ |
| 1003 |
// Get our max pos and neg top margins. |
996 |
// Get our max pos and neg top margins. |
| 1004 |
int posTop = child->maxTopMargin(true); |
997 |
int posTop = child ? child->maxTopMargin(true) : 0; |
| 1005 |
int negTop = child->maxTopMargin(false); |
998 |
int negTop = child ? child->maxTopMargin(false) : 0; |
| 1006 |
|
999 |
|
| 1007 |
// For self-collapsing blocks, collapse our bottom margins into our |
1000 |
// For self-collapsing blocks, collapse our bottom margins into our |
| 1008 |
// top to get new posTop and negTop values. |
1001 |
// top to get new posTop and negTop values. |
| 1009 |
if (child->isSelfCollapsingBlock()) { |
1002 |
if (child && child->isSelfCollapsingBlock()) { |
| 1010 |
posTop = max(posTop, child->maxBottomMargin(true)); |
1003 |
posTop = max(posTop, child->maxBottomMargin(true)); |
| 1011 |
negTop = max(negTop, child->maxBottomMargin(false)); |
1004 |
negTop = max(negTop, child->maxBottomMargin(false)); |
| 1012 |
} |
1005 |
} |
| 1013 |
|
1006 |
|
| 1014 |
// See if the top margin is quirky. We only care if this child has |
1007 |
// See if the top margin is quirky. We only care if this child has |
| 1015 |
// margins that will collapse with us. |
1008 |
// margins that will collapse with us. |
| 1016 |
bool topQuirk = child->isTopMarginQuirk() || style()->marginTopCollapse() == MDISCARD; |
1009 |
bool topQuirk = (child && child->isTopMarginQuirk()) || style()->marginTopCollapse() == MDISCARD; |
| 1017 |
|
1010 |
|
| 1018 |
if (marginInfo.canCollapseWithTop()) { |
1011 |
if (marginInfo.canCollapseWithTop()) { |
| 1019 |
// This child is collapsing with the top of the |
1012 |
// This child is collapsing with the top of the |
|
Lines 1026-1032
int RenderBlock::collapseMargins(RenderB
WebCore/rendering/RenderBlock.cpp_sec11
|
| 1026 |
// collapse it away, even if the margin is smaller (www.webreference.com |
1019 |
// collapse it away, even if the margin is smaller (www.webreference.com |
| 1027 |
// has an example of this, a <dt> with 0.8em author-specified inside |
1020 |
// has an example of this, a <dt> with 0.8em author-specified inside |
| 1028 |
// a <dl> inside a <td>. |
1021 |
// a <dl> inside a <td>. |
| 1029 |
if (!marginInfo.determinedTopQuirk() && !topQuirk && (posTop-negTop)) { |
1022 |
if (!marginInfo.determinedTopQuirk() && !topQuirk && (posTop - negTop)) { |
| 1030 |
setTopMarginQuirk(false); |
1023 |
setTopMarginQuirk(false); |
| 1031 |
marginInfo.setDeterminedTopQuirk(true); |
1024 |
marginInfo.setDeterminedTopQuirk(true); |
| 1032 |
} |
1025 |
} |
|
Lines 1044-1050
int RenderBlock::collapseMargins(RenderB
WebCore/rendering/RenderBlock.cpp_sec12
|
| 1044 |
marginInfo.setTopQuirk(topQuirk); |
1037 |
marginInfo.setTopQuirk(topQuirk); |
| 1045 |
|
1038 |
|
| 1046 |
int ypos = height(); |
1039 |
int ypos = height(); |
| 1047 |
if (child->isSelfCollapsingBlock()) { |
1040 |
if (child && child->isSelfCollapsingBlock()) { |
| 1048 |
// This child has no height. We need to compute our |
1041 |
// This child has no height. We need to compute our |
| 1049 |
// position before we collapse the child's margins together, |
1042 |
// position before we collapse the child's margins together, |
| 1050 |
// so that we can get an accurate position for the zero-height block. |
1043 |
// so that we can get an accurate position for the zero-height block. |
|
Lines 1063-1075
int RenderBlock::collapseMargins(RenderB
WebCore/rendering/RenderBlock.cpp_sec13
|
| 1063 |
// that needs to be positioned correctly (e.g., a block that |
1056 |
// that needs to be positioned correctly (e.g., a block that |
| 1064 |
// had a specified height of 0 but that actually had subcontent). |
1057 |
// had a specified height of 0 but that actually had subcontent). |
| 1065 |
ypos = height() + collapsedTopPos - collapsedTopNeg; |
1058 |
ypos = height() + collapsedTopPos - collapsedTopNeg; |
| 1066 |
} |
1059 |
} else { |
| 1067 |
else { |
1060 |
if (child && child->style()->marginTopCollapse() == MSEPARATE) { |
| 1068 |
if (child->style()->marginTopCollapse() == MSEPARATE) { |
|
|
| 1069 |
setHeight(height() + marginInfo.margin() + child->marginTop()); |
1061 |
setHeight(height() + marginInfo.margin() + child->marginTop()); |
| 1070 |
ypos = height(); |
1062 |
ypos = height(); |
| 1071 |
} |
1063 |
} else if (!marginInfo.atTopOfBlock() || |
| 1072 |
else if (!marginInfo.atTopOfBlock() || |
|
|
| 1073 |
(!marginInfo.canCollapseTopWithChildren() |
1064 |
(!marginInfo.canCollapseTopWithChildren() |
| 1074 |
&& (!style()->htmlHacks() || !marginInfo.quirkContainer() || !marginInfo.topQuirk()))) { |
1065 |
&& (!style()->htmlHacks() || !marginInfo.quirkContainer() || !marginInfo.topQuirk()))) { |
| 1075 |
// We're collapsing with a previous sibling's margins and not |
1066 |
// We're collapsing with a previous sibling's margins and not |
|
Lines 1078-1088
int RenderBlock::collapseMargins(RenderB
WebCore/rendering/RenderBlock.cpp_sec14
|
| 1078 |
ypos = height(); |
1069 |
ypos = height(); |
| 1079 |
} |
1070 |
} |
| 1080 |
|
1071 |
|
| 1081 |
marginInfo.setPosMargin(child->maxBottomMargin(true)); |
1072 |
marginInfo.setPosMargin(child ? child->maxBottomMargin(true) : 0); |
| 1082 |
marginInfo.setNegMargin(child->maxBottomMargin(false)); |
1073 |
marginInfo.setNegMargin(child ? child->maxBottomMargin(false) : 0); |
| 1083 |
|
1074 |
|
| 1084 |
if (marginInfo.margin()) |
1075 |
if (marginInfo.margin()) |
| 1085 |
marginInfo.setBottomQuirk(child->isBottomMarginQuirk() || style()->marginBottomCollapse() == MDISCARD); |
1076 |
marginInfo.setBottomQuirk((child && child->isBottomMarginQuirk()) || style()->marginBottomCollapse() == MDISCARD); |
| 1086 |
} |
1077 |
} |
| 1087 |
|
1078 |
|
| 1088 |
return ypos; |
1079 |
return ypos; |
|
Lines 1749-1768
void RenderBlock::paintObject(PaintInfo&
WebCore/rendering/RenderBlock.cpp_sec15
|
| 1749 |
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE) |
1740 |
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE) |
| 1750 |
paintOutline(paintInfo.context, tx, ty, width(), height(), style()); |
1741 |
paintOutline(paintInfo.context, tx, ty, width(), height(), style()); |
| 1751 |
|
1742 |
|
| 1752 |
// 6. paint continuation outlines. |
1743 |
// 6. paint caret. |
| 1753 |
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) { |
|
|
| 1754 |
if (inlineContinuation() && inlineContinuation()->hasOutline() && inlineContinuation()->style()->visibility() == VISIBLE) { |
| 1755 |
RenderInline* inlineRenderer = toRenderInline(inlineContinuation()->node()->renderer()); |
| 1756 |
if (!inlineRenderer->hasSelfPaintingLayer()) |
| 1757 |
containingBlock()->addContinuationWithOutline(inlineRenderer); |
| 1758 |
else if (!inlineRenderer->firstLineBox()) |
| 1759 |
inlineRenderer->paintOutline(paintInfo.context, tx - x() + inlineRenderer->containingBlock()->x(), |
| 1760 |
ty - y() + inlineRenderer->containingBlock()->y()); |
| 1761 |
} |
| 1762 |
paintContinuationOutlines(paintInfo, tx, ty); |
| 1763 |
} |
| 1764 |
|
| 1765 |
// 7. paint caret. |
| 1766 |
// If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground, |
1744 |
// If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground, |
| 1767 |
// then paint the caret. |
1745 |
// then paint the caret. |
| 1768 |
if (paintPhase == PaintPhaseForeground) { |
1746 |
if (paintPhase == PaintPhaseForeground) { |
|
Lines 1825-1881
void RenderBlock::paintEllipsisBoxes(Pai
WebCore/rendering/RenderBlock.cpp_sec16
|
| 1825 |
} |
1803 |
} |
| 1826 |
} |
1804 |
} |
| 1827 |
|
1805 |
|
| 1828 |
static ContinuationOutlineTableMap* continuationOutlineTable() |
|
|
| 1829 |
{ |
| 1830 |
DEFINE_STATIC_LOCAL(ContinuationOutlineTableMap, table, ()); |
| 1831 |
return &table; |
| 1832 |
} |
| 1833 |
|
| 1834 |
void RenderBlock::addContinuationWithOutline(RenderInline* flow) |
| 1835 |
{ |
| 1836 |
// We can't make this work if the inline is in a layer. We'll just rely on the broken |
| 1837 |
// way of painting. |
| 1838 |
ASSERT(!flow->layer() && !flow->isInlineContinuation()); |
| 1839 |
|
| 1840 |
ContinuationOutlineTableMap* table = continuationOutlineTable(); |
| 1841 |
ListHashSet<RenderInline*>* continuations = table->get(this); |
| 1842 |
if (!continuations) { |
| 1843 |
continuations = new ListHashSet<RenderInline*>; |
| 1844 |
table->set(this, continuations); |
| 1845 |
} |
| 1846 |
|
| 1847 |
continuations->add(flow); |
| 1848 |
} |
| 1849 |
|
| 1850 |
void RenderBlock::paintContinuationOutlines(PaintInfo& info, int tx, int ty) |
| 1851 |
{ |
| 1852 |
ContinuationOutlineTableMap* table = continuationOutlineTable(); |
| 1853 |
if (table->isEmpty()) |
| 1854 |
return; |
| 1855 |
|
| 1856 |
ListHashSet<RenderInline*>* continuations = table->get(this); |
| 1857 |
if (!continuations) |
| 1858 |
return; |
| 1859 |
|
| 1860 |
// Paint each continuation outline. |
| 1861 |
ListHashSet<RenderInline*>::iterator end = continuations->end(); |
| 1862 |
for (ListHashSet<RenderInline*>::iterator it = continuations->begin(); it != end; ++it) { |
| 1863 |
// Need to add in the coordinates of the intervening blocks. |
| 1864 |
RenderInline* flow = *it; |
| 1865 |
RenderBlock* block = flow->containingBlock(); |
| 1866 |
for ( ; block && block != this; block = block->containingBlock()) { |
| 1867 |
tx += block->x(); |
| 1868 |
ty += block->y(); |
| 1869 |
} |
| 1870 |
ASSERT(block); |
| 1871 |
flow->paintOutline(info.context, tx, ty); |
| 1872 |
} |
| 1873 |
|
| 1874 |
// Delete |
| 1875 |
delete continuations; |
| 1876 |
table->remove(this); |
| 1877 |
} |
| 1878 |
|
| 1879 |
void RenderBlock::setSelectionState(SelectionState s) |
1806 |
void RenderBlock::setSelectionState(SelectionState s) |
| 1880 |
{ |
1807 |
{ |
| 1881 |
if (selectionState() == s) |
1808 |
if (selectionState() == s) |
|
Lines 2985-3009
void RenderBlock::clearFloats()
WebCore/rendering/RenderBlock.cpp_sec17
|
| 2985 |
// out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted |
2912 |
// out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted |
| 2986 |
// to avoid floats. |
2913 |
// to avoid floats. |
| 2987 |
bool parentHasFloats = false; |
2914 |
bool parentHasFloats = false; |
| 2988 |
RenderObject* prev = previousSibling(); |
2915 |
RenderObject* prev = 0; |
| 2989 |
while (prev && (prev->isFloatingOrPositioned() || !prev->isBox() || !prev->isRenderBlock() || toRenderBlock(prev)->avoidsFloats())) { |
2916 |
RenderBlock* parentBlock = 0; |
| 2990 |
if (prev->isFloating()) |
2917 |
if (isAnonymousInlineBlock()) { |
| 2991 |
parentHasFloats = true; |
2918 |
parentBlock = containingBlock(); |
| 2992 |
prev = prev->previousSibling(); |
2919 |
parentHasFloats = parentBlock->containsFloats(); |
|
|
2920 |
} else { |
| 2921 |
while (prev && (prev->isFloatingOrPositioned() || !prev->isBox() || !prev->isRenderBlock() || toRenderBlock(prev)->avoidsFloats())) { |
| 2922 |
if (prev->isFloating()) |
| 2923 |
parentHasFloats = true; |
| 2924 |
prev = prev->previousSibling(); |
| 2925 |
} |
| 2926 |
|
| 2927 |
parentBlock = parent()->isRenderBlock() ? toRenderBlock(parent()) : 0; |
| 2993 |
} |
2928 |
} |
| 2994 |
|
2929 |
|
| 2995 |
// First add in floats from the parent. |
2930 |
// First add in floats from the parent. |
| 2996 |
int offset = y(); |
2931 |
int offset = y(); |
| 2997 |
if (parentHasFloats) { |
2932 |
if (parentHasFloats) |
| 2998 |
RenderBlock* parentBlock = toRenderBlock(parent()); |
|
|
| 2999 |
addIntrudingFloats(parentBlock, parentBlock->borderLeft() + parentBlock->paddingLeft(), offset); |
2933 |
addIntrudingFloats(parentBlock, parentBlock->borderLeft() + parentBlock->paddingLeft(), offset); |
| 3000 |
} |
2934 |
|
| 3001 |
|
|
|
| 3002 |
int xoffset = 0; |
2935 |
int xoffset = 0; |
| 3003 |
if (prev) |
2936 |
if (prev) |
| 3004 |
offset -= toRenderBox(prev)->y(); |
2937 |
offset -= toRenderBox(prev)->y(); |
| 3005 |
else if (parent()->isBox()) { |
2938 |
else if (parentBlock) { |
| 3006 |
prev = parent(); |
2939 |
prev = parentBlock; |
| 3007 |
xoffset += toRenderBox(prev)->borderLeft() + toRenderBox(prev)->paddingLeft(); |
2940 |
xoffset += toRenderBox(prev)->borderLeft() + toRenderBox(prev)->paddingLeft(); |
| 3008 |
} |
2941 |
} |
| 3009 |
|
2942 |
|
|
Lines 3138-3144
void RenderBlock::addIntrudingFloats(Ren
WebCore/rendering/RenderBlock.cpp_sec18
|
| 3138 |
// above. |xoff| will equal -flow->marginLeft() in this case, so it's already been taken |
3071 |
// above. |xoff| will equal -flow->marginLeft() in this case, so it's already been taken |
| 3139 |
// into account. Only apply this code if |child| is false, since otherwise the left margin |
3072 |
// into account. Only apply this code if |child| is false, since otherwise the left margin |
| 3140 |
// will get applied twice. |
3073 |
// will get applied twice. |
| 3141 |
if (prev != parent()) |
3074 |
if (prev != containingBlock()) |
| 3142 |
floatingObj->m_left += prev->marginLeft(); |
3075 |
floatingObj->m_left += prev->marginLeft(); |
| 3143 |
floatingObj->m_left -= marginLeft(); |
3076 |
floatingObj->m_left -= marginLeft(); |
| 3144 |
floatingObj->m_shouldPaint = false; // We are not in the direct inheritance chain for this float. We will never paint it. |
3077 |
floatingObj->m_shouldPaint = false; // We are not in the direct inheritance chain for this float. We will never paint it. |
|
Lines 3183-3189
void RenderBlock::markAllDescendantsWith
WebCore/rendering/RenderBlock.cpp_sec19
|
| 3183 |
removeFloatingObject(floatToRemove); |
3116 |
removeFloatingObject(floatToRemove); |
| 3184 |
|
3117 |
|
| 3185 |
// Iterate over our children and mark them as needed. |
3118 |
// Iterate over our children and mark them as needed. |
| 3186 |
if (!childrenInline()) { |
3119 |
if (childrenInline()) { |
|
|
3120 |
for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) { |
| 3121 |
RenderBlock* childBlock = box->anonymousInlineBlock(); |
| 3122 |
if (childBlock && (floatToRemove ? childBlock->containsFloat(floatToRemove) : childBlock->containsFloats())) |
| 3123 |
childBlock->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); |
| 3124 |
} |
| 3125 |
} else { |
| 3187 |
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { |
3126 |
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { |
| 3188 |
if ((!floatToRemove && child->isFloatingOrPositioned()) || !child->isRenderBlock()) |
3127 |
if ((!floatToRemove && child->isFloatingOrPositioned()) || !child->isRenderBlock()) |
| 3189 |
continue; |
3128 |
continue; |
|
Lines 4142-4155
void RenderBlock::calcInlinePrefWidths()
WebCore/rendering/RenderBlock.cpp_sec20
|
| 4142 |
} else |
4081 |
} else |
| 4143 |
clearPreviousFloat = false; |
4082 |
clearPreviousFloat = false; |
| 4144 |
|
4083 |
|
| 4145 |
bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak; |
4084 |
bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak || child->isAnonymousInlineBlock(); |
| 4146 |
if ((canBreakReplacedElement && (autoWrap || oldAutoWrap)) || clearPreviousFloat) { |
4085 |
if ((canBreakReplacedElement && (autoWrap || oldAutoWrap)) || clearPreviousFloat) { |
| 4147 |
m_minPrefWidth = max(inlineMin, m_minPrefWidth); |
4086 |
m_minPrefWidth = max(inlineMin, m_minPrefWidth); |
| 4148 |
inlineMin = 0; |
4087 |
inlineMin = 0; |
| 4149 |
} |
4088 |
} |
| 4150 |
|
4089 |
|
| 4151 |
// If we're supposed to clear the previous float, then terminate maxwidth as well. |
4090 |
// If we're supposed to clear the previous float, then terminate maxwidth as well. |
| 4152 |
if (clearPreviousFloat) { |
4091 |
// Also do this for anonymous inline blocks. |
|
|
4092 |
if (clearPreviousFloat || child->isAnonymousInlineBlock()) { |
| 4153 |
m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); |
4093 |
m_maxPrefWidth = max(inlineMax, m_maxPrefWidth); |
| 4154 |
inlineMax = 0; |
4094 |
inlineMax = 0; |
| 4155 |
} |
4095 |
} |
|
Lines 4158-4172
void RenderBlock::calcInlinePrefWidths()
WebCore/rendering/RenderBlock.cpp_sec21
|
| 4158 |
int ti = 0; |
4098 |
int ti = 0; |
| 4159 |
if (!addedTextIndent) { |
4099 |
if (!addedTextIndent) { |
| 4160 |
addedTextIndent = true; |
4100 |
addedTextIndent = true; |
| 4161 |
ti = style()->textIndent().calcMinValue(cw); |
4101 |
if (!child->isAnonymousInlineBlock()) { |
| 4162 |
childMin+=ti; |
4102 |
ti = style()->textIndent().calcMinValue(cw); |
| 4163 |
childMax+=ti; |
4103 |
childMin += ti; |
|
|
4104 |
childMax += ti; |
| 4105 |
} |
| 4164 |
} |
4106 |
} |
| 4165 |
|
4107 |
|
| 4166 |
// Add our width to the max. |
4108 |
// Add our width to the max. |
| 4167 |
inlineMax += childMax; |
4109 |
inlineMax += childMax; |
| 4168 |
|
4110 |
|
| 4169 |
if (!autoWrap || !canBreakReplacedElement) { |
4111 |
if ((!autoWrap || !canBreakReplacedElement) && !child->isAnonymousInlineBlock()) { |
| 4170 |
if (child->isFloating()) |
4112 |
if (child->isFloating()) |
| 4171 |
m_minPrefWidth = max(childMin, m_minPrefWidth); |
4113 |
m_minPrefWidth = max(childMin, m_minPrefWidth); |
| 4172 |
else |
4114 |
else |
|
Lines 4177-4182
void RenderBlock::calcInlinePrefWidths()
WebCore/rendering/RenderBlock.cpp_sec22
|
| 4177 |
|
4119 |
|
| 4178 |
// Now start a new line. |
4120 |
// Now start a new line. |
| 4179 |
inlineMin = 0; |
4121 |
inlineMin = 0; |
|
|
4122 |
|
| 4123 |
if (child->isAnonymousInlineBlock()) { |
| 4124 |
// Terminate max width as well. |
| 4125 |
m_maxPrefWidth = max(childMax, m_maxPrefWidth); |
| 4126 |
inlineMax = 0; |
| 4127 |
} |
| 4180 |
} |
4128 |
} |
| 4181 |
|
4129 |
|
| 4182 |
// We are no longer stripping whitespace at the start of |
4130 |
// We are no longer stripping whitespace at the start of |
|
Lines 4417-4425
int RenderBlock::lineHeight(bool firstLi
WebCore/rendering/RenderBlock.cpp_sec23
|
| 4417 |
// the base class. If we're being queried as though we're the root line |
4365 |
// the base class. If we're being queried as though we're the root line |
| 4418 |
// box, then the fact that we're an inline-block is irrelevant, and we behave |
4366 |
// box, then the fact that we're an inline-block is irrelevant, and we behave |
| 4419 |
// just like a block. |
4367 |
// just like a block. |
| 4420 |
if (isReplaced() && !isRootLineBox) |
4368 |
if (isReplaced() && !isRootLineBox) { |
|
|
4369 |
if (isAnonymousInlineBlock()) |
| 4370 |
return height(); |
| 4421 |
return height() + marginTop() + marginBottom(); |
4371 |
return height() + marginTop() + marginBottom(); |
| 4422 |
|
4372 |
} |
|
|
4373 |
|
| 4423 |
if (firstLine && document()->usesFirstLineRules()) { |
4374 |
if (firstLine && document()->usesFirstLineRules()) { |
| 4424 |
RenderStyle* s = style(firstLine); |
4375 |
RenderStyle* s = style(firstLine); |
| 4425 |
if (s != style()) |
4376 |
if (s != style()) |
|
Lines 4451-4456
int RenderBlock::baselinePosition(bool b
WebCore/rendering/RenderBlock.cpp_sec24
|
| 4451 |
// We also give up on finding a baseline if we have a vertical scrollbar, or if we are scrolled |
4402 |
// We also give up on finding a baseline if we have a vertical scrollbar, or if we are scrolled |
| 4452 |
// vertically (e.g., an overflow:hidden block that has had scrollTop moved) or if the baseline is outside |
4403 |
// vertically (e.g., an overflow:hidden block that has had scrollTop moved) or if the baseline is outside |
| 4453 |
// of our content box. |
4404 |
// of our content box. |
|
|
4405 |
if (isAnonymousInlineBlock()) |
| 4406 |
return height(); |
| 4454 |
int baselinePos = (layer() && (layer()->marquee() || layer()->verticalScrollbar() || layer()->scrollYOffset() != 0)) ? -1 : lastLineBoxBaseline(); |
4407 |
int baselinePos = (layer() && (layer()->marquee() || layer()->verticalScrollbar() || layer()->scrollYOffset() != 0)) ? -1 : lastLineBoxBaseline(); |
| 4455 |
if (baselinePos != -1 && baselinePos <= borderTop() + paddingTop() + contentHeight()) |
4408 |
if (baselinePos != -1 && baselinePos <= borderTop() + paddingTop() + contentHeight()) |
| 4456 |
return marginTop() + baselinePos; |
4409 |
return marginTop() + baselinePos; |
|
Lines 4875-4934
void RenderBlock::setMaxBottomMargins(in
WebCore/rendering/RenderBlock.cpp_sec25
|
| 4875 |
m_maxMargin->m_bottomNeg = neg; |
4828 |
m_maxMargin->m_bottomNeg = neg; |
| 4876 |
} |
4829 |
} |
| 4877 |
|
4830 |
|
| 4878 |
void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty) |
|
|
| 4879 |
{ |
| 4880 |
// For blocks inside inlines, we go ahead and include margins so that we run right up to the |
| 4881 |
// inline boxes above and below us (thus getting merged with them to form a single irregular |
| 4882 |
// shape). |
| 4883 |
if (inlineContinuation()) { |
| 4884 |
rects.append(IntRect(tx, ty - collapsedMarginTop(), |
| 4885 |
width(), height() + collapsedMarginTop() + collapsedMarginBottom())); |
| 4886 |
inlineContinuation()->absoluteRects(rects, |
| 4887 |
tx - x() + inlineContinuation()->containingBlock()->x(), |
| 4888 |
ty - y() + inlineContinuation()->containingBlock()->y()); |
| 4889 |
} else |
| 4890 |
rects.append(IntRect(tx, ty, width(), height())); |
| 4891 |
} |
| 4892 |
|
| 4893 |
void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads) |
| 4894 |
{ |
| 4895 |
// For blocks inside inlines, we go ahead and include margins so that we run right up to the |
| 4896 |
// inline boxes above and below us (thus getting merged with them to form a single irregular |
| 4897 |
// shape). |
| 4898 |
if (inlineContinuation()) { |
| 4899 |
FloatRect localRect(0, -collapsedMarginTop(), |
| 4900 |
width(), height() + collapsedMarginTop() + collapsedMarginBottom()); |
| 4901 |
quads.append(localToAbsoluteQuad(localRect)); |
| 4902 |
inlineContinuation()->absoluteQuads(quads); |
| 4903 |
} else |
| 4904 |
quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), height()))); |
| 4905 |
} |
| 4906 |
|
| 4907 |
IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth) |
| 4908 |
{ |
| 4909 |
IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth)); |
| 4910 |
if (inlineContinuation()) |
| 4911 |
r.inflateY(collapsedMarginTop()); |
| 4912 |
return r; |
| 4913 |
} |
| 4914 |
|
| 4915 |
RenderObject* RenderBlock::hoverAncestor() const |
| 4916 |
{ |
| 4917 |
return inlineContinuation() ? inlineContinuation() : RenderBox::hoverAncestor(); |
| 4918 |
} |
| 4919 |
|
| 4920 |
void RenderBlock::updateDragState(bool dragOn) |
| 4921 |
{ |
| 4922 |
RenderBox::updateDragState(dragOn); |
| 4923 |
if (inlineContinuation()) |
| 4924 |
inlineContinuation()->updateDragState(dragOn); |
| 4925 |
} |
| 4926 |
|
| 4927 |
RenderStyle* RenderBlock::outlineStyleForRepaint() const |
| 4928 |
{ |
| 4929 |
return inlineContinuation() ? inlineContinuation()->style() : style(); |
| 4930 |
} |
| 4931 |
|
| 4932 |
void RenderBlock::childBecameNonInline(RenderObject*) |
4831 |
void RenderBlock::childBecameNonInline(RenderObject*) |
| 4933 |
{ |
4832 |
{ |
| 4934 |
makeChildrenNonInline(); |
4833 |
makeChildrenNonInline(); |
|
Lines 4937-4962
void RenderBlock::childBecameNonInline(R
WebCore/rendering/RenderBlock.cpp_sec26
|
| 4937 |
// |this| may be dead here |
4836 |
// |this| may be dead here |
| 4938 |
} |
4837 |
} |
| 4939 |
|
4838 |
|
| 4940 |
void RenderBlock::updateHitTestResult(HitTestResult& result, const IntPoint& point) |
|
|
| 4941 |
{ |
| 4942 |
if (result.innerNode()) |
| 4943 |
return; |
| 4944 |
|
| 4945 |
Node* n = node(); |
| 4946 |
if (inlineContinuation()) |
| 4947 |
// We are in the margins of block elements that are part of a continuation. In |
| 4948 |
// this case we're actually still inside the enclosing inline element that was |
| 4949 |
// split. Go ahead and set our inner node accordingly. |
| 4950 |
n = inlineContinuation()->node(); |
| 4951 |
|
| 4952 |
if (n) { |
| 4953 |
result.setInnerNode(n); |
| 4954 |
if (!result.innerNonSharedNode()) |
| 4955 |
result.setInnerNonSharedNode(n); |
| 4956 |
result.setLocalPoint(point); |
| 4957 |
} |
| 4958 |
} |
| 4959 |
|
| 4960 |
IntRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, int* extraWidthToEndOfLine) |
4839 |
IntRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, int* extraWidthToEndOfLine) |
| 4961 |
{ |
4840 |
{ |
| 4962 |
// Do the normal calculation in most cases. |
4841 |
// Do the normal calculation in most cases. |
|
Lines 5037-5056
IntRect RenderBlock::localCaretRect(Inli
WebCore/rendering/RenderBlock.cpp_sec27
|
| 5037 |
|
4916 |
|
| 5038 |
void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) |
4917 |
void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) |
| 5039 |
{ |
4918 |
{ |
| 5040 |
// For blocks inside inlines, we go ahead and include margins so that we run right up to the |
4919 |
if (width() || height()) |
| 5041 |
// inline boxes above and below us (thus getting merged with them to form a single irregular |
|
|
| 5042 |
// shape). |
| 5043 |
if (inlineContinuation()) { |
| 5044 |
// FIXME: This check really isn't accurate. |
| 5045 |
bool nextInlineHasLineBox = inlineContinuation()->firstLineBox(); |
| 5046 |
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block. |
| 5047 |
bool prevInlineHasLineBox = toRenderInline(inlineContinuation()->node()->renderer())->firstLineBox(); |
| 5048 |
int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0; |
| 5049 |
int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0; |
| 5050 |
IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin); |
| 5051 |
if (!rect.isEmpty()) |
| 5052 |
rects.append(rect); |
| 5053 |
} else if (width() && height()) |
| 5054 |
rects.append(IntRect(tx, ty, width(), height())); |
4920 |
rects.append(IntRect(tx, ty, width(), height())); |
| 5055 |
|
4921 |
|
| 5056 |
if (!hasOverflowClip() && !hasControlClip()) { |
4922 |
if (!hasOverflowClip() && !hasControlClip()) { |
|
Lines 5075-5085
void RenderBlock::addFocusRingRects(Vect
WebCore/rendering/RenderBlock.cpp_sec28
|
| 5075 |
} |
4941 |
} |
| 5076 |
} |
4942 |
} |
| 5077 |
} |
4943 |
} |
| 5078 |
|
|
|
| 5079 |
if (inlineContinuation()) |
| 5080 |
inlineContinuation()->addFocusRingRects(rects, |
| 5081 |
tx - x() + inlineContinuation()->containingBlock()->x(), |
| 5082 |
ty - y() + inlineContinuation()->containingBlock()->y()); |
| 5083 |
} |
4944 |
} |
| 5084 |
|
4945 |
|
| 5085 |
RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const |
4946 |
RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const |
|
Lines 5111-5116
const char* RenderBlock::renderName() co
WebCore/rendering/RenderBlock.cpp_sec29
|
| 5111 |
return "RenderBlock (positioned)"; |
4972 |
return "RenderBlock (positioned)"; |
| 5112 |
if (isAnonymousBlock()) |
4973 |
if (isAnonymousBlock()) |
| 5113 |
return "RenderBlock (anonymous)"; |
4974 |
return "RenderBlock (anonymous)"; |
|
|
4975 |
else if (isAnonymousInlineBlock()) |
| 4976 |
return "RenderBlock (anonymous inline-block)"; |
| 5114 |
else if (isAnonymous()) |
4977 |
else if (isAnonymous()) |
| 5115 |
return "RenderBlock (generated)"; |
4978 |
return "RenderBlock (generated)"; |
| 5116 |
if (isRelPositioned()) |
4979 |
if (isRelPositioned()) |