Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Side by Side Diff: Source/core/rendering/svg/SVGTextQuery.cpp

Issue 414863002: Minimize RenderObject* casting to RenderText* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngine.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 bool SVGTextQuery::executeQuery(Data* queryData, ProcessTextFragmentCallback fra gmentCallback) const 105 bool SVGTextQuery::executeQuery(Data* queryData, ProcessTextFragmentCallback fra gmentCallback) const
106 { 106 {
107 unsigned processedCharacters = 0; 107 unsigned processedCharacters = 0;
108 unsigned textBoxCount = m_textBoxes.size(); 108 unsigned textBoxCount = m_textBoxes.size();
109 109
110 // Loop over all text boxes 110 // Loop over all text boxes
111 for (unsigned textBoxPosition = 0; textBoxPosition < textBoxCount; ++textBox Position) { 111 for (unsigned textBoxPosition = 0; textBoxPosition < textBoxCount; ++textBox Position) {
112 queryData->textBox = m_textBoxes.at(textBoxPosition); 112 queryData->textBox = m_textBoxes.at(textBoxPosition);
113 queryData->textRenderer = &toRenderSVGInlineText(queryData->textBox->tex tRenderer()); 113 queryData->textRenderer = &toRenderSVGInlineText(queryData->textBox->ren derer());
114 ASSERT(queryData->textRenderer->style()); 114 ASSERT(queryData->textRenderer->style());
115 115
116 queryData->isVerticalText = queryData->textRenderer->style()->svgStyle() .isVerticalWritingMode(); 116 queryData->isVerticalText = queryData->textRenderer->style()->svgStyle() .isVerticalWritingMode();
117 const Vector<SVGTextFragment>& fragments = queryData->textBox->textFragm ents(); 117 const Vector<SVGTextFragment>& fragments = queryData->textBox->textFragm ents();
118 118
119 // Loop over all text fragments in this text box, firing a callback for each. 119 // Loop over all text fragments in this text box, firing a callback for each.
120 unsigned fragmentCount = fragments.size(); 120 unsigned fragmentCount = fragments.size();
121 for (unsigned i = 0; i < fragmentCount; ++i) { 121 for (unsigned i = 0; i < fragmentCount; ++i) {
122 const SVGTextFragment& fragment = fragments.at(i); 122 const SVGTextFragment& fragment = fragments.at(i);
123 if ((this->*fragmentCallback)(queryData, fragment)) 123 if ((this->*fragmentCallback)(queryData, fragment))
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698