| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 LayoutPoint adjustedPaintOffset = paintOffset; | 123 LayoutPoint adjustedPaintOffset = paintOffset; |
| 124 adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(), | 124 adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(), |
| 125 y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->rende
rer().style(isFirstLineStyle())->fontMetrics().ascent())); | 125 y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->rende
rer().style(isFirstLineStyle())->fontMetrics().ascent())); |
| 126 markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); | 126 markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); |
| 127 } | 127 } |
| 128 | 128 |
| 129 IntRect EllipsisBox::selectionRect() | 129 IntRect EllipsisBox::selectionRect() |
| 130 { | 130 { |
| 131 RenderStyle* style = renderer().style(isFirstLineStyle()); | 131 RenderStyle* style = renderer().style(isFirstLineStyle()); |
| 132 const Font& font = style->font(); | 132 const Font& font = style->font(); |
| 133 return enclosingIntRect(font.selectionRectForText(RenderBlockFlow::construct
TextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPo
int(logicalLeft(), logicalTop() + root()->selectionTopAdjustedForPrecedingBlock(
)), root()->selectionHeightAdjustedForPrecedingBlock())); | 133 return enclosingIntRect(font.selectionRectForText(RenderBlockFlow::construct
TextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPo
int(logicalLeft(), logicalTop() + root().selectionTopAdjustedForPrecedingBlock()
), root().selectionHeightAdjustedForPrecedingBlock())); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void EllipsisBox::paintSelection(GraphicsContext* context, const FloatPoint& box
Origin, RenderStyle* style, const Font& font) | 136 void EllipsisBox::paintSelection(GraphicsContext* context, const FloatPoint& box
Origin, RenderStyle* style, const Font& font) |
| 137 { | 137 { |
| 138 Color textColor = renderer().resolveColor(style, CSSPropertyColor); | 138 Color textColor = renderer().resolveColor(style, CSSPropertyColor); |
| 139 Color c = renderer().selectionBackgroundColor(); | 139 Color c = renderer().selectionBackgroundColor(); |
| 140 if (!c.alpha()) | 140 if (!c.alpha()) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 // If the text color ends up being the same as the selection background, inv
ert the selection | 143 // If the text color ends up being the same as the selection background, inv
ert the selection |
| 144 // background. | 144 // background. |
| 145 if (textColor == c) | 145 if (textColor == c) |
| 146 c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue()); | 146 c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue()); |
| 147 | 147 |
| 148 GraphicsContextStateSaver stateSaver(*context); | 148 GraphicsContextStateSaver stateSaver(*context); |
| 149 LayoutUnit selectionBottom = root()->selectionBottom(); | 149 LayoutUnit selectionBottom = root().selectionBottom(); |
| 150 LayoutUnit top = root()->selectionTop(); | 150 LayoutUnit top = root().selectionTop(); |
| 151 LayoutUnit h = root()->selectionHeight(); | 151 LayoutUnit h = root().selectionHeight(); |
| 152 const int deltaY = roundToInt(renderer().style()->isFlippedLinesWritingMode(
) ? selectionBottom - logicalBottom() : logicalTop() - top); | 152 const int deltaY = roundToInt(renderer().style()->isFlippedLinesWritingMode(
) ? selectionBottom - logicalBottom() : logicalTop() - top); |
| 153 const FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); | 153 const FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); |
| 154 FloatRect clipRect(localOrigin, FloatSize(m_logicalWidth, h)); | 154 FloatRect clipRect(localOrigin, FloatSize(m_logicalWidth, h)); |
| 155 alignSelectionRectToDevicePixels(clipRect); | 155 alignSelectionRectToDevicePixels(clipRect); |
| 156 context->clip(clipRect); | 156 context->clip(clipRect); |
| 157 context->drawHighlightForText(font, RenderBlockFlow::constructTextRun(&rende
rer(), font, m_str, style, TextRun::AllowTrailingExpansion), localOrigin, h, c); | 157 context->drawHighlightForText(font, RenderBlockFlow::constructTextRun(&rende
rer(), font, m_str, style, TextRun::AllowTrailingExpansion), localOrigin, h, c); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) | 160 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) |
| 161 { | 161 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 178 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { | 178 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { |
| 179 renderer().updateHitTestResult(result, locationInContainer.point() - toL
ayoutSize(adjustedLocation)); | 179 renderer().updateHitTestResult(result, locationInContainer.point() - toL
ayoutSize(adjustedLocation)); |
| 180 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, boundsRect)) | 180 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, boundsRect)) |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 | 183 |
| 184 return false; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace WebCore | 187 } // namespace WebCore |
| OLD | NEW |