Commit b6e57d42 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Remove deprecated keys for PageDisplayState

Fixed: 926041
Change-Id: Ib40621f5039fcc6440968a397da1438aca7fbb78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215841Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771739}
parent 4c7c7f35
...@@ -19,10 +19,6 @@ NSString* const kContentInsetKey = @"contentInset"; ...@@ -19,10 +19,6 @@ NSString* const kContentInsetKey = @"contentInset";
NSString* const kMinZoomKey = @"minZoom"; NSString* const kMinZoomKey = @"minZoom";
NSString* const kMaxZoomKey = @"maxZoom"; NSString* const kMaxZoomKey = @"maxZoom";
NSString* const kZoomKey = @"zoom"; NSString* const kZoomKey = @"zoom";
// Deprecated serialization keys.
// TODO(crbug.com/926041): Remove these keys.
NSString* const kDeprecatedXOffsetKey = @"scrollX";
NSString* const kDeprecatedYOffsetKey = @"scrollY";
// Invalid consts. // Invalid consts.
const CGPoint kInvalidContentOffset = {NAN, NAN}; const CGPoint kInvalidContentOffset = {NAN, NAN};
const UIEdgeInsets kInvalidContentInset = {NAN, NAN, NAN, NAN}; const UIEdgeInsets kInvalidContentInset = {NAN, NAN, NAN, NAN};
...@@ -62,10 +58,7 @@ inline CGPoint GetContentOffset(NSDictionary* serialization) { ...@@ -62,10 +58,7 @@ inline CGPoint GetContentOffset(NSDictionary* serialization) {
NSValue* value = serialization[kContentOffsetKey]; NSValue* value = serialization[kContentOffsetKey];
if (value) if (value)
return [value CGPointValue]; return [value CGPointValue];
// TODO(crbug.com/926041): Return kInvalidContentOffset when legacy keys are return kInvalidContentOffset;
// removed.
return CGPointMake(GetFloatValue(kDeprecatedXOffsetKey, serialization),
GetFloatValue(kDeprecatedYOffsetKey, serialization));
} }
// Returns the contentInset stored in |serialization|, or a NAN inset if it is // Returns the contentInset stored in |serialization|, or a NAN inset if it is
// not set. // not set.
...@@ -73,14 +66,6 @@ inline UIEdgeInsets GetContentInset(NSDictionary* serialization) { ...@@ -73,14 +66,6 @@ inline UIEdgeInsets GetContentInset(NSDictionary* serialization) {
NSValue* value = serialization[kContentInsetKey]; NSValue* value = serialization[kContentInsetKey];
if (value) if (value)
return [value UIEdgeInsetsValue]; return [value UIEdgeInsetsValue];
if (serialization[kDeprecatedXOffsetKey] &&
serialization[kDeprecatedYOffsetKey]) {
// When restoring PageScrollStates created using the deprecated
// serialization keyes, use UIEdgeInsetsZero as default.
// TODO(crbug.com/926041): Just return kInvalidContentInset when legacy keys
// are removed.
return UIEdgeInsetsZero;
}
// Return an invalid inset if neither the new nor legacy keys were contained. // Return an invalid inset if neither the new nor legacy keys were contained.
return kInvalidContentInset; return kInvalidContentInset;
} }
......
...@@ -62,20 +62,6 @@ TEST_F(PageDisplayStateTest, Serialization) { ...@@ -62,20 +62,6 @@ TEST_F(PageDisplayStateTest, Serialization) {
EXPECT_EQ(state, new_state); EXPECT_EQ(state, new_state);
} }
// Tests that the PageScrollState is updated correctly when restored from the
// deprecated serialization keys.
// TODO(crbug.com/926041): Delete this test when legacy keys are removed.
TEST_F(PageDisplayStateTest, LegacySerialization) {
const CGPoint kContentOffset = CGPointMake(25.0, 100.0);
web::PageDisplayState state(
@{@"scrollX" : @(kContentOffset.x),
@"scrollY" : @(kContentOffset.y)});
EXPECT_TRUE(CGPointEqualToPoint(kContentOffset,
state.scroll_state().content_offset()));
EXPECT_TRUE(UIEdgeInsetsEqualToEdgeInsets(
state.scroll_state().content_inset(), UIEdgeInsetsZero));
}
// Tests PageScrollState::GetEffectiveContentOffsetForContentInset(). // Tests PageScrollState::GetEffectiveContentOffsetForContentInset().
TEST_F(PageDisplayStateTest, EffectiveContentOffset) { TEST_F(PageDisplayStateTest, EffectiveContentOffset) {
// kContentOffset is chosen such that a page with kTopInset is scrolled to the // kContentOffset is chosen such that a page with kTopInset is scrolled to the
......
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