| Index: cc/trees/layer_tree_impl.cc
|
| diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
|
| index 1aad8e4acf9d0c2508c00c8a2f560735be0f0d1c..b29c126f25dbd6e44bb73bdfaeca4fcb51368555 100644
|
| --- a/cc/trees/layer_tree_impl.cc
|
| +++ b/cc/trees/layer_tree_impl.cc
|
| @@ -56,6 +56,7 @@ namespace cc {
|
| LayerTreeImpl::LayerTreeImpl(
|
| LayerTreeHostImpl* layer_tree_host_impl,
|
| scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
|
| + scoped_refptr<SyncedProperty<ScaleGroup>> subframe_page_scale_factor,
|
| scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio,
|
| scoped_refptr<SyncedElasticOverscroll> elastic_overscroll)
|
| : layer_tree_host_impl_(layer_tree_host_impl),
|
| @@ -71,6 +72,7 @@ LayerTreeImpl::LayerTreeImpl(
|
| inner_viewport_scroll_layer_id_(Layer::INVALID_ID),
|
| outer_viewport_scroll_layer_id_(Layer::INVALID_ID),
|
| page_scale_factor_(page_scale_factor),
|
| + subframe_page_scale_factor_(subframe_page_scale_factor),
|
| min_page_scale_factor_(0),
|
| max_page_scale_factor_(0),
|
| device_scale_factor_(1.f),
|
| @@ -445,8 +447,8 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
|
|
|
| // Active tree already shares the page_scale_factor object with pending
|
| // tree so only the limits need to be provided.
|
| - target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
|
| - max_page_scale_factor());
|
| + target_tree->PushPageScaleFactorAndLimits(
|
| + nullptr, nullptr, min_page_scale_factor(), max_page_scale_factor());
|
| target_tree->SetDeviceScaleFactor(device_scale_factor());
|
| target_tree->set_painted_device_scale_factor(painted_device_scale_factor());
|
| target_tree->SetDeviceColorSpace(device_color_space_);
|
| @@ -728,18 +730,32 @@ void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) {
|
| }
|
| }
|
|
|
| -void LayerTreeImpl::PushPageScaleFromMainThread(float page_scale_factor,
|
| - float min_page_scale_factor,
|
| - float max_page_scale_factor) {
|
| - PushPageScaleFactorAndLimits(&page_scale_factor, min_page_scale_factor,
|
| - max_page_scale_factor);
|
| +void LayerTreeImpl::SetSubframePageScaleOnActiveTree(
|
| + float active_subframe_page_scale) {
|
| + DCHECK(IsActiveTree());
|
| + if (subframe_page_scale_factor()->SetCurrent(
|
| + ClampPageScaleFactorToLimits(active_subframe_page_scale))) {
|
| + DidUpdatePageScale();
|
| + }
|
| +}
|
| +
|
| +void LayerTreeImpl::PushPageScaleFromMainThread(
|
| + float page_scale_factor,
|
| + float subframe_page_scale_factor,
|
| + float min_page_scale_factor,
|
| + float max_page_scale_factor) {
|
| + PushPageScaleFactorAndLimits(&page_scale_factor, &subframe_page_scale_factor,
|
| + min_page_scale_factor, max_page_scale_factor);
|
| }
|
|
|
| -void LayerTreeImpl::PushPageScaleFactorAndLimits(const float* page_scale_factor,
|
| - float min_page_scale_factor,
|
| - float max_page_scale_factor) {
|
| - DCHECK(page_scale_factor || IsActiveTree());
|
| +void LayerTreeImpl::PushPageScaleFactorAndLimits(
|
| + const float* page_scale_factor,
|
| + const float* subframe_page_scale_factor,
|
| + float min_page_scale_factor,
|
| + float max_page_scale_factor) {
|
| + DCHECK(page_scale_factor || subframe_page_scale_factor || IsActiveTree());
|
| bool changed_page_scale = false;
|
| + bool changed_subframe_page_scale = false;
|
|
|
| changed_page_scale |=
|
| SetPageScaleFactorLimits(min_page_scale_factor, max_page_scale_factor);
|
| @@ -754,15 +770,26 @@ void LayerTreeImpl::PushPageScaleFactorAndLimits(const float* page_scale_factor,
|
| page_scale_factor_->PushFromMainThread(*page_scale_factor);
|
| }
|
|
|
| + if (subframe_page_scale_factor) {
|
| + changed_subframe_page_scale |= subframe_page_scale_factor_->Delta() != 1.f;
|
| + changed_subframe_page_scale |=
|
| + subframe_page_scale_factor_->PushFromMainThread(
|
| + *subframe_page_scale_factor);
|
| + }
|
| +
|
| if (IsActiveTree()) {
|
| // TODO(enne): Pushing from pending to active should never require
|
| // DidUpdatePageScale. The values should already be set by the fully
|
| // computed property trees being synced from one tree to another. Remove
|
| // this once CDP goes away.
|
| changed_page_scale |= page_scale_factor_->PushPendingToActive();
|
| + // TODO(wjmaclean): subframe_page_scale_factor is not involved in CDP so far
|
| + // as I know, not sure that that means for this next line.
|
| + changed_subframe_page_scale |=
|
| + subframe_page_scale_factor_->PushPendingToActive();
|
| }
|
|
|
| - if (changed_page_scale)
|
| + if (changed_page_scale || changed_subframe_page_scale)
|
| DidUpdatePageScale();
|
|
|
| if (page_scale_factor) {
|
| @@ -849,9 +876,12 @@ bool LayerTreeImpl::SetPageScaleFactorLimits(float min_page_scale_factor,
|
| }
|
|
|
| void LayerTreeImpl::DidUpdatePageScale() {
|
| - if (IsActiveTree())
|
| + if (IsActiveTree()) {
|
| page_scale_factor()->SetCurrent(
|
| ClampPageScaleFactorToLimits(current_page_scale_factor()));
|
| + subframe_page_scale_factor()->SetCurrent(
|
| + ClampPageScaleFactorToLimits(GetSubframePageScaleFactor()));
|
| + }
|
|
|
| set_needs_update_draw_properties();
|
| DidUpdateScrollState(inner_viewport_scroll_layer_id_);
|
| @@ -883,6 +913,15 @@ const SyncedProperty<ScaleGroup>* LayerTreeImpl::page_scale_factor() const {
|
| return page_scale_factor_.get();
|
| }
|
|
|
| +SyncedProperty<ScaleGroup>* LayerTreeImpl::subframe_page_scale_factor() {
|
| + return subframe_page_scale_factor_.get();
|
| +}
|
| +
|
| +const SyncedProperty<ScaleGroup>* LayerTreeImpl::subframe_page_scale_factor()
|
| + const {
|
| + return subframe_page_scale_factor_.get();
|
| +}
|
| +
|
| gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const {
|
| if (!InnerViewportContainerLayer())
|
| return gfx::SizeF();
|
| @@ -906,6 +945,7 @@ void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() {
|
| DCHECK(IsActiveTree());
|
|
|
| page_scale_factor()->AbortCommit();
|
| + subframe_page_scale_factor()->AbortCommit();
|
| top_controls_shown_ratio()->AbortCommit();
|
| elastic_overscroll()->AbortCommit();
|
|
|
|
|