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

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

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Relocate the logic of updating mainThreadScrollingFromStyle Created 4 years 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 container->removeAttribute("class"); 842 container->removeAttribute("class");
843 forceFullCompositingUpdate(); 843 forceFullCompositingUpdate();
844 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar(); 844 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar();
845 ASSERT_FALSE( 845 ASSERT_FALSE(
846 scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThread()); 846 scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThread());
847 ASSERT_FALSE( 847 ASSERT_FALSE(
848 scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingReasons() & 848 scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingReasons() &
849 MainThreadScrollingReason::kCustomScrollbarScrolling); 849 MainThreadScrollingReason::kCustomScrollbarScrolling);
850 } 850 }
851 851
852 TEST_F(ScrollingCoordinatorTest, MainThreadScrollingReasonFromStyle) {
853 registerMockedHttpURLLoad("two_transparent_scrollable_area.html");
854 navigateTo(m_baseURL + "two_transparent_scrollable_area.html");
855 forceFullCompositingUpdate();
856
857 Page* page = frame()->page();
858 ASSERT_TRUE(page->scrollingCoordinator());
859 ASSERT_TRUE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
860 MainThreadScrollingReason::kHasOpacity);
861
862 // Remove opacity from one of the layouts.
bokan 2016/12/14 13:28:59 layouts->scrollers
yigu 2016/12/14 21:17:33 Done.
863 // Still need to scroll on main thread.
864 Document* document = frame()->document();
865 Element* container = document->getElementById("scroller1");
866 DCHECK(container);
867
868 container->removeAttribute("class");
869 forceFullCompositingUpdate();
870
871 ASSERT_TRUE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
872 MainThreadScrollingReason::kHasOpacity);
873
874 // Remove opacity from the other layout would lead to
875 // scroll on impl.
876 container = document->getElementById("scroller2");
877 DCHECK(container);
878
879 container->removeAttribute("class");
880 forceFullCompositingUpdate();
881
882 ASSERT_FALSE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
883 MainThreadScrollingReason::kHasOpacity);
884 }
885
852 } // namespace blink 886 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698