| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; | 83 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
| 84 | 84 |
| 85 RenderBlock::RenderBlock(ContainerNode* node) | 85 RenderBlock::RenderBlock(ContainerNode* node) |
| 86 : RenderBox(node) | 86 : RenderBox(node) |
| 87 , m_hasMarginBeforeQuirk(false) | 87 , m_hasMarginBeforeQuirk(false) |
| 88 , m_hasMarginAfterQuirk(false) | 88 , m_hasMarginAfterQuirk(false) |
| 89 , m_beingDestroyed(false) | 89 , m_beingDestroyed(false) |
| 90 , m_hasMarkupTruncation(false) | 90 , m_hasMarkupTruncation(false) |
| 91 , m_hasBorderOrPaddingLogicalWidthChanged(false) | 91 , m_hasBorderOrPaddingLogicalWidthChanged(false) |
| 92 , m_hasOnlySelfCollapsingChildren(false) | 92 , m_hasOnlySelfCollapsingChildren(false) |
| 93 , m_descendantsWithFloatsMarkedForLayout(false) | |
| 94 { | 93 { |
| 95 // RenderBlockFlow calls setChildrenInline(true). | 94 // RenderBlockFlow calls setChildrenInline(true). |
| 96 // By default, subclasses do not have inline children. | 95 // By default, subclasses do not have inline children. |
| 97 } | 96 } |
| 98 | 97 |
| 99 void RenderBlock::trace(Visitor* visitor) | 98 void RenderBlock::trace(Visitor* visitor) |
| 100 { | 99 { |
| 101 visitor->trace(m_children); | 100 visitor->trace(m_children); |
| 102 RenderBox::trace(visitor); | 101 RenderBox::trace(visitor); |
| 103 } | 102 } |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 799 } |
| 801 | 800 |
| 802 RenderBox::removeChild(oldChild); | 801 RenderBox::removeChild(oldChild); |
| 803 | 802 |
| 804 RenderObject* child = prev ? prev : next; | 803 RenderObject* child = prev ? prev : next; |
| 805 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { | 804 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { |
| 806 // The removal has knocked us down to containing only a single anonymous | 805 // The removal has knocked us down to containing only a single anonymous |
| 807 // box. We can go ahead and pull the content right back up into our | 806 // box. We can go ahead and pull the content right back up into our |
| 808 // box. | 807 // box. |
| 809 collapseAnonymousBlockChild(this, toRenderBlock(child)); | 808 collapseAnonymousBlockChild(this, toRenderBlock(child)); |
| 810 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | |
| 811 // It's possible that the removal has knocked us down to a single anonym
ous | |
| 812 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | |
| 813 // are floating, then we need to pull the content up also. | |
| 814 RenderBlock* anonymousBlock = toRenderBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); | |
| 815 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) | |
| 816 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) | |
| 817 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { | |
| 818 collapseAnonymousBlockChild(this, anonymousBlock); | |
| 819 } | |
| 820 } | 809 } |
| 821 | 810 |
| 822 if (!firstChild()) { | 811 if (!firstChild()) { |
| 823 // If this was our last child be sure to clear out our line boxes. | 812 // If this was our last child be sure to clear out our line boxes. |
| 824 if (childrenInline()) | 813 if (childrenInline()) |
| 825 deleteLineBoxTree(); | 814 deleteLineBoxTree(); |
| 826 | 815 |
| 827 // If we are an empty anonymous block in the continuation chain, | 816 // If we are an empty anonymous block in the continuation chain, |
| 828 // we need to remove ourself and fix the continuation chain. | 817 // we need to remove ourself and fix the continuation chain. |
| 829 if (!beingDestroyed() && isAnonymousBlockContinuation()) { | 818 if (!beingDestroyed() && isAnonymousBlockContinuation()) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 if (relayoutChildren && child->needsPreferredWidthsRecalculation()) | 1081 if (relayoutChildren && child->needsPreferredWidthsRecalculation()) |
| 1093 child->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 1082 child->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
| 1094 } | 1083 } |
| 1095 | 1084 |
| 1096 void RenderBlock::simplifiedNormalFlowLayout() | 1085 void RenderBlock::simplifiedNormalFlowLayout() |
| 1097 { | 1086 { |
| 1098 if (childrenInline()) { | 1087 if (childrenInline()) { |
| 1099 ListHashSet<RootInlineBox*> lineBoxes; | 1088 ListHashSet<RootInlineBox*> lineBoxes; |
| 1100 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1089 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
| 1101 RenderObject* o = walker.current(); | 1090 RenderObject* o = walker.current(); |
| 1102 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating
())) { | 1091 if (!o->isOutOfFlowPositioned() && o->isReplaced()) { |
| 1103 o->layoutIfNeeded(); | 1092 o->layoutIfNeeded(); |
| 1104 if (toRenderBox(o)->inlineBoxWrapper()) { | 1093 if (toRenderBox(o)->inlineBoxWrapper()) { |
| 1105 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo
t(); | 1094 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo
t(); |
| 1106 lineBoxes.add(&box); | 1095 lineBoxes.add(&box); |
| 1107 } | 1096 } |
| 1108 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { | 1097 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { |
| 1109 o->clearNeedsLayout(); | 1098 o->clearNeedsLayout(); |
| 1110 } | 1099 } |
| 1111 } | 1100 } |
| 1112 | 1101 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 } | 1284 } |
| 1296 | 1285 |
| 1297 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 1286 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 1298 { | 1287 { |
| 1299 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) | 1288 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) |
| 1300 paintChild(child, paintInfo, paintOffset); | 1289 paintChild(child, paintInfo, paintOffset); |
| 1301 } | 1290 } |
| 1302 | 1291 |
| 1303 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) | 1292 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) |
| 1304 { | 1293 { |
| 1305 if (!child->hasSelfPaintingLayer() && !child->isFloating()) | 1294 if (!child->hasSelfPaintingLayer()) |
| 1306 child->paint(paintInfo, paintOffset); | 1295 child->paint(paintInfo, paintOffset); |
| 1307 } | 1296 } |
| 1308 | 1297 |
| 1309 void RenderBlock::paintChildAsInlineBlock(RenderBox* child, PaintInfo& paintInfo
, const LayoutPoint& paintOffset) | 1298 void RenderBlock::paintChildAsInlineBlock(RenderBox* child, PaintInfo& paintInfo
, const LayoutPoint& paintOffset) |
| 1310 { | 1299 { |
| 1311 if (!child->hasSelfPaintingLayer() && !child->isFloating()) | 1300 if (!child->hasSelfPaintingLayer()) |
| 1312 paintAsInlineBlock(child, paintInfo, paintOffset); | 1301 paintAsInlineBlock(child, paintInfo, paintOffset); |
| 1313 } | 1302 } |
| 1314 | 1303 |
| 1315 void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInf
o, const LayoutPoint& childPoint) | 1304 void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInf
o, const LayoutPoint& childPoint) |
| 1316 { | 1305 { |
| 1317 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 1306 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
| 1318 return; | 1307 return; |
| 1319 | 1308 |
| 1320 // Paint all phases atomically, as though the element established its own | 1309 // Paint all phases atomically, as though the element established its own |
| 1321 // stacking context. (See Appendix E.2, section 7.2.1.4 on | 1310 // stacking context. (See Appendix E.2, section 7.2.1.4 on |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 bool RenderBlock::shouldPaintSelectionGaps() const | 1516 bool RenderBlock::shouldPaintSelectionGaps() const |
| 1528 { | 1517 { |
| 1529 return selectionState() != SelectionNone && isSelectionRoot(); | 1518 return selectionState() != SelectionNone && isSelectionRoot(); |
| 1530 } | 1519 } |
| 1531 | 1520 |
| 1532 bool RenderBlock::isSelectionRoot() const | 1521 bool RenderBlock::isSelectionRoot() const |
| 1533 { | 1522 { |
| 1534 ASSERT(node() || isAnonymous()); | 1523 ASSERT(node() || isAnonymous()); |
| 1535 | 1524 |
| 1536 if (isDocumentElement() || hasOverflowClip() | 1525 if (isDocumentElement() || hasOverflowClip() |
| 1537 || isPositioned() || isFloating() | 1526 || isPositioned() |
| 1538 || isInlineBlock() | 1527 || isInlineBlock() |
| 1539 || hasTransform() || hasMask() | 1528 || hasTransform() || hasMask() |
| 1540 || isFlexItemIncludingDeprecated()) | 1529 || isFlexItemIncludingDeprecated()) |
| 1541 return true; | 1530 return true; |
| 1542 | 1531 |
| 1543 if (view() && view()->selectionStart()) { | 1532 if (view() && view()->selectionStart()) { |
| 1544 Node* startElement = view()->selectionStart()->node(); | 1533 Node* startElement = view()->selectionStart()->node(); |
| 1545 if (startElement && startElement->rootEditableElement() == node()) | 1534 if (startElement && startElement->rootEditableElement() == node()) |
| 1546 return true; | 1535 return true; |
| 1547 } | 1536 } |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 if (childrenInline()) { | 2171 if (childrenInline()) { |
| 2183 // We have to hit-test our line boxes. | 2172 // We have to hit-test our line boxes. |
| 2184 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu
mulatedOffset, hitTestAction)) | 2173 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu
mulatedOffset, hitTestAction)) |
| 2185 return true; | 2174 return true; |
| 2186 } else { | 2175 } else { |
| 2187 // Hit test our children. | 2176 // Hit test our children. |
| 2188 HitTestAction childHitTest = hitTestAction; | 2177 HitTestAction childHitTest = hitTestAction; |
| 2189 if (hitTestAction == HitTestChildBlockBackgrounds) | 2178 if (hitTestAction == HitTestChildBlockBackgrounds) |
| 2190 childHitTest = HitTestChildBlockBackground; | 2179 childHitTest = HitTestChildBlockBackground; |
| 2191 for (RenderBox* child = lastChildBox(); child; child = child->previousSi
blingBox()) { | 2180 for (RenderBox* child = lastChildBox(); child; child = child->previousSi
blingBox()) { |
| 2192 if (!child->hasSelfPaintingLayer() && !child->isFloating() && child-
>nodeAtPoint(request, result, locationInContainer, accumulatedOffset, childHitTe
st)) | 2181 if (!child->hasSelfPaintingLayer() && child->nodeAtPoint(request, re
sult, locationInContainer, accumulatedOffset, childHitTest)) |
| 2193 return true; | 2182 return true; |
| 2194 } | 2183 } |
| 2195 } | 2184 } |
| 2196 | 2185 |
| 2197 return false; | 2186 return false; |
| 2198 } | 2187 } |
| 2199 | 2188 |
| 2200 Position RenderBlock::positionForBox(InlineBox *box, bool start) const | 2189 Position RenderBlock::positionForBox(InlineBox *box, bool start) const |
| 2201 { | 2190 { |
| 2202 if (!box) | 2191 if (!box) |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 | 2426 |
| 2438 clearPreferredLogicalWidthsDirty(); | 2427 clearPreferredLogicalWidthsDirty(); |
| 2439 } | 2428 } |
| 2440 | 2429 |
| 2441 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const | 2430 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const |
| 2442 { | 2431 { |
| 2443 RenderStyle* styleToUse = style(); | 2432 RenderStyle* styleToUse = style(); |
| 2444 bool nowrap = styleToUse->whiteSpace() == NOWRAP; | 2433 bool nowrap = styleToUse->whiteSpace() == NOWRAP; |
| 2445 | 2434 |
| 2446 RenderObject* child = firstChild(); | 2435 RenderObject* child = firstChild(); |
| 2447 RenderBlock* containingBlock = this->containingBlock(); | |
| 2448 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | |
| 2449 while (child) { | 2436 while (child) { |
| 2450 // Positioned children don't affect the min/max width | 2437 // Positioned children don't affect the min/max width |
| 2451 if (child->isOutOfFlowPositioned()) { | 2438 if (child->isOutOfFlowPositioned()) { |
| 2452 child = child->nextSibling(); | 2439 child = child->nextSibling(); |
| 2453 continue; | 2440 continue; |
| 2454 } | 2441 } |
| 2455 | 2442 |
| 2456 RefPtr<RenderStyle> childStyle = child->style(); | 2443 RefPtr<RenderStyle> childStyle = child->style(); |
| 2457 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids
Floats())) { | |
| 2458 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; | |
| 2459 if (childStyle->clear() & CLEFT) { | |
| 2460 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | |
| 2461 floatLeftWidth = 0; | |
| 2462 } | |
| 2463 if (childStyle->clear() & CRIGHT) { | |
| 2464 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | |
| 2465 floatRightWidth = 0; | |
| 2466 } | |
| 2467 } | |
| 2468 | 2444 |
| 2469 // A margin basically has three types: fixed, percentage, and auto (vari
able). | 2445 // A margin basically has three types: fixed, percentage, and auto (vari
able). |
| 2470 // Auto and percentage margins simply become 0 when computing min/max wi
dth. | 2446 // Auto and percentage margins simply become 0 when computing min/max wi
dth. |
| 2471 // Fixed margins can be added in as is. | 2447 // Fixed margins can be added in as is. |
| 2472 Length startMarginLength = childStyle->marginStartUsing(styleToUse); | 2448 Length startMarginLength = childStyle->marginStartUsing(styleToUse); |
| 2473 Length endMarginLength = childStyle->marginEndUsing(styleToUse); | 2449 Length endMarginLength = childStyle->marginEndUsing(styleToUse); |
| 2474 LayoutUnit margin = 0; | 2450 LayoutUnit margin = 0; |
| 2475 LayoutUnit marginStart = 0; | 2451 LayoutUnit marginStart = 0; |
| 2476 LayoutUnit marginEnd = 0; | 2452 LayoutUnit marginEnd = 0; |
| 2477 if (startMarginLength.isFixed()) | 2453 if (startMarginLength.isFixed()) |
| 2478 marginStart += startMarginLength.value(); | 2454 marginStart += startMarginLength.value(); |
| 2479 if (endMarginLength.isFixed()) | 2455 if (endMarginLength.isFixed()) |
| 2480 marginEnd += endMarginLength.value(); | 2456 marginEnd += endMarginLength.value(); |
| 2481 margin = marginStart + marginEnd; | 2457 margin = marginStart + marginEnd; |
| 2482 | 2458 |
| 2483 LayoutUnit childMinPreferredLogicalWidth = child->minPreferredLogicalWid
th(); | 2459 LayoutUnit childMinPreferredLogicalWidth = child->minPreferredLogicalWid
th(); |
| 2484 LayoutUnit childMaxPreferredLogicalWidth = child->maxPreferredLogicalWid
th(); | 2460 LayoutUnit childMaxPreferredLogicalWidth = child->maxPreferredLogicalWid
th(); |
| 2485 | 2461 |
| 2486 LayoutUnit w = childMinPreferredLogicalWidth + margin; | 2462 LayoutUnit w = childMinPreferredLogicalWidth + margin; |
| 2487 minLogicalWidth = std::max(w, minLogicalWidth); | 2463 minLogicalWidth = std::max(w, minLogicalWidth); |
| 2488 | 2464 |
| 2489 // IE ignores tables for calculation of nowrap. Makes some sense. | 2465 // IE ignores tables for calculation of nowrap. Makes some sense. |
| 2490 if (nowrap) | 2466 if (nowrap) |
| 2491 maxLogicalWidth = std::max(w, maxLogicalWidth); | 2467 maxLogicalWidth = std::max(w, maxLogicalWidth); |
| 2492 | 2468 |
| 2493 w = childMaxPreferredLogicalWidth + margin; | 2469 w = childMaxPreferredLogicalWidth + margin; |
| 2494 | 2470 |
| 2495 if (!child->isFloating()) { | 2471 maxLogicalWidth = std::max(w, maxLogicalWidth); |
| 2496 if (child->isBox() && toRenderBox(child)->avoidsFloats()) { | |
| 2497 // Determine a left and right max value based off whether or not
the floats can fit in the | |
| 2498 // margins of the object. For negative margins, we will attempt
to overlap the float if the negative margin | |
| 2499 // is smaller than the float width. | |
| 2500 bool ltr = containingBlock ? containingBlock->style()->isLeftToR
ightDirection() : styleToUse->isLeftToRightDirection(); | |
| 2501 LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd; | |
| 2502 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart; | |
| 2503 LayoutUnit maxLeft = marginLogicalLeft > 0 ? std::max(floatLeftW
idth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft; | |
| 2504 LayoutUnit maxRight = marginLogicalRight > 0 ? std::max(floatRig
htWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; | |
| 2505 w = childMaxPreferredLogicalWidth + maxLeft + maxRight; | |
| 2506 w = std::max(w, floatLeftWidth + floatRightWidth); | |
| 2507 } else { | |
| 2508 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, max
LogicalWidth); | |
| 2509 } | |
| 2510 floatLeftWidth = floatRightWidth = 0; | |
| 2511 } | |
| 2512 | |
| 2513 if (child->isFloating()) { | |
| 2514 if (childStyle->floating() == LeftFloat) | |
| 2515 floatLeftWidth += w; | |
| 2516 else | |
| 2517 floatRightWidth += w; | |
| 2518 } else { | |
| 2519 maxLogicalWidth = std::max(w, maxLogicalWidth); | |
| 2520 } | |
| 2521 | 2472 |
| 2522 child = child->nextSibling(); | 2473 child = child->nextSibling(); |
| 2523 } | 2474 } |
| 2524 | 2475 |
| 2525 // Always make sure these values are non-negative. | 2476 // Always make sure these values are non-negative. |
| 2526 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); | 2477 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); |
| 2527 maxLogicalWidth = std::max<LayoutUnit>(0, maxLogicalWidth); | 2478 maxLogicalWidth = std::max<LayoutUnit>(0, maxLogicalWidth); |
| 2528 | |
| 2529 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth
); | |
| 2530 } | 2479 } |
| 2531 | 2480 |
| 2532 bool RenderBlock::hasLineIfEmpty() const | 2481 bool RenderBlock::hasLineIfEmpty() const |
| 2533 { | 2482 { |
| 2534 return node() && node()->isRootEditableElement(); | 2483 return node() && node()->isRootEditableElement(); |
| 2535 } | 2484 } |
| 2536 | 2485 |
| 2537 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const | 2486 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const |
| 2538 { | 2487 { |
| 2539 // Inline blocks are replaced elements. Otherwise, just pass off to | 2488 // Inline blocks are replaced elements. Otherwise, just pass off to |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 RenderBlock* RenderBlock::firstLineBlock() const | 2607 RenderBlock* RenderBlock::firstLineBlock() const |
| 2659 { | 2608 { |
| 2660 RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); | 2609 RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); |
| 2661 bool hasPseudo = false; | 2610 bool hasPseudo = false; |
| 2662 while (true) { | 2611 while (true) { |
| 2663 // FIXME(sky): Remove all this. | 2612 // FIXME(sky): Remove all this. |
| 2664 hasPseudo = false; | 2613 hasPseudo = false; |
| 2665 if (hasPseudo) | 2614 if (hasPseudo) |
| 2666 break; | 2615 break; |
| 2667 RenderObject* parentBlock = firstLineBlock->parent(); | 2616 RenderObject* parentBlock = firstLineBlock->parent(); |
| 2668 if (firstLineBlock->isReplaced() || firstLineBlock->isFloating() | 2617 if (firstLineBlock->isReplaced() |
| 2669 || !parentBlock | 2618 || !parentBlock |
| 2670 || !parentBlock->isRenderBlockFlow()) | 2619 || !parentBlock->isRenderBlockFlow()) |
| 2671 break; | 2620 break; |
| 2672 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock()); | 2621 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock()); |
| 2673 if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock) | 2622 if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock) |
| 2674 break; | 2623 break; |
| 2675 firstLineBlock = toRenderBlock(parentBlock); | 2624 firstLineBlock = toRenderBlock(parentBlock); |
| 2676 } | 2625 } |
| 2677 | 2626 |
| 2678 if (!hasPseudo) | 2627 if (!hasPseudo) |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQuirk()
: child->style()->hasMarginBeforeQuirk(); | 2886 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQuirk()
: child->style()->hasMarginBeforeQuirk(); |
| 2938 } | 2887 } |
| 2939 | 2888 |
| 2940 bool RenderBlock::hasMarginAfterQuirk(const RenderBox* child) const | 2889 bool RenderBlock::hasMarginAfterQuirk(const RenderBox* child) const |
| 2941 { | 2890 { |
| 2942 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuirk()
: child->style()->hasMarginAfterQuirk(); | 2891 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuirk()
: child->style()->hasMarginAfterQuirk(); |
| 2943 } | 2892 } |
| 2944 | 2893 |
| 2945 const char* RenderBlock::renderName() const | 2894 const char* RenderBlock::renderName() const |
| 2946 { | 2895 { |
| 2947 if (isFloating()) | |
| 2948 return "RenderBlock (floating)"; | |
| 2949 if (isOutOfFlowPositioned()) | 2896 if (isOutOfFlowPositioned()) |
| 2950 return "RenderBlock (positioned)"; | 2897 return "RenderBlock (positioned)"; |
| 2951 if (isAnonymousBlock()) | 2898 if (isAnonymousBlock()) |
| 2952 return "RenderBlock (anonymous)"; | 2899 return "RenderBlock (anonymous)"; |
| 2953 if (isAnonymous()) | 2900 if (isAnonymous()) |
| 2954 return "RenderBlock (generated)"; | 2901 return "RenderBlock (generated)"; |
| 2955 if (isRelPositioned()) | 2902 if (isRelPositioned()) |
| 2956 return "RenderBlock (relative positioned)"; | 2903 return "RenderBlock (relative positioned)"; |
| 2957 return "RenderBlock"; | 2904 return "RenderBlock"; |
| 2958 } | 2905 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3083 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 3030 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 3084 { | 3031 { |
| 3085 showRenderObject(); | 3032 showRenderObject(); |
| 3086 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3033 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3087 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3034 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3088 } | 3035 } |
| 3089 | 3036 |
| 3090 #endif | 3037 #endif |
| 3091 | 3038 |
| 3092 } // namespace blink | 3039 } // namespace blink |
| OLD | NEW |