summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraelias <aelias@chromium.org>2015-09-09 13:45:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-09 20:46:30 +0000
commit60b43d0fb14581c647034594f29e98f4ec2babf5 (patch)
tree829dbfe657c231307070fa73aa7b60108b090067
parentafc3598691aafb66f7975c9f522617797294d37e (diff)
downloadchromium_src-60b43d0fb14581c647034594f29e98f4ec2babf5.zip
chromium_src-60b43d0fb14581c647034594f29e98f4ec2babf5.tar.gz
chromium_src-60b43d0fb14581c647034594f29e98f4ec2babf5.tar.bz2
Replace ViewMsg_DidChangeBodyBackgroundColor with a frame metadata field.
This cleans out an Android-specific IPC. Doing it this way should also allow more perfect synchronization (although we hadn't observed the previous lack of synchronization to cause any visible bugs in practice). BUG=527284 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1311093007 Cr-Commit-Position: refs/heads/master@{#347997}
-rw-r--r--cc/output/compositor_frame_metadata.cc4
-rw-r--r--cc/output/compositor_frame_metadata.h6
-rw-r--r--cc/trees/layer_tree_host_impl.cc1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc9
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.h3
-rw-r--r--content/common/view_messages.h4
-rw-r--r--content/renderer/render_widget.cc19
-rw-r--r--content/renderer/render_widget.h6
8 files changed, 15 insertions, 37 deletions
diff --git a/cc/output/compositor_frame_metadata.cc b/cc/output/compositor_frame_metadata.cc
index dad78a0..b3a9b2d 100644
--- a/cc/output/compositor_frame_metadata.cc
+++ b/cc/output/compositor_frame_metadata.cc
@@ -12,8 +12,8 @@ CompositorFrameMetadata::CompositorFrameMetadata()
min_page_scale_factor(0.f),
max_page_scale_factor(0.f),
root_overflow_x_hidden(false),
- root_overflow_y_hidden(false) {
-}
+ root_overflow_y_hidden(false),
+ root_background_color(SK_ColorWHITE) {}
CompositorFrameMetadata::~CompositorFrameMetadata() {
}
diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h
index 999a6b4..72035e3 100644
--- a/cc/output/compositor_frame_metadata.h
+++ b/cc/output/compositor_frame_metadata.h
@@ -9,6 +9,7 @@
#include "cc/base/cc_export.h"
#include "cc/output/viewport_selection_bound.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/events/latency_info.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/geometry/vector2d_f.h"
@@ -42,6 +43,11 @@ class CC_EXPORT CompositorFrameMetadata {
gfx::Vector2dF location_bar_offset;
gfx::Vector2dF location_bar_content_translation;
+ // This color is usually obtained from the background color of the <body>
+ // element. It can be used for filling in gutter areas around the frame when
+ // it's too small to fill the box the parent reserved for it.
+ SkColor root_background_color;
+
// Provides selection region updates relative to the current viewport. If the
// selection is empty or otherwise unused, the bound types will indicate such.
ViewportSelection selection;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 7372d1d..9770aac 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1459,6 +1459,7 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset());
metadata.location_bar_content_translation =
gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset());
+ metadata.root_background_color = active_tree_->background_color();
active_tree_->GetViewportSelection(&metadata.selection);
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index e6257f2..9e4370f 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -357,8 +357,6 @@ bool RenderWidgetHostViewAndroid::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message)
IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor,
- OnDidChangeBodyBackgroundColor)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
OnSetNeedsBeginFrames)
IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted,
@@ -674,8 +672,7 @@ void RenderWidgetHostViewAndroid::TextInputStateChanged(
params.show_ime_if_needed, params.is_non_ime_change);
}
-void RenderWidgetHostViewAndroid::OnDidChangeBodyBackgroundColor(
- SkColor color) {
+void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
if (cached_background_color_ == color)
return;
@@ -859,7 +856,7 @@ void RenderWidgetHostViewAndroid::SelectionBoundsChanged(
void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) {
RenderWidgetHostViewBase::SetBackgroundColor(color);
host_->SetBackgroundOpaque(GetBackgroundOpaque());
- OnDidChangeBodyBackgroundColor(color);
+ UpdateBackgroundColor(color);
}
void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
@@ -1320,6 +1317,8 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
ConvertSelectionBound(frame_metadata.selection.end));
}
+ UpdateBackgroundColor(frame_metadata.root_background_color);
+
// All offsets and sizes are in CSS pixels.
content_view_core_->UpdateFrameInfo(
frame_metadata.root_scroll_offset,
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index a35385e..3f41a35 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -211,7 +211,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
void SendGestureEvent(const blink::WebGestureEvent& event);
- void OnDidChangeBodyBackgroundColor(SkColor color);
void OnStartContentIntent(const GURL& content_url);
void OnSetNeedsBeginFrames(bool enabled);
void OnSmartClipDataExtracted(const base::string16& text,
@@ -275,6 +274,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
void AttachLayers();
void RemoveLayers();
+ void UpdateBackgroundColor(SkColor color);
+
// Called after async screenshot task completes. Scales and crops the result
// of the copy.
static void PrepareTextureCopyOutputResult(
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 4b6e69c..0cb1403 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -1400,10 +1400,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_FindMatchRects_Reply,
IPC_MESSAGE_ROUTED1(ViewHostMsg_StartContentIntent,
GURL /* content_url */)
-// Message sent when the renderer changed the background color for the view.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_DidChangeBodyBackgroundColor,
- uint32 /* bg_color */)
-
// This message runs the MediaCodec for decoding audio for webaudio.
IPC_MESSAGE_CONTROL3(ViewHostMsg_RunWebAudioMediaCodec,
base::SharedMemoryHandle /* encoded_data_handle */,
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index fa599be..689b5769 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -519,7 +519,6 @@ RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
next_output_surface_id_(0),
#if defined(OS_ANDROID)
text_field_is_dirty_(false),
- body_background_color_(SK_ColorWHITE),
#endif
popup_origin_scale_for_emulation_(0.f),
frame_swap_message_queue_(new FrameSwapMessageQueue()),
@@ -1407,12 +1406,6 @@ blink::WebLayerTreeView* RenderWidget::layerTreeView() {
}
void RenderWidget::didFirstVisuallyNonEmptyLayout() {
- // TODO(dglazkov): Remove this -- we should just pass background color
- // in CompositorFrameMetadata.
-#if defined(OS_ANDROID)
- DidChangeBodyBackgroundColor(webwidget_->backgroundColor());
-#endif
-
QueueMessage(
new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_),
MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE);
@@ -2129,18 +2122,6 @@ bool RenderWidget::ShouldUpdateCompositionInfo(
}
#if defined(OS_ANDROID)
-void RenderWidget::DidChangeBodyBackgroundColor(SkColor bg_color) {
- // If not initialized, default to white. Note that 0 is different from black
- // as black still has alpha 0xFF.
- if (!bg_color)
- bg_color = SK_ColorWHITE;
-
- if (bg_color != body_background_color_) {
- body_background_color_ = bg_color;
- Send(new ViewHostMsg_DidChangeBodyBackgroundColor(routing_id(), bg_color));
- }
-}
-
bool RenderWidget::DoesRecordFullLayer() const {
return false;
}
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index bdce8a0..610a0b5 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -336,7 +336,6 @@ class CONTENT_EXPORT RenderWidget
void UpdateCompositionInfo(bool should_update_range);
#if defined(OS_ANDROID)
- void DidChangeBodyBackgroundColor(SkColor bg_color);
virtual bool DoesRecordFullLayer() const;
#endif
@@ -784,11 +783,6 @@ class CONTENT_EXPORT RenderWidget
// intentionally keep the last ack'd value to know what the browser is
// currently aware of.
std::deque<blink::WebTextInputInfo> text_input_info_history_;
-
- // The background color of the document body element. This is used as the
- // default background color for filling the screen areas for which we don't
- // have the actual content.
- SkColor body_background_color_;
#endif
scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_;