| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // FIXME(dominicc): Poor confused check-webkit-style demands Attribute.h here. | 5 // FIXME(dominicc): Poor confused check-webkit-style demands Attribute.h here. |
| 6 #include "core/dom/Attribute.h" | 6 #include "core/dom/Attribute.h" |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
| 10 #include "core/SVGNames.h" | 10 #include "core/SVGNames.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Pastes htmlToPaste into the body of pageHolder's document, and | 51 // Pastes htmlToPaste into the body of pageHolder's document, and |
| 52 // returns the new content of the body. | 52 // returns the new content of the body. |
| 53 String ContentAfterPastingHTML(DummyPageHolder* page_holder, | 53 String ContentAfterPastingHTML(DummyPageHolder* page_holder, |
| 54 const char* html_to_paste) { | 54 const char* html_to_paste) { |
| 55 LocalFrame& frame = page_holder->GetFrame(); | 55 LocalFrame& frame = page_holder->GetFrame(); |
| 56 HTMLElement* body = page_holder->GetDocument().body(); | 56 HTMLElement* body = page_holder->GetDocument().body(); |
| 57 | 57 |
| 58 // Make the body editable, and put the caret in it. | 58 // Make the body editable, and put the caret in it. |
| 59 body->setAttribute(HTMLNames::contenteditableAttr, "true"); | 59 body->setAttribute(HTMLNames::contenteditableAttr, "true"); |
| 60 body->focus(); |
| 60 frame.GetDocument()->UpdateStyleAndLayout(); | 61 frame.GetDocument()->UpdateStyleAndLayout(); |
| 61 frame.Selection().SetSelection( | 62 frame.Selection().SetSelection( |
| 62 SelectionInDOMTree::Builder().SelectAllChildren(*body).Build()); | 63 SelectionInDOMTree::Builder().SelectAllChildren(*body).Build()); |
| 63 EXPECT_EQ(kCaretSelection, frame.Selection() | 64 EXPECT_EQ(kCaretSelection, frame.Selection() |
| 64 .ComputeVisibleSelectionInDOMTreeDeprecated() | 65 .ComputeVisibleSelectionInDOMTreeDeprecated() |
| 65 .GetSelectionType()); | 66 .GetSelectionType()); |
| 66 EXPECT_TRUE(frame.Selection() | 67 EXPECT_TRUE(frame.Selection() |
| 67 .ComputeVisibleSelectionInDOMTreeDeprecated() | 68 .ComputeVisibleSelectionInDOMTreeDeprecated() |
| 68 .IsContentEditable()) | 69 .IsContentEditable()) |
| 69 << "We should be pasting into something editable."; | 70 << "We should be pasting into something editable."; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 Attribute fine_attribute(SVGNames::fromAttr, "hello, world!"); | 388 Attribute fine_attribute(SVGNames::fromAttr, "hello, world!"); |
| 388 Document* document = Document::Create(); | 389 Document* document = Document::Create(); |
| 389 Element* element = SVGSetElement::Create(*document); | 390 Element* element = SVGSetElement::Create(*document); |
| 390 EXPECT_FALSE( | 391 EXPECT_FALSE( |
| 391 element->IsSVGAnimationAttributeSettingJavaScriptURL(fine_attribute)) | 392 element->IsSVGAnimationAttributeSettingJavaScriptURL(fine_attribute)) |
| 392 << "The animate element should not identify a 'from' attribute with an " | 393 << "The animate element should not identify a 'from' attribute with an " |
| 393 "innocuous value as setting a JavaScript URL."; | 394 "innocuous value as setting a JavaScript URL."; |
| 394 } | 395 } |
| 395 | 396 |
| 396 } // namespace blink | 397 } // namespace blink |
| OLD | NEW |