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 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4163 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); | 4163 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); |
4164 | 4164 |
4165 // Reset with swapped base and extent. | 4165 // Reset with swapped base and extent. |
4166 frame->selectRange(topLeft(endWebRect), bottomRightMinusOne(startWebRect)); | 4166 frame->selectRange(topLeft(endWebRect), bottomRightMinusOne(startWebRect)); |
4167 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); | 4167 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); |
4168 | 4168 |
4169 frame->moveRangeSelectionExtent(bottomRightMinusOne(endWebRect)); | 4169 frame->moveRangeSelectionExtent(bottomRightMinusOne(endWebRect)); |
4170 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); | 4170 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); |
4171 } | 4171 } |
4172 | 4172 |
| 4173 TEST_F(WebFrameTest, MoveRangeSelectionExtentScollsInputField) |
| 4174 { |
| 4175 WebLocalFrameImpl* frame; |
| 4176 WebRect startWebRect; |
| 4177 WebRect endWebRect; |
| 4178 |
| 4179 registerMockedHttpURLLoad("move_range_selection_extent_input_field.html"); |
| 4180 |
| 4181 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4182 initializeTextSelectionWebView(m_baseURL + "move_range_selection_extent_inpu
t_field.html", &webViewHelper); |
| 4183 frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); |
| 4184 EXPECT_EQ("Length", selectionAsString(frame)); |
| 4185 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); |
| 4186 |
| 4187 EXPECT_EQ(0, frame->frame()->selection().rootEditableElement()->scrollLeft()
); |
| 4188 frame->moveRangeSelectionExtent(WebPoint(endWebRect.x + 500, endWebRect.y)); |
| 4189 EXPECT_GE(frame->frame()->selection().rootEditableElement()->scrollLeft(), 1
); |
| 4190 EXPECT_EQ("Lengthy text goes here.", selectionAsString(frame)); |
| 4191 } |
| 4192 |
4173 static int computeOffset(RenderObject* renderer, int x, int y) | 4193 static int computeOffset(RenderObject* renderer, int x, int y) |
4174 { | 4194 { |
4175 return VisiblePosition(renderer->positionForPoint(LayoutPoint(x, y))).deepEq
uivalent().computeOffsetInContainerNode(); | 4195 return VisiblePosition(renderer->positionForPoint(LayoutPoint(x, y))).deepEq
uivalent().computeOffsetInContainerNode(); |
4176 } | 4196 } |
4177 | 4197 |
4178 // positionForPoint returns the wrong values for contenteditable spans. See | 4198 // positionForPoint returns the wrong values for contenteditable spans. See |
4179 // http://crbug.com/238334. | 4199 // http://crbug.com/238334. |
4180 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) | 4200 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) |
4181 { | 4201 { |
4182 registerMockedHttpURLLoad("select_range_span_editable.html"); | 4202 registerMockedHttpURLLoad("select_range_span_editable.html"); |
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6964 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6984 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6965 | 6985 |
6966 // Neither should a page reload. | 6986 // Neither should a page reload. |
6967 localFrame->reload(); | 6987 localFrame->reload(); |
6968 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6988 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
6969 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6989 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
6970 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6990 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6971 } | 6991 } |
6972 | 6992 |
6973 } // namespace | 6993 } // namespace |
OLD | NEW |