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

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

Issue 1827793003: Support currentScale for embedded SVG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Align with review comments Created 4 years, 8 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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void LayoutSVGRoot::buildLocalToBorderBoxTransform() 297 void LayoutSVGRoot::buildLocalToBorderBoxTransform()
298 { 298 {
299 SVGSVGElement* svg = toSVGSVGElement(node()); 299 SVGSVGElement* svg = toSVGSVGElement(node());
300 ASSERT(svg); 300 ASSERT(svg);
301 float scale = style()->effectiveZoom(); 301 float scale = style()->effectiveZoom();
302 FloatPoint translate = svg->currentTranslate(); 302 FloatPoint translate = svg->currentTranslate();
303 LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + padd ingTop()); 303 LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + padd ingTop());
304 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / s cale, contentHeight() / scale); 304 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / s cale, contentHeight() / scale);
305 305
306 AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPaddin g.width() + translate.x(), borderAndPadding.height() + translate.y()); 306 AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPaddin g.width() + translate.x(), borderAndPadding.height() + translate.y());
307 viewToBorderBoxTransform.scale(svg->currentScale());
307 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform); 308 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
308 } 309 }
309 310
310 const AffineTransform& LayoutSVGRoot::localToParentTransform() const 311 const AffineTransform& LayoutSVGRoot::localToParentTransform() const
311 { 312 {
312 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform; 313 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform;
313 m_localToParentTransform = m_localToBorderBoxTransform; 314 m_localToParentTransform = m_localToBorderBoxTransform;
314 if (location().x()) 315 if (location().x())
315 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( location().x())); 316 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( location().x()));
316 if (location().y()) 317 if (location().y())
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 updateHitTestResult(result, pointInBorderBox); 421 updateHitTestResult(result, pointInBorderBox);
421 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) 422 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
422 return true; 423 return true;
423 } 424 }
424 } 425 }
425 426
426 return false; 427 return false;
427 } 428 }
428 429
429 } // namespace blink 430 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/resources/green-rect.svg ('k') | third_party/WebKit/Source/core/svg/SVGSVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698