| OLD | NEW |
| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 { | 82 { |
| 83 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); | 83 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); |
| 84 EXPECT_FALSE(webViewImpl->bestTapNode(platformEvent)); | 84 EXPECT_FALSE(webViewImpl->bestTapNode(platformEvent)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 touchEvent.y = 20; | 87 touchEvent.y = 20; |
| 88 // Shouldn't crash. | 88 // Shouldn't crash. |
| 89 | 89 |
| 90 { | 90 { |
| 91 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); | 91 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); |
| 92 webViewImpl->enableTapHighlight(platformEvent); | 92 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 93 } | 93 } |
| 94 | 94 |
| 95 EXPECT_TRUE(webViewImpl->linkHighlight()); | 95 EXPECT_TRUE(webViewImpl->linkHighlight(0)); |
| 96 EXPECT_TRUE(webViewImpl->linkHighlight()->contentLayer()); | 96 EXPECT_TRUE(webViewImpl->linkHighlight(0)->contentLayer()); |
| 97 EXPECT_TRUE(webViewImpl->linkHighlight()->clipLayer()); | 97 EXPECT_TRUE(webViewImpl->linkHighlight(0)->clipLayer()); |
| 98 | 98 |
| 99 // Find a target inside a scrollable div | 99 // Find a target inside a scrollable div |
| 100 | 100 |
| 101 touchEvent.y = 100; | 101 touchEvent.y = 100; |
| 102 { | 102 { |
| 103 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); | 103 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); |
| 104 webViewImpl->enableTapHighlight(platformEvent); | 104 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 105 } | 105 } |
| 106 | 106 |
| 107 ASSERT_TRUE(webViewImpl->linkHighlight()); | 107 ASSERT_TRUE(webViewImpl->linkHighlight(0)); |
| 108 | 108 |
| 109 // Don't highlight if no "hand cursor" | 109 // Don't highlight if no "hand cursor" |
| 110 touchEvent.y = 220; // An A-link with cross-hair cursor. | 110 touchEvent.y = 220; // An A-link with cross-hair cursor. |
| 111 { | 111 { |
| 112 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); | 112 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); |
| 113 webViewImpl->enableTapHighlight(platformEvent); | 113 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 114 } | 114 } |
| 115 ASSERT_FALSE(webViewImpl->linkHighlight()); | 115 ASSERT_FALSE(webViewImpl->linkHighlight(0)); |
| 116 | 116 |
| 117 touchEvent.y = 260; // A text input box. | 117 touchEvent.y = 260; // A text input box. |
| 118 { | 118 { |
| 119 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); | 119 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->
frameView(), touchEvent); |
| 120 webViewImpl->enableTapHighlight(platformEvent); | 120 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 121 } | 121 } |
| 122 ASSERT_FALSE(webViewImpl->linkHighlight()); | 122 ASSERT_FALSE(webViewImpl->linkHighlight(0)); |
| 123 | 123 |
| 124 webViewImpl->close(); | 124 webViewImpl->close(); |
| 125 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 125 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 class FakeWebFrameClient : public WebFrameClient { | 128 class FakeWebFrameClient : public WebFrameClient { |
| 129 // To make the destructor public. | 129 // To make the destructor public. |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 class FakeCompositingWebViewClient : public WebViewClient { | 132 class FakeCompositingWebViewClient : public WebViewClient { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 WebGestureEvent touchEvent; | 174 WebGestureEvent touchEvent; |
| 175 touchEvent.type = WebInputEvent::GestureTapDown; | 175 touchEvent.type = WebInputEvent::GestureTapDown; |
| 176 touchEvent.x = 20; | 176 touchEvent.x = 20; |
| 177 touchEvent.y = 20; | 177 touchEvent.y = 20; |
| 178 | 178 |
| 179 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram
eView(), touchEvent); | 179 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram
eView(), touchEvent); |
| 180 Node* touchNode = webViewImpl->bestTapNode(platformEvent); | 180 Node* touchNode = webViewImpl->bestTapNode(platformEvent); |
| 181 ASSERT_TRUE(touchNode); | 181 ASSERT_TRUE(touchNode); |
| 182 | 182 |
| 183 webViewImpl->enableTapHighlight(platformEvent); | 183 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 184 ASSERT_TRUE(webViewImpl->linkHighlight()); | 184 ASSERT_TRUE(webViewImpl->linkHighlight(0)); |
| 185 | 185 |
| 186 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight()->currentGraphic
sLayerForTesting(); | 186 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight(0)->currentGraphi
csLayerForTesting(); |
| 187 ASSERT_TRUE(highlightLayer); | 187 ASSERT_TRUE(highlightLayer); |
| 188 EXPECT_TRUE(highlightLayer->linkHighlight()); | 188 EXPECT_TRUE(highlightLayer->linkHighlight(0)); |
| 189 | 189 |
| 190 touchNode->remove(IGNORE_EXCEPTION); | 190 touchNode->remove(IGNORE_EXCEPTION); |
| 191 webViewImpl->layout(); | 191 webViewImpl->layout(); |
| 192 EXPECT_FALSE(highlightLayer->linkHighlight()); | 192 EXPECT_FALSE(highlightLayer->linkHighlight(0)); |
| 193 | 193 |
| 194 webViewImpl->close(); | 194 webViewImpl->close(); |
| 195 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 195 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace | 198 } // namespace |
| OLD | NEW |