Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Bug fix Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 EXPECT_TRUE(constraint.is_anchored_top && constraint.is_anchored_left && 367 EXPECT_TRUE(constraint.is_anchored_top && constraint.is_anchored_left &&
368 !constraint.is_anchored_right && 368 !constraint.is_anchored_right &&
369 !constraint.is_anchored_bottom); 369 !constraint.is_anchored_bottom);
370 EXPECT_EQ(1.f, constraint.top_offset); 370 EXPECT_EQ(1.f, constraint.top_offset);
371 EXPECT_EQ(1.f, constraint.left_offset); 371 EXPECT_EQ(1.f, constraint.left_offset);
372 EXPECT_EQ(IntRect(100, 100, 10, 10), 372 EXPECT_EQ(IntRect(100, 100, 10, 10),
373 IntRect(constraint.scroll_container_relative_sticky_box_rect)); 373 IntRect(constraint.scroll_container_relative_sticky_box_rect));
374 EXPECT_EQ( 374 EXPECT_EQ(
375 IntRect(100, 100, 200, 200), 375 IntRect(100, 100, 200, 200),
376 IntRect(constraint.scroll_container_relative_containing_block_rect)); 376 IntRect(constraint.scroll_container_relative_containing_block_rect));
377 EXPECT_EQ(IntPoint(100, 100),
378 IntPoint(constraint.parent_relative_sticky_box_offset));
379 } 377 }
380 { 378 {
381 Element* element = document->getElementById("div-tr"); 379 Element* element = document->getElementById("div-tr");
382 ASSERT_TRUE(element); 380 ASSERT_TRUE(element);
383 WebLayer* layer = WebLayerFromElement(element); 381 WebLayer* layer = WebLayerFromElement(element);
384 ASSERT_TRUE(layer); 382 ASSERT_TRUE(layer);
385 WebLayerStickyPositionConstraint constraint = 383 WebLayerStickyPositionConstraint constraint =
386 layer->StickyPositionConstraint(); 384 layer->StickyPositionConstraint();
387 ASSERT_TRUE(constraint.is_sticky); 385 ASSERT_TRUE(constraint.is_sticky);
388 EXPECT_TRUE(constraint.is_anchored_top && !constraint.is_anchored_left && 386 EXPECT_TRUE(constraint.is_anchored_top && !constraint.is_anchored_left &&
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 ASSERT_TRUE(layer); 442 ASSERT_TRUE(layer);
445 WebLayerStickyPositionConstraint constraint = 443 WebLayerStickyPositionConstraint constraint =
446 layer->StickyPositionConstraint(); 444 layer->StickyPositionConstraint();
447 ASSERT_TRUE(constraint.is_sticky); 445 ASSERT_TRUE(constraint.is_sticky);
448 EXPECT_TRUE(constraint.is_anchored_top); 446 EXPECT_TRUE(constraint.is_anchored_top);
449 EXPECT_EQ(IntRect(100, 110, 10, 10), 447 EXPECT_EQ(IntRect(100, 110, 10, 10),
450 IntRect(constraint.scroll_container_relative_sticky_box_rect)); 448 IntRect(constraint.scroll_container_relative_sticky_box_rect));
451 EXPECT_EQ( 449 EXPECT_EQ(
452 IntRect(100, 100, 200, 200), 450 IntRect(100, 100, 200, 200),
453 IntRect(constraint.scroll_container_relative_containing_block_rect)); 451 IntRect(constraint.scroll_container_relative_containing_block_rect));
454 EXPECT_EQ(IntPoint(0, 10),
455 IntPoint(constraint.parent_relative_sticky_box_offset));
456 } 452 }
457 } 453 }
458 454
459 TEST_P(ScrollingCoordinatorTest, touchEventHandler) { 455 TEST_P(ScrollingCoordinatorTest, touchEventHandler) {
460 RegisterMockedHttpURLLoad("touch-event-handler.html"); 456 RegisterMockedHttpURLLoad("touch-event-handler.html");
461 NavigateTo(base_url_ + "touch-event-handler.html"); 457 NavigateTo(base_url_ + "touch-event-handler.html");
462 ForceFullCompositingUpdate(); 458 ForceFullCompositingUpdate();
463 459
464 ASSERT_EQ(WebEventListenerProperties::kBlocking, 460 ASSERT_EQ(WebEventListenerProperties::kBlocking,
465 GetWebLayerTreeView()->EventListenerProperties( 461 GetWebLayerTreeView()->EventListenerProperties(
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 ForceFullCompositingUpdate(); 1260 ForceFullCompositingUpdate();
1265 PaintLayerScrollableArea* scrollable_area2 = 1261 PaintLayerScrollableArea* scrollable_area2 =
1266 ToLayoutBoxModelObject(container2->GetLayoutObject()) 1262 ToLayoutBoxModelObject(container2->GetLayoutObject())
1267 ->GetScrollableArea(); 1263 ->GetScrollableArea();
1268 ASSERT_TRUE(scrollable_area2); 1264 ASSERT_TRUE(scrollable_area2);
1269 EXPECT_TRUE(scrollable_area2->GetNonCompositedMainThreadScrollingReasons() & 1265 EXPECT_TRUE(scrollable_area2->GetNonCompositedMainThreadScrollingReasons() &
1270 MainThreadScrollingReason::kHasBorderRadius); 1266 MainThreadScrollingReason::kHasBorderRadius);
1271 } 1267 }
1272 1268
1273 } // namespace blink 1269 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp ('k') | third_party/WebKit/public/platform/WebLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698