<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174065] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174065">174065</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-09-29 09:58:42 -0700 (Mon, 29 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses
https://bugs.webkit.org/show_bug.cgi?id=137169

Reviewed by Darin Adler.

Source/WebCore:

Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses by
using the SPECIALIZE_TYPE_TRAITS_*() macro. Drop the DOCUMENT_TYPE_CASTS()
macro as it is no longer needed.

No new tests, no behavior change.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::namedItemGetter):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
* dom/Document.cpp:
(WebCore::Document::prepareForDestruction):
(WebCore::Document::processHttpEquiv):
(WebCore::eventTargetElementForDocument):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::insertedInto):
(WebCore::Element::removedFrom):
(WebCore::Element::updateName):
(WebCore::Element::updateId):
* html/HTMLDocument.h:
(WebCore::isHTMLDocument):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::matchesReadWritePseudoClass):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateDocNamedItem):
* html/ImageDocument.cpp:
(WebCore::ImageDocumentParser::document):
* html/ImageDocument.h:
(WebCore::isImageDocument):
* html/MediaDocument.h:
(WebCore::isMediaDocument):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
* html/PluginDocument.h:
(WebCore::isPluginDocument):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadPlugin):
* page/DragController.cpp:
(WebCore::DragController::operationForLoad):
* page/FrameView.cpp:
(WebCore::determineLayerFlushThrottleState):

Source/WebKit/win:

Use is&lt;&gt;() / downcast&lt;&gt;() for HTMLDocument and its subclasses.

* DOMHTMLClasses.cpp:
(DOMHTMLDocument::URL):
(DOMHTMLDocument::body):
(DOMHTMLDocument::forms):

Source/WebKit2:

Use is&lt;&gt;() / downcast&lt;&gt;() for HTMLDocument and its subclasses.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pdfDocumentForPrintingFrame):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp">trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLDocumenth">trunk/Source/WebCore/html/HTMLDocument.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementcpp">trunk/Source/WebCore/html/HTMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLEmbedElementcpp">trunk/Source/WebCore/html/HTMLEmbedElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementcpp">trunk/Source/WebCore/html/HTMLImageElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLObjectElementcpp">trunk/Source/WebCore/html/HTMLObjectElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDocumentcpp">trunk/Source/WebCore/html/ImageDocument.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDocumenth">trunk/Source/WebCore/html/ImageDocument.h</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaDocumenth">trunk/Source/WebCore/html/MediaDocument.h</a></li>
<li><a href="#trunkSourceWebCorehtmlPluginDocumentcpp">trunk/Source/WebCore/html/PluginDocument.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlPluginDocumenth">trunk/Source/WebCore/html/PluginDocument.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubframeLoadercpp">trunk/Source/WebCore/loader/SubframeLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinDOMHTMLClassescpp">trunk/Source/WebKit/win/DOMHTMLClasses.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/ChangeLog        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-09-29  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
+        Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137169
+
+        Reviewed by Darin Adler.
+
+        Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses by
+        using the SPECIALIZE_TYPE_TRAITS_*() macro. Drop the DOCUMENT_TYPE_CASTS()
+        macro as it is no longer needed.
+
+        No new tests, no behavior change.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::namedItemGetter):
+        (WebCore::JSDOMWindow::getOwnPropertySlot):
+        (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
+        * dom/Document.cpp:
+        (WebCore::Document::prepareForDestruction):
+        (WebCore::Document::processHttpEquiv):
+        (WebCore::eventTargetElementForDocument):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::insertedInto):
+        (WebCore::Element::removedFrom):
+        (WebCore::Element::updateName):
+        (WebCore::Element::updateId):
+        * html/HTMLDocument.h:
+        (WebCore::isHTMLDocument):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::matchesReadWritePseudoClass):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget):
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::parseAttribute):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateDocNamedItem):
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocumentParser::document):
+        * html/ImageDocument.h:
+        (WebCore::isImageDocument):
+        * html/MediaDocument.h:
+        (WebCore::isMediaDocument):
+        * html/PluginDocument.cpp:
+        (WebCore::PluginDocumentParser::createDocumentStructure):
+        * html/PluginDocument.h:
+        (WebCore::isPluginDocument):
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::loadPlugin):
+        * page/DragController.cpp:
+        (WebCore::DragController::operationForLoad):
+        * page/FrameView.cpp:
+        (WebCore::determineLayerFlushThrottleState):
+
</ins><span class="cx"> 2014-09-29  Bruno de Oliveira Abinader  &lt;bruno.d@partner.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Revert &quot;Support for :enabled selector on Anchor &amp; Area elements&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -80,19 +80,19 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObj-&gt;impl()));
</span><span class="cx">     ASSERT(document);
</span><del>-    ASSERT(document-&gt;isHTMLDocument());
</del><ins>+    ASSERT(is&lt;HTMLDocument&gt;(document));
</ins><span class="cx"> 
</span><span class="cx">     AtomicStringImpl* atomicPropertyName = propertyName.publicName();
</span><del>-    if (!atomicPropertyName || !toHTMLDocument(*document).hasWindowNamedItem(*atomicPropertyName))
</del><ins>+    if (!atomicPropertyName || !downcast&lt;HTMLDocument&gt;(*document).hasWindowNamedItem(*atomicPropertyName))
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span><del>-    if (UNLIKELY(toHTMLDocument(*document).windowNamedItemContainsMultipleElements(*atomicPropertyName))) {
</del><ins>+    if (UNLIKELY(downcast&lt;HTMLDocument&gt;(*document).windowNamedItemContainsMultipleElements(*atomicPropertyName))) {
</ins><span class="cx">         RefPtr&lt;HTMLCollection&gt; collection = document-&gt;windowNamedItems(atomicPropertyName);
</span><span class="cx">         ASSERT(collection-&gt;length() &gt; 1);
</span><span class="cx">         return JSValue::encode(toJS(exec, thisObj-&gt;globalObject(), WTF::getPtr(collection)));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return JSValue::encode(toJS(exec, thisObj-&gt;globalObject(), toHTMLDocument(*document).windowNamedItem(*atomicPropertyName)));
</del><ins>+    return JSValue::encode(toJS(exec, thisObj-&gt;globalObject(), downcast&lt;HTMLDocument&gt;(*document).windowNamedItem(*atomicPropertyName)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="lines">@@ -244,9 +244,9 @@
</span><span class="cx"> 
</span><span class="cx">     // Allow shortcuts like 'Image1' instead of document.images.Image1
</span><span class="cx">     Document* document = thisObject-&gt;impl().frame()-&gt;document();
</span><del>-    if (document-&gt;isHTMLDocument()) {
</del><ins>+    if (is&lt;HTMLDocument&gt;(document)) {
</ins><span class="cx">         AtomicStringImpl* atomicPropertyName = propertyName.publicName();
</span><del>-        if (atomicPropertyName &amp;&amp; toHTMLDocument(*document).hasWindowNamedItem(*atomicPropertyName)) {
</del><ins>+        if (atomicPropertyName &amp;&amp; downcast&lt;HTMLDocument&gt;(*document).hasWindowNamedItem(*atomicPropertyName)) {
</ins><span class="cx">             slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, namedItemGetter);
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="lines">@@ -321,9 +321,9 @@
</span><span class="cx"> 
</span><span class="cx">     // Allow shortcuts like 'Image1' instead of document.images.Image1
</span><span class="cx">     Document* document = thisObject-&gt;impl().frame()-&gt;document();
</span><del>-    if (document-&gt;isHTMLDocument()) {
</del><ins>+    if (is&lt;HTMLDocument&gt;(document)) {
</ins><span class="cx">         AtomicStringImpl* atomicPropertyName = propertyName.publicName();
</span><del>-        if (atomicPropertyName &amp;&amp; toHTMLDocument(*document).hasWindowNamedItem(*atomicPropertyName)) {
</del><ins>+        if (atomicPropertyName &amp;&amp; downcast&lt;HTMLDocument&gt;(*document).hasWindowNamedItem(*atomicPropertyName)) {
</ins><span class="cx">             slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, namedItemGetter);
</span><span class="cx">             return true;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -2107,8 +2107,8 @@
</span><span class="cx">     if (hasLivingRenderTree())
</span><span class="cx">         destroyRenderTree();
</span><span class="cx"> 
</span><del>-    if (isPluginDocument())
-        toPluginDocument(this)-&gt;detachFromPluginElement();
</del><ins>+    if (is&lt;PluginDocument&gt;(*this))
+        downcast&lt;PluginDocument&gt;(*this).detachFromPluginElement();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_LOCK)
</span><span class="cx">     if (page())
</span><span class="lines">@@ -2879,9 +2879,9 @@
</span><span class="cx"> 
</span><span class="cx">     case HTTPHeaderName::SetCookie:
</span><span class="cx">         // FIXME: make setCookie work on XML documents too; e.g. in case of &lt;html:meta .....&gt;
</span><del>-        if (isHTMLDocument()) {
</del><ins>+        if (is&lt;HTMLDocument&gt;(*this)) {
</ins><span class="cx">             // Exception (for sandboxed documents) ignored.
</span><del>-            toHTMLDocument(*this).setCookie(content, IGNORE_EXCEPTION);
</del><ins>+            downcast&lt;HTMLDocument&gt;(*this).setCookie(content, IGNORE_EXCEPTION);
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="lines">@@ -5900,19 +5900,17 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-Element* eventTargetElementForDocument(Document* doc)
</del><ins>+Element* eventTargetElementForDocument(Document* document)
</ins><span class="cx"> {
</span><del>-    if (!doc)
</del><ins>+    if (!document)
</ins><span class="cx">         return nullptr;
</span><del>-    Element* element = doc-&gt;focusedElement();
-    if (!element &amp;&amp; doc-&gt;isPluginDocument()) {
-        PluginDocument* pluginDocument = toPluginDocument(doc);
-        element = pluginDocument-&gt;pluginElement();
-    }
-    if (!element &amp;&amp; doc-&gt;isHTMLDocument())
-        element = doc-&gt;body();
</del><ins>+    Element* element = document-&gt;focusedElement();
+    if (!element &amp;&amp; is&lt;PluginDocument&gt;(document))
+        element = downcast&lt;PluginDocument&gt;(*document).pluginElement();
+    if (!element &amp;&amp; is&lt;HTMLDocument&gt;(document))
+        element = document-&gt;body();
</ins><span class="cx">     if (!element)
</span><del>-        element = doc-&gt;documentElement();
</del><ins>+        element = document-&gt;documentElement();
</ins><span class="cx">     return element;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/dom/Document.h        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1747,9 +1747,6 @@
</span><span class="cx"> 
</span><span class="cx"> NODE_TYPE_CASTS(Document)
</span><span class="cx"> 
</span><del>-#define DOCUMENT_TYPE_CASTS(ToClassName) \
-    TYPE_CASTS_BASE(ToClassName, Document, document, WebCore::is##ToClassName(*document), WebCore::is##ToClassName(document))
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1338,7 +1338,7 @@
</span><span class="cx">         elementRareData()-&gt;clearClassListValueForQuirksMode();
</span><span class="cx"> 
</span><span class="cx">     TreeScope* newScope = &amp;insertionPoint.treeScope();
</span><del>-    HTMLDocument* newDocument = !wasInDocument &amp;&amp; inDocument() &amp;&amp; newScope-&gt;documentScope().isHTMLDocument() ? toHTMLDocument(&amp;newScope-&gt;documentScope()) : nullptr;
</del><ins>+    HTMLDocument* newDocument = !wasInDocument &amp;&amp; inDocument() &amp;&amp; is&lt;HTMLDocument&gt;(newScope-&gt;documentScope()) ? &amp;downcast&lt;HTMLDocument&gt;(newScope-&gt;documentScope()) : nullptr;
</ins><span class="cx">     if (newScope != &amp;treeScope())
</span><span class="cx">         newScope = nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -1381,7 +1381,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (insertionPoint.isInTreeScope()) {
</span><span class="cx">         TreeScope* oldScope = &amp;insertionPoint.treeScope();
</span><del>-        HTMLDocument* oldDocument = inDocument() &amp;&amp; oldScope-&gt;documentScope().isHTMLDocument() ? toHTMLDocument(&amp;oldScope-&gt;documentScope()) : nullptr;
</del><ins>+        HTMLDocument* oldDocument = inDocument() &amp;&amp; is&lt;HTMLDocument&gt;(oldScope-&gt;documentScope()) ? &amp;downcast&lt;HTMLDocument&gt;(oldScope-&gt;documentScope()) : nullptr;
</ins><span class="cx">         if (oldScope != &amp;treeScope() || !isInTreeScope())
</span><span class="cx">             oldScope = nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -2588,9 +2588,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (!inDocument())
</span><span class="cx">         return;
</span><del>-    if (!document().isHTMLDocument())
</del><ins>+    if (!is&lt;HTMLDocument&gt;(document()))
</ins><span class="cx">         return;
</span><del>-    updateNameForDocument(toHTMLDocument(document()), oldName, newName);
</del><ins>+    updateNameForDocument(downcast&lt;HTMLDocument&gt;(document()), oldName, newName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Element::updateNameForTreeScope(TreeScope&amp; scope, const AtomicString&amp; oldName, const AtomicString&amp; newName)
</span><span class="lines">@@ -2636,9 +2636,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (!inDocument())
</span><span class="cx">         return;
</span><del>-    if (!document().isHTMLDocument())
</del><ins>+    if (!is&lt;HTMLDocument&gt;(document()))
</ins><span class="cx">         return;
</span><del>-    updateIdForDocument(toHTMLDocument(document()), oldId, newId, UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute);
</del><ins>+    updateIdForDocument(downcast&lt;HTMLDocument&gt;(document()), oldId, newId, UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Element::updateIdForTreeScope(TreeScope&amp; scope, const AtomicString&amp; oldId, const AtomicString&amp; newId)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLDocument.h (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLDocument.h        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLDocument.h        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -97,11 +97,11 @@
</span><span class="cx">     DocumentOrderedMap m_windowNamedItem;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool isHTMLDocument(const Document&amp; document) { return document.isHTMLDocument(); }
-void isHTMLDocument(const HTMLDocument&amp;); // Catch unnecessary runtime check of type known at compile time.
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(HTMLDocument)
+    static bool isHTMLDocument(const Document&amp; document) { return document.isHTMLDocument(); }
+    static bool isHTMLDocument(const Node&amp; node) { return node.isDocumentNode() &amp;&amp; isHTMLDocument(toDocument(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-DOCUMENT_TYPE_CASTS(HTMLDocument)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // HTMLDocument_h
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -379,10 +379,8 @@
</span><span class="cx">     } while (currentElement);
</span><span class="cx"> 
</span><span class="cx">     const Document&amp; document = this-&gt;document();
</span><del>-    if (document.isHTMLDocument()) {
-        const HTMLDocument&amp; htmlDocument = toHTMLDocument(document);
-        return htmlDocument.inDesignMode();
-    }
</del><ins>+    if (is&lt;HTMLDocument&gt;(document))
+        return downcast&lt;HTMLDocument&gt;(document).inDesignMode();
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLEmbedElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -166,11 +166,11 @@
</span><span class="cx">     Ref&lt;HTMLEmbedElement&gt; protect(*this); // Loading the plugin might remove us from the document.
</span><span class="cx">     bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url);
</span><span class="cx">     if (!beforeLoadAllowedLoad) {
</span><del>-        if (document().isPluginDocument()) {
</del><ins>+        if (is&lt;PluginDocument&gt;(document())) {
</ins><span class="cx">             // Plugins inside plugin documents load differently than other plugins. By the time
</span><span class="cx">             // we are here in a plugin document, the load of the plugin (which is the plugin document's
</span><span class="cx">             // main resource) has already started. We need to explicitly cancel the main resource load here.
</span><del>-            toPluginDocument(&amp;document())-&gt;cancelManualPluginLoad();
</del><ins>+            downcast&lt;PluginDocument&gt;(document()).cancelManualPluginLoad();
</ins><span class="cx">         }
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -182,8 +182,8 @@
</span><span class="cx">     } else {
</span><span class="cx">         if (name == nameAttr) {
</span><span class="cx">             bool willHaveName = !value.isNull();
</span><del>-            if (hasName() != willHaveName &amp;&amp; inDocument() &amp;&amp; document().isHTMLDocument()) {
-                HTMLDocument&amp; document = toHTMLDocument(this-&gt;document());
</del><ins>+            if (hasName() != willHaveName &amp;&amp; inDocument() &amp;&amp; is&lt;HTMLDocument&gt;(document())) {
+                HTMLDocument&amp; document = downcast&lt;HTMLDocument&gt;(this-&gt;document());
</ins><span class="cx">                 const AtomicString&amp; id = getIdAttribute();
</span><span class="cx">                 if (!id.isEmpty() &amp;&amp; id != getNameAttribute()) {
</span><span class="cx">                     if (willHaveName)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1795,11 +1795,11 @@
</span><span class="cx">     setShouldDelayLoadEvent(false);
</span><span class="cx"> 
</span><span class="cx">     // 6 - Abort the overall resource selection algorithm.
</span><del>-    m_currentSourceNode = 0;
</del><ins>+    m_currentSourceNode = nullptr;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    if (document().isMediaDocument())
-        toMediaDocument(document()).mediaElementSawUnsupportedTracks();
</del><ins>+    if (is&lt;MediaDocument&gt;(document()))
+        downcast&lt;MediaDocument&gt;(document()).mediaElementSawUnsupportedTracks();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4208,8 +4208,8 @@
</span><span class="cx">     // The MediaPlayer came across content it cannot completely handle.
</span><span class="cx">     // This is normally acceptable except when we are in a standalone
</span><span class="cx">     // MediaDocument. If so, tell the document what has happened.
</span><del>-    if (document().isMediaDocument())
-        toMediaDocument(document()).mediaElementSawUnsupportedTracks();
</del><ins>+    if (is&lt;MediaDocument&gt;(document()))
+        downcast&lt;MediaDocument&gt;(document()).mediaElementSawUnsupportedTracks();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::mediaPlayerResourceNotSupported(MediaPlayer*)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLObjectElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLObjectElement.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -435,8 +435,8 @@
</span><span class="cx">             isNamedItem = false;
</span><span class="cx">         child = child-&gt;nextSibling();
</span><span class="cx">     }
</span><del>-    if (isNamedItem != wasNamedItem &amp;&amp; inDocument() &amp;&amp; document().isHTMLDocument()) {
-        HTMLDocument&amp; document = toHTMLDocument(this-&gt;document());
</del><ins>+    if (isNamedItem != wasNamedItem &amp;&amp; inDocument() &amp;&amp; is&lt;HTMLDocument&gt;(document())) {
+        HTMLDocument&amp; document = downcast&lt;HTMLDocument&gt;(this-&gt;document());
</ins><span class="cx"> 
</span><span class="cx">         const AtomicString&amp; id = getIdAttribute();
</span><span class="cx">         if (!id.isEmpty()) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageDocument.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageDocument.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/ImageDocument.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Only used during parsing, so document is guaranteed to be non-null.
</span><span class="cx">     ASSERT(RawDataDocumentParser::document());
</span><del>-    return toImageDocument(*RawDataDocumentParser::document());
</del><ins>+    return downcast&lt;ImageDocument&gt;(*RawDataDocumentParser::document());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ImageDocumentParser::appendBytes(DocumentWriter&amp;, const char*, size_t)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageDocument.h (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageDocument.h        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/ImageDocument.h        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -82,11 +82,11 @@
</span><span class="cx">     bool m_shouldShrinkImage;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool isImageDocument(const Document&amp; document) { return document.isImageDocument(); }
-void isImageDocument(const ImageDocument&amp;); // Catch unnecessary runtime check of type known at compile time.
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(ImageDocument)
+    static bool isImageDocument(const Document&amp; document) { return document.isImageDocument(); }
+    static bool isImageDocument(const Node&amp; node) { return node.isDocumentNode() &amp;&amp; isImageDocument(toDocument(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-DOCUMENT_TYPE_CASTS(ImageDocument)
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ImageDocument_h
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaDocument.h (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaDocument.h        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/MediaDocument.h        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -56,11 +56,11 @@
</span><span class="cx">     String m_outgoingReferrer;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool isMediaDocument(const Document&amp; document) { return document.isMediaDocument(); }
-void isMediaDocument(const MediaDocument&amp;); // Catch unnecessary runtime check of type known at compile time.
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(MediaDocument)
+    static bool isMediaDocument(const Document&amp; document) { return document.isMediaDocument(); }
+    static bool isMediaDocument(const Node&amp; node) { return node.isDocumentNode() &amp;&amp; isMediaDocument(toDocument(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-DOCUMENT_TYPE_CASTS(MediaDocument)
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlPluginDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/PluginDocument.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/PluginDocument.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/PluginDocument.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     if (loader)
</span><span class="cx">         m_embedElement-&gt;setAttribute(typeAttr, loader-&gt;writer().mimeType());
</span><span class="cx"> 
</span><del>-    toPluginDocument(document())-&gt;setPluginElement(m_embedElement);
</del><ins>+    downcast&lt;PluginDocument&gt;(*document()).setPluginElement(m_embedElement);
</ins><span class="cx"> 
</span><span class="cx">     body-&gt;appendChild(embedElement, IGNORE_EXCEPTION);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlPluginDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/PluginDocument.h (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/PluginDocument.h        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/html/PluginDocument.h        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -61,11 +61,11 @@
</span><span class="cx">     RefPtr&lt;HTMLPlugInElement&gt; m_pluginElement;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool isPluginDocument(const Document&amp; document) { return document.isPluginDocument(); }
-void isPluginDocument(const PluginDocument&amp;); // Catch unnecessary runtime check of type known at compile time.
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(PluginDocument)
+    static bool isPluginDocument(const Document&amp; document) { return document.isPluginDocument(); }
+    static bool isPluginDocument(const Node&amp; node) { return node.isDocumentNode() &amp;&amp; isPluginDocument(toDocument(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-DOCUMENT_TYPE_CASTS(PluginDocument)
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // PluginDocument_h
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubframeLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubframeLoader.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -393,7 +393,7 @@
</span><span class="cx">     pluginElement.subframeLoaderWillCreatePlugIn(url);
</span><span class="cx"> 
</span><span class="cx">     IntSize contentSize = roundedIntSize(LayoutSize(renderer-&gt;contentWidth(), renderer-&gt;contentHeight()));
</span><del>-    bool loadManually = document()-&gt;isPluginDocument() &amp;&amp; !m_containsPlugins &amp;&amp; toPluginDocument(document())-&gt;shouldLoadPluginManually();
</del><ins>+    bool loadManually = is&lt;PluginDocument&gt;(document()) &amp;&amp; !m_containsPlugins &amp;&amp; downcast&lt;PluginDocument&gt;(*document()).shouldLoadPluginManually();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // On iOS, we only tell the plugin to be in full page mode if the containing plugin document is the top level document.
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/page/DragController.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -397,8 +397,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool pluginDocumentAcceptsDrags = false;
</span><span class="cx"> 
</span><del>-    if (doc &amp;&amp; doc-&gt;isPluginDocument()) {
-        const Widget* widget = toPluginDocument(doc)-&gt;pluginWidget();
</del><ins>+    if (doc &amp;&amp; is&lt;PluginDocument&gt;(doc)) {
+        const Widget* widget = downcast&lt;PluginDocument&gt;(*doc).pluginWidget();
</ins><span class="cx">         const PluginViewBase* pluginView = (widget &amp;&amp; widget-&gt;isPluginViewBase()) ? toPluginViewBase(widget) : nullptr;
</span><span class="cx"> 
</span><span class="cx">         if (pluginView)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -2311,7 +2311,7 @@
</span><span class="cx">         return 0;
</span><span class="cx">     // Disable for image documents so large GIF animations don't get throttled during loading.
</span><span class="cx">     auto* document = page.mainFrame().document();
</span><del>-    if (!document || isImageDocument(*document))
</del><ins>+    if (!document || is&lt;ImageDocument&gt;(*document))
</ins><span class="cx">         return 0;
</span><span class="cx">     return LayerFlushThrottleState::Enabled;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebKit/win/ChangeLog        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-09-29  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
+        Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137169
+
+        Reviewed by Darin Adler.
+
+        Use is&lt;&gt;() / downcast&lt;&gt;() for HTMLDocument and its subclasses.
+
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLDocument::URL):
+        (DOMHTMLDocument::body):
+        (DOMHTMLDocument::forms):
+
</ins><span class="cx"> 2014-09-28  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use std::unique_ptr for ContextMenuController
</span></span></pre></div>
<a id="trunkSourceWebKitwinDOMHTMLClassescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/DOMHTMLClasses.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/DOMHTMLClasses.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebKit/win/DOMHTMLClasses.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -250,18 +250,18 @@
</span><span class="cx">     if (!result)
</span><span class="cx">         return E_POINTER;
</span><span class="cx"> 
</span><del>-    *result = BString(toHTMLDocument(m_document)-&gt;url()).release();
</del><ins>+    *result = BString(downcast&lt;HTMLDocument&gt;(*m_document).url()).release();
</ins><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> HRESULT STDMETHODCALLTYPE DOMHTMLDocument::body( 
</span><span class="cx">         /* [retval][out] */ IDOMHTMLElement** bodyElement)
</span><span class="cx"> {
</span><del>-    *bodyElement = 0;
-    if (!m_document || !m_document-&gt;isHTMLDocument())
</del><ins>+    *bodyElement = nullptr;
+    if (!m_document || !is&lt;HTMLDocument&gt;(m_document))
</ins><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><del>-    HTMLDocument&amp; htmlDoc = toHTMLDocument(*m_document);
</del><ins>+    HTMLDocument&amp; htmlDoc = downcast&lt;HTMLDocument&gt;(*m_document);
</ins><span class="cx">     COMPtr&lt;IDOMElement&gt; domElement;
</span><span class="cx">     domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc.body()));
</span><span class="cx">     if (domElement)
</span><span class="lines">@@ -300,11 +300,11 @@
</span><span class="cx"> HRESULT STDMETHODCALLTYPE DOMHTMLDocument::forms( 
</span><span class="cx">         /* [retval][out] */ IDOMHTMLCollection** collection)
</span><span class="cx"> {
</span><del>-    *collection = 0;
-    if (!m_document || !m_document-&gt;isHTMLDocument())
</del><ins>+    *collection = nullptr;
+    if (!m_document || !is&lt;HTMLDocument&gt;(m_document))
</ins><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><del>-    HTMLDocument&amp; htmlDoc = toHTMLDocument(*m_document);
</del><ins>+    HTMLDocument&amp; htmlDoc = downcast&lt;HTMLDocument&gt;(*m_document);
</ins><span class="cx">     RefPtr&lt;HTMLCollection&gt; forms = htmlDoc.forms();
</span><span class="cx">     *collection = DOMHTMLCollection::createInstance(forms.get());
</span><span class="cx">     return S_OK;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-09-29  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
+        Make is&lt;&gt;() / downcast&lt;&gt;() work for HTMLDocument and its subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137169
+
+        Reviewed by Darin Adler.
+
+        Use is&lt;&gt;() / downcast&lt;&gt;() for HTMLDocument and its subclasses.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::pdfDocumentForPrintingFrame):
+
</ins><span class="cx"> 2014-09-29  Tibor Meszaros  &lt;tmeszaros.u-szeged@partner.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix !ENABLE(INSPECTOR) build after r173929
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (174064 => 174065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-09-29 16:31:33 UTC (rev 174064)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-09-29 16:58:42 UTC (rev 174065)
</span><span class="lines">@@ -3688,14 +3688,14 @@
</span><span class="cx"> {
</span><span class="cx">     Document* document = coreFrame-&gt;document();
</span><span class="cx">     if (!document)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    if (!document-&gt;isPluginDocument())
-        return 0;
</del><ins>+    if (!is&lt;PluginDocument&gt;(document))
+        return nullptr;
</ins><span class="cx"> 
</span><del>-    PluginView* pluginView = static_cast&lt;PluginView*&gt;(toPluginDocument(document)-&gt;pluginWidget());
</del><ins>+    PluginView* pluginView = static_cast&lt;PluginView*&gt;(downcast&lt;PluginDocument&gt;(*document).pluginWidget());
</ins><span class="cx">     if (!pluginView)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     return pluginView-&gt;pdfDocumentForPrinting();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>