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

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: 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 // LayoutBox methods will expect coordinates w/o any transforms in coordinates 295 // LayoutBox methods will expect coordinates w/o any transforms in coordinates
296 // relative to our borderBox origin. This method gives us exactly that. 296 // relative to our borderBox origin. This method gives us exactly that.
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 float viewWidth = contentWidth();
305 float viewHeight = contentHeight();
306
307 if (isEmbeddedThroughFrameContainingSVGDocument()) {
fs 2016/03/29 11:58:51 I think a better way to structure this code would
308 LayoutPart* ownerLayoutObject = svg->document().frame()->ownerLayoutObje ct();
309 float currentPageZoom = svg->document().frame()->pageZoomFactor();
fs 2016/03/29 11:58:51 Won't LocalFrame::setPageZoomFactor cause the effe
Shanmuga Pandi 2016/03/30 08:40:06 Yes. LocalFrame::setPageZoomFactor will cause the
fs 2016/03/30 09:04:12 I don't think you should be comparing anything at
Shanmuga Pandi 2016/03/30 09:17:38 Yes . I agree with that. Layout size of embedding
fs 2016/03/30 10:16:30 Well, something like: AffineTransform viewToBorde
Shanmuga Pandi 2016/03/30 10:23:30 Thank you for your suggestion. But What will be t
fs 2016/03/30 10:46:39 That would be an option I guess, there's nothing t
310 float ownerPageZoom = ownerLayoutObject->document().frame()->pageZoomFac tor();
311 if (currentPageZoom != ownerPageZoom)
312 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(viewWidth / ownerPageZoom, viewHeight / ownerPageZoom);
313 else
314 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(viewWidth / scale, viewHeight / scale);
315 } else {
316 m_localToBorderBoxTransform = svg->viewBoxToViewTransform(viewWidth / sc ale, viewHeight / scale);
317 }
305 318
306 AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPaddin g.width() + translate.x(), borderAndPadding.height() + translate.y()); 319 AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPaddin g.width() + translate.x(), borderAndPadding.height() + translate.y());
307 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform); 320 m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
308 } 321 }
309 322
310 const AffineTransform& LayoutSVGRoot::localToParentTransform() const 323 const AffineTransform& LayoutSVGRoot::localToParentTransform() const
311 { 324 {
312 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform; 325 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform;
313 m_localToParentTransform = m_localToBorderBoxTransform; 326 m_localToParentTransform = m_localToBorderBoxTransform;
314 if (location().x()) 327 if (location().x())
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 updateHitTestResult(result, pointInBorderBox); 433 updateHitTestResult(result, pointInBorderBox);
421 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) 434 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
422 return true; 435 return true;
423 } 436 }
424 } 437 }
425 438
426 return false; 439 return false;
427 } 440 }
428 441
429 } // namespace blink 442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698