Commit 73249085 authored by pdr's avatar pdr Committed by Commit bot

[SPV2] Add the device scale factor to the root transform node

This patch sets the device scale factor on cc's root transform node,
fixing several layout tests. This approach is different from how
cc builds property trees (see post_local_scale_factor in
property_tree_builder's AddTransformNodeIfNeeded) where a post_local
transform is used, but aligns closer to blink's approach of using a
single transform per transform node.

This approach is temporary and will need to be refactored when we
begin supporting viewport transforms such as pinch-zoom.

BUG=642240
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2318933006
Cr-Commit-Position: refs/heads/master@{#417394}
parent fe1468fe
......@@ -2277,18 +2277,6 @@ crbug.com/636463 fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-vertic
crbug.com/636463 fast/text/international/bidi-neutral-in-mixed-direction-run-crash.html [ Crash ]
crbug.com/636463 fast/text/whitespace/whitespace-and-margin-wrap-after-list-marker-crash.html [ Crash ]
crbug.com/642240 fast/backgrounds/gradient-background-leakage-hidpi.html [ Failure ]
crbug.com/642240 fast/canvas/canvas-hidpi-blurry.html [ Failure ]
crbug.com/642240 fast/hidpi/broken-image-icon-hidpi.html [ Failure ]
crbug.com/642240 fast/hidpi/broken-image-with-size-hidpi.html [ Failure ]
crbug.com/642240 fast/hidpi/clip-text-in-hidpi.html [ Failure ]
crbug.com/642240 fast/hidpi/device-scale-factor-paint.html [ Failure ]
crbug.com/642240 fast/hidpi/focus-rings.html [ Failure ]
crbug.com/642240 fast/hidpi/gradient-with-scaled-ancestor.html [ Failure ]
crbug.com/642240 fast/hidpi/resize-corner-hidpi.html [ Failure ]
crbug.com/642240 fast/sub-pixel/shadows-hidpi.html [ Failure ]
crbug.com/642240 svg/as-image/image-respects-deviceScaleFactor.html [ Failure ]
crbug.com/644358 fast/forms/relayout-shifts-inner-editor.html [ Crash ]
crbug.com/644358 fast/repaint/bugzilla-6388.html [ Failure ]
crbug.com/644358 fast/repaint/change-transform.html [ Failure ]
......
......@@ -218,6 +218,9 @@ public:
m_effectStack.append(BlinkEffectAndCcIdPair{nullptr, kSecondaryRootNodeId});
}
// TODO(pdr): This will need to be unified with how viewport scale works.
void setDeviceScaleFactor(float);
int compositorIdForTransformNode(const TransformPaintPropertyNode*);
int compositorIdForClipNode(const ClipPaintPropertyNode*);
int switchToEffectNode(const EffectPaintPropertyNode& nextEffect);
......@@ -255,6 +258,12 @@ private:
#endif
};
void PropertyTreeManager::setDeviceScaleFactor(float deviceScaleFactor)
{
auto& rootTransformNode = *transformTree().Node(kSecondaryRootNodeId);
rootTransformNode.local.Scale(deviceScaleFactor, deviceScaleFactor);
}
int PropertyTreeManager::compositorIdForTransformNode(const TransformPaintPropertyNode* transformNode)
{
if (!transformNode)
......@@ -434,6 +443,7 @@ void PaintArtifactCompositor::update(const PaintArtifact& paintArtifact)
m_extraDataForTesting = wrapUnique(new ExtraDataForTesting);
setMinimalPropertyTrees(host->GetLayerTree()->property_trees(), m_rootLayer->id());
m_rootLayer->RemoveAllChildren();
m_rootLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber);
m_rootLayer->SetTransformTreeIndex(kSecondaryRootNodeId);
......@@ -442,6 +452,8 @@ void PaintArtifactCompositor::update(const PaintArtifact& paintArtifact)
m_rootLayer->SetScrollTreeIndex(kRealRootNodeId);
PropertyTreeManager propertyTreeManager(*host->GetLayerTree()->property_trees(), m_rootLayer.get());
propertyTreeManager.setDeviceScaleFactor(host->GetLayerTree()->device_scale_factor());
m_contentLayerClients.clear();
m_contentLayerClients.reserveCapacity(paintArtifact.paintChunks().size());
for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) {
......
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