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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 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
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 unsigned position; 458 unsigned position;
459 FloatRect extent; 459 FloatRect extent;
460 }; 460 };
461 461
462 static inline void calculateGlyphBoundaries(const QueryData* queryData, const SV GTextFragment& fragment, int startPosition, FloatRect& extent) 462 static inline void calculateGlyphBoundaries(const QueryData* queryData, const SV GTextFragment& fragment, int startPosition, FloatRect& extent)
463 { 463 {
464 float scalingFactor = queryData->textLineLayout.scalingFactor(); 464 float scalingFactor = queryData->textLineLayout.scalingFactor();
465 ASSERT(scalingFactor); 465 ASSERT(scalingFactor);
466 466
467 FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, startPosition); 467 FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, startPosition);
468 glyphPosition.move(0, -queryData->textLineLayout.scaledFont().fontMetrics(). floatAscent() / scalingFactor); 468 glyphPosition.move(0, -queryData->textLineLayout.scaledFont().getFontMetrics ().floatAscent() / scalingFactor);
469 extent.setLocation(glyphPosition); 469 extent.setLocation(glyphPosition);
470 470
471 // Use the SVGTextMetrics computed by SVGTextMetricsBuilder (which spends 471 // Use the SVGTextMetrics computed by SVGTextMetricsBuilder (which spends
472 // time attempting to compute more correct glyph bounds already, handling 472 // time attempting to compute more correct glyph bounds already, handling
473 // cursive scripts to some degree.) 473 // cursive scripts to some degree.)
474 const Vector<SVGTextMetrics>& textMetricsValues = queryData->textLineLayout. layoutAttributes()->textMetricsValues(); 474 const Vector<SVGTextMetrics>& textMetricsValues = queryData->textLineLayout. layoutAttributes()->textMetricsValues();
475 const SVGTextMetrics& metrics = findMetricsForCharacter(textMetricsValues, f ragment, startPosition); 475 const SVGTextMetrics& metrics = findMetricsForCharacter(textMetricsValues, f ragment, startPosition);
476 476
477 // TODO(fs): Negative glyph extents seems kind of weird to have, but 477 // TODO(fs): Negative glyph extents seems kind of weird to have, but
478 // presently it can occur in some cases (like Arabic.) 478 // presently it can occur in some cases (like Arabic.)
(...skipping 11 matching lines...) Expand all
490 if (fragment.isTransformed()) { 490 if (fragment.isTransformed()) {
491 AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGT extFragment::TransformIgnoringTextLength); 491 AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGT extFragment::TransformIgnoringTextLength);
492 extent = fragmentTransform.mapRect(extent); 492 extent = fragmentTransform.mapRect(extent);
493 } 493 }
494 } 494 }
495 495
496 static inline FloatRect calculateFragmentBoundaries(LineLayoutSVGInlineText text LineLayout, const SVGTextFragment& fragment) 496 static inline FloatRect calculateFragmentBoundaries(LineLayoutSVGInlineText text LineLayout, const SVGTextFragment& fragment)
497 { 497 {
498 float scalingFactor = textLineLayout.scalingFactor(); 498 float scalingFactor = textLineLayout.scalingFactor();
499 ASSERT(scalingFactor); 499 ASSERT(scalingFactor);
500 float baseline = textLineLayout.scaledFont().fontMetrics().floatAscent() / s calingFactor; 500 float baseline = textLineLayout.scaledFont().getFontMetrics().floatAscent() / scalingFactor;
501 return fragment.boundingBox(baseline); 501 return fragment.boundingBox(baseline);
502 } 502 }
503 503
504 static bool extentOfCharacterCallback(QueryData* queryData, const SVGTextFragmen t& fragment) 504 static bool extentOfCharacterCallback(QueryData* queryData, const SVGTextFragmen t& fragment)
505 { 505 {
506 ExtentOfCharacterData* data = static_cast<ExtentOfCharacterData*>(queryData) ; 506 ExtentOfCharacterData* data = static_cast<ExtentOfCharacterData*>(queryData) ;
507 507
508 int startPosition = data->position; 508 int startPosition = data->position;
509 int endPosition = startPosition + 1; 509 int endPosition = startPosition + 1;
510 if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startP osition, endPosition)) 510 if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startP osition, endPosition))
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 606
607 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const 607 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const
608 { 608 {
609 CharacterNumberAtPositionData data(position); 609 CharacterNumberAtPositionData data(position);
610 spatialQuery(m_queryRootLayoutObject, &data, characterNumberAtPositionCallba ck); 610 spatialQuery(m_queryRootLayoutObject, &data, characterNumberAtPositionCallba ck);
611 return data.characterNumberWithin(m_queryRootLayoutObject); 611 return data.characterNumberWithin(m_queryRootLayoutObject);
612 } 612 }
613 613
614 } // namespace blink 614 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698