| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (child->isInlineFlowBox()) { | 88 if (child->isInlineFlowBox()) { |
| 89 // Skip generated content. | 89 // Skip generated content. |
| 90 if (!child->getLineLayoutItem().node()) | 90 if (!child->getLineLayoutItem().node()) |
| 91 continue; | 91 continue; |
| 92 | 92 |
| 93 collectTextBoxesInFlowBox(toInlineFlowBox(child), textBoxes); | 93 collectTextBoxesInFlowBox(toInlineFlowBox(child), textBoxes); |
| 94 continue; | 94 continue; |
| 95 } | 95 } |
| 96 | 96 |
| 97 if (child->isSVGInlineTextBox()) | 97 if (child->isSVGInlineTextBox()) |
| 98 textBoxes.append(toSVGInlineTextBox(child)); | 98 textBoxes.push_back(toSVGInlineTextBox(child)); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 typedef bool ProcessTextFragmentCallback(QueryData*, const SVGTextFragment&); | 102 typedef bool ProcessTextFragmentCallback(QueryData*, const SVGTextFragment&); |
| 103 | 103 |
| 104 static bool queryTextBox(QueryData* queryData, | 104 static bool queryTextBox(QueryData* queryData, |
| 105 const SVGInlineTextBox* textBox, | 105 const SVGInlineTextBox* textBox, |
| 106 ProcessTextFragmentCallback fragmentCallback) { | 106 ProcessTextFragmentCallback fragmentCallback) { |
| 107 queryData->textBox = textBox; | 107 queryData->textBox = textBox; |
| 108 queryData->textLineLayout = | 108 queryData->textLineLayout = |
| (...skipping 24 matching lines...) Expand all Loading... |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 static void collectTextBoxesInLogicalOrder( | 137 static void collectTextBoxesInLogicalOrder( |
| 138 LineLayoutSVGInlineText textLineLayout, | 138 LineLayoutSVGInlineText textLineLayout, |
| 139 Vector<SVGInlineTextBox*>& textBoxes) { | 139 Vector<SVGInlineTextBox*>& textBoxes) { |
| 140 textBoxes.shrink(0); | 140 textBoxes.shrink(0); |
| 141 for (InlineTextBox* textBox = textLineLayout.firstTextBox(); textBox; | 141 for (InlineTextBox* textBox = textLineLayout.firstTextBox(); textBox; |
| 142 textBox = textBox->nextTextBox()) | 142 textBox = textBox->nextTextBox()) |
| 143 textBoxes.append(toSVGInlineTextBox(textBox)); | 143 textBoxes.push_back(toSVGInlineTextBox(textBox)); |
| 144 std::sort(textBoxes.begin(), textBoxes.end(), InlineTextBox::compareByStart); | 144 std::sort(textBoxes.begin(), textBoxes.end(), InlineTextBox::compareByStart); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Execute a query in "logical" order starting at |queryRoot|. This means | 147 // Execute a query in "logical" order starting at |queryRoot|. This means |
| 148 // walking the lines boxes for each layout object in layout tree (pre)order. | 148 // walking the lines boxes for each layout object in layout tree (pre)order. |
| 149 static void logicalQuery(LayoutObject* queryRoot, | 149 static void logicalQuery(LayoutObject* queryRoot, |
| 150 QueryData* queryData, | 150 QueryData* queryData, |
| 151 ProcessTextFragmentCallback fragmentCallback) { | 151 ProcessTextFragmentCallback fragmentCallback) { |
| 152 if (!queryRoot) | 152 if (!queryRoot) |
| 153 return; | 153 return; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 | 618 |
| 619 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const { | 619 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const { |
| 620 CharacterNumberAtPositionData data(position); | 620 CharacterNumberAtPositionData data(position); |
| 621 spatialQuery(m_queryRootLayoutObject, &data, | 621 spatialQuery(m_queryRootLayoutObject, &data, |
| 622 characterNumberAtPositionCallback); | 622 characterNumberAtPositionCallback); |
| 623 return data.characterNumberWithin(m_queryRootLayoutObject); | 623 return data.characterNumberWithin(m_queryRootLayoutObject); |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |