| 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 18 matching lines...) Expand all Loading... |
| 29 #include "platform/fonts/Font.h" | 29 #include "platform/fonts/Font.h" |
| 30 #include "platform/graphics/DrawLooperBuilder.h" | 30 #include "platform/graphics/DrawLooperBuilder.h" |
| 31 #include "platform/graphics/GraphicsContextStateSaver.h" | 31 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 32 #include "platform/text/TextRun.h" | 32 #include "platform/text/TextRun.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
youtUnit lineTop, LayoutUnit lineBottom) | 36 void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
youtUnit lineTop, LayoutUnit lineBottom) |
| 37 { | 37 { |
| 38 GraphicsContext* context = paintInfo.context; | 38 GraphicsContext* context = paintInfo.context; |
| 39 RenderStyle* style = renderer().style(isFirstLineStyle()); | 39 RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
| 40 | 40 |
| 41 const Font& font = style->font(); | 41 const Font& font = style->font(); |
| 42 FloatPoint boxOrigin = locationIncludingFlipping(); | 42 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 43 boxOrigin.moveBy(FloatPoint(paintOffset)); | 43 boxOrigin.moveBy(FloatPoint(paintOffset)); |
| 44 if (!isHorizontal()) | 44 if (!isHorizontal()) |
| 45 boxOrigin.move(0, -virtualLogicalHeight()); | 45 boxOrigin.move(0, -virtualLogicalHeight()); |
| 46 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight
())); | 46 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight
())); |
| 47 GraphicsContextStateSaver stateSaver(*context); | 47 GraphicsContextStateSaver stateSaver(*context); |
| 48 if (!isHorizontal()) | 48 if (!isHorizontal()) |
| 49 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clock
wise)); | 49 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clock
wise)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style) | 116 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style) |
| 117 { | 117 { |
| 118 InlineBox* markupBox = this->markupBox(); | 118 InlineBox* markupBox = this->markupBox(); |
| 119 if (!markupBox) | 119 if (!markupBox) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 LayoutPoint adjustedPaintOffset = paintOffset; | 122 LayoutPoint adjustedPaintOffset = paintOffset; |
| 123 adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(), | 123 adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(), |
| 124 y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->rende
rer().style(isFirstLineStyle())->fontMetrics().ascent())); | 124 y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->rende
rer().styleOrFirstLineStyle(isFirstLineStyle())->fontMetrics().ascent())); |
| 125 markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); | 125 markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); |
| 126 } | 126 } |
| 127 | 127 |
| 128 IntRect EllipsisBox::selectionRect() | 128 IntRect EllipsisBox::selectionRect() |
| 129 { | 129 { |
| 130 RenderStyle* style = renderer().style(isFirstLineStyle()); | 130 RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()); |
| 131 const Font& font = style->font(); | 131 const Font& font = style->font(); |
| 132 return enclosingIntRect(font.selectionRectForText(RenderBlockFlow::construct
TextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPo
int(logicalLeft(), logicalTop() + root().selectionTopAdjustedForPrecedingBlock()
), root().selectionHeightAdjustedForPrecedingBlock())); | 132 return enclosingIntRect(font.selectionRectForText(RenderBlockFlow::construct
TextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPo
int(logicalLeft(), logicalTop() + root().selectionTopAdjustedForPrecedingBlock()
), root().selectionHeightAdjustedForPrecedingBlock())); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void EllipsisBox::paintSelection(GraphicsContext* context, const FloatPoint& box
Origin, RenderStyle* style, const Font& font) | 135 void EllipsisBox::paintSelection(GraphicsContext* context, const FloatPoint& box
Origin, RenderStyle* style, const Font& font) |
| 136 { | 136 { |
| 137 Color textColor = renderer().resolveColor(style, CSSPropertyColor); | 137 Color textColor = renderer().resolveColor(style, CSSPropertyColor); |
| 138 Color c = renderer().selectionBackgroundColor(); | 138 Color c = renderer().selectionBackgroundColor(); |
| 139 if (!c.alpha()) | 139 if (!c.alpha()) |
| 140 return; | 140 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 155 context->clip(clipRect); | 155 context->clip(clipRect); |
| 156 context->drawHighlightForText(font, RenderBlockFlow::constructTextRun(&rende
rer(), font, m_str, style, TextRun::AllowTrailingExpansion), localOrigin, h, c); | 156 context->drawHighlightForText(font, RenderBlockFlow::constructTextRun(&rende
rer(), font, m_str, style, TextRun::AllowTrailingExpansion), localOrigin, h, c); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) | 159 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) |
| 160 { | 160 { |
| 161 LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLef
t()); | 161 LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLef
t()); |
| 162 | 162 |
| 163 // Hit test the markup box. | 163 // Hit test the markup box. |
| 164 if (InlineBox* markupBox = this->markupBox()) { | 164 if (InlineBox* markupBox = this->markupBox()) { |
| 165 RenderStyle* style = renderer().style(isFirstLineStyle()); | 165 RenderStyle* style = renderer().styleOrFirstLineStyle(isFirstLineStyle()
); |
| 166 LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x(); | 166 LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x(); |
| 167 LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() -
(markupBox->y() + markupBox->renderer().style(isFirstLineStyle())->fontMetrics()
.ascent()); | 167 LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() -
(markupBox->y() + markupBox->renderer().styleOrFirstLineStyle(isFirstLineStyle()
)->fontMetrics().ascent()); |
| 168 if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutP
oint(mtx, mty), lineTop, lineBottom)) { | 168 if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutP
oint(mtx, mty), lineTop, lineBottom)) { |
| 169 renderer().updateHitTestResult(result, locationInContainer.point() -
LayoutSize(mtx, mty)); | 169 renderer().updateHitTestResult(result, locationInContainer.point() -
LayoutSize(mtx, mty)); |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 FloatPoint boxOrigin = locationIncludingFlipping(); | 174 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 175 boxOrigin.moveBy(accumulatedOffset); | 175 boxOrigin.moveBy(accumulatedOffset); |
| 176 FloatRect boundsRect(boxOrigin, size()); | 176 FloatRect boundsRect(boxOrigin, size()); |
| 177 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { | 177 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { |
| 178 renderer().updateHitTestResult(result, locationInContainer.point() - toL
ayoutSize(adjustedLocation)); | 178 renderer().updateHitTestResult(result, locationInContainer.point() - toL
ayoutSize(adjustedLocation)); |
| 179 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, boundsRect)) | 179 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, boundsRect)) |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 return false; | 183 return false; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace WebCore | 186 } // namespace WebCore |
| OLD | NEW |