OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 | 4288 |
4289 private: | 4289 private: |
4290 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; | 4290 CompositedSelectionBoundsTestLayerTreeView m_testLayerTreeView; |
4291 }; | 4291 }; |
4292 | 4292 |
4293 class CompositedSelectionBoundsTest : public WebFrameTest { | 4293 class CompositedSelectionBoundsTest : public WebFrameTest { |
4294 protected: | 4294 protected: |
4295 CompositedSelectionBoundsTest() | 4295 CompositedSelectionBoundsTest() |
4296 : m_fakeSelectionLayerTreeView(m_fakeSelectionWebViewClient.selectionLay
erTreeView()) | 4296 : m_fakeSelectionLayerTreeView(m_fakeSelectionWebViewClient.selectionLay
erTreeView()) |
4297 { | 4297 { |
4298 blink::RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true)
; | 4298 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); |
4299 registerMockedHttpURLLoad("Ahem.ttf"); | 4299 registerMockedHttpURLLoad("Ahem.ttf"); |
4300 | 4300 |
4301 m_webViewHelper.initialize(true, 0, &m_fakeSelectionWebViewClient); | 4301 m_webViewHelper.initialize(true, 0, &m_fakeSelectionWebViewClient); |
4302 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); | 4302 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); |
4303 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 4303 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
4304 m_webViewHelper.webView()->resize(WebSize(640, 480)); | 4304 m_webViewHelper.webView()->resize(WebSize(640, 480)); |
4305 } | 4305 } |
4306 | 4306 |
4307 void runTest(const char* testFile) | 4307 void runTest(const char* testFile) |
4308 { | 4308 { |
(...skipping 17 matching lines...) Expand all Loading... |
4326 ASSERT_TRUE(selection); | 4326 ASSERT_TRUE(selection); |
4327 ASSERT_TRUE(selectStart); | 4327 ASSERT_TRUE(selectStart); |
4328 ASSERT_TRUE(selectEnd); | 4328 ASSERT_TRUE(selectEnd); |
4329 | 4329 |
4330 EXPECT_FALSE(selection->isNone()); | 4330 EXPECT_FALSE(selection->isNone()); |
4331 | 4331 |
4332 ASSERT_TRUE((*result)->IsArray()); | 4332 ASSERT_TRUE((*result)->IsArray()); |
4333 v8::Array& expectedResult = *v8::Array::Cast(*result); | 4333 v8::Array& expectedResult = *v8::Array::Cast(*result); |
4334 ASSERT_GE(expectedResult.Length(), 10u); | 4334 ASSERT_GE(expectedResult.Length(), 10u); |
4335 | 4335 |
4336 blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck
(v8::Isolate::GetCurrent(), expectedResult.Get(0)); | 4336 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck(v8::Is
olate::GetCurrent(), expectedResult.Get(0)); |
4337 ASSERT_TRUE(layerOwnerNodeForStart); | 4337 ASSERT_TRUE(layerOwnerNodeForStart); |
4338 EXPECT_EQ(layerOwnerNodeForStart->layoutObject()->enclosingLayer()->encl
osingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(),
selectStart->layerId); | 4338 EXPECT_EQ(layerOwnerNodeForStart->layoutObject()->enclosingLayer()->encl
osingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(),
selectStart->layerId); |
4339 v8::Local<v8::Context> context = v8::Isolate::GetCurrent()->GetCurrentCo
ntext(); | 4339 v8::Local<v8::Context> context = v8::Isolate::GetCurrent()->GetCurrentCo
ntext(); |
4340 EXPECT_EQ(expectedResult.Get(context, 1).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeTopInLayer.x); | 4340 EXPECT_EQ(expectedResult.Get(context, 1).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeTopInLayer.x); |
4341 EXPECT_EQ(expectedResult.Get(context, 2).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeTopInLayer.y); | 4341 EXPECT_EQ(expectedResult.Get(context, 2).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeTopInLayer.y); |
4342 EXPECT_EQ(expectedResult.Get(context, 3).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeBottomInLayer.x); | 4342 EXPECT_EQ(expectedResult.Get(context, 3).ToLocalChecked().As<v8::Int32>(
)->Value(), selectStart->edgeBottomInLayer.x); |
4343 | 4343 |
4344 blink::Node* layerOwnerNodeForEnd = blink::V8Node::toImplWithTypeCheck(v
8::Isolate::GetCurrent(), expectedResult.Get(context, 5).ToLocalChecked()); | 4344 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck(v8::Isol
ate::GetCurrent(), expectedResult.Get(context, 5).ToLocalChecked()); |
| 4345 |
4345 ASSERT_TRUE(layerOwnerNodeForEnd); | 4346 ASSERT_TRUE(layerOwnerNodeForEnd); |
4346 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject()->enclosingLayer()->enclos
ingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), s
electEnd->layerId); | 4347 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject()->enclosingLayer()->enclos
ingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), s
electEnd->layerId); |
4347 EXPECT_EQ(expectedResult.Get(context, 6).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeTopInLayer.x); | 4348 EXPECT_EQ(expectedResult.Get(context, 6).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeTopInLayer.x); |
4348 EXPECT_EQ(expectedResult.Get(context, 7).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeTopInLayer.y); | 4349 EXPECT_EQ(expectedResult.Get(context, 7).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeTopInLayer.y); |
4349 EXPECT_EQ(expectedResult.Get(context, 8).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeBottomInLayer.x); | 4350 EXPECT_EQ(expectedResult.Get(context, 8).ToLocalChecked().As<v8::Int32>(
)->Value(), selectEnd->edgeBottomInLayer.x); |
4350 | 4351 |
4351 // Platform differences can introduce small stylistic deviations in | 4352 // Platform differences can introduce small stylistic deviations in |
4352 // y-axis positioning, the details of which aren't relevant to | 4353 // y-axis positioning, the details of which aren't relevant to |
4353 // selection behavior. However, such deviations from the expected value | 4354 // selection behavior. However, such deviations from the expected value |
4354 // should be consistent for the corresponding y coordinates. | 4355 // should be consistent for the corresponding y coordinates. |
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7230 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); | 7231 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); |
7231 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8()
.find("Blocked a frame")); | 7232 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8()
.find("Blocked a frame")); |
7232 | 7233 |
7233 // Manually reset to break WebViewHelpers' dependencies on the stack | 7234 // Manually reset to break WebViewHelpers' dependencies on the stack |
7234 // allocated WebFrameClients. | 7235 // allocated WebFrameClients. |
7235 webViewHelper.reset(); | 7236 webViewHelper.reset(); |
7236 popupWebViewHelper.reset(); | 7237 popupWebViewHelper.reset(); |
7237 } | 7238 } |
7238 | 7239 |
7239 } // namespace blink | 7240 } // namespace blink |
OLD | NEW |