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

Unified Diff: third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp

Issue 1545443002: Helper for checking if an SVGTextFragment is transformed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
index a0789956e6f1b84aed067e5f377b2485c287b631..ff547aea673ac3a47a6233700286ca279c097798 100644
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
@@ -88,10 +88,11 @@ int SVGInlineTextBox::offsetForPositionInFragment(const SVGTextFragment& fragmen
// Eventually handle lengthAdjust="spacingAndGlyphs".
// FIXME: Handle vertical text.
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform);
- if (!fragmentTransform.isIdentity())
+ if (fragment.isTransformed()) {
+ AffineTransform fragmentTransform;
+ fragment.buildFragmentTransform(fragmentTransform);
textRun.setHorizontalGlyphStretch(narrowPrecisionToFloat(fragmentTransform.xScale()));
+ }
return fragment.characterOffset - start() + lineLayoutItem.scaledFont().offsetForPosition(textRun, position * scalingFactor, includePartialGlyphs);
}
@@ -153,8 +154,10 @@ LayoutRect SVGInlineTextBox::localSelectionRect(int startPosition, int endPositi
continue;
FloatRect fragmentRect = selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style);
- fragment.buildFragmentTransform(fragmentTransform);
- fragmentRect = fragmentTransform.mapRect(fragmentRect);
+ if (fragment.isTransformed()) {
+ fragment.buildFragmentTransform(fragmentTransform);
+ fragmentRect = fragmentTransform.mapRect(fragmentRect);
+ }
selectionRect.unite(fragmentRect);
}
@@ -281,9 +284,10 @@ bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation&
AffineTransform fragmentTransform;
for (const auto& fragment : m_textFragments) {
FloatQuad fragmentQuad(FloatRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height));
- fragment.buildFragmentTransform(fragmentTransform);
- if (!fragmentTransform.isIdentity())
+ if (fragment.isTransformed()) {
+ fragment.buildFragmentTransform(fragmentTransform);
fragmentQuad = fragmentTransform.mapQuad(fragmentQuad);
+ }
if (fragmentQuad.containsPoint(FloatPoint(locationInContainer.point()))) {
lineLayoutItem.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));

Powered by Google App Engine
This is Rietveld 408576698