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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Select the correct color for painting the text. | 49 // Select the correct color for painting the text. |
50 Color foreground = paintInfo.forceBlackText() ? Color::black : renderer(
)->selectionForegroundColor(); | 50 Color foreground = paintInfo.forceBlackText() ? Color::black : renderer(
)->selectionForegroundColor(); |
51 if (foreground != Color::transparent && foreground != styleTextColor) | 51 if (foreground != Color::transparent && foreground != styleTextColor) |
52 context->setFillColor(foreground); | 52 context->setFillColor(foreground); |
53 } | 53 } |
54 | 54 |
55 // Text shadows are disabled when printing. http://crbug.com/258321 | 55 // Text shadows are disabled when printing. http://crbug.com/258321 |
56 const ShadowData* shadow = context->printing() ? 0 : style->textShadow(); | 56 const ShadowData* shadow = context->printing() ? 0 : style->textShadow(); |
57 bool hasShadow = shadow; | 57 bool hasShadow = shadow; |
58 if (hasShadow) { | 58 if (hasShadow) { |
59 DrawLooper drawLooper; | 59 RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper); |
60 do { | 60 do { |
61 int shadowX = isHorizontal() ? shadow->x() : shadow->y(); | 61 int shadowX = isHorizontal() ? shadow->x() : shadow->y(); |
62 int shadowY = isHorizontal() ? shadow->y() : -shadow->x(); | 62 int shadowY = isHorizontal() ? shadow->y() : -shadow->x(); |
63 FloatSize offset(shadowX, shadowY); | 63 FloatSize offset(shadowX, shadowY); |
64 drawLooper.addShadow(offset, shadow->blur(), | 64 drawLooper->addShadow(offset, shadow->blur(), |
65 m_renderer->resolveColor(shadow->color(), Color::stdShadowColor)
, | 65 m_renderer->resolveColor(shadow->color(), Color::stdShadowColor)
, |
66 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); | 66 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); |
67 } while ((shadow = shadow->next())); | 67 } while ((shadow = shadow->next())); |
68 drawLooper.addUnmodifiedContent(); | 68 drawLooper->addUnmodifiedContent(); |
69 context->setDrawLooper(drawLooper); | 69 context->setDrawLooper(drawLooper.release()); |
70 } | 70 } |
71 | 71 |
72 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo
w. | 72 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo
w. |
73 FloatPoint boxOrigin(paintOffset); | 73 FloatPoint boxOrigin(paintOffset); |
74 boxOrigin.move(x(), y()); | 74 boxOrigin.move(x(), y()); |
75 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); | 75 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); |
76 FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + style->fontMetrics().as
cent()); | 76 FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + style->fontMetrics().as
cent()); |
77 TextRun textRun = RenderBlock::constructTextRun(renderer(), font, m_str, sty
le, TextRun::AllowTrailingExpansion); | 77 TextRun textRun = RenderBlock::constructTextRun(renderer(), font, m_str, sty
le, TextRun::AllowTrailingExpansion); |
78 TextRunPaintInfo textRunPaintInfo(textRun); | 78 TextRunPaintInfo textRunPaintInfo(textRun); |
79 textRunPaintInfo.bounds = boxRect; | 79 textRunPaintInfo.bounds = boxRect; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { | 169 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio
n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { |
170 renderer()->updateHitTestResult(result, locationInContainer.point() - to
LayoutSize(adjustedLocation)); | 170 renderer()->updateHitTestResult(result, locationInContainer.point() - to
LayoutSize(adjustedLocation)); |
171 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo
cationInContainer, boundsRect)) | 171 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo
cationInContainer, boundsRect)) |
172 return true; | 172 return true; |
173 } | 173 } |
174 | 174 |
175 return false; | 175 return false; |
176 } | 176 } |
177 | 177 |
178 } // namespace WebCore | 178 } // namespace WebCore |
OLD | NEW |