Source/WebCore/ChangeLog

 12012-09-23 Matt Falkenhagen <falken@chromium.org>
 2
 3 Skeleton implementation of dialog.showModal()
 4 https://bugs.webkit.org/show_bug.cgi?id=97425
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This adds a basic implementation of showModal(), so the top layer
 9 can be tested once it is implemented. The main features of
 10 showModal(), modality and the top layer, are not yet implemented.
 11
 12 Test: fast/dom/HTMLDialogElement/dialog-show-modal.html
 13
 14 * html/HTMLDialogElement.cpp:
 15 (WebCore::HTMLDialogElement::showModal): The same as show(), but throws an error in the cases specified in the spec.
 16 (WebCore):
 17 * html/HTMLDialogElement.h:
 18 (HTMLDialogElement):
 19 * html/HTMLDialogElement.idl:
 20
1212012-09-21 Evan Wallace <evan.exe@gmail.com>
222
323 [WebSocket] Receiving a large message is really slow

Source/WebCore/html/HTMLDialogElement.cpp

@@void HTMLDialogElement::show()
6262 setBooleanAttribute(openAttr, true);
6363}
6464
 65void HTMLDialogElement::showModal(ExceptionCode& ec)
 66{
 67 if (fastHasAttribute(openAttr) || !inDocument()) {
 68 ec = INVALID_STATE_ERR;
 69 return;
 70 }
 71 setBooleanAttribute(openAttr, true);
 72}
 73
6574bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const
6675{
6776 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: modifying an attribute for which there is an attribute selector

Source/WebCore/html/HTMLDialogElement.h

@@public:
4141
4242 void close(ExceptionCode&);
4343 void show();
 44 void showModal(ExceptionCode&);
4445
4546private:
4647 HTMLDialogElement(const QualifiedName&, Document*);

Source/WebCore/html/HTMLDialogElement.idl

@@module html {
3131 attribute [Reflect] boolean open;
3232 void close() raises(DOMException);
3333 void show();
 34 void showModal() raises(DOMException);
3435 };
3536
3637}

LayoutTests/ChangeLog

 12012-09-23 Matt Falkenhagen <falken@chromium.org>
 2
 3 Skeleton implementation of dialog.showModal()
 4 https://bugs.webkit.org/show_bug.cgi?id=97425
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add a test that showModal() opens the dialog or throws an error in the cases specified in the spec.
 9
 10 * fast/dom/HTMLDialogElement/dialog-show-modal-expected.txt: Added.
 11 * fast/dom/HTMLDialogElement/dialog-show-modal.html: Added.
 12
1132012-09-21 Marcelo Lira <marcelo.lira@openbossa.org>
214
315 [Qt] REGRESSION: 5 tests started to fail with newer Qt5

LayoutTests/fast/dom/HTMLDialogElement/dialog-show-modal-expected.txt

 1Tests that showModal() performs the steps specified in the HTML spec. bug 97425
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS computedStyle.getPropertyValue('display') is 'none'
 7PASS computedStyle.getPropertyValue('display') is 'block'
 8PASS dialog.showModal(); threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
 9PASS computedStyle.getPropertyValue('display') is 'none'
 10PASS dialog.showModal(); threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
 11PASS successfullyParsed is true
 12
 13TEST COMPLETE
 14

LayoutTests/fast/dom/HTMLDialogElement/dialog-show-modal.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<script src="../../js/resources/js-test-pre.js"></script>
 5<script>
 6if (window.internals)
 7 internals.settings.setDialogElementEnabled(true);
 8</script>
 9</head>
 10<body>
 11<dialog id="mydialog">It's my dialog.</dialog>
 12<script>
 13description("Tests that showModal() performs the steps specified in the HTML spec. bug 97425");
 14
 15dialog = document.getElementById('mydialog');
 16computedStyle = window.getComputedStyle(dialog, null);
 17shouldBe("computedStyle.getPropertyValue('display')", "'none'");
 18
 19dialog.showModal();
 20computedStyle = window.getComputedStyle(dialog, null);
 21shouldBe("computedStyle.getPropertyValue('display')", "'block'");
 22
 23// The quoted text in the comments below are from <http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#dom-dialog-showmodal>.
 24// "If dialog already has an open attribute, then throw an InvalidStateError exception."
 25shouldThrow('dialog.showModal();', "'Error: INVALID_STATE_ERR: DOM Exception 11'");
 26
 27dialog.close();
 28shouldBe("computedStyle.getPropertyValue('display')", "'none'");
 29
 30dialog.parentNode.removeChild(dialog);
 31// "If dialog is not in a Document, then throw an InvalidStateError exception."
 32shouldThrow('dialog.showModal();', "'Error: INVALID_STATE_ERR: DOM Exception 11'");
 33</script>
 34<script src="../../js/resources/js-test-post.js"></script>
 35</body>
 36</html>