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

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

Issue 2514573003: Update documentation and cleanup impls for localToSVGParentTransform() (Closed)
Patch Set: - Created 4 years, 1 month 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 m_localToBorderBoxTransform = svg->viewBoxToViewTransform( 335 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(
336 contentWidth() / scale, contentHeight() / scale); 336 contentWidth() / scale, contentHeight() / scale);
337 337
338 AffineTransform viewToBorderBoxTransform( 338 AffineTransform viewToBorderBoxTransform(
339 scale, 0, 0, scale, borderAndPadding.width() + translate.x(), 339 scale, 0, 0, scale, borderAndPadding.width() + translate.x(),
340 borderAndPadding.height() + translate.y()); 340 borderAndPadding.height() + translate.y());
341 viewToBorderBoxTransform.scale(svg->currentScale()); 341 viewToBorderBoxTransform.scale(svg->currentScale());
342 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform); 342 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
343 } 343 }
344 344
345 const AffineTransform& LayoutSVGRoot::localToSVGParentTransform() const { 345 AffineTransform LayoutSVGRoot::localToSVGParentTransform() const {
346 // Slightly optimized version of m_localToParentTransform = 346 return AffineTransform::translation(roundToInt(location().x()),
347 // AffineTransform::translation(x(), y()) * m_localToBorderBoxTransform; 347 roundToInt(location().y())) *
348 m_localToParentTransform = m_localToBorderBoxTransform; 348 m_localToBorderBoxTransform;
349 if (location().x())
350 m_localToParentTransform.setE(m_localToParentTransform.e() +
351 roundToInt(location().x()));
352 if (location().y())
353 m_localToParentTransform.setF(m_localToParentTransform.f() +
354 roundToInt(location().y()));
355 return m_localToParentTransform;
356 } 349 }
357 350
358 LayoutRect LayoutSVGRoot::localVisualRect() const { 351 LayoutRect LayoutSVGRoot::localVisualRect() const {
359 // This is an open-coded aggregate of SVGLayoutSupport::localVisualRect 352 // This is an open-coded aggregate of SVGLayoutSupport::localVisualRect
360 // and LayoutReplaced::localVisualRect. The reason for this is to optimize/ 353 // and LayoutReplaced::localVisualRect. The reason for this is to optimize/
361 // minimize the visual rect when the box is not "decorated" (does not have 354 // minimize the visual rect when the box is not "decorated" (does not have
362 // background/border/etc., see 355 // background/border/etc., see
363 // LayoutSVGRootTest.VisualRectMappingWithViewportClipWithoutBorder). 356 // LayoutSVGRootTest.VisualRectMappingWithViewportClipWithoutBorder).
364 357
365 // Return early for any cases where we don't actually paint. 358 // Return early for any cases where we don't actually paint.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (result.addNodeToListBasedTestResult(node(), locationInContainer, 460 if (result.addNodeToListBasedTestResult(node(), locationInContainer,
468 boundsRect) == StopHitTesting) 461 boundsRect) == StopHitTesting)
469 return true; 462 return true;
470 } 463 }
471 } 464 }
472 465
473 return false; 466 return false;
474 } 467 }
475 468
476 } // namespace blink 469 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.h ('k') | third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698