Changeset 145745 in webkit
- Timestamp:
- Mar 13, 2013 1:29:08 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 88 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r145744 r145745 1 2013-03-13 Abhishek Arya <inferno@chromium.org> 2 3 Replace static_casts with to* functions for document types. 4 https://bugs.webkit.org/show_bug.cgi?id=112225 5 6 Reviewed by Ryosuke Niwa. 7 8 to* helper functions are preferred over static_cast calls since they 9 help to catch bad casts easily on the testing infrastructure. 10 11 * Modules/geolocation/Geolocation.cpp: 12 (WebCore::Geolocation::document): 13 ....lot of files. 14 1 15 2013-03-13 Liam Quinn <lquinn@blackberry.com> 2 16 -
trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp
r145399 r145745 254 254 Document* Geolocation::document() const 255 255 { 256 ASSERT_WITH_SECURITY_IMPLICATION(!scriptExecutionContext() || scriptExecutionContext()->isDocument()); 257 return static_cast<Document*>(scriptExecutionContext()); 256 return toDocument(scriptExecutionContext()); 258 257 } 259 258 -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp
r141735 r145745 71 71 ASSERT(context->isDocument() || context->isWorkerContext()); 72 72 if (context->isDocument()) { 73 Document* document = static_cast<Document*>(context);73 Document* document = toDocument(context); 74 74 return document->frame() && document->page(); 75 75 } … … 85 85 ASSERT(isContextValid(context)); 86 86 if (context->isDocument()) { 87 Document* document = static_cast<Document*>(context);87 Document* document = toDocument(context); 88 88 return document->page()->group().groupSettings()->indexedDBDatabasePath(); 89 89 } -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r144808 r145745 140 140 , m_stopped(false) 141 141 { 142 ASSERT(m_scriptExecutionContext->isDocument()); 143 Document* document = static_cast<Document*>(m_scriptExecutionContext); 142 Document* document = toDocument(m_scriptExecutionContext); 144 143 145 144 if (!document->frame()) { -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
r129749 r145745 119 119 { 120 120 if (m_scriptExecutionContext) { 121 ASSERT(m_scriptExecutionContext->isDocument()); 122 return static_cast<Document*>(m_scriptExecutionContext); 121 return toDocument(m_scriptExecutionContext); 123 122 } 124 123 -
trunk/Source/WebCore/Modules/notifications/Notification.cpp
r144565 r145745 110 110 , m_taskTimer(adoptPtr(new Timer<Notification>(this, &Notification::taskTimerFired))) 111 111 { 112 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 113 m_notificationCenter = DOMWindowNotifications::webkitNotifications(static_cast<Document*>(context)->domWindow()); 112 m_notificationCenter = DOMWindowNotifications::webkitNotifications(toDocument(context)->domWindow()); 114 113 115 114 ASSERT(m_notificationCenter->client()); … … 172 171 if (m_state == Idle && m_notificationCenter->client()) { 173 172 #if ENABLE(NOTIFICATIONS) 174 if (! static_cast<Document*>(scriptExecutionContext())->page())173 if (!toDocument(scriptExecutionContext())->page()) 175 174 return; 176 if (NotificationController::from( static_cast<Document*>(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {175 if (NotificationController::from(toDocument(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) { 177 176 dispatchErrorEvent(); 178 177 return; … … 260 259 const String& Notification::permission(ScriptExecutionContext* context) 261 260 { 262 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 263 ASSERT(static_cast<Document*>(context)->page()); 264 return permissionString(NotificationController::from(static_cast<Document*>(context)->page())->client()->checkPermission(context)); 261 ASSERT(toDocument(context)->page()); 262 return permissionString(NotificationController::from(toDocument(context)->page())->client()->checkPermission(context)); 265 263 } 266 264 … … 286 284 void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback) 287 285 { 288 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 289 ASSERT(static_cast<Document*>(context)->page()); 290 NotificationController::from(static_cast<Document*>(context)->page())->client()->requestPermission(context, callback); 286 ASSERT(toDocument(context)->page()); 287 NotificationController::from(toDocument(context)->page())->client()->requestPermission(context, callback); 291 288 } 292 289 #endif -
trunk/Source/WebCore/Modules/speech/SpeechGrammar.cpp
r141783 r145745 46 46 void SpeechGrammar::setSrc(ScriptExecutionContext* scriptExecutionContext, const String& src) 47 47 { 48 ASSERT_WITH_SECURITY_IMPLICATION(scriptExecutionContext->isDocument()); 49 Document* document = static_cast<Document*>(scriptExecutionContext); 48 Document* document = toDocument(scriptExecutionContext); 50 49 m_src = document->completeURL(src); 51 50 } -
trunk/Source/WebCore/Modules/speech/SpeechGrammarList.cpp
r141783 r145745 49 49 void SpeechGrammarList::addFromUri(ScriptExecutionContext* scriptExecutionContext, const String& src, double weight) 50 50 { 51 ASSERT_WITH_SECURITY_IMPLICATION(scriptExecutionContext->isDocument()); 52 Document* document = static_cast<Document*>(scriptExecutionContext); 51 Document* document = toDocument(scriptExecutionContext); 53 52 m_grammars.append(SpeechGrammar::create(document->completeURL(src), weight)); 54 53 } -
trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp
r136392 r145745 172 172 , m_started(false) 173 173 { 174 ASSERT(scriptExecutionContext()->isDocument()); 175 Document* document = static_cast<Document*>(scriptExecutionContext()); 174 Document* document = toDocument(scriptExecutionContext()); 176 175 177 176 Page* page = document->page(); -
trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp
r137516 r145745 44 44 } 45 45 46 Document* document = static_cast<Document*>(context);46 Document* document = toDocument(context); 47 47 48 48 // FIXME: offline contexts have limitations on supported sample-rates. -
trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
r141928 r145745 206 206 { 207 207 if (m_scriptExecutionContext->isDocument()) { 208 Document* document = static_cast<Document*>(m_scriptExecutionContext);208 Document* document = toDocument(m_scriptExecutionContext); 209 209 if (!document->page() || (document->page()->settings()->privateBrowsingEnabled() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document->securityOrigin()->protocol()))) 210 210 return false; … … 219 219 { 220 220 if (m_scriptExecutionContext->isDocument()) { 221 Document* document = static_cast<Document*>(m_scriptExecutionContext);221 Document* document = toDocument(m_scriptExecutionContext); 222 222 if (Page* page = document->page()) 223 223 page->chrome()->client()->exceededDatabaseQuota(document->frame(), name, details); -
trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
r141783 r145745 66 66 #endif // ENABLE(WORKERS) 67 67 68 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 69 return WebSocketChannel::create(static_cast<Document*>(context), client); 68 return WebSocketChannel::create(toDocument(context), client); 70 69 } 71 70 -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r144607 r145745 244 244 bool shouldBypassMainWorldContentSecurityPolicy = false; 245 245 if (scriptExecutionContext()->isDocument()) { 246 Document* document = static_cast<Document*>(scriptExecutionContext());246 Document* document = toDocument(scriptExecutionContext()); 247 247 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy(); 248 248 } -
trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
r144037 r145745 200 200 KURL url = httpURLForAuthenticationAndCookies(); 201 201 if (m_context->isDocument()) { 202 Document* document = static_cast<Document*>(m_context);202 Document* document = toDocument(m_context); 203 203 String cookie = cookieRequestHeaderFieldValue(document, url); 204 204 if (!cookie.isEmpty()) … … 252 252 KURL url = httpURLForAuthenticationAndCookies(); 253 253 if (m_context->isDocument()) { 254 Document* document = static_cast<Document*>(m_context);254 Document* document = toDocument(m_context); 255 255 String cookie = cookieRequestHeaderFieldValue(document, url); 256 256 if (!cookie.isEmpty()) -
trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp
r127757 r145745 148 148 : m_workerClientWrapper(clientWrapper) 149 149 , m_loaderProxy(loaderProxy) 150 , m_mainWebSocketChannel(WebSocketChannel::create( static_cast<Document*>(context), this))150 , m_mainWebSocketChannel(WebSocketChannel::create(toDocument(context), this)) 151 151 , m_taskMode(taskMode) 152 152 { -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r144911 r145745 2802 2802 return 0; 2803 2803 2804 SVGSVGElement* rootElement = static_cast<SVGDocument*>(doc)->rootElement();2804 SVGSVGElement* rootElement = toSVGDocument(doc)->rootElement(); 2805 2805 if (!rootElement) 2806 2806 return 0; -
trunk/Source/WebCore/bindings/js/DOMRequestState.h
r140908 r145745 49 49 { 50 50 if (m_scriptExecutionContext->isDocument()) { 51 Document* document = static_cast<Document*>(m_scriptExecutionContext);51 Document* document = toDocument(m_scriptExecutionContext); 52 52 m_exec = scriptStateFromPage(mainThreadNormalWorld(), document->page()); 53 53 } else { -
trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
r137516 r145745 65 65 return throwVMError(exec, createReferenceError(exec, "AudioContext constructor called in a script execution context which is not a document")); 66 66 67 Document* document = static_cast<Document*>(scriptExecutionContext);67 Document* document = toDocument(scriptExecutionContext); 68 68 69 69 RefPtr<AudioContext> audioContext; -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r143863 r145745 83 83 Document* document() const 84 84 { 85 return static_cast<Document*>(scriptExecutionContext());85 return toDocument(scriptExecutionContext()); 86 86 } 87 87 -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
r130612 r145745 114 114 { 115 115 if (scriptExecutionContext->isDocument()) 116 return toJSDOMGlobalObject( static_cast<Document*>(scriptExecutionContext), exec);116 return toJSDOMGlobalObject(toDocument(scriptExecutionContext), exec); 117 117 118 118 #if ENABLE(WORKERS) … … 133 133 { 134 134 if (scriptExecutionContext->isDocument()) 135 return toJSDOMGlobalObject( static_cast<Document*>(scriptExecutionContext), world);135 return toJSDOMGlobalObject(toDocument(scriptExecutionContext), world); 136 136 137 137 #if ENABLE(WORKERS) -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r138646 r145745 261 261 if (document->isHTMLDocument()) { 262 262 AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName); 263 if (atomicPropertyName && ( static_cast<HTMLDocument*>(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) {263 if (atomicPropertyName && (toHTMLDocument(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) { 264 264 slot.setCustom(thisObject, namedItemGetter); 265 265 return true; … … 337 337 if (document->isHTMLDocument()) { 338 338 AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName); 339 if (atomicPropertyName && ( static_cast<HTMLDocument*>(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) {339 if (atomicPropertyName && (toHTMLDocument(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) { 340 340 slot.setCustom(thisObject, namedItemGetter); 341 341 return true; … … 408 408 if (document->isHTMLDocument()) { 409 409 AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName); 410 if (atomicPropertyName && ( static_cast<HTMLDocument*>(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) {410 if (atomicPropertyName && (toHTMLDocument(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) { 411 411 PropertySlot slot; 412 412 slot.setCustom(thisObject, namedItemGetter); -
trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
r127191 r145745 61 61 { 62 62 JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase)); 63 HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl());63 HTMLDocument* document = toHTMLDocument(thisObj->impl()); 64 64 65 65 RefPtr<HTMLCollection> collection = document->documentNamedItems(propertyNameToAtomicString(propertyName)); … … 90 90 return v; 91 91 92 return toJS(exec, globalObject(), static_cast<HTMLDocument*>(impl())->all());92 return toJS(exec, globalObject(), toHTMLDocument(impl())->all()); 93 93 } 94 94 … … 105 105 // For compatibility with other browsers, pass open calls with more than 2 parameters to the window. 106 106 if (exec->argumentCount() > 2) { 107 Frame* frame = static_cast<HTMLDocument*>(impl())->frame();107 Frame* frame = toHTMLDocument(impl())->frame(); 108 108 if (frame) { 109 109 JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(exec)); … … 125 125 126 126 // In the case of two parameters or fewer, do a normal document open. 127 static_cast<HTMLDocument*>(impl())->open(activeDocument);127 toHTMLDocument(impl())->open(activeDocument); 128 128 return this; 129 129 } … … 158 158 JSValue JSHTMLDocument::write(ExecState* exec) 159 159 { 160 documentWrite(exec, static_cast<HTMLDocument*>(impl()), DoNotAddNewline);160 documentWrite(exec, toHTMLDocument(impl()), DoNotAddNewline); 161 161 return jsUndefined(); 162 162 } … … 164 164 JSValue JSHTMLDocument::writeln(ExecState* exec) 165 165 { 166 documentWrite(exec, static_cast<HTMLDocument*>(impl()), DoAddNewline);166 documentWrite(exec, toHTMLDocument(impl()), DoAddNewline); 167 167 return jsUndefined(); 168 168 } -
trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp
r141348 r145745 83 83 return 0; 84 84 85 Document* document = static_cast<Document*>(executionContext);85 Document* document = toDocument(executionContext); 86 86 87 87 if (!document->frame()) -
trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp
r144891 r145745 244 244 case Node::DOCUMENT_NODE: 245 245 // we don't want to cache the document itself in the per-document dictionary 246 return toJS(exec, globalObject, static_cast<Document*>(node));246 return toJS(exec, globalObject, toDocument(node)); 247 247 case Node::DOCUMENT_TYPE_NODE: 248 248 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, DocumentType, node); -
trunk/Source/WebCore/bindings/js/ScheduledAction.cpp
r135291 r145745 78 78 { 79 79 if (context->isDocument()) 80 execute( static_cast<Document*>(context));80 execute(toDocument(context)); 81 81 #if ENABLE(WORKERS) 82 82 else { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r145575 r145745 3221 3221 my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeFunc->signature); 3222 3222 push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; 3223 push(@implContent, " if (context && context->isDocument() && ${enableFunction}( static_cast<Document*>(context))) {\n");3223 push(@implContent, " if (context && context->isDocument() && ${enableFunction}(toDocument(context))) {\n"); 3224 3224 my $name = $runtimeFunc->signature->name; 3225 3225 push(@implContent, <<END); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r145575 r145745 3196 3196 3197 3197 ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationContext()); 3198 if (context && context->isDocument() && ContextFeatures::enabledPerContextMethod1Enabled( static_cast<Document*>(context))) {3198 if (context && context->isDocument() && ContextFeatures::enabledPerContextMethod1Enabled(toDocument(context))) { 3199 3199 proto->Set(v8::String::NewSymbol("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1MethodCallback, v8Undefined(), defaultSignature)->GetFunction()); 3200 3200 } 3201 if (context && context->isDocument() && ContextFeatures::featureNameEnabled( static_cast<Document*>(context))) {3201 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(toDocument(context))) { 3202 3202 proto->Set(v8::String::NewSymbol("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2MethodCallback, v8Undefined(), defaultSignature)->GetFunction()); 3203 3203 } -
trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp
r144617 r145745 135 135 { 136 136 ScriptExecutionContext* scriptExecutionContext = state->scriptExecutionContext(); 137 RefPtr<Frame> protect = static_cast<Document*>(scriptExecutionContext)->frame();137 RefPtr<Frame> protect = toDocument(scriptExecutionContext)->frame(); 138 138 ScriptDebugServer::compileScript(state, expression, sourceURL, scriptId, exceptionMessage); 139 139 if (!scriptId->isNull()) … … 152 152 153 153 ScriptExecutionContext* scriptExecutionContext = state->scriptExecutionContext(); 154 Frame* frame = static_cast<Document*>(scriptExecutionContext)->frame();154 Frame* frame = toDocument(scriptExecutionContext)->frame(); 155 155 InspectorInstrumentationCookie cookie; 156 156 if (frame) -
trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp
r142565 r145745 79 79 { 80 80 if (context->isDocument()) { 81 Frame* frame = static_cast<Document*>(context)->frame();81 Frame* frame = toDocument(context)->frame(); 82 82 if (!frame) 83 83 return; -
trunk/Source/WebCore/bindings/v8/V8Binding.cpp
r144919 r145745 262 262 { 263 263 if (context->isDocument()) { 264 if (Frame* frame = static_cast<Document*>(context)->frame())264 if (Frame* frame = toDocument(context)->frame()) 265 265 return worldContext.adjustedContext(frame->script()); 266 266 #if ENABLE(WORKERS) … … 276 276 { 277 277 if (context->isDocument()) { 278 if (Frame* frame = static_cast<Document*>(context)->frame()) {278 if (Frame* frame = toDocument(context)->frame()) { 279 279 // FIXME: Store the DOMWrapperWorld for the main world in the v8::Context so callers 280 280 // that are looking up their world with DOMWrapperWorld::isolatedWorld(v8::Context::GetCurrent()) -
trunk/Source/WebCore/bindings/v8/V8EventListener.cpp
r141771 r145745 86 86 return v8::Local<v8::Value>(); 87 87 88 Frame* frame = static_cast<Document*>(context)->frame();88 Frame* frame = toDocument(context)->frame(); 89 89 if (!frame) 90 90 return v8::Local<v8::Value>(); -
trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
r145562 r145745 94 94 return v8::Local<v8::Value>(); 95 95 96 Frame* frame = static_cast<Document*>(context)->frame();96 Frame* frame = toDocument(context)->frame(); 97 97 if (!frame) 98 98 return v8::Local<v8::Value>(); … … 114 114 return; 115 115 116 if (context->isDocument() && ! static_cast<Document*>(context)->contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_position.m_line))116 if (context->isDocument() && !toDocument(context)->contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_position.m_line)) 117 117 return; 118 118 … … 120 120 121 121 ASSERT(context->isDocument()); 122 Frame* frame = static_cast<Document*>(context)->frame();122 Frame* frame = toDocument(context)->frame(); 123 123 ASSERT(frame); 124 124 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) -
trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r144805 r145745 484 484 485 485 if (doc && doc->isHTMLDocument()) { 486 if ( static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {486 if (toHTMLDocument(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) { 487 487 RefPtr<HTMLCollection> items = doc->windowNamedItems(propName); 488 488 if (!items->isEmpty()) { -
trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
r144587 r145745 94 94 ASSERT(impl); 95 95 if (impl->isHTMLDocument()) 96 return wrap( static_cast<HTMLDocument*>(impl), creationContext, isolate);96 return wrap(toHTMLDocument(impl), creationContext, isolate); 97 97 #if ENABLE(SVG) 98 98 if (impl->isSVGDocument()) 99 return wrap( static_cast<SVGDocument*>(impl), creationContext, isolate);99 return wrap(toSVGDocument(impl), creationContext, isolate); 100 100 #endif 101 101 v8::Handle<v8::Object> wrapper = V8Document::createWrapper(impl, creationContext, isolate); -
trunk/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp
r145444 r145745 150 150 return wrap(static_cast<Comment*>(impl), creationContext, isolate); 151 151 case Node::DOCUMENT_NODE: 152 return wrap( static_cast<Document*>(impl), creationContext, isolate);152 return wrap(toDocument(impl), creationContext, isolate); 153 153 case Node::DOCUMENT_TYPE_NODE: 154 154 return wrap(static_cast<DocumentType*>(impl), creationContext, isolate); -
trunk/Source/WebCore/dom/ContainerNode.cpp
r144891 r145745 204 204 205 205 if (oldChild && newParent->isDocumentNode()) { 206 if (! static_cast<Document*>(newParent)->canReplaceChild(newChild, oldChild))206 if (!toDocument(newParent)->canReplaceChild(newChild, oldChild)) 207 207 return HIERARCHY_REQUEST_ERR; 208 208 } else if (!isChildTypeAllowed(newParent, newChild)) -
trunk/Source/WebCore/dom/CustomElementConstructor.h
r145040 r145745 55 55 virtual ~CustomElementConstructor(); 56 56 57 Document* document() const { return static_cast<Document*>(m_scriptExecutionContext); }57 Document* document() const { return toDocument(m_scriptExecutionContext); } 58 58 const QualifiedName& name() const { return m_name; } 59 59 -
trunk/Source/WebCore/dom/CustomElementRegistry.cpp
r145040 r145745 165 165 inline Document* CustomElementRegistry::document() const 166 166 { 167 return static_cast<Document*>(m_scriptExecutionContext);167 return toDocument(m_scriptExecutionContext); 168 168 } 169 169 -
trunk/Source/WebCore/dom/Document.cpp
r145421 r145745 2865 2865 if (isHTMLDocument()) { 2866 2866 // Exception (for sandboxed documents) ignored. 2867 static_cast<HTMLDocument*>(this)->setCookie(content, IGNORE_EXCEPTION);2867 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); 2868 2868 } 2869 2869 } else if (equalIgnoringCase(equiv, "content-language")) … … 5756 5756 Node* node = doc->focusedNode(); 5757 5757 if (!node && doc->isPluginDocument()) { 5758 PluginDocument* pluginDocument = static_cast<PluginDocument*>(doc);5758 PluginDocument* pluginDocument = toPluginDocument(doc); 5759 5759 node = pluginDocument->pluginNode(); 5760 5760 } -
trunk/Source/WebCore/dom/Document.h
r145421 r145745 1215 1215 void processArguments(const String& features, void* data, ArgumentsCallback); 1216 1216 1217 virtual bool isDocument() const { return true; }1217 virtual bool isDocument() const OVERRIDE { return true; } 1218 1218 1219 1219 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); … … 1584 1584 #endif 1585 1585 1586 inline Document* toDocument(ScriptExecutionContext* scriptExecutionContext) 1587 { 1588 ASSERT_WITH_SECURITY_IMPLICATION(!scriptExecutionContext || scriptExecutionContext->isDocument()); 1589 return static_cast<Document*>(scriptExecutionContext); 1590 } 1591 1592 inline const Document* toDocument(const ScriptExecutionContext* scriptExecutionContext) 1593 { 1594 ASSERT_WITH_SECURITY_IMPLICATION(!scriptExecutionContext || scriptExecutionContext->isDocument()); 1595 return static_cast<const Document*>(scriptExecutionContext); 1596 } 1597 1598 inline Document* toDocument(Node* node) 1599 { 1600 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isDocumentNode()); 1601 return static_cast<Document*>(node); 1602 } 1603 1604 inline const Document* toDocument(const Node* node) 1605 { 1606 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isDocumentNode()); 1607 return static_cast<const Document*>(node); 1608 } 1609 1610 // This will catch anyone doing an unnecessary cast. 1611 void toDocument(const Document*); 1612 1586 1613 // Put these methods here, because they require the Document definition, but we really want to inline them. 1587 1614 -
trunk/Source/WebCore/dom/DocumentType.cpp
r127228 r145745 66 66 ASSERT(parentNode() && parentNode()->isDocumentNode()); 67 67 if (parentNode() && parentNode()->isDocumentNode()) { 68 Document* doc = static_cast<Document*>(parentNode());68 Document* doc = toDocument(parentNode()); 69 69 if (!doc->doctype()) 70 70 doc->setDocType(this); -
trunk/Source/WebCore/dom/Element.cpp
r145524 r145745 2200 2200 } else if (n->isDocumentNode()) { 2201 2201 // checking the MIME content-language 2202 value = static_cast<const Document*>(n)->contentLanguage();2202 value = toDocument(n)->contentLanguage(); 2203 2203 } 2204 2204 … … 2683 2683 2684 2684 if (!oldName.isEmpty()) 2685 static_cast<HTMLDocument*>(document())->removeNamedItem(oldName);2685 toHTMLDocument(document())->removeNamedItem(oldName); 2686 2686 2687 2687 if (!newName.isEmpty()) 2688 static_cast<HTMLDocument*>(document())->addNamedItem(newName);2688 toHTMLDocument(document())->addNamedItem(newName); 2689 2689 } 2690 2690 … … 2695 2695 2696 2696 if (!oldId.isEmpty()) 2697 static_cast<HTMLDocument*>(document())->removeExtraNamedItem(oldId);2697 toHTMLDocument(document())->removeExtraNamedItem(oldId); 2698 2698 2699 2699 if (!newId.isEmpty()) 2700 static_cast<HTMLDocument*>(document())->addExtraNamedItem(newId);2700 toHTMLDocument(document())->addExtraNamedItem(newId); 2701 2701 } 2702 2702 -
trunk/Source/WebCore/dom/EventTarget.cpp
r145421 r145745 208 208 ScriptExecutionContext* context = scriptExecutionContext(); 209 209 if (context && context->isDocument()) { 210 Document* document = static_cast<Document*>(context);210 Document* document = toDocument(context); 211 211 if (document->domWindow()) { 212 212 if (listenerPrefixedVector) … … 264 264 ScriptExecutionContext* context = scriptExecutionContext(); 265 265 if (context && context->isDocument()) { 266 Document* document = static_cast<Document*>(context);266 Document* document = toDocument(context); 267 267 document->resetLastHandledUserGestureTimestamp(); 268 268 } -
trunk/Source/WebCore/dom/NamedFlowCollection.cpp
r142223 r145745 104 104 { 105 105 ScriptExecutionContext* context = ContextDestructionObserver::scriptExecutionContext(); 106 ASSERT(!context || context->isDocument()); 107 return static_cast<Document*>(context); 106 return toDocument(context); 108 107 } 109 108 -
trunk/Source/WebCore/dom/Node.cpp
r145524 r145745 1493 1493 } 1494 1494 case DOCUMENT_NODE: 1495 if (Element* de = static_cast<const Document*>(this)->documentElement())1495 if (Element* de = toDocument(this)->documentElement()) 1496 1496 return de->isDefaultNamespace(namespaceURI); 1497 1497 return false; … … 1526 1526 return lookupNamespacePrefix(namespaceURI, static_cast<const Element *>(this)); 1527 1527 case DOCUMENT_NODE: 1528 if (Element* de = static_cast<const Document*>(this)->documentElement())1528 if (Element* de = toDocument(this)->documentElement()) 1529 1529 return de->lookupPrefix(namespaceURI); 1530 1530 return String(); … … 1584 1584 } 1585 1585 case DOCUMENT_NODE: 1586 if (Element* de = static_cast<const Document*>(this)->documentElement())1586 if (Element* de = toDocument(this)->documentElement()) 1587 1587 return de->lookupNamespaceURI(prefix); 1588 1588 return String(); -
trunk/Source/WebCore/dom/WindowEventContext.cpp
r95901 r145745 47 47 return; 48 48 49 m_window = static_cast<Document*>(topLevelContainer)->domWindow();49 m_window = toDocument(topLevelContainer)->domWindow(); 50 50 m_target = topEventContext ? topEventContext->target() : node.get(); 51 51 } -
trunk/Source/WebCore/editing/MarkupAccumulator.cpp
r141877 r145745 502 502 break; 503 503 case Node::DOCUMENT_NODE: 504 appendXMLDeclaration(result, static_cast<const Document*>(node));504 appendXMLDeclaration(result, toDocument(node)); 505 505 break; 506 506 case Node::DOCUMENT_FRAGMENT_NODE: -
trunk/Source/WebCore/html/HTMLDocument.h
r140382 r145745 108 108 } 109 109 110 inline HTMLDocument* toHTMLDocument(Document* document) 111 { 112 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isHTMLDocument()); 113 return static_cast<HTMLDocument*>(document); 114 } 115 116 inline const HTMLDocument* toHTMLDocument(const Document* document) 117 { 118 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isHTMLDocument()); 119 return static_cast<const HTMLDocument*>(document); 120 } 121 122 // This will catch anyone doing an unnecessary cast. 123 void toHTMLDocument(const HTMLDocument*); 124 110 125 } // namespace WebCore 111 126 -
trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp
r143089 r145745 118 118 Document* doc = contentDocument(); 119 119 if (doc && doc->isSVGDocument()) 120 return static_cast<SVGDocument*>(doc);120 return toSVGDocument(doc); 121 121 // Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument 122 122 ec = NOT_SUPPORTED_ERR; -
trunk/Source/WebCore/html/HTMLIFrameElement.cpp
r144949 r145745 82 82 if (name == nameAttr) { 83 83 if (inDocument() && document()->isHTMLDocument() && !isInShadowTree()) { 84 HTMLDocument* document = static_cast<HTMLDocument*>(this->document());84 HTMLDocument* document = toHTMLDocument(this->document()); 85 85 document->removeExtraNamedItem(m_name); 86 86 document->addExtraNamedItem(value); … … 114 114 InsertionNotificationRequest result = HTMLFrameElementBase::insertedInto(insertionPoint); 115 115 if (insertionPoint->inDocument() && document()->isHTMLDocument() && !insertionPoint->isInShadowTree()) 116 static_cast<HTMLDocument*>(document())->addExtraNamedItem(m_name);116 toHTMLDocument(document())->addExtraNamedItem(m_name); 117 117 return result; 118 118 } … … 122 122 HTMLFrameElementBase::removedFrom(insertionPoint); 123 123 if (insertionPoint->inDocument() && document()->isHTMLDocument() && !insertionPoint->isInShadowTree()) 124 static_cast<HTMLDocument*>(document())->removeExtraNamedItem(m_name);124 toHTMLDocument(document())->removeExtraNamedItem(m_name); 125 125 } 126 126 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r145322 r145745 3625 3625 // MediaDocument. If so, tell the document what has happened. 3626 3626 if (ownerDocument()->isMediaDocument()) { 3627 MediaDocument* mediaDocument = static_cast<MediaDocument*>(ownerDocument());3627 MediaDocument* mediaDocument = toMediaDocument(ownerDocument()); 3628 3628 mediaDocument->mediaElementSawUnsupportedTracks(); 3629 3629 } -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r144568 r145745 443 443 } 444 444 if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) { 445 HTMLDocument* document = static_cast<HTMLDocument*>(this->document());445 HTMLDocument* document = toHTMLDocument(this->document()); 446 446 if (isNamedItem) { 447 447 document->addNamedItem(getNameAttribute()); -
trunk/Source/WebCore/html/ImageDocument.cpp
r144568 r145745 85 85 ImageDocument* document() const 86 86 { 87 return static_cast<ImageDocument*>(RawDataDocumentParser::document());87 return toImageDocument(RawDataDocumentParser::document()); 88 88 } 89 89 -
trunk/Source/WebCore/html/ImageDocument.h
r97113 r145745 72 72 bool m_shouldShrinkImage; 73 73 }; 74 74 75 inline ImageDocument* toImageDocument(Document* document) 76 { 77 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isImageDocument()); 78 return static_cast<ImageDocument*>(document); 79 } 80 81 inline const ImageDocument* toImageDocument(const Document* document) 82 { 83 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isImageDocument()); 84 return static_cast<const ImageDocument*>(document); 85 } 86 87 // This will catch anyone doing an unnecessary cast. 88 void toImageDocument(const ImageDocument*); 89 75 90 } 76 91 -
trunk/Source/WebCore/html/MediaDocument.h
r95901 r145745 55 55 Timer<MediaDocument> m_replaceMediaElementTimer; 56 56 }; 57 57 58 inline MediaDocument* toMediaDocument(Document* document) 59 { 60 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isMediaDocument()); 61 return static_cast<MediaDocument*>(document); 62 } 63 64 inline const MediaDocument* toMediaDocument(const Document* document) 65 { 66 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isMediaDocument()); 67 return static_cast<const MediaDocument*>(document); 68 } 69 70 // This will catch anyone doing an unnecessary cast. 71 void toMediaDocument(const MediaDocument*); 72 58 73 } 59 74 -
trunk/Source/WebCore/html/PluginDocument.cpp
r144568 r145745 98 98 m_embedElement->setAttribute(typeAttr, loader->writer()->mimeType()); 99 99 100 static_cast<PluginDocument*>(document())->setPluginNode(m_embedElement);100 toPluginDocument(document())->setPluginNode(m_embedElement); 101 101 102 102 body->appendChild(embedElement, IGNORE_EXCEPTION); -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r145404 r145745 203 203 , m_pauseOnExit(false) 204 204 , m_snapToLines(true) 205 , m_cueBackgroundBox(HTMLDivElement::create( static_cast<Document*>(context)))205 , m_cueBackgroundBox(HTMLDivElement::create(toDocument(context))) 206 206 , m_displayTreeShouldChange(true) 207 207 { -
trunk/Source/WebCore/html/track/TextTrackCue.h
r145397 r145745 194 194 TextTrackCue(ScriptExecutionContext*, double start, double end, const String& content); 195 195 196 Document* ownerDocument() { return static_cast<Document*>(m_scriptExecutionContext); }196 Document* ownerDocument() { return toDocument(m_scriptExecutionContext); } 197 197 198 198 virtual PassRefPtr<TextTrackCueBox> createDisplayTree(); -
trunk/Source/WebCore/html/track/WebVTTParser.cpp
r143563 r145745 245 245 246 246 ASSERT(m_scriptExecutionContext->isDocument()); 247 Document* document = static_cast<Document*>(m_scriptExecutionContext);247 Document* document = toDocument(m_scriptExecutionContext); 248 248 249 249 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r145342 r145745 379 379 return 0; 380 380 } 381 return static_cast<Document*>(node);381 return toDocument(node); 382 382 } 383 383 … … 734 734 return; 735 735 736 Document* document = node->isDocumentNode() ? static_cast<Document*>(node) : node->ownerDocument();736 Document* document = node->isDocumentNode() ? toDocument(node) : node->ownerDocument(); 737 737 if (!document || !document->isHTMLDocument()) { 738 738 *errorString = "Not an HTML document"; … … 1355 1355 1356 1356 } else if (node->isDocumentNode()) { 1357 Document* document = static_cast<Document*>(node);1357 Document* document = toDocument(node); 1358 1358 value->setDocumentURL(documentURLString(document)); 1359 1359 value->setBaseURL(documentBaseURLString(document)); … … 1490 1490 { 1491 1491 if (node->isDocumentNode()) { 1492 Document* document = static_cast<Document*>(node);1492 Document* document = toDocument(node); 1493 1493 return document->ownerElement(); 1494 1494 } -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r145510 r145745 118 118 Frame* frame = 0; 119 119 if (context->isDocument()) 120 frame = static_cast<Document*>(context)->frame();120 frame = toDocument(context)->frame(); 121 121 return frame; 122 122 } -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r145510 r145745 2057 2057 return 0; 2058 2058 if (context->isDocument()) 2059 return instrumentingAgentsForPage( static_cast<Document*>(context)->page());2059 return instrumentingAgentsForPage(toDocument(context)->page()); 2060 2060 #if ENABLE(WORKERS) 2061 2061 return instrumentingAgentsForNonDocumentContext(context); -
trunk/Source/WebCore/loader/Prerenderer.cpp
r141570 r145745 131 131 { 132 132 ASSERT(scriptExecutionContext()->isDocument()); 133 return static_cast<Document*>(scriptExecutionContext());133 return toDocument(scriptExecutionContext()); 134 134 } 135 135 -
trunk/Source/WebCore/loader/TextTrackLoader.cpp
r144949 r145745 118 118 { 119 119 DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Cross-origin text track load denied by Cross-Origin Resource Sharing policy."))); 120 Document* document = static_cast<Document*>(m_scriptExecutionContext);120 Document* document = toDocument(m_scriptExecutionContext); 121 121 document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage); 122 122 m_state = Failed; … … 127 127 ASSERT(m_cachedCueData == resource); 128 128 129 Document* document = static_cast<Document*>(m_scriptExecutionContext);129 Document* document = toDocument(m_scriptExecutionContext); 130 130 if (!m_crossOriginMode.isNull() 131 131 && !document->securityOrigin()->canRequest(resource->response().url()) … … 155 155 156 156 ASSERT(m_scriptExecutionContext->isDocument()); 157 Document* document = static_cast<Document*>(m_scriptExecutionContext);157 Document* document = toDocument(m_scriptExecutionContext); 158 158 CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url))); 159 159 -
trunk/Source/WebCore/loader/ThreadableLoader.cpp
r141783 r145745 51 51 #endif // ENABLE(WORKERS) 52 52 53 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 54 return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, options); 53 return DocumentThreadableLoader::create(toDocument(context), client, request, options); 55 54 } 56 55 … … 66 65 #endif // ENABLE(WORKERS) 67 66 68 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 69 DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client, options); 67 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), request, client, options); 70 68 } 71 69 -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r141783 r145745 108 108 { 109 109 ASSERT(isMainThread()); 110 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 111 Document* document = static_cast<Document*>(context); 110 Document* document = toDocument(context); 112 111 113 112 OwnPtr<ResourceRequest> request(ResourceRequest::adopt(requestData)); -
trunk/Source/WebCore/page/ContentSecurityPolicy.cpp
r145268 r145745 1433 1433 { 1434 1434 if (m_scriptExecutionContext->isDocument()) { 1435 Document* document = static_cast<Document*>(m_scriptExecutionContext);1435 Document* document = toDocument(m_scriptExecutionContext); 1436 1436 if (document->domWindow()) 1437 1437 FeatureObserver::observe(document->domWindow(), getFeatureObserverType(type)); … … 1677 1677 return; 1678 1678 1679 Document* document = static_cast<Document*>(m_scriptExecutionContext);1679 Document* document = toDocument(m_scriptExecutionContext); 1680 1680 Frame* frame = document->frame(); 1681 1681 if (!frame) -
trunk/Source/WebCore/page/DOMWindow.cpp
r145692 r145745 921 921 if (context) { 922 922 ASSERT(isMainThread()); 923 Document* activeDocument = static_cast<Document*>(context);923 Document* activeDocument = toDocument(context); 924 924 if (opener() && activeDocument->domWindow() == opener()) 925 925 allowFocus = true; … … 974 974 if (context) { 975 975 ASSERT(isMainThread()); 976 Document* activeDocument = static_cast<Document*>(context);976 Document* activeDocument = toDocument(context); 977 977 if (!activeDocument) 978 978 return; … … 1324 1324 { 1325 1325 ScriptExecutionContext* context = ContextDestructionObserver::scriptExecutionContext(); 1326 ASSERT_WITH_SECURITY_IMPLICATION(!context || context->isDocument()); 1327 return static_cast<Document*>(context); 1326 return toDocument(context); 1328 1327 } 1329 1328 -
trunk/Source/WebCore/page/DragController.cpp
r144553 r145745 415 415 416 416 if (doc && doc->isPluginDocument()) { 417 const Widget* widget = static_cast<PluginDocument*>(doc)->pluginWidget();417 const Widget* widget = toPluginDocument(doc)->pluginWidget(); 418 418 const PluginViewBase* pluginView = (widget && widget->isPluginViewBase()) ? static_cast<const PluginViewBase*>(widget) : 0; 419 419 -
trunk/Source/WebCore/page/EventHandler.cpp
r145481 r145745 665 665 #if ENABLE(SVG) 666 666 if (m_frame->document()->isSVGDocument() 667 && static_cast<SVGDocument*>(m_frame->document())->zoomAndPanEnabled()) {667 && toSVGDocument(m_frame->document())->zoomAndPanEnabled()) { 668 668 if (event.event().shiftKey() && singleClick) { 669 669 m_svgPan = true; 670 static_cast<SVGDocument*>(m_frame->document())->startPan(m_frame->view()->windowToContents(event.event().position()));670 toSVGDocument(m_frame->document())->startPan(m_frame->view()->windowToContents(event.event().position())); 671 671 return true; 672 672 } … … 1695 1695 #if ENABLE(SVG) 1696 1696 if (m_svgPan) { 1697 static_cast<SVGDocument*>(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_lastKnownMousePosition));1697 toSVGDocument(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_lastKnownMousePosition)); 1698 1698 return true; 1699 1699 } … … 1844 1844 if (m_svgPan) { 1845 1845 m_svgPan = false; 1846 static_cast<SVGDocument*>(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_lastKnownMousePosition));1846 toSVGDocument(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_lastKnownMousePosition)); 1847 1847 return true; 1848 1848 } -
trunk/Source/WebCore/page/EventSource.cpp
r138817 r145745 89 89 bool shouldBypassMainWorldContentSecurityPolicy = false; 90 90 if (context->isDocument()) { 91 Document* document = static_cast<Document*>(context);91 Document* document = toDocument(context); 92 92 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy(); 93 93 } -
trunk/Source/WebCore/page/FocusController.cpp
r142977 r145745 849 849 850 850 if (container->isDocumentNode()) 851 static_cast<Document*>(container)->updateLayoutIgnorePendingStylesheets();851 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 852 852 853 853 // Figure out the starting rect. … … 870 870 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, container); 871 871 if (container && container->isDocumentNode()) 872 static_cast<Document*>(container)->updateLayoutIgnorePendingStylesheets();872 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 873 873 } while (!consumed && container); 874 874 -
trunk/Source/WebCore/page/Frame.cpp
r144911 r145745 932 932 // FIXME: How to handle compound documents + zoomAndPan="disabled"? Needs SVG WG clarification. 933 933 if (document->isSVGDocument()) { 934 if (! static_cast<SVGDocument*>(document)->zoomAndPanEnabled())934 if (!toSVGDocument(document)->zoomAndPanEnabled()) 935 935 return; 936 936 } -
trunk/Source/WebCore/page/FrameView.cpp
r145156 r145745 1793 1793 #if ENABLE(SVG) 1794 1794 if (m_frame->document()->isSVGDocument()) { 1795 if (SVGSVGElement* svg = static_cast<SVGDocument*>(m_frame->document())->rootElement()) {1795 if (SVGSVGElement* svg = toSVGDocument(m_frame->document())->rootElement()) { 1796 1796 svg->setupInitialView(name, anchorNode); 1797 1797 if (!anchorNode) -
trunk/Source/WebCore/page/History.cpp
r141315 r145745 117 117 118 118 ASSERT(isMainThread()); 119 Document* activeDocument = static_cast<Document*>(context);119 Document* activeDocument = toDocument(context); 120 120 if (!activeDocument) 121 121 return; -
trunk/Source/WebCore/page/SpatialNavigation.cpp
r143295 r145745 372 372 ASSERT(container); 373 373 if (container->isDocumentNode()) 374 return scrollInDirection( static_cast<Document*>(container)->frame(), direction);374 return scrollInDirection(toDocument(container)->frame(), direction); 375 375 376 376 if (!container->renderBox()) … … 441 441 do { 442 442 if (parent->isDocumentNode()) 443 parent = static_cast<Document*>(parent)->document()->frame()->ownerElement();443 parent = toDocument(parent)->document()->frame()->ownerElement(); 444 444 else 445 445 parent = parent->parentNode(); … … 453 453 ASSERT(container); 454 454 if (container->isDocumentNode()) 455 return canScrollInDirection( static_cast<const Document*>(container)->frame(), direction);455 return canScrollInDirection(toDocument(container)->frame(), direction); 456 456 457 457 if (!isScrollableNode(container)) … … 522 522 523 523 if (node->isDocumentNode()) 524 return frameRectInAbsoluteCoordinates( static_cast<Document*>(node)->frame());524 return frameRectInAbsoluteCoordinates(toDocument(node)->frame()); 525 525 LayoutRect rect = rectToAbsoluteCoordinates(node->document()->frame(), node->boundingBox()); 526 526 -
trunk/Source/WebCore/page/TouchAdjustment.cpp
r143727 r145745 228 228 return ancestor; 229 229 if (node->isDocumentNode()) 230 return static_cast<const Document*>(node)->ownerElement();230 return toDocument(node)->ownerElement(); 231 231 return 0; 232 232 } -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r145041 r145745 211 211 212 212 if (touchTarget->isDocumentNode() && touchTarget != document) { 213 accumulateDocumentEventTargetRects(rects, static_cast<const Document*>(touchTarget));213 accumulateDocumentEventTargetRects(rects, toDocument(touchTarget)); 214 214 continue; 215 215 } -
trunk/Source/WebCore/rendering/RenderText.cpp
r144073 r145745 155 155 // They should be switched to passing null and using setDocumentForAnonymous. 156 156 if (node && node->isDocumentNode()) 157 setDocumentForAnonymous( static_cast<Document*>(node));157 setDocumentForAnonymous(toDocument(node)); 158 158 159 159 m_isAllASCII = m_text.containsOnlyASCII(); -
trunk/Source/WebCore/rendering/RenderTreeAsText.cpp
r145596 r145745 825 825 return; 826 826 827 Document* doc = static_cast<Document*>(n);827 Document* doc = toDocument(n); 828 828 Frame* frame = doc->frame(); 829 829 if (!frame) -
trunk/Source/WebCore/svg/SVGDocument.h
r108758 r145745 59 59 }; 60 60 61 inline SVGDocument* toSVGDocument(Document* document) 62 { 63 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isSVGDocument()); 64 return static_cast<SVGDocument*>(document); 65 } 66 67 inline const SVGDocument* toSVGDocument(const Document* document) 68 { 69 ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isSVGDocument()); 70 return static_cast<const SVGDocument*>(document); 71 } 72 73 // This will catch anyone doing an unnecessary cast. 74 void toSVGDocument(const SVGDocument*); 75 61 76 } // namespace WebCore 62 77 -
trunk/Source/WebCore/svg/graphics/SVGImage.cpp
r143692 r145745 67 67 68 68 Frame* frame = m_page->mainFrame(); 69 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();69 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 70 70 if (!rootElement) 71 71 return; … … 85 85 return IntSize(); 86 86 Frame* frame = m_page->mainFrame(); 87 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();87 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 88 88 if (!rootElement) 89 89 return IntSize(); … … 214 214 return 0; 215 215 Frame* frame = m_page->mainFrame(); 216 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();216 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 217 217 if (!rootElement) 218 218 return 0; … … 233 233 return false; 234 234 Frame* frame = m_page->mainFrame(); 235 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();235 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 236 236 if (!rootElement) 237 237 return false; … … 244 244 return false; 245 245 Frame* frame = m_page->mainFrame(); 246 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();246 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 247 247 if (!rootElement) 248 248 return false; … … 255 255 return; 256 256 Frame* frame = m_page->mainFrame(); 257 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();257 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 258 258 if (!rootElement) 259 259 return; … … 275 275 return; 276 276 Frame* frame = m_page->mainFrame(); 277 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();277 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 278 278 if (!rootElement) 279 279 return; … … 287 287 return; 288 288 Frame* frame = m_page->mainFrame(); 289 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();289 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); 290 290 if (!rootElement) 291 291 return; -
trunk/Source/WebCore/testing/Internals.cpp
r145735 r145745 283 283 Document* Internals::contextDocument() const 284 284 { 285 return static_cast<Document*>(scriptExecutionContext());285 return toDocument(scriptExecutionContext()); 286 286 } 287 287 -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp
r141783 r145745 47 47 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 48 48 if (scriptContext->isDocument()) 49 globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create( static_cast<Document*>(scriptContext))));49 globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(toDocument(scriptContext)))); 50 50 } 51 51 … … 56 56 JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); 57 57 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 58 ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isDocument()); 59 Page* page = static_cast<Document*>(scriptContext)->frame()->page(); 58 Page* page = toDocument(scriptContext)->frame()->page(); 60 59 Internals::resetToConsistentState(page); 61 60 InternalSettings::from(page)->resetToConsistentState(); -
trunk/Source/WebCore/testing/v8/WebCoreTestSupport.cpp
r141783 r145745 47 47 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 48 48 if (scriptContext->isDocument()) 49 context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create( static_cast<Document*>(scriptContext)), v8::Handle<v8::Object>(), context->GetIsolate()));49 context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(toDocument(scriptContext)), v8::Handle<v8::Object>(), context->GetIsolate())); 50 50 } 51 51 … … 60 60 61 61 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 62 ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isDocument()); 63 Page* page = static_cast<Document*>(scriptContext)->frame()->page(); 62 Page* page = toDocument(scriptContext)->frame()->page(); 64 63 Internals::resetToConsistentState(page); 65 64 InternalSettings::from(page)->resetToConsistentState(); -
trunk/Source/WebKit/win/DOMHTMLClasses.cpp
r145596 r145745 251 251 return E_POINTER; 252 252 253 *result = BString( static_cast<HTMLDocument*>(m_document)->url()).release();253 *result = BString(toHTMLDocument(m_document)->url()).release(); 254 254 return S_OK; 255 255 } … … 262 262 return E_FAIL; 263 263 264 HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);264 HTMLDocument* htmlDoc = toHTMLDocument(m_document); 265 265 COMPtr<IDOMElement> domElement; 266 266 domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc->body())); … … 305 305 return E_FAIL; 306 306 307 HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);307 HTMLDocument* htmlDoc = toHTMLDocument(m_document); 308 308 RefPtr<HTMLCollection> forms = htmlDoc->forms(); 309 309 *collection = DOMHTMLCollection::createInstance(forms.get()); -
trunk/Source/WebKit2/ChangeLog
r145738 r145745 1 2013-03-13 Abhishek Arya <inferno@chromium.org> 2 3 Replace static_casts with to* functions for document types. 4 https://bugs.webkit.org/show_bug.cgi?id=112225 5 6 Reviewed by Ryosuke Niwa. 7 8 * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: Remove the redundant helper. 9 1 10 2013-03-13 Zan Dobersek <zdobersek@igalia.com> 2 11 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm
r131148 r145745 35 35 #import <WebCore/Text.h> 36 36 37 static inline WebCore::Document* toDocument(WebCore::Node* node)38 {39 ASSERT(!node || node->isDocumentNode());40 return static_cast<WebCore::Document*>(node);41 }42 43 37 @implementation WKDOMDocument 44 38
Note: See TracChangeset
for help on using the changeset viewer.