| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
| 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 29 matching lines...) Expand all Loading... |
| 40 , textBox(0) | 40 , textBox(0) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool isVerticalText; | 44 bool isVerticalText; |
| 45 unsigned processedCharacters; | 45 unsigned processedCharacters; |
| 46 RenderSVGInlineText* textRenderer; | 46 RenderSVGInlineText* textRenderer; |
| 47 const SVGInlineTextBox* textBox; | 47 const SVGInlineTextBox* textBox; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 static inline InlineFlowBox* flowBoxForRenderer(RenderObject* renderer) | 50 static inline InlineFlowBox* flowBoxForRenderer(LayoutObject* renderer) |
| 51 { | 51 { |
| 52 if (!renderer) | 52 if (!renderer) |
| 53 return 0; | 53 return 0; |
| 54 | 54 |
| 55 if (renderer->isRenderBlock()) { | 55 if (renderer->isRenderBlock()) { |
| 56 // If we're given a block element, it has to be a RenderSVGText. | 56 // If we're given a block element, it has to be a RenderSVGText. |
| 57 ASSERT(renderer->isSVGText()); | 57 ASSERT(renderer->isSVGText()); |
| 58 RenderBlockFlow* renderBlockFlow = toRenderBlockFlow(renderer); | 58 RenderBlockFlow* renderBlockFlow = toRenderBlockFlow(renderer); |
| 59 | 59 |
| 60 // RenderSVGText only ever contains a single line box. | 60 // RenderSVGText only ever contains a single line box. |
| 61 InlineFlowBox* flowBox = renderBlockFlow->firstLineBox(); | 61 InlineFlowBox* flowBox = renderBlockFlow->firstLineBox(); |
| 62 ASSERT(flowBox == renderBlockFlow->lastLineBox()); | 62 ASSERT(flowBox == renderBlockFlow->lastLineBox()); |
| 63 return flowBox; | 63 return flowBox; |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (renderer->isRenderInline()) { | 66 if (renderer->isRenderInline()) { |
| 67 // We're given a RenderSVGInline or objects that derive from it (RenderS
VGTSpan / RenderSVGTextPath) | 67 // We're given a RenderSVGInline or objects that derive from it (RenderS
VGTSpan / RenderSVGTextPath) |
| 68 RenderInline* renderInline = toRenderInline(renderer); | 68 RenderInline* renderInline = toRenderInline(renderer); |
| 69 | 69 |
| 70 // RenderSVGInline only ever contains a single line box. | 70 // RenderSVGInline only ever contains a single line box. |
| 71 InlineFlowBox* flowBox = renderInline->firstLineBox(); | 71 InlineFlowBox* flowBox = renderInline->firstLineBox(); |
| 72 ASSERT(flowBox == renderInline->lastLineBox()); | 72 ASSERT(flowBox == renderInline->lastLineBox()); |
| 73 return flowBox; | 73 return flowBox; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ASSERT_NOT_REACHED(); | 76 ASSERT_NOT_REACHED(); |
| 77 return 0; | 77 return 0; |
| 78 } | 78 } |
| 79 | 79 |
| 80 SVGTextQuery::SVGTextQuery(RenderObject* renderer) | 80 SVGTextQuery::SVGTextQuery(LayoutObject* renderer) |
| 81 { | 81 { |
| 82 collectTextBoxesInFlowBox(flowBoxForRenderer(renderer)); | 82 collectTextBoxesInFlowBox(flowBoxForRenderer(renderer)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SVGTextQuery::collectTextBoxesInFlowBox(InlineFlowBox* flowBox) | 85 void SVGTextQuery::collectTextBoxesInFlowBox(InlineFlowBox* flowBox) |
| 86 { | 86 { |
| 87 if (!flowBox) | 87 if (!flowBox) |
| 88 return; | 88 return; |
| 89 | 89 |
| 90 for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnL
ine()) { | 90 for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnL
ine()) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const | 508 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const |
| 509 { | 509 { |
| 510 CharacterNumberAtPositionData data(position); | 510 CharacterNumberAtPositionData data(position); |
| 511 if (!executeQuery(&data, &SVGTextQuery::characterNumberAtPositionCallback)) | 511 if (!executeQuery(&data, &SVGTextQuery::characterNumberAtPositionCallback)) |
| 512 return -1; | 512 return -1; |
| 513 | 513 |
| 514 return data.processedCharacters; | 514 return data.processedCharacters; |
| 515 } | 515 } |
| 516 | 516 |
| 517 } | 517 } |
| OLD | NEW |