| 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 LayoutUnit RenderBlock::textIndentOffset() const | 1281 LayoutUnit RenderBlock::textIndentOffset() const |
| 1282 { | 1282 { |
| 1283 LayoutUnit cw = 0; | 1283 LayoutUnit cw = 0; |
| 1284 if (style()->textIndent().isPercent()) | 1284 if (style()->textIndent().isPercent()) |
| 1285 cw = containingBlock()->availableLogicalWidth(); | 1285 cw = containingBlock()->availableLogicalWidth(); |
| 1286 return minimumValueForLength(style()->textIndent(), cw); | 1286 return minimumValueForLength(style()->textIndent(), cw); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 void RenderBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l
ogicalBottom, RootInlineBox* highest) | |
| 1290 { | |
| 1291 if (logicalTop >= logicalBottom) | |
| 1292 return; | |
| 1293 | |
| 1294 RootInlineBox* lowestDirtyLine = lastRootBox(); | |
| 1295 RootInlineBox* afterLowest = lowestDirtyLine; | |
| 1296 while (lowestDirtyLine && lowestDirtyLine->lineBottomWithLeading() >= logica
lBottom && logicalBottom < LayoutUnit::max()) { | |
| 1297 afterLowest = lowestDirtyLine; | |
| 1298 lowestDirtyLine = lowestDirtyLine->prevRootBox(); | |
| 1299 } | |
| 1300 | |
| 1301 while (afterLowest && afterLowest != highest && (afterLowest->lineBottomWith
Leading() >= logicalTop || afterLowest->lineBottomWithLeading() < 0)) { | |
| 1302 afterLowest->markDirty(); | |
| 1303 afterLowest = afterLowest->prevRootBox(); | |
| 1304 } | |
| 1305 } | |
| 1306 | |
| 1307 bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, HitTestAction hitTestAction) | 1289 bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, HitTestAction hitTestAction) |
| 1308 { | 1290 { |
| 1309 LayoutPoint adjustedLocation(accumulatedOffset + location()); | 1291 LayoutPoint adjustedLocation(accumulatedOffset + location()); |
| 1310 LayoutSize localOffset = toLayoutSize(adjustedLocation); | 1292 LayoutSize localOffset = toLayoutSize(adjustedLocation); |
| 1311 | 1293 |
| 1312 if (!isRenderView()) { | 1294 if (!isRenderView()) { |
| 1313 // Check if we need to do anything at all. | 1295 // Check if we need to do anything at all. |
| 1314 // If we have clipping, then we can't have any spillout. | 1296 // If we have clipping, then we can't have any spillout. |
| 1315 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve
rflowRect(); | 1297 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve
rflowRect(); |
| 1316 overflowBox.moveBy(adjustedLocation); | 1298 overflowBox.moveBy(adjustedLocation); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 { | 1563 { |
| 1582 if (hasOverflowClip()) | 1564 if (hasOverflowClip()) |
| 1583 offset += scrolledContentOffset(); | 1565 offset += scrolledContentOffset(); |
| 1584 } | 1566 } |
| 1585 | 1567 |
| 1586 LayoutUnit RenderBlock::availableLogicalWidth() const | 1568 LayoutUnit RenderBlock::availableLogicalWidth() const |
| 1587 { | 1569 { |
| 1588 return RenderBox::availableLogicalWidth(); | 1570 return RenderBox::availableLogicalWidth(); |
| 1589 } | 1571 } |
| 1590 | 1572 |
| 1591 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay
outUnit& maxLogicalWidth) const | |
| 1592 { | |
| 1593 if (isRenderParagraph()) { | |
| 1594 // FIXME: Remove this const_cast. | |
| 1595 toRenderBlockFlow(const_cast<RenderBlock*>(this))->computeInlinePreferre
dLogicalWidths(minLogicalWidth, maxLogicalWidth); | |
| 1596 } else { | |
| 1597 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); | |
| 1598 } | |
| 1599 | |
| 1600 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); | |
| 1601 } | |
| 1602 | |
| 1603 void RenderBlock::computePreferredLogicalWidths() | 1573 void RenderBlock::computePreferredLogicalWidths() |
| 1604 { | 1574 { |
| 1605 ASSERT(preferredLogicalWidthsDirty()); | 1575 ASSERT(preferredLogicalWidthsDirty()); |
| 1606 | 1576 |
| 1607 m_minPreferredLogicalWidth = 0; | 1577 m_minPreferredLogicalWidth = 0; |
| 1608 m_maxPreferredLogicalWidth = 0; | 1578 m_maxPreferredLogicalWidth = 0; |
| 1609 | 1579 |
| 1610 // FIXME: The isFixed() calls here should probably be checking for isSpecifi
ed since you | 1580 // FIXME: The isFixed() calls here should probably be checking for isSpecifi
ed since you |
| 1611 // should be able to use percentage, calc or viewport relative values for wi
dth. | 1581 // should be able to use percentage, calc or viewport relative values for wi
dth. |
| 1612 RenderStyle* styleToUse = style(); | 1582 RenderStyle* styleToUse = style(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1625 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); | 1595 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
| 1626 } | 1596 } |
| 1627 | 1597 |
| 1628 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); | 1598 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); |
| 1629 m_minPreferredLogicalWidth += borderAndPadding; | 1599 m_minPreferredLogicalWidth += borderAndPadding; |
| 1630 m_maxPreferredLogicalWidth += borderAndPadding; | 1600 m_maxPreferredLogicalWidth += borderAndPadding; |
| 1631 | 1601 |
| 1632 clearPreferredLogicalWidthsDirty(); | 1602 clearPreferredLogicalWidthsDirty(); |
| 1633 } | 1603 } |
| 1634 | 1604 |
| 1635 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const | 1605 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay
outUnit& maxLogicalWidth) const |
| 1636 { | 1606 { |
| 1637 RenderStyle* styleToUse = style(); | 1607 RenderStyle* styleToUse = style(); |
| 1638 bool nowrap = styleToUse->whiteSpace() == NOWRAP; | 1608 bool nowrap = styleToUse->whiteSpace() == NOWRAP; |
| 1639 | 1609 |
| 1640 RenderObject* child = firstChild(); | 1610 RenderObject* child = firstChild(); |
| 1641 while (child) { | 1611 while (child) { |
| 1642 // Positioned children don't affect the min/max width | 1612 // Positioned children don't affect the min/max width |
| 1643 if (child->isOutOfFlowPositioned()) { | 1613 if (child->isOutOfFlowPositioned()) { |
| 1644 child = child->nextSibling(); | 1614 child = child->nextSibling(); |
| 1645 continue; | 1615 continue; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1673 | 1643 |
| 1674 w = childMaxPreferredLogicalWidth + margin; | 1644 w = childMaxPreferredLogicalWidth + margin; |
| 1675 | 1645 |
| 1676 maxLogicalWidth = std::max(w, maxLogicalWidth); | 1646 maxLogicalWidth = std::max(w, maxLogicalWidth); |
| 1677 | 1647 |
| 1678 child = child->nextSibling(); | 1648 child = child->nextSibling(); |
| 1679 } | 1649 } |
| 1680 | 1650 |
| 1681 // Always make sure these values are non-negative. | 1651 // Always make sure these values are non-negative. |
| 1682 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); | 1652 minLogicalWidth = std::max<LayoutUnit>(0, minLogicalWidth); |
| 1683 maxLogicalWidth = std::max<LayoutUnit>(0, maxLogicalWidth); | 1653 maxLogicalWidth = std::max<LayoutUnit>(minLogicalWidth, maxLogicalWidth); |
| 1684 } | 1654 } |
| 1685 | 1655 |
| 1686 bool RenderBlock::hasLineIfEmpty() const | 1656 bool RenderBlock::hasLineIfEmpty() const |
| 1687 { | 1657 { |
| 1688 return node() && node()->isRootEditableElement(); | 1658 return node() && node()->isRootEditableElement(); |
| 1689 } | 1659 } |
| 1690 | 1660 |
| 1691 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const | 1661 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const |
| 1692 { | 1662 { |
| 1693 // Inline blocks are replaced elements. Otherwise, just pass off to | 1663 // Inline blocks are replaced elements. Otherwise, just pass off to |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 2112 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 2143 { | 2113 { |
| 2144 showRenderObject(); | 2114 showRenderObject(); |
| 2145 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2115 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2146 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2116 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2147 } | 2117 } |
| 2148 | 2118 |
| 2149 #endif | 2119 #endif |
| 2150 | 2120 |
| 2151 } // namespace blink | 2121 } // namespace blink |
| OLD | NEW |