Commit 6f80957a authored by fs's avatar fs Committed by Commit bot

Neuter the "screen scale factor" computation for SVG <text>

This removes the PaintLayer-factor and DSF from the "screen scale factor",
leaving only the transform to the <svg> root and the "content transform" (used
by <pattern>, <mask> and <clipPath>.)

BUG=664961

Review-Url: https://codereview.chromium.org/2492013004
Cr-Commit-Position: refs/heads/master@{#435599}
parent 15e05a11
......@@ -5,18 +5,18 @@ layer at (0,0) size 800x600
LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
LayoutSVGResourceMasker {mask} [id="textMask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
LayoutSVGRect {rect} at (0,0) size 800x600 [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=0.00] [width=800.00] [height=600.00]
LayoutSVGText {text} at (0,-2.50) size 164.86x18.50 contains 1 chunk(s)
LayoutSVGInlineText {#text} at (0,-2.50) size 164.86x18.50
LayoutSVGText {text} at (0,-2) size 164.86x18 contains 1 chunk(s)
LayoutSVGInlineText {#text} at (0,-2) size 164.86x18
chunk 1 text run 1 at (0.00,12.00) startOffset 0 endOffset 26 width 164.87: "This text should be sharp."
LayoutSVGRect {rect} at (0,0) size 200x100 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=200.00] [height=100.00]
LayoutSVGRect {rect} at (0,0) size 200x100 [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=0.00] [width=200.00] [height=100.00]
[masker="textMask"] LayoutSVGResourceMasker {mask} at (0,-2.50) size 220x112.50
[masker="textMask"] LayoutSVGResourceMasker {mask} at (0,-2) size 220x112
LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
LayoutSVGResourceLinearGradient {linearGradient} [id="blackGradient"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,0)]
LayoutSVGGradientStop {stop} [offset=0.00] [color=#000000]
LayoutSVGGradientStop {stop} [offset=1.00] [color=#000000]
LayoutSVGText {text} at (0,21.50) size 291.03x18.50 contains 1 chunk(s)
LayoutSVGInlineText {#text} at (0,21.50) size 291.03x18.50
LayoutSVGText {text} at (0,22) size 291.03x18 contains 1 chunk(s)
LayoutSVGInlineText {#text} at (0,22) size 291.03x18
chunk 1 text run 1 at (0.00,36.00) startOffset 0 endOffset 47 width 291.04: "This text and the circles should also be sharp."
LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
LayoutSVGResourceClipper {clipPath} [id="circleClipPath"] [clipPathUnits=objectBoundingBox]
......
......@@ -520,7 +520,7 @@ SubtreeContentTransformScope::~SubtreeContentTransformScope() {
m_savedContentTransformation.copyTransformTo(s_currentContentTransformation);
}
AffineTransform SVGLayoutSupport::deprecatedCalculateTransformToLayer(
float SVGLayoutSupport::calculateScreenFontSizeScalingFactor(
const LayoutObject* layoutObject) {
AffineTransform transform;
while (layoutObject) {
......@@ -529,44 +529,10 @@ AffineTransform SVGLayoutSupport::deprecatedCalculateTransformToLayer(
break;
layoutObject = layoutObject->parent();
}
// Continue walking up the layer tree, accumulating CSS transforms.
// FIXME: this queries layer compositing state - which is not
// supported during layout. Hence, the result may not include all CSS
// transforms.
PaintLayer* layer = layoutObject ? layoutObject->enclosingLayer() : 0;
while (layer && layer->isAllowedToQueryCompositingState()) {
// We can stop at compositing layers, to match the backing resolution.
// FIXME: should we be computing the transform to the nearest composited
// layer, or the nearest composited layer that does not paint into its
// ancestor? I think this is the nearest composited ancestor since we will
// inherit its transforms in the composited layer tree.
if (layer->compositingState() != NotComposited)
break;
if (TransformationMatrix* layerTransform = layer->transform())
transform = layerTransform->toAffineTransform() * transform;
layer = layer->parent();
}
return transform;
}
float SVGLayoutSupport::calculateScreenFontSizeScalingFactor(
const LayoutObject* layoutObject) {
ASSERT(layoutObject);
// FIXME: trying to compute a device space transform at record time is wrong.
// All clients should be updated to avoid relying on this information, and the
// method should be removed.
AffineTransform ctm =
deprecatedCalculateTransformToLayer(layoutObject) *
SubtreeContentTransformScope::currentContentTransformation();
ctm.scale(
layoutObject->document().frameHost()->deviceScaleFactorDeprecated());
return clampTo<float>(sqrt((ctm.xScaleSquared() + ctm.yScaleSquared()) / 2));
transform.multiply(
SubtreeContentTransformScope::currentContentTransformation());
return clampTo<float>(
sqrt((transform.xScaleSquared() + transform.yScaleSquared()) / 2));
}
static inline bool compareCandidateDistance(const SearchCandidate& r1,
......
......@@ -145,8 +145,6 @@ class CORE_EXPORT SVGLayoutSupport {
static bool computeHasNonIsolatedBlendingDescendants(const LayoutObjectType*);
static bool isIsolationRequired(const LayoutObject*);
static AffineTransform deprecatedCalculateTransformToLayer(
const LayoutObject*);
static float calculateScreenFontSizeScalingFactor(const LayoutObject*);
static LayoutObject* findClosestLayoutSVGText(LayoutObject*,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment