OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 return textBoundingRect; | 233 return textBoundingRect; |
234 } | 234 } |
235 | 235 |
236 bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation&
locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUn
it) | 236 bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation&
locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUn
it) |
237 { | 237 { |
238 // FIXME: integrate with InlineTextBox::nodeAtPoint better. | 238 // FIXME: integrate with InlineTextBox::nodeAtPoint better. |
239 ASSERT(!isLineBreak()); | 239 ASSERT(!isLineBreak()); |
240 | 240 |
241 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r
esult.hitTestRequest(), getLineLayoutItem().style()->pointerEvents()); | 241 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r
esult.hitTestRequest(), getLineLayoutItem().style()->pointerEvents()); |
242 bool isVisible = getLineLayoutItem().style()->visibility() == VISIBLE; | 242 bool isVisible = getLineLayoutItem().style()->visibility() == EVisibility::V
isible; |
243 if (isVisible || !hitRules.requireVisible) { | 243 if (isVisible || !hitRules.requireVisible) { |
244 if (hitRules.canHitBoundingBox | 244 if (hitRules.canHitBoundingBox |
245 || (hitRules.canHitStroke && (getLineLayoutItem().style()->svgStyle(
).hasStroke() || !hitRules.requireStroke)) | 245 || (hitRules.canHitStroke && (getLineLayoutItem().style()->svgStyle(
).hasStroke() || !hitRules.requireStroke)) |
246 || (hitRules.canHitFill && (getLineLayoutItem().style()->svgStyle().
hasFill() || !hitRules.requireFill))) { | 246 || (hitRules.canHitFill && (getLineLayoutItem().style()->svgStyle().
hasFill() || !hitRules.requireFill))) { |
247 LayoutRect rect(topLeft(), LayoutSize(logicalWidth(), logicalHeight(
))); | 247 LayoutRect rect(topLeft(), LayoutSize(logicalWidth(), logicalHeight(
))); |
248 rect.moveBy(accumulatedOffset); | 248 rect.moveBy(accumulatedOffset); |
249 if (locationInContainer.intersects(rect)) { | 249 if (locationInContainer.intersects(rect)) { |
250 LineLayoutSVGInlineText lineLayoutItem = LineLayoutSVGInlineText
(this->getLineLayoutItem()); | 250 LineLayoutSVGInlineText lineLayoutItem = LineLayoutSVGInlineText
(this->getLineLayoutItem()); |
251 ASSERT(lineLayoutItem.scalingFactor()); | 251 ASSERT(lineLayoutItem.scalingFactor()); |
252 float baseline = lineLayoutItem.scaledFont().getFontMetrics().fl
oatAscent() / lineLayoutItem.scalingFactor(); | 252 float baseline = lineLayoutItem.scaledFont().getFontMetrics().fl
oatAscent() / lineLayoutItem.scalingFactor(); |
253 | 253 |
254 FloatPoint floatLocation = FloatPoint(locationInContainer.point(
)); | 254 FloatPoint floatLocation = FloatPoint(locationInContainer.point(
)); |
255 for (const SVGTextFragment& fragment : m_textFragments) { | 255 for (const SVGTextFragment& fragment : m_textFragments) { |
256 FloatQuad fragmentQuad = fragment.boundingQuad(baseline); | 256 FloatQuad fragmentQuad = fragment.boundingQuad(baseline); |
257 if (fragmentQuad.containsPoint(floatLocation)) { | 257 if (fragmentQuad.containsPoint(floatLocation)) { |
258 lineLayoutItem.updateHitTestResult(result, locationInCon
tainer.point() - toLayoutSize(accumulatedOffset)); | 258 lineLayoutItem.updateHitTestResult(result, locationInCon
tainer.point() - toLayoutSize(accumulatedOffset)); |
259 if (result.addNodeToListBasedTestResult(lineLayoutItem.n
ode(), locationInContainer, rect) == StopHitTesting) | 259 if (result.addNodeToListBasedTestResult(lineLayoutItem.n
ode(), locationInContainer, rect) == StopHitTesting) |
260 return true; | 260 return true; |
261 } | 261 } |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 } | 265 } |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 } // namespace blink | 269 } // namespace blink |
OLD | NEW |