Commit 117eba4e authored by Sam Fortiner's avatar Sam Fortiner Committed by Commit Bot

Remove position in GraphicsLayer's tree dump

This change removes position from the GraphicsLayer tree dump format as
another step toward the complete removal of position from GraphicsLayer.
This is accomplished by intentionally passing through 0, 0 for the
offset/position to CCLayerAsJSON which results in no output for
position.

As a supporting change, this change also renames CCLayerAsJSON's
position parameter to be offset_from_transform_node which more
accurately reflects what it is intended to be.

Finally, removing a dead-code version of GetLayerTreeAsTextForTesting in
WebLocalFrameImpl.


Bug: 999336
Change-Id: I17f40076ec6bcf6cab9c70034c2466847af3c233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898806Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Sam Fortiner <samfort@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#712926}
parent 4fa41b23
......@@ -733,11 +733,6 @@ class WebLocalFrame : public WebFrame {
// Testing ------------------------------------------------------------------
// Dumps the layer tree, used by the accelerated compositor, in
// text form. This is used only by web tests.
virtual WebString GetLayerTreeAsTextForTesting(
bool show_debug_info = false) const = 0;
// Prints the frame into the canvas, with page boundaries drawn as one pixel
// wide blue lines. This method exists to support web tests.
virtual void PrintPagesForTesting(cc::PaintCanvas*, const WebSize&) = 0;
......
......@@ -1579,15 +1579,6 @@ WebRect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {
: WebRect();
}
WebString WebLocalFrameImpl::GetLayerTreeAsTextForTesting(
bool show_debug_info) const {
if (!GetFrame())
return WebString();
return WebString(GetFrame()->GetLayerTreeAsTextForTesting(
show_debug_info ? kLayerTreeIncludesDebugInfo : kLayerTreeNormal));
}
// WebLocalFrameImpl public --------------------------------------------------
WebLocalFrame* WebLocalFrame::CreateMainFrame(
......
......@@ -303,8 +303,6 @@ class CORE_EXPORT WebLocalFrameImpl final
WebPerformance Performance() const override;
bool IsAdSubframe() const override;
void SetIsAdSubframe(blink::mojom::AdFrameType ad_frame_type) override;
WebString GetLayerTreeAsTextForTesting(
bool show_debug_info = false) const override;
void PrintPagesForTesting(cc::PaintCanvas*, const WebSize&) override;
WebRect GetSelectionBoundsRectForTesting() const override;
void PerformMediaPlayerAction(const WebPoint&,
......
......@@ -14,9 +14,10 @@ namespace blink {
namespace {
std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
LayerTreeFlags flags,
const FloatPoint& position) {
auto json = CCLayerAsJSON(layer->CcLayer(), flags, position);
LayerTreeFlags flags) {
// Intentionally passing through 0, 0 for the offset from the transform node
// as this dump implementation doesn't support transform/position information.
auto json = CCLayerAsJSON(layer->CcLayer(), flags, FloatPoint());
// Content dumped after this point, down to AppendAdditionalInfoAsJSON, is
// specific to GraphicsLayer tree dumping when called from one of the methods
......@@ -40,9 +41,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
// dumping code paths.
if (layer->MaskLayer()) {
auto mask_layer_json = std::make_unique<JSONArray>();
mask_layer_json->PushObject(
GraphicsLayerAsJSON(layer->MaskLayer(), flags,
FloatPoint(layer->MaskLayer()->GetPosition())));
mask_layer_json->PushObject(GraphicsLayerAsJSON(layer->MaskLayer(), flags));
json->SetArray("maskLayer", std::move(mask_layer_json));
}
......@@ -63,8 +62,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
std::unique_ptr<JSONObject> GraphicsLayerTreeAsJSON(const GraphicsLayer* layer,
LayerTreeFlags flags) {
DCHECK(flags & kOutputAsLayerTree);
std::unique_ptr<JSONObject> json =
GraphicsLayerAsJSON(layer, flags, FloatPoint(layer->GetPosition()));
std::unique_ptr<JSONObject> json = GraphicsLayerAsJSON(layer, flags);
if (layer->Children().size()) {
auto children_json = std::make_unique<JSONArray>();
for (wtf_size_t i = 0; i < layer->Children().size(); i++) {
......
......@@ -27,9 +27,10 @@ String PointerAsString(const void* ptr) {
} // namespace
// Create a JSON version of the specified |layer|.
std::unique_ptr<JSONObject> CCLayerAsJSON(const cc::Layer* layer,
LayerTreeFlags flags,
const FloatPoint& position) {
std::unique_ptr<JSONObject> CCLayerAsJSON(
const cc::Layer* layer,
LayerTreeFlags flags,
const FloatPoint& offset_from_transform_node) {
auto json = std::make_unique<JSONObject>();
if (flags & kLayerTreeIncludesDebugInfo) {
......@@ -39,8 +40,8 @@ std::unique_ptr<JSONObject> CCLayerAsJSON(const cc::Layer* layer,
json->SetString("name", String(layer->DebugName().c_str()));
if (position != FloatPoint())
json->SetArray("position", PointAsJSONArray(position));
if (offset_from_transform_node != FloatPoint())
json->SetArray("position", PointAsJSONArray(offset_from_transform_node));
// This is testing against gfx::Size(), *not* whether the size is empty.
if (layer->bounds() != gfx::Size())
......
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