| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 void EllipsisBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et, LayoutUnit lineTop, LayoutUnit lineBottom) | 36 void EllipsisBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et, LayoutUnit lineTop, LayoutUnit lineBottom) |
| 37 { | 37 { |
| 38 EllipsisBoxPainter(*this).paint(paintInfo, paintOffset, lineTop, lineBottom)
; | 38 EllipsisBoxPainter(*this).paint(paintInfo, paintOffset, lineTop, lineBottom)
; |
| 39 } | 39 } |
| 40 | 40 |
| 41 InlineBox* EllipsisBox::markupBox() const | 41 InlineBox* EllipsisBox::markupBox() const |
| 42 { | 42 { |
| 43 if (!m_shouldPaintMarkupBox || !renderer().isLayoutBlock()) | 43 if (!m_shouldPaintMarkupBox || !layoutObject().isLayoutBlock()) |
| 44 return 0; | 44 return 0; |
| 45 | 45 |
| 46 LayoutBlock& block = toLayoutBlock(renderer()); | 46 LayoutBlock& block = toLayoutBlock(layoutObject()); |
| 47 RootInlineBox* lastLine = block.lineAtIndex(block.lineCount() - 1); | 47 RootInlineBox* lastLine = block.lineAtIndex(block.lineCount() - 1); |
| 48 if (!lastLine) | 48 if (!lastLine) |
| 49 return 0; | 49 return 0; |
| 50 | 50 |
| 51 // If the last line-box on the last line of a block is a link, -webkit-line-
clamp paints that box after the ellipsis. | 51 // If the last line-box on the last line of a block is a link, -webkit-line-
clamp paints that box after the ellipsis. |
| 52 // It does not actually move the link. | 52 // It does not actually move the link. |
| 53 InlineBox* anchorBox = lastLine->lastChild(); | 53 InlineBox* anchorBox = lastLine->lastChild(); |
| 54 if (!anchorBox || !anchorBox->renderer().style()->isLink()) | 54 if (!anchorBox || !anchorBox->layoutObject().style()->isLink()) |
| 55 return 0; | 55 return 0; |
| 56 | 56 |
| 57 return anchorBox; | 57 return anchorBox; |
| 58 } | 58 } |
| 59 | 59 |
| 60 IntRect EllipsisBox::selectionRect() | 60 IntRect EllipsisBox::selectionRect() |
| 61 { | 61 { |
| 62 const LayoutStyle& style = renderer().styleRef(isFirstLineStyle()); | 62 const LayoutStyle& style = layoutObject().styleRef(isFirstLineStyle()); |
| 63 const Font& font = style.font(); | 63 const Font& font = style.font(); |
| 64 return enclosingIntRect(font.selectionRectForText(constructTextRun(&renderer
(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(logicalLeft()
, logicalTop() + root().selectionTopAdjustedForPrecedingBlock()), root().selecti
onHeightAdjustedForPrecedingBlock())); | 64 return enclosingIntRect(font.selectionRectForText(constructTextRun(&layoutOb
ject(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(logicalLe
ft(), logicalTop() + root().selectionTopAdjustedForPrecedingBlock()), root().sel
ectionHeightAdjustedForPrecedingBlock())); |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) | 67 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) |
| 68 { | 68 { |
| 69 // FIXME: the call to roundedLayoutPoint() below is temporary and should be
removed once | 69 // FIXME: the call to roundedLayoutPoint() below is temporary and should be
removed once |
| 70 // the transition to LayoutUnit-based types is complete (crbug.com/321237) | 70 // the transition to LayoutUnit-based types is complete (crbug.com/321237) |
| 71 LayoutPoint adjustedLocation = accumulatedOffset + topLeft().roundedLayoutPo
int(); | 71 LayoutPoint adjustedLocation = accumulatedOffset + topLeft().roundedLayoutPo
int(); |
| 72 | 72 |
| 73 // Hit test the markup box. | 73 // Hit test the markup box. |
| 74 if (InlineBox* markupBox = this->markupBox()) { | 74 if (InlineBox* markupBox = this->markupBox()) { |
| 75 const LayoutStyle& style = renderer().styleRef(isFirstLineStyle()); | 75 const LayoutStyle& style = layoutObject().styleRef(isFirstLineStyle()); |
| 76 LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x(); | 76 LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x(); |
| 77 LayoutUnit mty = adjustedLocation.y() + style.fontMetrics().ascent() - (
markupBox->y() + markupBox->renderer().style(isFirstLineStyle())->fontMetrics().
ascent()); | 77 LayoutUnit mty = adjustedLocation.y() + style.fontMetrics().ascent() - (
markupBox->y() + markupBox->layoutObject().style(isFirstLineStyle())->fontMetric
s().ascent()); |
| 78 if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutP
oint(mtx, mty), lineTop, lineBottom)) { | 78 if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutP
oint(mtx, mty), lineTop, lineBottom)) { |
| 79 renderer().updateHitTestResult(result, locationInContainer.point() -
LayoutSize(mtx, mty)); | 79 layoutObject().updateHitTestResult(result, locationInContainer.point
() - LayoutSize(mtx, mty)); |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping(); | 84 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping(); |
| 85 boxOrigin.moveBy(accumulatedOffset); | 85 boxOrigin.moveBy(accumulatedOffset); |
| 86 FloatRectWillBeLayoutRect boundsRect(boxOrigin, size()); | 86 FloatRectWillBeLayoutRect boundsRect(boxOrigin, size()); |
| 87 if (visibleToHitTestRequest(request) && boundsRect.intersects(FloatRectWillB
eLayoutRect(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0,
0)))) { | 87 if (visibleToHitTestRequest(request) && boundsRect.intersects(FloatRectWillB
eLayoutRect(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0,
0)))) { |
| 88 renderer().updateHitTestResult(result, locationInContainer.point() - toL
ayoutSize(adjustedLocation)); | 88 layoutObject().updateHitTestResult(result, locationInContainer.point() -
toLayoutSize(adjustedLocation)); |
| 89 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition | 89 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition |
| 90 // to LayoutUnit-based types is complete (crbug.com/321237) | 90 // to LayoutUnit-based types is complete (crbug.com/321237) |
| 91 if (!result.addNodeToListBasedTestResult(renderer().node(), request, loc
ationInContainer, boundsRect.rawValue())) | 91 if (!result.addNodeToListBasedTestResult(layoutObject().node(), request,
locationInContainer, boundsRect.rawValue())) |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace blink | 98 } // namespace blink |
| OLD | NEW |