| 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 5434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5445 registerMockedHttpURLLoad("move_range_selection_extent_input_field.html"); | 5445 registerMockedHttpURLLoad("move_range_selection_extent_input_field.html"); |
| 5446 | 5446 |
| 5447 FrameTestHelpers::WebViewHelper webViewHelper; | 5447 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5448 initializeTextSelectionWebView( | 5448 initializeTextSelectionWebView( |
| 5449 m_baseURL + "move_range_selection_extent_input_field.html", | 5449 m_baseURL + "move_range_selection_extent_input_field.html", |
| 5450 &webViewHelper); | 5450 &webViewHelper); |
| 5451 frame = webViewHelper.webView()->mainFrameImpl(); | 5451 frame = webViewHelper.webView()->mainFrameImpl(); |
| 5452 EXPECT_EQ("Length", selectionAsString(frame)); | 5452 EXPECT_EQ("Length", selectionAsString(frame)); |
| 5453 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); | 5453 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); |
| 5454 | 5454 |
| 5455 EXPECT_EQ(0, frame->frame()->selection().rootEditableElement()->scrollLeft()); | 5455 EXPECT_EQ(0, frame->frame() |
| 5456 ->selection() |
| 5457 .computeVisibleSelectionInDOMTreeDeprecated() |
| 5458 .rootEditableElement() |
| 5459 ->scrollLeft()); |
| 5456 frame->moveRangeSelectionExtent(WebPoint(endWebRect.x + 500, endWebRect.y)); | 5460 frame->moveRangeSelectionExtent(WebPoint(endWebRect.x + 500, endWebRect.y)); |
| 5457 EXPECT_GE(frame->frame()->selection().rootEditableElement()->scrollLeft(), 1); | 5461 EXPECT_GE(frame->frame() |
| 5462 ->selection() |
| 5463 .computeVisibleSelectionInDOMTreeDeprecated() |
| 5464 .rootEditableElement() |
| 5465 ->scrollLeft(), |
| 5466 1); |
| 5458 EXPECT_EQ("Lengthy text goes here.", selectionAsString(frame)); | 5467 EXPECT_EQ("Lengthy text goes here.", selectionAsString(frame)); |
| 5459 } | 5468 } |
| 5460 | 5469 |
| 5461 static int computeOffset(LayoutObject* layoutObject, int x, int y) { | 5470 static int computeOffset(LayoutObject* layoutObject, int x, int y) { |
| 5462 return createVisiblePosition( | 5471 return createVisiblePosition( |
| 5463 layoutObject->positionForPoint(LayoutPoint(x, y))) | 5472 layoutObject->positionForPoint(LayoutPoint(x, y))) |
| 5464 .deepEquivalent() | 5473 .deepEquivalent() |
| 5465 .computeOffsetInContainerNode(); | 5474 .computeOffsetInContainerNode(); |
| 5466 } | 5475 } |
| 5467 | 5476 |
| 5468 // positionForPoint returns the wrong values for contenteditable spans. See | 5477 // positionForPoint returns the wrong values for contenteditable spans. See |
| 5469 // http://crbug.com/238334. | 5478 // http://crbug.com/238334. |
| 5470 TEST_P(ParameterizedWebFrameTest, DISABLED_PositionForPointTest) { | 5479 TEST_P(ParameterizedWebFrameTest, DISABLED_PositionForPointTest) { |
| 5471 registerMockedHttpURLLoad("select_range_span_editable.html"); | 5480 registerMockedHttpURLLoad("select_range_span_editable.html"); |
| 5472 FrameTestHelpers::WebViewHelper webViewHelper; | 5481 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5473 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", | 5482 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", |
| 5474 &webViewHelper); | 5483 &webViewHelper); |
| 5475 WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); | 5484 WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); |
| 5476 LayoutObject* layoutObject = | 5485 LayoutObject* layoutObject = mainFrame->frame() |
| 5477 mainFrame->frame()->selection().rootEditableElement()->layoutObject(); | 5486 ->selection() |
| 5487 .computeVisibleSelectionInDOMTreeDeprecated() |
| 5488 .rootEditableElement() |
| 5489 ->layoutObject(); |
| 5478 EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); | 5490 EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); |
| 5479 EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); | 5491 EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); |
| 5480 | 5492 |
| 5481 registerMockedHttpURLLoad("select_range_div_editable.html"); | 5493 registerMockedHttpURLLoad("select_range_div_editable.html"); |
| 5482 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", | 5494 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", |
| 5483 &webViewHelper); | 5495 &webViewHelper); |
| 5484 mainFrame = webViewHelper.webView()->mainFrameImpl(); | 5496 mainFrame = webViewHelper.webView()->mainFrameImpl(); |
| 5485 layoutObject = | 5497 layoutObject = mainFrame->frame() |
| 5486 mainFrame->frame()->selection().rootEditableElement()->layoutObject(); | 5498 ->selection() |
| 5499 .computeVisibleSelectionInDOMTreeDeprecated() |
| 5500 .rootEditableElement() |
| 5501 ->layoutObject(); |
| 5487 EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); | 5502 EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); |
| 5488 EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); | 5503 EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); |
| 5489 } | 5504 } |
| 5490 | 5505 |
| 5491 #if !OS(MACOSX) && !OS(LINUX) | 5506 #if !OS(MACOSX) && !OS(LINUX) |
| 5492 TEST_P(ParameterizedWebFrameTest, | 5507 TEST_P(ParameterizedWebFrameTest, |
| 5493 SelectRangeStaysHorizontallyAlignedWhenMoved) { | 5508 SelectRangeStaysHorizontallyAlignedWhenMoved) { |
| 5494 registerMockedHttpURLLoad("move_caret.html"); | 5509 registerMockedHttpURLLoad("move_caret.html"); |
| 5495 | 5510 |
| 5496 FrameTestHelpers::WebViewHelper webViewHelper; | 5511 FrameTestHelpers::WebViewHelper webViewHelper; |
| (...skipping 5883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11380 | 11395 |
| 11381 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11396 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11382 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11397 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11383 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11398 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11384 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11399 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11385 | 11400 |
| 11386 webViewHelper.reset(); | 11401 webViewHelper.reset(); |
| 11387 } | 11402 } |
| 11388 | 11403 |
| 11389 } // namespace blink | 11404 } // namespace blink |
| OLD | NEW |