| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 webView->resize(WebSize(800, 1200)); | 203 webView->resize(WebSize(800, 1200)); |
| 204 | 204 |
| 205 // Scroll to verify the code properly transforms windows to client co-ords. | 205 // Scroll to verify the code properly transforms windows to client co-ords. |
| 206 const int kScrollOffset = 100; | 206 const int kScrollOffset = 100; |
| 207 Document* document = static_cast<Document*>(webView->mainFrame()->document()
); | 207 Document* document = static_cast<Document*>(webView->mainFrame()->document()
); |
| 208 document->frame()->view()->setScrollPosition(IntPoint(0, kScrollOffset), Pro
grammaticScroll); | 208 document->frame()->view()->setScrollPosition(IntPoint(0, kScrollOffset), Pro
grammaticScroll); |
| 209 | 209 |
| 210 return webView; | 210 return webView; |
| 211 } | 211 } |
| 212 | 212 |
| 213 IntRect windowClipRect(const FrameView& frameView) |
| 214 { |
| 215 LayoutRect clipRect(LayoutPoint(), LayoutSize(frameView.visibleContentSize(E
xcludeScrollbars))); |
| 216 frameView.layoutViewItem().mapToVisualRectInAncestorSpace(&frameView.layoutV
iew()->containerForPaintInvalidation(), clipRect); |
| 217 return enclosingIntRect(clipRect); |
| 218 } |
| 219 |
| 213 void TouchActionTest::runTestOnTree(ContainerNode* root, WebView* webView, Touch
ActionTrackingWebViewClient& client) | 220 void TouchActionTest::runTestOnTree(ContainerNode* root, WebView* webView, Touch
ActionTrackingWebViewClient& client) |
| 214 { | 221 { |
| 215 // Find all elements to test the touch-action of in the document. | 222 // Find all elements to test the touch-action of in the document. |
| 216 TrackExceptionState es; | 223 TrackExceptionState es; |
| 217 | 224 |
| 218 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. | 225 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. |
| 219 Persistent<StaticElementList> elements = root->querySelectorAll("[expected-a
ction]", es); | 226 Persistent<StaticElementList> elements = root->querySelectorAll("[expected-a
ction]", es); |
| 220 ASSERT_FALSE(es.hadException()); | 227 ASSERT_FALSE(es.hadException()); |
| 221 | 228 |
| 222 for (unsigned index = 0; index < elements->length(); index++) { | 229 for (unsigned index = 0; index < elements->length(); index++) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 default: | 271 default: |
| 265 FAIL() << "Invalid location index."; | 272 FAIL() << "Invalid location index."; |
| 266 } | 273 } |
| 267 | 274 |
| 268 IntPoint windowPoint = root->document().frame()->view()->convertToRo
otFrame(framePoint); | 275 IntPoint windowPoint = root->document().frame()->view()->convertToRo
otFrame(framePoint); |
| 269 contextStream << "=" << windowPoint.x() << "," << windowPoint.y() <<
")."; | 276 contextStream << "=" << windowPoint.x() << "," << windowPoint.y() <<
")."; |
| 270 std::string failureContextPos = contextStream.str(); | 277 std::string failureContextPos = contextStream.str(); |
| 271 | 278 |
| 272 LocalFrame* mainFrame = static_cast<LocalFrame*>(webView->mainFrame(
)->toImplBase()->frame()); | 279 LocalFrame* mainFrame = static_cast<LocalFrame*>(webView->mainFrame(
)->toImplBase()->frame()); |
| 273 FrameView* mainFrameView = mainFrame->view(); | 280 FrameView* mainFrameView = mainFrame->view(); |
| 274 IntRect visibleRect = mainFrameView->windowClipRect(); | 281 IntRect visibleRect = windowClipRect(*mainFrameView); |
| 275 ASSERT_TRUE(visibleRect.contains(windowPoint)) << failureContextPos | 282 ASSERT_TRUE(visibleRect.contains(windowPoint)) << failureContextPos |
| 276 << " Test point not contained in visible area: " << visibleRect.
x() << "," << visibleRect.y() | 283 << " Test point not contained in visible area: " << visibleRect.
x() << "," << visibleRect.y() |
| 277 << "-" << visibleRect.maxX() << "," << visibleRect.maxY(); | 284 << "-" << visibleRect.maxX() << "," << visibleRect.maxY(); |
| 278 | 285 |
| 279 // First validate that a hit test at this point will really hit the
element | 286 // First validate that a hit test at this point will really hit the
element |
| 280 // we intended. This is the easiest way for a test to be broken, but
has nothing really | 287 // we intended. This is the easiest way for a test to be broken, but
has nothing really |
| 281 // to do with touch action. | 288 // to do with touch action. |
| 282 // Note that we can't use WebView's hit test API because it doesn't
look into shadow DOM. | 289 // Note that we can't use WebView's hit test API because it doesn't
look into shadow DOM. |
| 283 IntPoint docPoint(mainFrameView->frameToContents(windowPoint)); | 290 IntPoint docPoint(mainFrameView->frameToContents(windowPoint)); |
| 284 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoin
t(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 291 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoin
t(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 { | 374 { |
| 368 runShadowDOMTest("touch-action-shadow-dom.html"); | 375 runShadowDOMTest("touch-action-shadow-dom.html"); |
| 369 } | 376 } |
| 370 | 377 |
| 371 TEST_F(TouchActionTest, Pan) | 378 TEST_F(TouchActionTest, Pan) |
| 372 { | 379 { |
| 373 runTouchActionTest("touch-action-pan.html"); | 380 runTouchActionTest("touch-action-pan.html"); |
| 374 } | 381 } |
| 375 | 382 |
| 376 } // namespace blink | 383 } // namespace blink |
| OLD | NEW |