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

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

Issue 302433009: Fix computation of local-to-border-box transform for RenderSVGRoot (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Load matrix and check identity. Created 6 years, 7 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/custom/svg-root-padding-top-expected.html ('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) 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // RenderBox methods will expect coordinates w/o any transforms in coordinates 330 // RenderBox methods will expect coordinates w/o any transforms in coordinates
331 // relative to our borderBox origin. This method gives us exactly that. 331 // relative to our borderBox origin. This method gives us exactly that.
332 void RenderSVGRoot::buildLocalToBorderBoxTransform() 332 void RenderSVGRoot::buildLocalToBorderBoxTransform()
333 { 333 {
334 SVGSVGElement* svg = toSVGSVGElement(node()); 334 SVGSVGElement* svg = toSVGSVGElement(node());
335 ASSERT(svg); 335 ASSERT(svg);
336 float scale = style()->effectiveZoom(); 336 float scale = style()->effectiveZoom();
337 FloatPoint translate = svg->currentTranslate(); 337 FloatPoint translate = svg->currentTranslate();
338 LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + padd ingTop()); 338 LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + padd ingTop());
339 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / s cale, contentHeight() / scale); 339 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / s cale, contentHeight() / scale);
340 if (borderAndPadding.isEmpty() && scale == 1 && translate == FloatPoint::zer o()) 340 AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPaddin g.width() + translate.x(), borderAndPadding.height() + translate.y());
341 if (viewToBorderBoxTransform.isIdentity())
341 return; 342 return;
342 m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndP adding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_l ocalToBorderBoxTransform; 343 m_localToBorderBoxTransform = viewToBorderBoxTransform * m_localToBorderBoxT ransform;
343 } 344 }
344 345
345 const AffineTransform& RenderSVGRoot::localToParentTransform() const 346 const AffineTransform& RenderSVGRoot::localToParentTransform() const
346 { 347 {
347 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform; 348 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform;
348 m_localToParentTransform = m_localToBorderBoxTransform; 349 m_localToParentTransform = m_localToBorderBoxTransform;
349 if (x()) 350 if (x())
350 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x())); 351 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x()));
351 if (y()) 352 if (y())
352 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y())); 353 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y()));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 updateHitTestResult(result, pointInBorderBox); 458 updateHitTestResult(result, pointInBorderBox);
458 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 459 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect))
459 return true; 460 return true;
460 } 461 }
461 } 462 }
462 463
463 return false; 464 return false;
464 } 465 }
465 466
466 } 467 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/svg-root-padding-top-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698