OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/page_state_serialization.h" | 5 #include "content/common/page_state_serialization.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // it was on a private branch. | 599 // it was on a private branch. |
600 ReadReal(obj); | 600 ReadReal(obj); |
601 ReadBoolean(obj); | 601 ReadBoolean(obj); |
602 | 602 |
603 // In this version, page_scale_factor included device_scale_factor and | 603 // In this version, page_scale_factor included device_scale_factor and |
604 // scroll offsets were premultiplied by pageScaleFactor. | 604 // scroll offsets were premultiplied by pageScaleFactor. |
605 if (state->page_scale_factor) { | 605 if (state->page_scale_factor) { |
606 float device_scale_factor = g_device_scale_factor_for_testing; | 606 float device_scale_factor = g_device_scale_factor_for_testing; |
607 if (!device_scale_factor) { | 607 if (!device_scale_factor) { |
608 device_scale_factor = | 608 device_scale_factor = |
609 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(). | 609 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); |
610 device_scale_factor(); | |
611 } | 610 } |
612 state->scroll_offset = | 611 state->scroll_offset = |
613 gfx::Point(state->scroll_offset.x() / state->page_scale_factor, | 612 gfx::Point(state->scroll_offset.x() / state->page_scale_factor, |
614 state->scroll_offset.y() / state->page_scale_factor); | 613 state->scroll_offset.y() / state->page_scale_factor); |
615 state->page_scale_factor /= device_scale_factor; | 614 state->page_scale_factor /= device_scale_factor; |
616 } | 615 } |
617 } | 616 } |
618 #endif | 617 #endif |
619 | 618 |
620 // Subitems | 619 // Subitems |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 float device_scale_factor, | 751 float device_scale_factor, |
753 ExplodedPageState* exploded) { | 752 ExplodedPageState* exploded) { |
754 g_device_scale_factor_for_testing = device_scale_factor; | 753 g_device_scale_factor_for_testing = device_scale_factor; |
755 bool rv = DecodePageState(encoded, exploded); | 754 bool rv = DecodePageState(encoded, exploded); |
756 g_device_scale_factor_for_testing = 0.0; | 755 g_device_scale_factor_for_testing = 0.0; |
757 return rv; | 756 return rv; |
758 } | 757 } |
759 #endif | 758 #endif |
760 | 759 |
761 } // namespace content | 760 } // namespace content |
OLD | NEW |