OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@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. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/layout/svg/LayoutSVGShape.h" | 35 #include "core/layout/svg/LayoutSVGShape.h" |
36 #include "core/layout/svg/LayoutSVGText.h" | 36 #include "core/layout/svg/LayoutSVGText.h" |
37 #include "core/layout/svg/LayoutSVGTransformableContainer.h" | 37 #include "core/layout/svg/LayoutSVGTransformableContainer.h" |
38 #include "core/layout/svg/LayoutSVGViewportContainer.h" | 38 #include "core/layout/svg/LayoutSVGViewportContainer.h" |
39 #include "core/layout/svg/SVGResources.h" | 39 #include "core/layout/svg/SVGResources.h" |
40 #include "core/layout/svg/SVGResourcesCache.h" | 40 #include "core/layout/svg/SVGResourcesCache.h" |
41 #include "core/paint/PaintLayer.h" | 41 #include "core/paint/PaintLayer.h" |
42 #include "core/svg/SVGElement.h" | 42 #include "core/svg/SVGElement.h" |
43 #include "platform/geometry/TransformState.h" | 43 #include "platform/geometry/TransformState.h" |
44 #include "platform/graphics/StrokeData.h" | 44 #include "platform/graphics/StrokeData.h" |
| 45 #include "wtf/MathExtras.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 | 48 |
48 struct SearchCandidate { | 49 struct SearchCandidate { |
49 SearchCandidate() | 50 SearchCandidate() |
50 : candidateLayoutObject(nullptr) | 51 : candidateLayoutObject(nullptr) |
51 , candidateDistance(std::numeric_limits<float>::max()) | 52 , candidateDistance(std::numeric_limits<float>::max()) |
52 { | 53 { |
53 } | 54 } |
54 SearchCandidate(LayoutObject* layoutObject, float distance) | 55 SearchCandidate(LayoutObject* layoutObject, float distance) |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 503 |
503 float SVGLayoutSupport::calculateScreenFontSizeScalingFactor(const LayoutObject*
layoutObject) | 504 float SVGLayoutSupport::calculateScreenFontSizeScalingFactor(const LayoutObject*
layoutObject) |
504 { | 505 { |
505 ASSERT(layoutObject); | 506 ASSERT(layoutObject); |
506 | 507 |
507 // FIXME: trying to compute a device space transform at record time is wrong
. All clients | 508 // FIXME: trying to compute a device space transform at record time is wrong
. All clients |
508 // should be updated to avoid relying on this information, and the method sh
ould be removed. | 509 // should be updated to avoid relying on this information, and the method sh
ould be removed. |
509 AffineTransform ctm = deprecatedCalculateTransformToLayer(layoutObject) * Su
btreeContentTransformScope::currentContentTransformation(); | 510 AffineTransform ctm = deprecatedCalculateTransformToLayer(layoutObject) * Su
btreeContentTransformScope::currentContentTransformation(); |
510 ctm.scale(layoutObject->document().frameHost()->deviceScaleFactorDeprecated(
)); | 511 ctm.scale(layoutObject->document().frameHost()->deviceScaleFactorDeprecated(
)); |
511 | 512 |
512 return narrowPrecisionToFloat(sqrt((ctm.xScaleSquared() + ctm.yScaleSquared(
)) / 2)); | 513 return clampTo<float>(sqrt((ctm.xScaleSquared() + ctm.yScaleSquared()) / 2))
; |
513 } | 514 } |
514 | 515 |
515 static inline bool compareCandidateDistance(const SearchCandidate& r1, const Sea
rchCandidate& r2) | 516 static inline bool compareCandidateDistance(const SearchCandidate& r1, const Sea
rchCandidate& r2) |
516 { | 517 { |
517 return r1.candidateDistance < r2.candidateDistance; | 518 return r1.candidateDistance < r2.candidateDistance; |
518 } | 519 } |
519 | 520 |
520 static inline float distanceToChildLayoutObject(LayoutObject* child, const Float
Point& point) | 521 static inline float distanceToChildLayoutObject(LayoutObject* child, const Float
Point& point) |
521 { | 522 { |
522 const AffineTransform& localToParentTransform = child->localToSVGParentTrans
form(); | 523 const AffineTransform& localToParentTransform = child->localToSVGParentTrans
form(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 577 |
577 return closestText; | 578 return closestText; |
578 } | 579 } |
579 | 580 |
580 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj
ect, const FloatPoint& point) | 581 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj
ect, const FloatPoint& point) |
581 { | 582 { |
582 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL
ayoutObject; | 583 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL
ayoutObject; |
583 } | 584 } |
584 | 585 |
585 } // namespace blink | 586 } // namespace blink |
OLD | NEW |