예제 #1
0
 FrameMetrics GetPinchableFrameMetrics()
 {
   FrameMetrics fm;
   fm.SetCompositionBounds(ParentLayerRect(200, 200, 100, 200));
   fm.SetScrollableRect(CSSRect(0, 0, 980, 1000));
   fm.SetScrollOffset(CSSPoint(300, 300));
   fm.SetZoom(CSSToParentLayerScale2D(2.0, 2.0));
   // APZC only allows zooming on the root scrollable frame.
   fm.SetIsRootContent(true);
   // the visible area of the document in CSS pixels is x=300 y=300 w=50 h=100
   return fm;
 }
예제 #2
0
TEST_F(APZCBasicTester, Overzoom) {
  // the visible area of the document in CSS pixels is x=10 y=0 w=100 h=100
  FrameMetrics fm;
  fm.SetCompositionBounds(ParentLayerRect(0, 0, 100, 100));
  fm.SetScrollableRect(CSSRect(0, 0, 125, 150));
  fm.SetScrollOffset(CSSPoint(10, 0));
  fm.SetZoom(CSSToParentLayerScale2D(1.0, 1.0));
  fm.SetIsRootContent(true);
  apzc->SetFrameMetrics(fm);

  MakeApzcZoomable();

  EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);

  PinchWithPinchInputAndCheckStatus(apzc, ScreenIntPoint(50, 50), 0.5, true);

  fm = apzc->GetFrameMetrics();
  EXPECT_EQ(0.8f, fm.GetZoom().ToScaleFactor().scale);
  // bug 936721 - PGO builds introduce rounding error so
  // use a fuzzy match instead
  EXPECT_LT(std::abs(fm.GetScrollOffset().x), 1e-5);
  EXPECT_LT(std::abs(fm.GetScrollOffset().y), 1e-5);
}