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 "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
9 #include "core/SVGNames.h" | 9 #include "core/SVGNames.h" |
10 #include "core/XLinkNames.h" | 10 #include "core/XLinkNames.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // returns the new content of the body. | 52 // returns the new content of the body. |
53 String contentAfterPastingHTML(DummyPageHolder* pageHolder, | 53 String contentAfterPastingHTML(DummyPageHolder* pageHolder, |
54 const char* htmlToPaste) { | 54 const char* htmlToPaste) { |
55 LocalFrame& frame = pageHolder->frame(); | 55 LocalFrame& frame = pageHolder->frame(); |
56 HTMLElement* body = pageHolder->document().body(); | 56 HTMLElement* body = pageHolder->document().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 frame.document()->updateStyleAndLayout(); | 60 frame.document()->updateStyleAndLayout(); |
61 frame.selection().setSelection( | 61 frame.selection().setSelection( |
62 VisibleSelection::selectionFromContentsOfNode(body)); | 62 SelectionInDOMTree::Builder().selectAllChildren(*body).build()); |
63 EXPECT_EQ(CaretSelection, frame.selection().getSelectionType()); | 63 EXPECT_EQ(CaretSelection, frame.selection().getSelectionType()); |
64 EXPECT_TRUE(frame.selection().isContentEditable()) | 64 EXPECT_TRUE(frame.selection().isContentEditable()) |
65 << "We should be pasting into something editable."; | 65 << "We should be pasting into something editable."; |
66 | 66 |
67 Pasteboard* pasteboard = Pasteboard::generalPasteboard(); | 67 Pasteboard* pasteboard = Pasteboard::generalPasteboard(); |
68 pasteboard->writeHTML(htmlToPaste, blankURL(), "", false); | 68 pasteboard->writeHTML(htmlToPaste, blankURL(), "", false); |
69 EXPECT_TRUE(frame.editor().executeCommand("Paste")); | 69 EXPECT_TRUE(frame.editor().executeCommand("Paste")); |
70 | 70 |
71 return body->innerHTML(); | 71 return body->innerHTML(); |
72 } | 72 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 Attribute fineAttribute(SVGNames::fromAttr, "hello, world!"); | 383 Attribute fineAttribute(SVGNames::fromAttr, "hello, world!"); |
384 Document* document = Document::create(); | 384 Document* document = Document::create(); |
385 Element* element = SVGSetElement::create(*document); | 385 Element* element = SVGSetElement::create(*document); |
386 EXPECT_FALSE( | 386 EXPECT_FALSE( |
387 element->isSVGAnimationAttributeSettingJavaScriptURL(fineAttribute)) | 387 element->isSVGAnimationAttributeSettingJavaScriptURL(fineAttribute)) |
388 << "The animate element should not identify a 'from' attribute with an " | 388 << "The animate element should not identify a 'from' attribute with an " |
389 "innocuous value as setting a JavaScript URL."; | 389 "innocuous value as setting a JavaScript URL."; |
390 } | 390 } |
391 | 391 |
392 } // namespace blink | 392 } // namespace blink |
OLD | NEW |