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 { ...@@ -733,11 +733,6 @@ class WebLocalFrame : public WebFrame {
// Testing ------------------------------------------------------------------ // 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 // Prints the frame into the canvas, with page boundaries drawn as one pixel
// wide blue lines. This method exists to support web tests. // wide blue lines. This method exists to support web tests.
virtual void PrintPagesForTesting(cc::PaintCanvas*, const WebSize&) = 0; virtual void PrintPagesForTesting(cc::PaintCanvas*, const WebSize&) = 0;
......
...@@ -1579,15 +1579,6 @@ WebRect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const { ...@@ -1579,15 +1579,6 @@ WebRect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {
: WebRect(); : WebRect();
} }
WebString WebLocalFrameImpl::GetLayerTreeAsTextForTesting(
bool show_debug_info) const {
if (!GetFrame())
return WebString();
return WebString(GetFrame()->GetLayerTreeAsTextForTesting(
show_debug_info ? kLayerTreeIncludesDebugInfo : kLayerTreeNormal));
}
// WebLocalFrameImpl public -------------------------------------------------- // WebLocalFrameImpl public --------------------------------------------------
WebLocalFrame* WebLocalFrame::CreateMainFrame( WebLocalFrame* WebLocalFrame::CreateMainFrame(
......
...@@ -303,8 +303,6 @@ class CORE_EXPORT WebLocalFrameImpl final ...@@ -303,8 +303,6 @@ class CORE_EXPORT WebLocalFrameImpl final
WebPerformance Performance() const override; WebPerformance Performance() const override;
bool IsAdSubframe() const override; bool IsAdSubframe() const override;
void SetIsAdSubframe(blink::mojom::AdFrameType ad_frame_type) 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; void PrintPagesForTesting(cc::PaintCanvas*, const WebSize&) override;
WebRect GetSelectionBoundsRectForTesting() const override; WebRect GetSelectionBoundsRectForTesting() const override;
void PerformMediaPlayerAction(const WebPoint&, void PerformMediaPlayerAction(const WebPoint&,
......
...@@ -14,9 +14,10 @@ namespace blink { ...@@ -14,9 +14,10 @@ namespace blink {
namespace { namespace {
std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer, std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
LayerTreeFlags flags, LayerTreeFlags flags) {
const FloatPoint& position) { // Intentionally passing through 0, 0 for the offset from the transform node
auto json = CCLayerAsJSON(layer->CcLayer(), flags, position); // 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 // Content dumped after this point, down to AppendAdditionalInfoAsJSON, is
// specific to GraphicsLayer tree dumping when called from one of the methods // specific to GraphicsLayer tree dumping when called from one of the methods
...@@ -40,9 +41,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer, ...@@ -40,9 +41,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
// dumping code paths. // dumping code paths.
if (layer->MaskLayer()) { if (layer->MaskLayer()) {
auto mask_layer_json = std::make_unique<JSONArray>(); auto mask_layer_json = std::make_unique<JSONArray>();
mask_layer_json->PushObject( mask_layer_json->PushObject(GraphicsLayerAsJSON(layer->MaskLayer(), flags));
GraphicsLayerAsJSON(layer->MaskLayer(), flags,
FloatPoint(layer->MaskLayer()->GetPosition())));
json->SetArray("maskLayer", std::move(mask_layer_json)); json->SetArray("maskLayer", std::move(mask_layer_json));
} }
...@@ -63,8 +62,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer, ...@@ -63,8 +62,7 @@ std::unique_ptr<JSONObject> GraphicsLayerAsJSON(const GraphicsLayer* layer,
std::unique_ptr<JSONObject> GraphicsLayerTreeAsJSON(const GraphicsLayer* layer, std::unique_ptr<JSONObject> GraphicsLayerTreeAsJSON(const GraphicsLayer* layer,
LayerTreeFlags flags) { LayerTreeFlags flags) {
DCHECK(flags & kOutputAsLayerTree); DCHECK(flags & kOutputAsLayerTree);
std::unique_ptr<JSONObject> json = std::unique_ptr<JSONObject> json = GraphicsLayerAsJSON(layer, flags);
GraphicsLayerAsJSON(layer, flags, FloatPoint(layer->GetPosition()));
if (layer->Children().size()) { if (layer->Children().size()) {
auto children_json = std::make_unique<JSONArray>(); auto children_json = std::make_unique<JSONArray>();
for (wtf_size_t i = 0; i < layer->Children().size(); i++) { for (wtf_size_t i = 0; i < layer->Children().size(); i++) {
......
...@@ -27,9 +27,10 @@ String PointerAsString(const void* ptr) { ...@@ -27,9 +27,10 @@ String PointerAsString(const void* ptr) {
} // namespace } // namespace
// Create a JSON version of the specified |layer|. // Create a JSON version of the specified |layer|.
std::unique_ptr<JSONObject> CCLayerAsJSON(const cc::Layer* layer, std::unique_ptr<JSONObject> CCLayerAsJSON(
LayerTreeFlags flags, const cc::Layer* layer,
const FloatPoint& position) { LayerTreeFlags flags,
const FloatPoint& offset_from_transform_node) {
auto json = std::make_unique<JSONObject>(); auto json = std::make_unique<JSONObject>();
if (flags & kLayerTreeIncludesDebugInfo) { if (flags & kLayerTreeIncludesDebugInfo) {
...@@ -39,8 +40,8 @@ std::unique_ptr<JSONObject> CCLayerAsJSON(const cc::Layer* layer, ...@@ -39,8 +40,8 @@ std::unique_ptr<JSONObject> CCLayerAsJSON(const cc::Layer* layer,
json->SetString("name", String(layer->DebugName().c_str())); json->SetString("name", String(layer->DebugName().c_str()));
if (position != FloatPoint()) if (offset_from_transform_node != FloatPoint())
json->SetArray("position", PointAsJSONArray(position)); json->SetArray("position", PointAsJSONArray(offset_from_transform_node));
// This is testing against gfx::Size(), *not* whether the size is empty. // This is testing against gfx::Size(), *not* whether the size is empty.
if (layer->bounds() != gfx::Size()) 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