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

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

Issue 1032363002: Fix handling of Arabic script in SVGTextContentElement.getSubStringLength (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | « LayoutTests/svg/text/bidi-getsubstringlength-expected.txt ('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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 bool SVGTextQuery::subStringLengthCallback(Data* queryData, const SVGTextFragmen t& fragment) const 250 bool SVGTextQuery::subStringLengthCallback(Data* queryData, const SVGTextFragmen t& fragment) const
251 { 251 {
252 SubStringLengthData* data = static_cast<SubStringLengthData*>(queryData); 252 SubStringLengthData* data = static_cast<SubStringLengthData*>(queryData);
253 253
254 int startPosition = data->startPosition; 254 int startPosition = data->startPosition;
255 int endPosition = startPosition + data->length; 255 int endPosition = startPosition + data->length;
256 if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startP osition, endPosition)) 256 if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startP osition, endPosition))
257 return false; 257 return false;
258 258
259 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(queryData->te xtLayoutObject, fragment.characterOffset + startPosition, endPosition - startPos ition, queryData->textLayoutObject->styleRef().direction()); 259 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(queryData->te xtLayoutObject, fragment.characterOffset + startPosition, endPosition - startPos ition, queryData->textBox->direction());
260 data->subStringLength += queryData->isVerticalText ? metrics.height() : metr ics.width(); 260 data->subStringLength += queryData->isVerticalText ? metrics.height() : metr ics.width();
261 return false; 261 return false;
262 } 262 }
263 263
264 float SVGTextQuery::subStringLength(unsigned startPosition, unsigned length) con st 264 float SVGTextQuery::subStringLength(unsigned startPosition, unsigned length) con st
265 { 265 {
266 SubStringLengthData data(startPosition, length); 266 SubStringLengthData data(startPosition, length);
267 executeQuery(&data, &SVGTextQuery::subStringLengthCallback); 267 executeQuery(&data, &SVGTextQuery::subStringLengthCallback);
268 return data.subStringLength; 268 return data.subStringLength;
269 } 269 }
(...skipping 238 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 | « LayoutTests/svg/text/bidi-getsubstringlength-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698