OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 RefPtr<Element> meta = document()->createElement(metaTag, false); | 83 RefPtr<Element> meta = document()->createElement(metaTag, false); |
84 meta->setAttribute(nameAttr, "viewport"); | 84 meta->setAttribute(nameAttr, "viewport"); |
85 meta->setAttribute(contentAttr, "width=device-width"); | 85 meta->setAttribute(contentAttr, "width=device-width"); |
86 head->appendChild(meta, IGNORE_EXCEPTION); | 86 head->appendChild(meta, IGNORE_EXCEPTION); |
87 | 87 |
88 RefPtr<Element> body = document()->createElement(bodyTag, false); | 88 RefPtr<Element> body = document()->createElement(bodyTag, false); |
89 rootElement->appendChild(body, IGNORE_EXCEPTION); | 89 rootElement->appendChild(body, IGNORE_EXCEPTION); |
90 | 90 |
91 RefPtr<Element> mediaElement = document()->createElement(videoTag, false); | 91 RefPtr<Element> mediaElement = document()->createElement(videoTag, false); |
92 | 92 |
93 m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get()); | 93 m_mediaElement = toHTMLVideoElement(mediaElement.get()); |
94 m_mediaElement->setAttribute(controlsAttr, ""); | 94 m_mediaElement->setAttribute(controlsAttr, ""); |
95 m_mediaElement->setAttribute(autoplayAttr, ""); | 95 m_mediaElement->setAttribute(autoplayAttr, ""); |
96 | 96 |
97 m_mediaElement->setAttribute(nameAttr, "media"); | 97 m_mediaElement->setAttribute(nameAttr, "media"); |
98 | 98 |
99 RefPtr<Element> sourceElement = document()->createElement(sourceTag, false); | 99 RefPtr<Element> sourceElement = document()->createElement(sourceTag, false); |
100 HTMLSourceElement* source = static_cast<HTMLSourceElement*>(sourceElement.ge
t()); | 100 HTMLSourceElement* source = static_cast<HTMLSourceElement*>(sourceElement.ge
t()); |
101 source->setSrc(document()->url()); | 101 source->setSrc(document()->url()); |
102 | 102 |
103 if (DocumentLoader* loader = document()->loader()) | 103 if (DocumentLoader* loader = document()->loader()) |
(...skipping 22 matching lines...) Expand all Loading... |
126 | 126 |
127 PassRefPtr<DocumentParser> MediaDocument::createParser() | 127 PassRefPtr<DocumentParser> MediaDocument::createParser() |
128 { | 128 { |
129 return MediaDocumentParser::create(this); | 129 return MediaDocumentParser::create(this); |
130 } | 130 } |
131 | 131 |
132 static inline HTMLVideoElement* descendentVideoElement(Node* node) | 132 static inline HTMLVideoElement* descendentVideoElement(Node* node) |
133 { | 133 { |
134 ASSERT(node); | 134 ASSERT(node); |
135 | 135 |
136 if (node->hasTagName(videoTag)) | 136 if (isHTMLVideoElement(node)) |
137 return static_cast<HTMLVideoElement*>(node); | 137 return toHTMLVideoElement(node); |
138 | 138 |
139 RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceU
RI(), videoTag.localName()); | 139 RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceU
RI(), videoTag.localName()); |
140 | 140 |
141 if (nodeList.get()->length() > 0) | 141 if (nodeList.get()->length() > 0) |
142 return static_cast<HTMLVideoElement*>(nodeList.get()->item(0)); | 142 return toHTMLVideoElement(nodeList.get()->item(0)); |
143 | 143 |
144 return 0; | 144 return 0; |
145 } | 145 } |
146 | 146 |
147 void MediaDocument::defaultEventHandler(Event* event) | 147 void MediaDocument::defaultEventHandler(Event* event) |
148 { | 148 { |
149 // Match the default Quicktime plugin behavior to allow | 149 // Match the default Quicktime plugin behavior to allow |
150 // clicking and double-clicking to pause and play the media. | 150 // clicking and double-clicking to pause and play the media. |
151 Node* targetNode = event->target()->toNode(); | 151 Node* targetNode = event->target()->toNode(); |
152 if (!targetNode) | 152 if (!targetNode) |
(...skipping 11 matching lines...) Expand all Loading... |
164 if (video->canPlay()) | 164 if (video->canPlay()) |
165 video->play(); | 165 video->play(); |
166 } else | 166 } else |
167 video->pause(); | 167 video->pause(); |
168 event->setDefaultHandled(); | 168 event->setDefaultHandled(); |
169 } | 169 } |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 } | 173 } |
OLD | NEW |