Changeset 40824 in webkit
- Timestamp:
- Feb 10, 2009 9:33:33 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r40823 r40824 1 2009-02-10 Alexey Proskuryakov <ap@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 https://bugs.webkit.org/show_bug.cgi?id=23867 6 Eliminate obsolete frame->document() checks 7 8 * page/FrameView.cpp: (WebCore::FrameView::paintContents): Apparently due to a typo 9 (document vs. !document), fillWithRed was always set to false, and other branches were 10 never taken. Removing the check for document restores debug-only red color filling. 11 12 * loader/FrameLoader.cpp: (WebCore::FrameLoader::begin): Only call dispatchWindowObjectAvailable() 13 after a document is created. A client can do anything in its delegate method, so we'd need 14 to have frame->document() checks otherwise. DumpRenderTree uses this delegate to add its 15 custom property, and it was crashing due to null document in JSDOMWindowBase::getOwnPropertySlot(). 16 17 * bindings/js/JSDOMWindowBase.cpp: 18 (WebCore::JSDOMWindowBase::getOwnPropertySlot): 19 * bindings/js/JSDOMWindowCustom.cpp: 20 (WebCore::JSDOMWindow::addEventListener): 21 (WebCore::JSDOMWindow::removeEventListener): 22 * bindings/js/JSNavigatorCustom.cpp: 23 (WebCore::needsYouTubeQuirk): 24 * bindings/js/ScheduledAction.cpp: 25 (WebCore::ScheduledAction::execute): 26 * bindings/js/ScriptControllerMac.mm: 27 (WebCore::updateRenderingForBindings): 28 * dom/Document.cpp: 29 (WebCore::Document::initSecurityContext): 30 * editing/Editor.cpp: 31 (WebCore::Editor::deleteWithDirection): 32 (WebCore::Editor::dispatchCPPEvent): 33 (WebCore::Editor::applyStyle): 34 (WebCore::Editor::applyParagraphStyle): 35 * editing/EditorCommand.cpp: 36 (WebCore::Editor::Command::execute): 37 (WebCore::Editor::Command::isEnabled): 38 (WebCore::Editor::Command::state): 39 (WebCore::Editor::Command::value): 40 * editing/SelectionController.cpp: 41 (WebCore::SelectionController::recomputeCaretRect): 42 (WebCore::SelectionController::selectFrameElementInParentIfFullySelected): 43 (WebCore::SelectionController::selectAll): 44 (WebCore::SelectionController::setFocused): 45 * inspector/InspectorController.cpp: 46 (WebCore::getResourceDocumentNode): 47 * inspector/JavaScriptDebugServer.cpp: 48 (WebCore::JavaScriptDebugServer::setJavaScriptPaused): 49 * loader/DocumentLoader.cpp: 50 (WebCore::canonicalizedTitle): 51 (WebCore::DocumentLoader::stopLoading): 52 (WebCore::DocumentLoader::isLoadingInAPISense): 53 (WebCore::DocumentLoader::subresource): 54 (WebCore::DocumentLoader::getSubresources): 55 * loader/FrameLoader.cpp: 56 (WebCore::FrameLoader::urlSelected): 57 (WebCore::FrameLoader::stop): 58 (WebCore::FrameLoader::iconURL): 59 (WebCore::FrameLoader::executeIfJavaScriptURL): 60 (WebCore::FrameLoader::clear): 61 (WebCore::FrameLoader::endIfNotLoadingMainResource): 62 (WebCore::FrameLoader::restoreDocumentState): 63 (WebCore::FrameLoader::gotoAnchor): 64 (WebCore::FrameLoader::loadDone): 65 (WebCore::FrameLoader::checkCompleted): 66 (WebCore::FrameLoader::checkCallImplicitClose): 67 (WebCore::FrameLoader::scheduleRefresh): 68 (WebCore::FrameLoader::outgoingOrigin): 69 (WebCore::FrameLoader::canCachePageContainingThisFrame): 70 (WebCore::FrameLoader::logCanCacheFrameDecision): 71 (WebCore::FrameLoader::updatePolicyBaseURL): 72 (WebCore::FrameLoader::setPolicyBaseURL): 73 (WebCore::FrameLoader::frameDetached): 74 (WebCore::FrameLoader::shouldScrollToAnchor): 75 (WebCore::FrameLoader::saveDocumentState): 76 * loader/archive/cf/LegacyWebArchive.cpp: 77 (WebCore::LegacyWebArchive::create): 78 * loader/icon/IconFetcher.cpp: 79 (WebCore::IconFetcher::create): 80 * loader/icon/IconLoader.cpp: 81 (WebCore::IconLoader::startLoading): 82 * page/AccessibilityRenderObject.cpp: 83 (WebCore::AccessibilityRenderObject::visiblePositionForPoint): 84 * page/Chrome.cpp: 85 (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): 86 (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer): 87 * page/DOMWindow.cpp: 88 (WebCore::DOMWindow::sessionStorage): 89 (WebCore::DOMWindow::alert): 90 (WebCore::DOMWindow::confirm): 91 (WebCore::DOMWindow::prompt): 92 (WebCore::DOMWindow::scrollX): 93 (WebCore::DOMWindow::scrollY): 94 (WebCore::DOMWindow::getMatchedCSSRules): 95 (WebCore::DOMWindow::openDatabase): 96 (WebCore::DOMWindow::scrollBy): 97 (WebCore::DOMWindow::scrollTo): 98 * page/EventHandler.cpp: 99 (WebCore::EventHandler::allowDHTMLDrag): 100 (WebCore::EventHandler::scrollOverflow): 101 (WebCore::EventHandler::handleMousePressEvent): 102 (WebCore::EventHandler::handleMouseDoubleClickEvent): 103 (WebCore::EventHandler::handleMouseMoveEvent): 104 (WebCore::EventHandler::handleMouseReleaseEvent): 105 (WebCore::EventHandler::updateDragAndDrop): 106 (WebCore::EventHandler::handleWheelEvent): 107 (WebCore::EventHandler::sendContextMenuEvent): 108 (WebCore::EventHandler::capsLockStateMayHaveChanged): 109 (WebCore::EventHandler::sendResizeEvent): 110 (WebCore::EventHandler::sendScrollEvent): 111 * page/FocusController.cpp: 112 (WebCore::deepFocusableNode): 113 (WebCore::FocusController::advanceFocus): 114 * page/Frame.cpp: 115 (WebCore::Frame::setFocusedNodeIfNeeded): 116 (WebCore::Frame::shouldApplyTextZoom): 117 (WebCore::Frame::shouldApplyPageZoom): 118 (WebCore::Frame::setZoomFactor): 119 (WebCore::Frame::setPrinting): 120 (WebCore::Frame::reapplyStyles): 121 (WebCore::Frame::isContentEditable): 122 (WebCore::Frame::computeAndSetTypingStyle): 123 (WebCore::Frame::selectionComputedStyle): 124 (WebCore::Frame::applyEditingStyleToBodyElement): 125 (WebCore::Frame::removeEditingStyleFromBodyElement): 126 (WebCore::Frame::contentRenderer): 127 (WebCore::Frame::styleForSelectionStart): 128 (WebCore::Frame::setSelectionFromNone): 129 (WebCore::Frame::findString): 130 (WebCore::Frame::markAllMatchesForText): 131 (WebCore::Frame::setMarkedTextMatchesAreHighlighted): 132 (WebCore::Frame::documentTypeString): 133 (WebCore::Frame::shouldClose): 134 (WebCore::Frame::respondToChangedSelection): 135 * page/FrameView.cpp: 136 (WebCore::FrameView::~FrameView): 137 (WebCore::FrameView::createScrollbar): 138 (WebCore::FrameView::layout): 139 (WebCore::FrameView::layoutTimerFired): 140 (WebCore::FrameView::scheduleRelayout): 141 (WebCore::FrameView::needsLayout): 142 (WebCore::FrameView::unscheduleRelayout): 143 (WebCore::FrameView::windowClipRect): 144 * page/Geolocation.cpp: 145 (WebCore::Geolocation::disconnectFrame): 146 * page/Page.cpp: 147 (WebCore::networkStateChanged): 148 (WebCore::Page::~Page): 149 (WebCore::Page::unmarkAllTextMatches): 150 (WebCore::Page::setMediaVolume): 151 * page/animation/AnimationController.cpp: 152 (WebCore::AnimationControllerPrivate::updateRenderingDispatcherFired): 153 * page/mac/EventHandlerMac.mm: 154 (WebCore::EventHandler::currentKeyboardEvent): 155 (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks): 156 * page/mac/FrameMac.mm: 157 (WebCore::Frame::dashboardRegionsDictionary): 158 (WebCore::Frame::setUserStyleSheetLocation): 159 (WebCore::Frame::setUserStyleSheet): 160 * storage/LocalStorageArea.cpp: 161 (WebCore::LocalStorageArea::dispatchStorageEvent): 162 * storage/SessionStorageArea.cpp: 163 (WebCore::SessionStorageArea::dispatchStorageEvent): 164 * svg/graphics/SVGImage.cpp: 165 (WebCore::SVGImage::setContainerSize): 166 (WebCore::SVGImage::usesContainerSize): 167 (WebCore::SVGImage::size): 168 (WebCore::SVGImage::hasRelativeWidth): 169 (WebCore::SVGImage::hasRelativeHeight): 170 Removed frame->document() checks. 171 1 172 2009-02-10 Adam Treat <adam.treat@torchmobile.com> 2 173 -
trunk/WebCore/bindings/js/JSDOMWindowBase.cpp
r40541 r40824 610 610 // Allow shortcuts like 'Image1' instead of document.images.Image1 611 611 Document* document = impl()->frame()->document(); 612 if (document && document->isHTMLDocument()) {612 if (document->isHTMLDocument()) { 613 613 AtomicStringImpl* atomicPropertyName = AtomicString::find(propertyName); 614 614 if (atomicPropertyName && (static_cast<HTMLDocument*>(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) { -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r40508 r40824 269 269 return jsUndefined(); 270 270 271 if (RefPtr<JSEventListener> listener = findOrCreateJSEventListener(exec, args.at(exec, 1))) { 272 if (Document* doc = frame->document()) 273 doc->addWindowEventListener(AtomicString(args.at(exec, 0).toString(exec)), listener.release(), args.at(exec, 2).toBoolean(exec)); 274 } 271 if (RefPtr<JSEventListener> listener = findOrCreateJSEventListener(exec, args.at(exec, 1))) 272 frame->document()->addWindowEventListener(AtomicString(args.at(exec, 0).toString(exec)), listener.release(), args.at(exec, 2).toBoolean(exec)); 275 273 276 274 return jsUndefined(); … … 283 281 return jsUndefined(); 284 282 285 if (JSEventListener* listener = findJSEventListener(args.at(exec, 1))) { 286 if (Document* doc = frame->document()) 287 doc->removeWindowEventListener(AtomicString(args.at(exec, 0).toString(exec)), listener, args.at(exec, 2).toBoolean(exec)); 288 } 283 if (JSEventListener* listener = findJSEventListener(args.at(exec, 1))) 284 frame->document()->removeWindowEventListener(AtomicString(args.at(exec, 0).toString(exec)), listener, args.at(exec, 2).toBoolean(exec)); 289 285 290 286 return jsUndefined(); -
trunk/WebCore/bindings/js/JSNavigatorCustom.cpp
r39670 r40824 77 77 78 78 Document* document = frame->document(); 79 // FIXME: The document is never null, so we should remove this check along with the80 // other similar ones in this file when we are absolutely sure it's safe.81 if (!document)82 return false;83 79 84 80 // Do the quirk only on the front page of the global version of YouTube. -
trunk/WebCore/bindings/js/ScheduledAction.cpp
r40046 r40824 133 133 // for all possible entry points that might possibly execute script, but this seems 134 134 // to be a bit too low-level. 135 if (Document* document = frame->document()) 136 document->updateRendering(); 135 frame->document()->updateRendering(); 137 136 138 137 frame->script()->setProcessingTimerCallback(false); -
trunk/WebCore/bindings/js/ScriptControllerMac.mm
r40031 r40824 158 158 return; 159 159 160 Document* document = frame->document(); 161 if (!document) 162 return; 163 164 document->updateRendering(); 160 frame->document()->updateRendering(); 165 161 } 166 162 -
trunk/WebCore/dom/Document.cpp
r40719 r40824 4159 4159 ownerFrame = m_frame->loader()->opener(); 4160 4160 4161 if (ownerFrame && ownerFrame->document()) {4161 if (ownerFrame) { 4162 4162 m_cookieURL = ownerFrame->document()->cookieURL(); 4163 4163 // We alias the SecurityOrigins to match Firefox, see Bug 15313 -
trunk/WebCore/editing/Editor.cpp
r40793 r40824 223 223 bool Editor::deleteWithDirection(SelectionController::EDirection direction, TextGranularity granularity, bool killRing, bool isTypingAction) 224 224 { 225 if (!canEdit() || !m_frame->document())225 if (!canEdit()) 226 226 return false; 227 227 … … 690 690 { 691 691 Node* target = m_frame->selection()->start().element(); 692 if (!target && m_frame->document())692 if (!target) 693 693 target = m_frame->document()->body(); 694 694 if (!target) … … 719 719 break; 720 720 case VisibleSelection::RangeSelection: 721 if ( m_frame->document() &&style)721 if (style) 722 722 applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction)); 723 723 break; … … 738 738 case VisibleSelection::CaretSelection: 739 739 case VisibleSelection::RangeSelection: 740 if ( m_frame->document() &&style)740 if (style) 741 741 applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties)); 742 742 break; -
trunk/WebCore/editing/EditorCommand.cpp
r40793 r40824 1444 1444 if (!isEnabled(triggeringEvent)) { 1445 1445 // Let certain commands be executed when performed explicitly even if they are disabled. 1446 if (!isSupported() || !m_frame || !m_ frame->document() || !m_command->allowExecutionWhenDisabled)1446 if (!isSupported() || !m_frame || !m_command->allowExecutionWhenDisabled) 1447 1447 return false; 1448 1448 } … … 1463 1463 bool Editor::Command::isEnabled(Event* triggeringEvent) const 1464 1464 { 1465 if (!isSupported() || !m_frame || !m_frame->document())1465 if (!isSupported() || !m_frame) 1466 1466 return false; 1467 1467 return m_command->isEnabled(m_frame.get(), triggeringEvent, m_source); … … 1470 1470 TriState Editor::Command::state(Event* triggeringEvent) const 1471 1471 { 1472 if (!isSupported() || !m_frame || !m_frame->document())1472 if (!isSupported() || !m_frame) 1473 1473 return FalseTriState; 1474 1474 return m_command->state(m_frame.get(), triggeringEvent); … … 1477 1477 String Editor::Command::value(Event* triggeringEvent) const 1478 1478 { 1479 if (!isSupported() || !m_frame || !m_frame->document())1479 if (!isSupported() || !m_frame) 1480 1480 return String(); 1481 1481 return m_command->value(m_frame.get(), triggeringEvent); -
trunk/WebCore/editing/SelectionController.cpp
r40793 r40824 831 831 bool SelectionController::recomputeCaretRect() 832 832 { 833 if (!m_frame || !m_frame->document())833 if (!m_frame) 834 834 return false; 835 835 … … 1044 1044 // Get to the <iframe> or <frame> (or even <object>) element in the parent frame. 1045 1045 Document* doc = m_frame->document(); 1046 if (!doc)1047 return;1048 1046 Element* ownerElement = doc->ownerElement(); 1049 1047 if (!ownerElement) … … 1073 1071 { 1074 1072 Document* document = m_frame->document(); 1075 if (!document)1076 return;1077 1073 1078 1074 if (document->focusedNode() && document->focusedNode()->canSelectAll()) { … … 1208 1204 focusedOrActiveStateChanged(); 1209 1205 1210 if (Document* doc = m_frame->document()) 1211 doc->dispatchWindowEvent(flag ? eventNames().focusEvent : eventNames().blurEvent, false, false); 1206 m_frame->document()->dispatchWindowEvent(flag ? eventNames().focusEvent : eventNames().blurEvent, false, false); 1212 1207 } 1213 1208 -
trunk/WebCore/inspector/InspectorController.cpp
r40794 r40824 669 669 670 670 Document* document = frame->document(); 671 if (!document)672 return undefined;673 671 674 672 if (document->isPluginDocument() || document->isImageDocument() || document->isMediaDocument()) -
trunk/WebCore/inspector/JavaScriptDebugServer.cpp
r39880 r40824 364 364 frame->script()->setPaused(paused); 365 365 366 if (Document* document = frame->document()) { 367 if (paused) 368 document->suspendActiveDOMObjects(); 369 else 370 document->resumeActiveDOMObjects(); 371 } 366 Document* document = frame->document(); 367 if (paused) 368 document->suspendActiveDOMObjects(); 369 else 370 document->resumeActiveDOMObjects(); 372 371 373 372 setJavaScriptPaused(frame->view(), paused); -
trunk/WebCore/loader/DocumentLoader.cpp
r40740 r40824 115 115 116 116 // Replace the backslashes with currency symbols if the encoding requires it. 117 if (frame->document()) 118 frame->document()->displayBufferModifiedByEncoding(buffer.characters(), buffer.length()); 117 frame->document()->displayBufferModifiedByEncoding(buffer.characters(), buffer.length()); 119 118 120 119 return String::adopt(buffer); … … 293 292 Document* doc = m_frame->document(); 294 293 295 if (loading || (doc && doc->parsing()))294 if (loading || doc->parsing()) 296 295 m_frame->loader()->stopLoading(false); 297 296 } … … 469 468 if (!m_subresourceLoaders.isEmpty()) 470 469 return true; 471 if (Document* doc = m_frame->document()) { 472 if (doc->docLoader()->requestCount()) 470 Document* doc = m_frame->document(); 471 if (doc->docLoader()->requestCount()) 472 return true; 473 if (Tokenizer* tok = doc->tokenizer()) 474 if (tok->processingData()) 473 475 return true; 474 if (Tokenizer* tok = doc->tokenizer())475 if (tok->processingData())476 return true;477 }478 476 } 479 477 return frameLoader()->subframeIsLoading(); … … 553 551 554 552 Document* doc = m_frame->document(); 555 if (!doc)556 return archiveResourceForURL(url);557 553 558 554 CachedResource* resource = doc->docLoader()->cachedResource(url); … … 569 565 570 566 Document* document = m_frame->document(); 571 if (!document)572 return;573 567 574 568 const DocLoader::DocumentResourceMap& allResources = document->docLoader()->allCachedResources(); -
trunk/WebCore/loader/FrameLoader.cpp
r40792 r40824 411 411 412 412 String target = _target; 413 if (target.isEmpty() && m_frame->document())413 if (target.isEmpty()) 414 414 target = m_frame->document()->baseTarget(); 415 415 … … 646 646 RefPtr<Frame> protector(m_frame); 647 647 648 if (m_frame->document()) { 649 if (m_frame->document()->tokenizer()) 650 m_frame->document()->tokenizer()->stopParsing(); 651 m_frame->document()->finishParsing(); 652 } else 653 // WebKit partially uses WebCore when loading non-HTML docs. In these cases doc==nil, but 654 // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to 655 // become true. An example is when a subframe is a pure text doc, and that subframe is the 656 // last one to complete. 657 checkCompleted(); 648 if (m_frame->document()->tokenizer()) 649 m_frame->document()->tokenizer()->stopParsing(); 650 m_frame->document()->finishParsing(); 651 658 652 if (m_iconLoader) 659 653 m_iconLoader->stopLoading(); … … 684 678 685 679 // If we have an iconURL from a Link element, return that 686 if ( m_frame->document() &&!m_frame->document()->iconURL().isEmpty())680 if (!m_frame->document()->iconURL().isEmpty()) 687 681 return KURL(m_frame->document()->iconURL()); 688 682 … … 758 752 759 753 SecurityOrigin* currentSecurityOrigin = 0; 760 if (m_frame->document()) 761 currentSecurityOrigin = m_frame->document()->securityOrigin(); 754 currentSecurityOrigin = m_frame->document()->securityOrigin(); 762 755 763 756 // FIXME: We should always replace the document, but doing so … … 816 809 m_needsClear = false; 817 810 818 if ( m_frame->document() &&!m_frame->document()->inPageCache()) {811 if (!m_frame->document()->inPageCache()) { 819 812 m_frame->document()->cancelParsing(); 820 813 m_frame->document()->stopActiveDOMObjects(); … … 913 906 RefPtr<SecurityOrigin> forcedSecurityOrigin = origin; 914 907 915 bool resetScripting = !(m_isDisplayingInitialEmptyDocument && m_frame->document() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url));908 bool resetScripting = !(m_isDisplayingInitialEmptyDocument && m_frame->document()->securityOrigin()->isSecureTransitionTo(url)); 916 909 clear(resetScripting, resetScripting); 917 910 if (resetScripting) 918 911 m_frame->script()->updatePlatformScriptObjects(); 919 if (dispatch)920 dispatchWindowObjectAvailable();921 912 922 913 m_needsClear = true; … … 940 931 document = DOMImplementation::createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode()); 941 932 m_frame->setDocument(document); 933 934 if (dispatch) 935 dispatchWindowObjectAvailable(); 942 936 943 937 document->setURL(m_URL); … … 1062 1056 void FrameLoader::endIfNotLoadingMainResource() 1063 1057 { 1064 if (m_isLoadingMainResource || !m_frame->page() )1058 if (m_isLoadingMainResource || !m_frame->page() || !m_frame->document()) 1065 1059 return; 1066 1060 … … 1071 1065 1072 1066 // make sure nothing's left in there 1073 if (m_frame->document()) { 1074 write(0, 0, true); 1075 m_frame->document()->finishParsing(); 1067 write(0, 0, true); 1068 m_frame->document()->finishParsing(); 1076 1069 #if USE(LOW_BANDWIDTH_DISPLAY) 1077 1078 1079 1080 1070 if (m_frame->document()->inLowBandwidthDisplay()) { 1071 m_finishedParsingDuringLowBandwidthDisplay = true; 1072 switchOutLowBandwidthDisplayIfReady(); 1073 } 1081 1074 #endif 1082 } else1083 // WebKit partially uses WebCore when loading non-HTML docs. In these cases doc==nil, but1084 // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to1085 // become true. An example is when a subframe is a pure text doc, and that subframe is the1086 // last one to complete.1087 checkCompleted();1088 1075 } 1089 1076 … … 1197 1184 { 1198 1185 Document* doc = m_frame->document(); 1199 if (!doc)1200 return;1201 1186 1202 1187 HistoryItem* itemToRestore = 0; … … 1229 1214 // and possibly repaint because :target pseudo class may have been 1230 1215 // set (see bug 11321). 1231 if (!m_URL.hasRef() && ! (m_frame->document() && m_frame->document()->cssTarget()))1216 if (!m_URL.hasRef() && !m_frame->document()->cssTarget()) 1232 1217 return; 1233 1218 … … 1267 1252 void FrameLoader::loadDone() 1268 1253 { 1269 if (m_frame->document()) 1270 checkCompleted(); 1254 checkCompleted(); 1271 1255 } 1272 1256 … … 1283 1267 1284 1268 // Are we still parsing? 1285 if (m_frame->document() && m_frame->document()->parsing())1269 if (m_frame->document()->parsing()) 1286 1270 return; 1287 1271 1288 1272 // Still waiting for images/scripts? 1289 if (m_frame->document()) 1290 if (numRequests(m_frame->document())) 1291 return; 1273 if (numRequests(m_frame->document())) 1274 return; 1292 1275 1293 1276 #if USE(LOW_BANDWIDTH_DISPLAY) 1294 1277 // as switch will be called, don't complete yet 1295 if (m_frame->document() && m_frame->document()->inLowBandwidthDisplay() && m_needToSwitchOutLowBandwidthDisplay)1278 if (m_frame->document()->inLowBandwidthDisplay() && m_needToSwitchOutLowBandwidthDisplay) 1296 1279 return; 1297 1280 #endif … … 1339 1322 void FrameLoader::checkCallImplicitClose() 1340 1323 { 1341 if (m_didCallImplicitClose || !m_frame->document() ||m_frame->document()->parsing())1324 if (m_didCallImplicitClose || m_frame->document()->parsing()) 1342 1325 return; 1343 1326 … … 1348 1331 m_didCallImplicitClose = true; 1349 1332 m_wasUnloadEventEmitted = false; 1350 if (m_frame->document()) 1351 m_frame->document()->implicitClose(); 1333 m_frame->document()->implicitClose(); 1352 1334 } 1353 1335 … … 1419 1401 return; 1420 1402 1421 // Handle a location change of a page with no document as a special case. 1422 // This may happen when a frame requests a refresh of another frame. 1423 bool duringLoad = !m_frame->document(); 1424 1425 // If a refresh was scheduled during a load, then stop the current load. 1426 // Otherwise when the current load transitions from a provisional to a 1427 // committed state, pending redirects may be cancelled. 1428 if (duringLoad) 1429 stopLoading(true); 1430 1431 ScheduledRedirection::Type type = duringLoad 1432 ? ScheduledRedirection::locationChangeDuringLoad : ScheduledRedirection::locationChange; 1403 ScheduledRedirection::Type type = ScheduledRedirection::locationChange; 1433 1404 scheduleRedirection(new ScheduledRedirection(type, m_URL.string(), m_outgoingReferrer, true, true, wasUserGesture, true)); 1434 1405 } … … 1644 1615 // We need to update the layout before scrolling, otherwise we could 1645 1616 // really mess things up if an anchor scroll comes at a bad moment. 1646 if (m_frame->document()) { 1647 m_frame->document()->updateRendering(); 1648 // Only do a layout if changes have occurred that make it necessary. 1649 if (m_frame->view() && m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout()) 1650 m_frame->view()->layout(); 1651 } 1617 m_frame->document()->updateRendering(); 1618 // Only do a layout if changes have occurred that make it necessary. 1619 if (m_frame->view() && m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout()) 1620 m_frame->view()->layout(); 1652 1621 1653 1622 // Scroll nested layers and frames to reveal the anchor. … … 1788 1757 String FrameLoader::outgoingOrigin() const 1789 1758 { 1790 if (m_frame->document()) 1791 return m_frame->document()->securityOrigin()->toString(); 1792 1793 return SecurityOrigin::createEmpty()->toString(); 1759 return m_frame->document()->securityOrigin()->toString(); 1794 1760 } 1795 1761 … … 1895 1861 && !m_containsPlugIns 1896 1862 && !m_URL.protocolIs("https") 1897 && m_frame->document()1898 1863 && !m_frame->document()->hasWindowEventListener(eventNames().unloadEvent) 1899 1864 #if ENABLE(DATABASE) … … 2038 2003 if (m_URL.protocolIs("https")) 2039 2004 { PCLOG(" -Frame is HTTPS"); cannotCache = true; } 2040 if (!m_frame->document()) {2041 PCLOG(" -There is no Document object");2042 cannotCache = true;2043 break;2044 }2045 2005 if (m_frame->document()->hasWindowEventListener(eventNames().unloadEvent)) 2046 2006 { PCLOG(" -Frame has an unload event listener"); cannotCache = true; } … … 2084 2044 void FrameLoader::updatePolicyBaseURL() 2085 2045 { 2086 if (m_frame->tree()->parent() && m_frame->tree()->parent()->document())2046 if (m_frame->tree()->parent()) 2087 2047 setPolicyBaseURL(m_frame->tree()->parent()->document()->policyBaseURL()); 2088 2048 else … … 2092 2052 void FrameLoader::setPolicyBaseURL(const KURL& url) 2093 2053 { 2094 if (m_frame->document()) 2095 m_frame->document()->setPolicyBaseURL(url); 2054 m_frame->document()->setPolicyBaseURL(url); 2096 2055 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) 2097 2056 child->loader()->setPolicyBaseURL(url); … … 3523 3482 { 3524 3483 stopAllLoaders(); 3525 if (Document* document = m_frame->document()) 3526 document->stopActiveDOMObjects(); 3484 m_frame->document()->stopActiveDOMObjects(); 3527 3485 detachFromParent(); 3528 3486 } … … 3881 3839 // We don't want to just scroll if a link from within a 3882 3840 // frameset is trying to reload the frameset into _top. 3883 && (!m_frame->document() || !m_frame->document()->isFrameSet());3841 && !m_frame->document()->isFrameSet(); 3884 3842 } 3885 3843 … … 4453 4411 ASSERT(document); 4454 4412 4455 if ( document &&item->isCurrentDocument(document)) {4413 if (item->isCurrentDocument(document)) { 4456 4414 LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->name().string().utf8().data(), item); 4457 4415 item->setDocumentState(document->formElementsState()); -
trunk/WebCore/loader/archive/cf/LegacyWebArchive.cpp
r40746 r40824 507 507 (childFrame = static_cast<HTMLFrameOwnerElement*>(*it)->contentFrame())) { 508 508 RefPtr<LegacyWebArchive> subframeArchive; 509 if (Document* document = childFrame->document()) 510 subframeArchive = LegacyWebArchive::create(document); 511 else 512 subframeArchive = create(childFrame); 509 subframeArchive = LegacyWebArchive::create(childFrame->document()); 513 510 514 511 if (subframeArchive) -
trunk/WebCore/loader/icon/IconFetcher.cpp
r39880 r40824 102 102 { 103 103 Document* document = frame->document(); 104 if (!document)105 return 0;106 104 107 105 HTMLHeadElement* head = document->head(); -
trunk/WebCore/loader/icon/IconLoader.cpp
r40335 r40824 62 62 if (m_resourceLoader) 63 63 return; 64 65 // FIXME: http://bugs.webkit.org/show_bug.cgi?id=1090266 // Once ResourceHandle will load without a DocLoader, we can remove this check.67 // A frame may be documentless - one example is a frame containing only a PDF.68 if (!m_frame->document()) {69 LOG(IconDatabase, "Documentless-frame - icon won't be loaded");70 return;71 }72 64 73 65 // Set flag so we can detect the case where the load completes before -
trunk/WebCore/page/AccessibilityRenderObject.cpp
r40793 r40824 1771 1771 if (!frame) 1772 1772 break; 1773 Document* document = frame->document(); 1774 if (!document) 1775 break; 1776 renderView = document->renderView(); 1773 renderView = frame->document()->renderView(); 1777 1774 frameView = static_cast<FrameView*>(widget); 1778 1775 } -
trunk/WebCore/page/Chrome.cpp
r40017 r40824 458 458 459 459 #if !PLATFORM(MAC) 460 for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 461 if (Document* document = frame->document()) 462 document->suspendActiveDOMObjects(); 463 } 460 for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) 461 frame->document()->suspendActiveDOMObjects(); 464 462 #endif 465 463 } … … 479 477 480 478 #if !PLATFORM(MAC) 481 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 482 if (Document* document = frame->document()) 483 document->resumeActiveDOMObjects(); 484 } 479 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) 480 frame->document()->resumeActiveDOMObjects(); 485 481 #endif 486 482 } -
trunk/WebCore/page/DOMWindow.cpp
r40768 r40824 325 325 326 326 Document* document = m_frame->document(); 327 if (!document)328 return 0;329 327 330 328 RefPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin()); … … 499 497 return; 500 498 501 Document* doc = m_frame->document(); 502 ASSERT(doc); 503 if (doc) 504 doc->updateRendering(); 499 m_frame->document()->updateRendering(); 505 500 506 501 Page* page = m_frame->page(); … … 516 511 return false; 517 512 518 Document* doc = m_frame->document(); 519 ASSERT(doc); 520 if (doc) 521 doc->updateRendering(); 513 m_frame->document()->updateRendering(); 522 514 523 515 Page* page = m_frame->page(); … … 533 525 return String(); 534 526 535 Document* doc = m_frame->document(); 536 ASSERT(doc); 537 if (doc) 538 doc->updateRendering(); 527 m_frame->document()->updateRendering(); 539 528 540 529 Page* page = m_frame->page(); … … 644 633 return 0; 645 634 646 Document* doc = m_frame->document(); 647 ASSERT(doc); 648 if (doc) 649 doc->updateLayoutIgnorePendingStylesheets(); 635 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 650 636 651 637 return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor()); … … 661 647 return 0; 662 648 663 Document* doc = m_frame->document(); 664 ASSERT(doc); 665 if (doc) 666 doc->updateLayoutIgnorePendingStylesheets(); 649 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 667 650 668 651 return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor()); … … 798 781 799 782 Document* doc = m_frame->document(); 800 ASSERT(doc);801 if (!doc)802 return 0;803 783 804 784 if (!pseudoElt.isEmpty()) … … 826 806 827 807 Document* doc = m_frame->document(); 828 ASSERT(doc);829 if (!doc)830 return 0;831 808 832 809 Settings* settings = m_frame->settings(); … … 843 820 return; 844 821 845 Document* doc = m_frame->document(); 846 ASSERT(doc); 847 if (doc) 848 doc->updateLayoutIgnorePendingStylesheets(); 822 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 849 823 850 824 FrameView* view = m_frame->view(); … … 860 834 return; 861 835 862 Document* doc = m_frame->document(); 863 ASSERT(doc); 864 if (doc) 865 doc->updateLayoutIgnorePendingStylesheets(); 836 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 866 837 867 838 FrameView* view = m_frame->view(); -
trunk/WebCore/page/EventHandler.cpp
r40793 r40824 686 686 void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const 687 687 { 688 if (!m_frame || !m_frame->document()) {688 if (!m_frame) { 689 689 flagDHTML = false; 690 690 flagUA = false; … … 792 792 bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity granularity) 793 793 { 794 if (!m_frame->document())795 return false;796 797 794 Node* node = m_frame->document()->focusedNode(); 798 795 if (!node) … … 1003 1000 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) 1004 1001 { 1005 if (!m_frame->document())1006 return false;1007 1008 1002 RefPtr<FrameView> protector(m_frame->view()); 1009 1003 … … 1127 1121 bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEvent) 1128 1122 { 1129 if (!m_frame->document())1130 return false;1131 1132 1123 RefPtr<FrameView> protector(m_frame->view()); 1133 1124 … … 1186 1177 // builds, if it happens. 1187 1178 ASSERT(m_frame); 1188 if (!m_frame || !m_frame->document())1179 if (!m_frame) 1189 1180 return false; 1190 1181 … … 1284 1275 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) 1285 1276 { 1286 if (!m_frame->document())1287 return false;1288 1289 1277 RefPtr<FrameView> protector(m_frame->view()); 1290 1278 … … 1355 1343 { 1356 1344 bool accept = false; 1357 1358 if (!m_frame->document())1359 return false;1360 1345 1361 1346 if (!m_frame->view()) … … 1601 1586 { 1602 1587 Document* doc = m_frame->document(); 1603 if (!doc)1604 return false;1605 1588 1606 1589 RenderObject* docRenderer = doc->renderer(); … … 1653 1636 Document* doc = m_frame->document(); 1654 1637 FrameView* v = m_frame->view(); 1655 if (! doc || !v)1638 if (!v) 1656 1639 return false; 1657 1640 … … 2238 2221 void EventHandler::capsLockStateMayHaveChanged() 2239 2222 { 2240 if (Document* d = m_frame->document())2241 2242 2243 2223 Document* d = m_frame->document(); 2224 if (Node* node = d->focusedNode()) 2225 if (RenderObject* r = node->renderer()) 2226 r->capsLockStateMayHaveChanged(); 2244 2227 } 2245 2228 … … 2273 2256 void EventHandler::sendResizeEvent() 2274 2257 { 2275 if (Document* doc = m_frame->document()) 2276 doc->dispatchWindowEvent(eventNames().resizeEvent, false, false); 2258 m_frame->document()->dispatchWindowEvent(eventNames().resizeEvent, false, false); 2277 2259 } 2278 2260 … … 2283 2265 return; 2284 2266 v->setWasScrolledByUser(true); 2285 Document* doc = m_frame->document(); 2286 if (!doc) 2287 return; 2288 doc->dispatchEventForType(eventNames().scrollEvent, true, false); 2267 m_frame->document()->dispatchEventForType(eventNames().scrollEvent, true, false); 2289 2268 } 2290 2269 -
trunk/WebCore/page/FocusController.cpp
r38094 r40824 91 91 92 92 Document* document = owner->contentFrame()->document(); 93 if (!document)94 break;95 93 96 94 node = (direction == FocusDirectionForward) … … 116 114 ASSERT(frame); 117 115 Document* document = frame->document(); 118 if (!document)119 return false;120 116 121 117 Node* node = (direction == FocusDirectionForward) … … 130 126 131 127 Document* parentDocument = parentFrame->document(); 132 if (!parentDocument)133 break;134 128 135 129 HTMLFrameOwnerElement* owner = frame->ownerElement(); … … 156 150 157 151 // Chrome doesn't want focus, so we should wrap focus. 158 if (Document* d = m_page->mainFrame()->document())159 160 161 152 Document* d = m_page->mainFrame()->document(); 153 node = (direction == FocusDirectionForward) 154 ? d->nextFocusableNode(0, event) 155 : d->previousFocusableNode(0, event); 162 156 163 157 node = deepFocusableNode(direction, node, event); -
trunk/WebCore/page/Frame.cpp
r40793 r40824 567 567 void Frame::setFocusedNodeIfNeeded() 568 568 { 569 if ( !document() ||selection()->isNone() || !selection()->isFocusedAndActive())569 if (selection()->isNone() || !selection()->isFocusedAndActive()) 570 570 return; 571 571 … … 697 697 return false; 698 698 #if ENABLE(SVG) 699 if (m_doc && m_doc->isSVGDocument())699 if (m_doc->isSVGDocument()) 700 700 return false; 701 701 #endif … … 708 708 return false; 709 709 #if ENABLE(SVG) 710 if (m_doc && m_doc->isSVGDocument())710 if (m_doc->isSVGDocument()) 711 711 return false; 712 712 #endif … … 722 722 // SVG doesn't care if the zoom factor is text only. It will always apply a 723 723 // zoom to the whole SVG. 724 if (m_doc && m_doc->isSVGDocument()) {724 if (m_doc->isSVGDocument()) { 725 725 if (!static_cast<SVGDocument*>(m_doc.get())->zoomAndPanEnabled()) 726 726 return; … … 736 736 m_page->settings()->setZoomsTextOnly(isTextOnly); 737 737 738 if (m_doc) 739 m_doc->recalcStyle(Node::Force); 738 m_doc->recalcStyle(Node::Force); 740 739 741 740 for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) 742 741 child->setZoomFactor(m_zoomFactor, isTextOnly); 743 742 744 if (m_doc && m_doc->renderer() && m_doc->renderer()->needsLayout() && view()->didFirstLayout())743 if (m_doc->renderer() && m_doc->renderer()->needsLayout() && view()->didFirstLayout()) 745 744 view()->layout(); 746 745 } … … 748 747 void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize) 749 748 { 750 if (!m_doc)751 return;752 753 749 m_doc->setPrinting(printing); 754 750 view()->setMediaType(printing ? "print" : "screen"); … … 809 805 // "reapplyStyles". We should probably eventually move it into its own 810 806 // method. 811 if (m_doc) 812 m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically()); 807 m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically()); 813 808 814 809 #if FRAME_LOADS_USER_STYLESHEET … … 824 819 // But we had problems when this code was removed. Details are in 825 820 // <http://bugs.webkit.org/show_bug.cgi?id=8079>. 826 if (m_doc) 827 m_doc->updateStyleSelector(); 821 m_doc->updateStyleSelector(); 828 822 } 829 823 … … 848 842 if (m_editor.clientIsEditable()) 849 843 return true; 850 if (!m_doc)851 return false;852 844 return m_doc->inDesignMode(); 853 845 } … … 918 910 RefPtr<CSSMutableStyleDeclaration> blockStyle = mutableStyle->copyBlockProperties(); 919 911 blockStyle->diff(mutableStyle.get()); 920 if ( document() &&blockStyle->length() > 0)912 if (blockStyle->length() > 0) 921 913 applyCommand(ApplyStyleCommand::create(document(), blockStyle.get(), editingAction)); 922 914 … … 946 938 { 947 939 nodeToRemove = 0; 948 949 if (!document())950 return 0;951 940 952 941 if (selection()->isNone()) … … 1033 1022 void Frame::applyEditingStyleToBodyElement() const 1034 1023 { 1035 if (!m_doc)1036 return;1037 1038 1024 RefPtr<NodeList> list = m_doc->getElementsByTagName("body"); 1039 1025 unsigned len = list->length(); … … 1045 1031 void Frame::removeEditingStyleFromBodyElement() const 1046 1032 { 1047 if (!m_doc)1048 return;1049 1050 1033 RefPtr<NodeList> list = m_doc->getElementsByTagName("body"); 1051 1034 unsigned len = list->length(); … … 1128 1111 { 1129 1112 Document* doc = document(); 1130 if (!doc)1131 return 0;1132 1113 RenderObject* object = doc->renderer(); 1133 1114 if (!object) … … 1327 1308 nodeToRemove = 0; 1328 1309 1329 if (!document())1330 return 0;1331 1310 if (selection()->isNone()) 1332 1311 return 0; … … 1365 1344 // entire WebView is editable or designMode is on for this document). 1366 1345 Document *doc = document(); 1367 if (! doc || !selection()->isNone() || !isContentEditable())1346 if (!selection()->isNone() || !isContentEditable()) 1368 1347 return; 1369 1348 … … 1388 1367 bool Frame::findString(const String& target, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection) 1389 1368 { 1390 if (target.isEmpty() || !document())1369 if (target.isEmpty()) 1391 1370 return false; 1392 1371 … … 1474 1453 unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsigned limit) 1475 1454 { 1476 if (target.isEmpty() || !document())1455 if (target.isEmpty()) 1477 1456 return 0; 1478 1457 … … 1517 1496 // each text match. 1518 1497 Document* doc = document(); 1519 if ( doc &&m_view && contentRenderer()) {1498 if (m_view && contentRenderer()) { 1520 1499 doc->updateLayout(); // Ensure layout is up to date. 1521 1500 IntRect visibleRect = m_view->visibleContentRect(); … … 1537 1516 void Frame::setMarkedTextMatchesAreHighlighted(bool flag) 1538 1517 { 1539 if (flag == m_highlightTextMatches || !document())1518 if (flag == m_highlightTextMatches) 1540 1519 return; 1541 1520 … … 1617 1596 String Frame::documentTypeString() const 1618 1597 { 1619 if (Document* doc = document()) { 1620 if (DocumentType* doctype = doc->doctype()) 1621 return createMarkup(doctype); 1622 } 1598 if (DocumentType* doctype = document()->doctype()) 1599 return createMarkup(doctype); 1623 1600 1624 1601 return String(); … … 1654 1631 1655 1632 RefPtr<Document> doc = document(); 1656 if (!doc)1657 return true;1658 1633 HTMLElement* body = doc->body(); 1659 1634 if (!body) … … 1664 1639 doc->handleWindowEvent(beforeUnloadEvent.get(), false); 1665 1640 1666 if (!beforeUnloadEvent->defaultPrevented() && doc)1641 if (!beforeUnloadEvent->defaultPrevented()) 1667 1642 doc->defaultEventHandler(beforeUnloadEvent.get()); 1668 1643 if (beforeUnloadEvent->result().isNull()) … … 1685 1660 void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping) 1686 1661 { 1687 if (document()) { 1688 bool isContinuousSpellCheckingEnabled = editor()->isContinuousSpellCheckingEnabled(); 1689 bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && editor()->isGrammarCheckingEnabled(); 1690 if (isContinuousSpellCheckingEnabled) { 1691 VisibleSelection newAdjacentWords; 1692 VisibleSelection newSelectedSentence; 1693 if (selection()->selection().isContentEditable()) { 1694 VisiblePosition newStart(selection()->selection().visibleStart()); 1695 newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary)); 1696 if (isContinuousGrammarCheckingEnabled) 1697 newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart)); 1698 } 1699 1700 // When typing we check spelling elsewhere, so don't redo it here. 1701 // If this is a change in selection resulting from a delete operation, 1702 // oldSelection may no longer be in the document. 1703 if (closeTyping && oldSelection.isContentEditable() && oldSelection.start().node() && oldSelection.start().node()->inDocument()) { 1704 VisiblePosition oldStart(oldSelection.visibleStart()); 1705 VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary)); 1706 if (oldAdjacentWords != newAdjacentWords) { 1707 editor()->markMisspellings(oldAdjacentWords); 1708 if (isContinuousGrammarCheckingEnabled) { 1709 VisibleSelection oldSelectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart)); 1710 if (oldSelectedSentence != newSelectedSentence) 1711 editor()->markBadGrammar(oldSelectedSentence); 1712 } 1662 bool isContinuousSpellCheckingEnabled = editor()->isContinuousSpellCheckingEnabled(); 1663 bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && editor()->isGrammarCheckingEnabled(); 1664 if (isContinuousSpellCheckingEnabled) { 1665 VisibleSelection newAdjacentWords; 1666 VisibleSelection newSelectedSentence; 1667 if (selection()->selection().isContentEditable()) { 1668 VisiblePosition newStart(selection()->selection().visibleStart()); 1669 newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary)); 1670 if (isContinuousGrammarCheckingEnabled) 1671 newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart)); 1672 } 1673 1674 // When typing we check spelling elsewhere, so don't redo it here. 1675 // If this is a change in selection resulting from a delete operation, 1676 // oldSelection may no longer be in the document. 1677 if (closeTyping && oldSelection.isContentEditable() && oldSelection.start().node() && oldSelection.start().node()->inDocument()) { 1678 VisiblePosition oldStart(oldSelection.visibleStart()); 1679 VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary)); 1680 if (oldAdjacentWords != newAdjacentWords) { 1681 editor()->markMisspellings(oldAdjacentWords); 1682 if (isContinuousGrammarCheckingEnabled) { 1683 VisibleSelection oldSelectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart)); 1684 if (oldSelectedSentence != newSelectedSentence) 1685 editor()->markBadGrammar(oldSelectedSentence); 1713 1686 } 1714 1687 } 1715 1716 // This only erases markers that are in the first unit (word or sentence) of the selection. 1717 // Perhaps peculiar, but it matches AppKit.1718 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())1719 document()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);1720 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())1721 document()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);1722 }1723 1724 // When continuous spell checking is off, existing markers disappear after the selection changes. 1725 if (!isContinuousSpellCheckingEnabled)1726 document()->removeMarkers(DocumentMarker::Spelling);1727 if (!isContinuousGrammarCheckingEnabled)1728 document()->removeMarkers(DocumentMarker::Grammar);1729 }1688 } 1689 1690 // This only erases markers that are in the first unit (word or sentence) of the selection. 1691 // Perhaps peculiar, but it matches AppKit. 1692 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) 1693 document()->removeMarkers(wordRange.get(), DocumentMarker::Spelling); 1694 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange()) 1695 document()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar); 1696 } 1697 1698 // When continuous spell checking is off, existing markers disappear after the selection changes. 1699 if (!isContinuousSpellCheckingEnabled) 1700 document()->removeMarkers(DocumentMarker::Spelling); 1701 if (!isContinuousGrammarCheckingEnabled) 1702 document()->removeMarkers(DocumentMarker::Grammar); 1730 1703 1731 1704 editor()->respondToChangedSelection(oldSelection); -
trunk/WebCore/page/FrameView.cpp
r40699 r40824 133 133 134 134 if (m_frame) { 135 ASSERT(m_frame->view() != this || !m_frame-> document() || !m_frame->contentRenderer());135 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); 136 136 RenderPart* renderer = m_frame->ownerRenderer(); 137 137 if (renderer && renderer->widget() == this) … … 287 287 // FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles). 288 288 Document* doc = m_frame->document(); 289 if (!doc)290 return ScrollView::createScrollbar(orientation);291 289 292 290 // Try the <body> element first as a scrollbar source. … … 444 442 445 443 Document* document = m_frame->document(); 446 if (!document) {447 // FIXME: Should we set m_size.height here too?448 m_size.setWidth(layoutWidth());449 return;450 }451 444 452 445 m_layoutSchedulingEnabled = false; … … 766 759 { 767 760 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 768 if ( m_frame->document() &&!m_frame->document()->ownerElement())761 if (!m_frame->document()->ownerElement()) 769 762 printf("Layout timer fired at %d\n", m_frame->document()->elapsedTime()); 770 763 #endif … … 774 767 void FrameView::scheduleRelayout() 775 768 { 776 ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());769 ASSERT(!m_frame->document()->inPageCache()); 777 770 ASSERT(m_frame->view() == this); 778 771 … … 785 778 if (!needsLayout()) 786 779 return; 787 if (!m_frame->document() || !m_frame->document()->shouldScheduleLayout())780 if (!m_frame->document()->shouldScheduleLayout()) 788 781 return; 789 782 … … 866 859 || (root && root->needsLayout()) 867 860 || m_layoutRoot 868 || (document && document->hasChangedChild()) // can occur when using WebKit ObjC interface861 || document->hasChangedChild() // can occur when using WebKit ObjC interface 869 862 || m_frame->needsReapplyStyles(); 870 863 } … … 883 876 884 877 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 885 if ( m_frame->document() &&!m_frame->document()->ownerElement())878 if (!m_frame->document()->ownerElement()) 886 879 printf("Layout timer unscheduled at %d\n", m_frame->document()->elapsedTime()); 887 880 #endif … … 1066 1059 // Set our clip rect to be our contents. 1067 1060 IntRect clipRect = contentsToWindow(visibleContentRect(!clipToContents)); 1068 if (!m_frame || !m_frame->document() || !m_frame->document()->ownerElement())1061 if (!m_frame || !m_frame->document()->ownerElement()) 1069 1062 return clipRect; 1070 1063 … … 1192 1185 1193 1186 Document* document = frame()->document(); 1194 if (!document)1195 return;1196 1187 1197 1188 #ifndef NDEBUG 1198 1189 bool fillWithRed; 1199 if (document || document->printing())1190 if (document->printing()) 1200 1191 fillWithRed = false; // Printing, don't fill with red (can't remember why). 1201 1192 else if (document->ownerElement()) -
trunk/WebCore/page/Geolocation.cpp
r38409 r40824 63 63 { 64 64 m_service->stopUpdating(); 65 if (m_frame->document()) 66 m_frame->document()->setUsingGeolocation(false); 65 m_frame->document()->setUsingGeolocation(false); 67 66 m_frame = 0; 68 67 } -
trunk/WebCore/page/Page.cpp
r40793 r40824 94 94 Document* document = frames[i]->document(); 95 95 96 if (!document)97 continue;98 99 96 // If the document does not have a body the event should be dispatched to the document 100 97 Node* eventTarget = document->body(); … … 159 156 160 157 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) { 161 if (frame->document()) 162 frame->document()->documentWillBecomeInactive(); 158 frame->document()->documentWillBecomeInactive(); 163 159 frame->pageDestroyed(); 164 160 } … … 359 355 Frame* frame = mainFrame(); 360 356 do { 361 if (Document* document = frame->document()) 362 document->removeMarkers(DocumentMarker::TextMatch); 357 frame->document()->removeMarkers(DocumentMarker::TextMatch); 363 358 frame = incrementFrame(frame, true, false); 364 359 } while (frame); … … 405 400 m_mediaVolume = volume; 406 401 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) { 407 if (frame->document()) 408 frame->document()->mediaVolumeDidChange(); 402 frame->document()->mediaVolumeDidChange(); 409 403 } 410 404 } -
trunk/WebCore/page/animation/AnimationController.cpp
r40706 r40824 148 148 m_nodeChangesToDispatch.clear(); 149 149 150 if (m_frame && m_frame->document())150 if (m_frame) 151 151 m_frame->document()->updateRendering(); 152 152 } -
trunk/WebCore/page/mac/EventHandlerMac.mm
r38458 r40824 84 84 PlatformKeyboardEvent platformEvent(event); 85 85 platformEvent.disambiguateKeyDownEvent(PlatformKeyboardEvent::RawKeyDown); 86 return KeyboardEvent::create(platformEvent, m_frame->document() ? m_frame->document()->defaultView() : 0);86 return KeyboardEvent::create(platformEvent, m_frame->document()->defaultView()); 87 87 } 88 88 case NSKeyUp: 89 return KeyboardEvent::create(event, m_frame->document() ? m_frame->document()->defaultView() : 0);89 return KeyboardEvent::create(event, m_frame->document()->defaultView()); 90 90 default: 91 91 return 0; … … 141 141 142 142 Document* document = m_frame->document(); 143 if (!document)144 return false;145 143 146 144 // RSS view needs arrow key keypress events. -
trunk/WebCore/page/mac/FrameMac.mm
r40204 r40824 491 491 { 492 492 Document* doc = document(); 493 if (!doc)494 return nil;495 493 496 494 const Vector<DashboardRegionValue>& regions = doc->dashboardRegions(); … … 538 536 delete m_userStyleSheetLoader; 539 537 m_userStyleSheetLoader = 0; 540 if (m_doc && m_doc->docLoader())538 if (m_doc->docLoader()) 541 539 m_userStyleSheetLoader = new UserStyleSheetLoader(m_doc, url.string()); 542 540 } … … 546 544 delete m_userStyleSheetLoader; 547 545 m_userStyleSheetLoader = 0; 548 if (m_doc) 549 m_doc->setUserStyleSheet(styleSheet); 546 m_doc->setUserStyleSheet(styleSheet); 550 547 } 551 548 -
trunk/WebCore/storage/LocalStorageArea.cpp
r38094 r40824 220 220 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { 221 221 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 222 if (Document* document = frame->document()) 223 if (document->securityOrigin()->equal(securityOrigin())) 224 frames.append(frame); 222 if (frame->document()->securityOrigin()->equal(securityOrigin())) 223 frames.append(frame); 225 224 } 226 225 } -
trunk/WebCore/storage/SessionStorageArea.cpp
r38094 r40824 76 76 Vector<RefPtr<Frame> > frames; 77 77 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 78 if (Document* document = frame->document()) 79 if (document->securityOrigin()->equal(securityOrigin())) 80 frames.append(frame); 78 if (frame->document()->securityOrigin()->equal(securityOrigin())) 79 frames.append(frame); 81 80 } 82 81 -
trunk/WebCore/svg/graphics/SVGImage.cpp
r40508 r40824 104 104 return; 105 105 106 if (!m_frame || !m_frame->document())106 if (!m_frame) 107 107 return; 108 108 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); … … 115 115 bool SVGImage::usesContainerSize() const 116 116 { 117 if (!m_frame || !m_frame->document())117 if (!m_frame) 118 118 return false; 119 119 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); … … 126 126 IntSize SVGImage::size() const 127 127 { 128 if (!m_frame || !m_frame->document())128 if (!m_frame) 129 129 return IntSize(); 130 130 … … 152 152 bool SVGImage::hasRelativeWidth() const 153 153 { 154 if (!m_frame || !m_frame->document())154 if (!m_frame) 155 155 return false; 156 156 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); … … 163 163 bool SVGImage::hasRelativeHeight() const 164 164 { 165 if (!m_frame || !m_frame->document())165 if (!m_frame) 166 166 return false; 167 167 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
Note: See TracChangeset
for help on using the changeset viewer.