Commit 802a13fc authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Move GraphicsLayer text dumping out of platform.

The immediate motivation for this patch is to pave the way to move
stuff out of platform/scroll and into core/. That aside, it probably
makes more sense to put this kind of code in core/ rather than
platform/.

BUG=823365
R=skobes@chromium.org,pdr@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I0859fbfa6ddf82c607a36cbbd0bee77e49a3c0b0
Reviewed-on: https://chromium-review.googlesource.com/1131000Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574081}
parent 8f2735dc
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/public/platform/web_float_rect.h"
#if INSIDE_BLINK #if INSIDE_BLINK
#include "third_party/blink/renderer/platform/geometry/float_rect.h"
#include "third_party/blink/renderer/platform/scroll/scroll_alignment.h" #include "third_party/blink/renderer/platform/scroll/scroll_alignment.h"
#include "third_party/blink/renderer/platform/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/scroll/scroll_types.h"
#endif #endif
......
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
#include "third_party/blink/renderer/core/page/drag_controller.h" #include "third_party/blink/renderer/core/page/drag_controller.h"
#include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h" #include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/paint/compositing/graphics_layer_tree_as_text.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/paint/object_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h"
#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/probe/core_probes.h"
...@@ -875,7 +876,8 @@ String LocalFrame::GetLayerTreeAsTextForTesting(unsigned flags) const { ...@@ -875,7 +876,8 @@ String LocalFrame::GetLayerTreeAsTextForTesting(unsigned flags) const {
while (root_layer->Parent()) while (root_layer->Parent())
root_layer = root_layer->Parent(); root_layer = root_layer->Parent();
} }
layers = root_layer->LayerTreeAsJSON(static_cast<LayerTreeFlags>(flags)); layers = GraphicsLayerTreeAsJSON(root_layer,
static_cast<LayerTreeFlags>(flags));
} }
} }
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "third_party/blink/renderer/core/paint/compositing/composited_selection.h" #include "third_party/blink/renderer/core/paint/compositing/composited_selection.h"
#include "third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.h" #include "third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.h"
#include "third_party/blink/renderer/core/paint/compositing/graphics_layer_tree_as_text.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/paint/frame_painter.h" #include "third_party/blink/renderer/core/paint/frame_painter.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
...@@ -2686,6 +2687,24 @@ static void CollectDrawableLayersForLayerListRecursively( ...@@ -2686,6 +2687,24 @@ static void CollectDrawableLayersForLayerListRecursively(
CollectDrawableLayersForLayerListRecursively(context, layer->MaskLayer()); CollectDrawableLayersForLayerListRecursively(context, layer->MaskLayer());
} }
static void PaintGraphicsLayerRecursively(GraphicsLayer* layer) {
layer->PaintRecursively();
#if DCHECK_IS_ON()
if (VLOG_IS_ON(2)) {
DEFINE_STATIC_LOCAL(String, s_previous_tree, ());
LayerTreeFlags flags = VLOG_IS_ON(3) ? 0xffffffff : kOutputAsLayerTree;
String new_tree = GraphicsLayerTreeAsTextForTesting(layer, flags);
if (new_tree != s_previous_tree) {
VLOG(2) << "After GraphicsLayer::PaintRecursively()\n"
<< "GraphicsLayer tree:\n"
<< new_tree.Utf8().data();
s_previous_tree = new_tree;
}
}
#endif
}
void LocalFrameView::PaintTree() { void LocalFrameView::PaintTree() {
TRACE_EVENT0("blink,benchmark", "LocalFrameView::paintTree"); TRACE_EVENT0("blink,benchmark", "LocalFrameView::paintTree");
SCOPED_UMA_AND_UKM_TIMER("Blink.Paint.UpdateTime", UkmMetricNames::kPaint); SCOPED_UMA_AND_UKM_TIMER("Blink.Paint.UpdateTime", UkmMetricNames::kPaint);
...@@ -2729,21 +2748,25 @@ void LocalFrameView::PaintTree() { ...@@ -2729,21 +2748,25 @@ void LocalFrameView::PaintTree() {
// frame view of a page overlay. The page overlay is in the layer tree of // frame view of a page overlay. The page overlay is in the layer tree of
// the host page and will be painted during painting of the host page. // the host page and will be painted during painting of the host page.
if (GraphicsLayer* root_graphics_layer = if (GraphicsLayer* root_graphics_layer =
layout_view->Compositor()->PaintRootGraphicsLayer()) layout_view->Compositor()->PaintRootGraphicsLayer()) {
root_graphics_layer->PaintRecursively(); PaintGraphicsLayerRecursively(root_graphics_layer);
}
// TODO(sataya.m):Main frame doesn't create RootFrameViewport in some // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some
// webkit_unit_tests (http://crbug.com/644788). // webkit_unit_tests (http://crbug.com/644788).
if (viewport_scrollable_area_) { if (viewport_scrollable_area_) {
if (GraphicsLayer* layer_for_horizontal_scrollbar = if (GraphicsLayer* layer_for_horizontal_scrollbar =
viewport_scrollable_area_->LayerForHorizontalScrollbar()) viewport_scrollable_area_->LayerForHorizontalScrollbar()) {
layer_for_horizontal_scrollbar->PaintRecursively(); PaintGraphicsLayerRecursively(layer_for_horizontal_scrollbar);
}
if (GraphicsLayer* layer_for_vertical_scrollbar = if (GraphicsLayer* layer_for_vertical_scrollbar =
viewport_scrollable_area_->LayerForVerticalScrollbar()) viewport_scrollable_area_->LayerForVerticalScrollbar()) {
layer_for_vertical_scrollbar->PaintRecursively(); PaintGraphicsLayerRecursively(layer_for_vertical_scrollbar);
}
if (GraphicsLayer* layer_for_scroll_corner = if (GraphicsLayer* layer_for_scroll_corner =
viewport_scrollable_area_->LayerForScrollCorner()) viewport_scrollable_area_->LayerForScrollCorner()) {
layer_for_scroll_corner->PaintRecursively(); PaintGraphicsLayerRecursively(layer_for_scroll_corner);
}
} }
} }
......
...@@ -63,6 +63,8 @@ blink_core_sources("paint") { ...@@ -63,6 +63,8 @@ blink_core_sources("paint") {
"compositing/compositing_requirements_updater.h", "compositing/compositing_requirements_updater.h",
"compositing/compositing_state.h", "compositing/compositing_state.h",
"compositing/compositing_triggers.h", "compositing/compositing_triggers.h",
"compositing/graphics_layer_tree_as_text.cc",
"compositing/graphics_layer_tree_as_text.h",
"compositing/graphics_layer_tree_builder.cc", "compositing/graphics_layer_tree_builder.cc",
"compositing/graphics_layer_tree_builder.h", "compositing/graphics_layer_tree_builder.h",
"compositing/graphics_layer_updater.cc", "compositing/graphics_layer_updater.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_COMPOSITING_GRAPHICS_LAYER_TREE_AS_TEXT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_COMPOSITING_GRAPHICS_LAYER_TREE_AS_TEXT_H_
#include <memory>
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer_client.h"
namespace blink {
class GraphicsLayer;
class JSONObject;
std::unique_ptr<JSONObject> GraphicsLayerTreeAsJSON(const GraphicsLayer*,
LayerTreeFlags);
String CORE_EXPORT GraphicsLayerTreeAsTextForTesting(const GraphicsLayer*,
LayerTreeFlags);
} // namespace blink
#if DCHECK_IS_ON()
// Outside the blink namespace for ease of invocation from gdb.
void CORE_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*);
void CORE_EXPORT showGraphicsLayers(const blink::GraphicsLayer*);
#endif
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_COMPOSITING_GRAPHICS_LAYER_TREE_AS_TEXT_H_
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_context.h" #include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_context.h"
#include "third_party/blink/renderer/core/page/viewport_description.h" #include "third_party/blink/renderer/core/page/viewport_description.h"
#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "third_party/blink/renderer/core/paint/compositing/graphics_layer_tree_as_text.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
...@@ -2208,9 +2209,8 @@ String Internals::elementLayerTreeAsText( ...@@ -2208,9 +2209,8 @@ String Internals::elementLayerTreeAsText(
return String(); return String();
} }
return layer->GetCompositedLayerMapping() return GraphicsLayerTreeAsTextForTesting(
->MainGraphicsLayer() layer->GetCompositedLayerMapping()->MainGraphicsLayer(), flags);
->GetLayerTreeAsTextForTesting(flags);
} }
String Internals::scrollingStateTreeAsText(Document*) const { String Internals::scrollingStateTreeAsText(Document*) const {
......
...@@ -68,7 +68,6 @@ namespace blink { ...@@ -68,7 +68,6 @@ namespace blink {
class CompositorFilterOperations; class CompositorFilterOperations;
class Image; class Image;
class JSONObject;
class LinkHighlight; class LinkHighlight;
class PaintController; class PaintController;
class RasterInvalidationTracking; class RasterInvalidationTracking;
...@@ -97,6 +96,9 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -97,6 +96,9 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
CompositingReasons GetCompositingReasons() const { CompositingReasons GetCompositingReasons() const {
return compositing_reasons_; return compositing_reasons_;
} }
SquashingDisallowedReasons GetSquashingDisallowedReasons() const {
return squashing_disallowed_reasons_;
}
void SetSquashingDisallowedReasons(SquashingDisallowedReasons reasons) { void SetSquashingDisallowedReasons(SquashingDisallowedReasons reasons) {
squashing_disallowed_reasons_ = reasons; squashing_disallowed_reasons_ = reasons;
} }
...@@ -153,6 +155,8 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -153,6 +155,8 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
bool MasksToBounds() const; bool MasksToBounds() const;
void SetMasksToBounds(bool); void SetMasksToBounds(bool);
bool IsRootForIsolatedGroup() const { return is_root_for_isolated_group_; }
bool DrawsContent() const { return draws_content_; } bool DrawsContent() const { return draws_content_; }
void SetDrawsContent(bool); void SetDrawsContent(bool);
...@@ -175,9 +179,12 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -175,9 +179,12 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
bool BackfaceVisibility() const { return backface_visibility_; } bool BackfaceVisibility() const { return backface_visibility_; }
void SetBackfaceVisibility(bool visible); void SetBackfaceVisibility(bool visible);
bool ShouldFlattenTransform() const { return should_flatten_transform_; }
float Opacity() const { return opacity_; } float Opacity() const { return opacity_; }
void SetOpacity(float); void SetOpacity(float);
BlendMode GetBlendMode() const { return blend_mode_; }
void SetBlendMode(BlendMode); void SetBlendMode(BlendMode);
void SetIsRootForIsolatedGroup(bool); void SetIsRootForIsolatedGroup(bool);
...@@ -229,8 +236,6 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -229,8 +236,6 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
// returned string. // returned string.
String GetLayerTreeAsTextForTesting(LayerTreeFlags = kLayerTreeNormal) const; String GetLayerTreeAsTextForTesting(LayerTreeFlags = kLayerTreeNormal) const;
std::unique_ptr<JSONObject> LayerTreeAsJSON(LayerTreeFlags) const;
void UpdateTrackingRasterInvalidations(); void UpdateTrackingRasterInvalidations();
void ResetTrackedRasterInvalidations(); void ResetTrackedRasterInvalidations();
bool HasTrackedRasterInvalidations() const; bool HasTrackedRasterInvalidations() const;
...@@ -247,9 +252,10 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -247,9 +252,10 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
void SetScrollableArea(ScrollableArea*); void SetScrollableArea(ScrollableArea*);
ScrollableArea* GetScrollableArea() const { return scrollable_area_; } ScrollableArea* GetScrollableArea() const { return scrollable_area_; }
void ScrollableAreaDisposed(); void ScrollableAreaDisposed();
int GetRenderingContext3D() const { return rendering_context3d_; }
cc::PictureLayer* ContentLayer() const { return layer_.get(); } cc::PictureLayer* ContentLayer() const { return layer_.get(); }
static void RegisterContentsLayer(cc::Layer*); static void RegisterContentsLayer(cc::Layer*);
...@@ -284,6 +290,7 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -284,6 +290,7 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
void SetIsResizedByBrowserControls(bool); void SetIsResizedByBrowserControls(bool);
void SetIsContainerForFixedPositionLayers(bool); void SetIsContainerForFixedPositionLayers(bool);
bool HasLayerState() const { return layer_state_.get(); }
void SetLayerState(const PropertyTreeState&, const IntPoint& layer_offset); void SetLayerState(const PropertyTreeState&, const IntPoint& layer_offset);
const PropertyTreeState& GetPropertyTreeState() const { const PropertyTreeState& GetPropertyTreeState() const {
return layer_state_->state; return layer_state_->state;
...@@ -309,9 +316,11 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -309,9 +316,11 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
needs_check_raster_invalidation_ = true; needs_check_raster_invalidation_ = true;
} }
bool HasScrollParent() const { return has_scroll_parent_; }
bool HasClipParent() const { return has_clip_parent_; }
protected: protected:
String DebugName(cc::Layer*) const; String DebugName(cc::Layer*) const;
bool ShouldFlattenTransform() const { return should_flatten_transform_; }
explicit GraphicsLayer(GraphicsLayerClient&); explicit GraphicsLayer(GraphicsLayerClient&);
...@@ -355,18 +364,6 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -355,18 +364,6 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
cc::Layer* ContentsLayerIfRegistered(); cc::Layer* ContentsLayerIfRegistered();
void SetContentsLayer(cc::Layer*); void SetContentsLayer(cc::Layer*);
typedef HashMap<int, int> RenderingContextMap;
std::unique_ptr<JSONObject> LayerTreeAsJSONInternal(
LayerTreeFlags,
RenderingContextMap&) const;
std::unique_ptr<JSONObject> LayerAsJSONInternal(
LayerTreeFlags,
RenderingContextMap&,
const FloatPoint& position) const;
void AddTransformJSONProperties(JSONObject&, RenderingContextMap&) const;
void AddFlattenInheritedTransformJSON(JSONObject&) const;
class LayersAsJSONArray;
RasterInvalidator& EnsureRasterInvalidator(); RasterInvalidator& EnsureRasterInvalidator();
void SetNeedsDisplayInRect(const IntRect&); void SetNeedsDisplayInRect(const IntRect&);
...@@ -462,10 +459,4 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -462,10 +459,4 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
} // namespace blink } // namespace blink
#if DCHECK_IS_ON()
// Outside the blink namespace for ease of invocation from gdb.
void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*);
void PLATFORM_EXPORT showGraphicsLayers(const blink::GraphicsLayer*);
#endif
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GRAPHICS_LAYER_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GRAPHICS_LAYER_H_
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