Changeset 40824 in webkit


Ignore:
Timestamp:
Feb 10, 2009 9:33:33 AM (15 years ago)
Author:
ap@webkit.org
Message:

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=23867
Eliminate obsolete frame->document() checks

  • page/FrameView.cpp: (WebCore::FrameView::paintContents): Apparently due to a typo (document vs. !document), fillWithRed was always set to false, and other branches were never taken. Removing the check for document restores debug-only red color filling.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::begin): Only call dispatchWindowObjectAvailable() after a document is created. A client can do anything in its delegate method, so we'd need to have frame->document() checks otherwise. DumpRenderTree uses this delegate to add its custom property, and it was crashing due to null document in JSDOMWindowBase::getOwnPropertySlot().
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::getOwnPropertySlot):
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::addEventListener): (WebCore::JSDOMWindow::removeEventListener):
  • bindings/js/JSNavigatorCustom.cpp: (WebCore::needsYouTubeQuirk):
  • bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::execute):
  • bindings/js/ScriptControllerMac.mm: (WebCore::updateRenderingForBindings):
  • dom/Document.cpp: (WebCore::Document::initSecurityContext):
  • editing/Editor.cpp: (WebCore::Editor::deleteWithDirection): (WebCore::Editor::dispatchCPPEvent): (WebCore::Editor::applyStyle): (WebCore::Editor::applyParagraphStyle):
  • editing/EditorCommand.cpp: (WebCore::Editor::Command::execute): (WebCore::Editor::Command::isEnabled): (WebCore::Editor::Command::state): (WebCore::Editor::Command::value):
  • editing/SelectionController.cpp: (WebCore::SelectionController::recomputeCaretRect): (WebCore::SelectionController::selectFrameElementInParentIfFullySelected): (WebCore::SelectionController::selectAll): (WebCore::SelectionController::setFocused):
  • inspector/InspectorController.cpp: (WebCore::getResourceDocumentNode):
  • inspector/JavaScriptDebugServer.cpp: (WebCore::JavaScriptDebugServer::setJavaScriptPaused):
  • loader/DocumentLoader.cpp: (WebCore::canonicalizedTitle): (WebCore::DocumentLoader::stopLoading): (WebCore::DocumentLoader::isLoadingInAPISense): (WebCore::DocumentLoader::subresource): (WebCore::DocumentLoader::getSubresources):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::stop): (WebCore::FrameLoader::iconURL): (WebCore::FrameLoader::executeIfJavaScriptURL): (WebCore::FrameLoader::clear): (WebCore::FrameLoader::endIfNotLoadingMainResource): (WebCore::FrameLoader::restoreDocumentState): (WebCore::FrameLoader::gotoAnchor): (WebCore::FrameLoader::loadDone): (WebCore::FrameLoader::checkCompleted): (WebCore::FrameLoader::checkCallImplicitClose): (WebCore::FrameLoader::scheduleRefresh): (WebCore::FrameLoader::outgoingOrigin): (WebCore::FrameLoader::canCachePageContainingThisFrame): (WebCore::FrameLoader::logCanCacheFrameDecision): (WebCore::FrameLoader::updatePolicyBaseURL): (WebCore::FrameLoader::setPolicyBaseURL): (WebCore::FrameLoader::frameDetached): (WebCore::FrameLoader::shouldScrollToAnchor): (WebCore::FrameLoader::saveDocumentState):
  • loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create):
  • loader/icon/IconFetcher.cpp: (WebCore::IconFetcher::create):
  • loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading):
  • page/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::visiblePositionForPoint):
  • page/Chrome.cpp: (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::sessionStorage): (WebCore::DOMWindow::alert): (WebCore::DOMWindow::confirm): (WebCore::DOMWindow::prompt): (WebCore::DOMWindow::scrollX): (WebCore::DOMWindow::scrollY): (WebCore::DOMWindow::getMatchedCSSRules): (WebCore::DOMWindow::openDatabase): (WebCore::DOMWindow::scrollBy): (WebCore::DOMWindow::scrollTo):
  • page/EventHandler.cpp: (WebCore::EventHandler::allowDHTMLDrag): (WebCore::EventHandler::scrollOverflow): (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::updateDragAndDrop): (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::sendContextMenuEvent): (WebCore::EventHandler::capsLockStateMayHaveChanged): (WebCore::EventHandler::sendResizeEvent): (WebCore::EventHandler::sendScrollEvent):
  • page/FocusController.cpp: (WebCore::deepFocusableNode): (WebCore::FocusController::advanceFocus):
  • page/Frame.cpp: (WebCore::Frame::setFocusedNodeIfNeeded): (WebCore::Frame::shouldApplyTextZoom): (WebCore::Frame::shouldApplyPageZoom): (WebCore::Frame::setZoomFactor): (WebCore::Frame::setPrinting): (WebCore::Frame::reapplyStyles): (WebCore::Frame::isContentEditable): (WebCore::Frame::computeAndSetTypingStyle): (WebCore::Frame::selectionComputedStyle): (WebCore::Frame::applyEditingStyleToBodyElement): (WebCore::Frame::removeEditingStyleFromBodyElement): (WebCore::Frame::contentRenderer): (WebCore::Frame::styleForSelectionStart): (WebCore::Frame::setSelectionFromNone): (WebCore::Frame::findString): (WebCore::Frame::markAllMatchesForText): (WebCore::Frame::setMarkedTextMatchesAreHighlighted): (WebCore::Frame::documentTypeString): (WebCore::Frame::shouldClose): (WebCore::Frame::respondToChangedSelection):
  • page/FrameView.cpp: (WebCore::FrameView::~FrameView): (WebCore::FrameView::createScrollbar): (WebCore::FrameView::layout): (WebCore::FrameView::layoutTimerFired): (WebCore::FrameView::scheduleRelayout): (WebCore::FrameView::needsLayout): (WebCore::FrameView::unscheduleRelayout): (WebCore::FrameView::windowClipRect):
  • page/Geolocation.cpp: (WebCore::Geolocation::disconnectFrame):
  • page/Page.cpp: (WebCore::networkStateChanged): (WebCore::Page::~Page): (WebCore::Page::unmarkAllTextMatches): (WebCore::Page::setMediaVolume):
  • page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::updateRenderingDispatcherFired):
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::currentKeyboardEvent): (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks):
  • page/mac/FrameMac.mm: (WebCore::Frame::dashboardRegionsDictionary): (WebCore::Frame::setUserStyleSheetLocation): (WebCore::Frame::setUserStyleSheet):
  • storage/LocalStorageArea.cpp: (WebCore::LocalStorageArea::dispatchStorageEvent):
  • storage/SessionStorageArea.cpp: (WebCore::SessionStorageArea::dispatchStorageEvent):
  • svg/graphics/SVGImage.cpp: (WebCore::SVGImage::setContainerSize): (WebCore::SVGImage::usesContainerSize): (WebCore::SVGImage::size): (WebCore::SVGImage::hasRelativeWidth): (WebCore::SVGImage::hasRelativeHeight): Removed frame->document() checks.
Location:
trunk/WebCore
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r40823 r40824  
     12009-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
    11722009-02-10  Adam Treat  <adam.treat@torchmobile.com>
    2173
  • trunk/WebCore/bindings/js/JSDOMWindowBase.cpp

    r40541 r40824  
    610610    // Allow shortcuts like 'Image1' instead of document.images.Image1
    611611    Document* document = impl()->frame()->document();
    612     if (document && document->isHTMLDocument()) {
     612    if (document->isHTMLDocument()) {
    613613        AtomicStringImpl* atomicPropertyName = AtomicString::find(propertyName);
    614614        if (atomicPropertyName && (static_cast<HTMLDocument*>(document)->hasNamedItem(atomicPropertyName) || document->hasElementWithId(atomicPropertyName))) {
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r40508 r40824  
    269269        return jsUndefined();
    270270
    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));
    275273
    276274    return jsUndefined();
     
    283281        return jsUndefined();
    284282
    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));
    289285
    290286    return jsUndefined();
  • trunk/WebCore/bindings/js/JSNavigatorCustom.cpp

    r39670 r40824  
    7777
    7878    Document* document = frame->document();
    79     // FIXME: The document is never null, so we should remove this check along with the
    80     // other similar ones in this file when we are absolutely sure it's safe.
    81     if (!document)
    82         return false;
    8379
    8480    // Do the quirk only on the front page of the global version of YouTube.
  • trunk/WebCore/bindings/js/ScheduledAction.cpp

    r40046 r40824  
    133133    // for all possible entry points that might possibly execute script, but this seems
    134134    // to be a bit too low-level.
    135     if (Document* document = frame->document())
    136         document->updateRendering();
     135    frame->document()->updateRendering();
    137136
    138137    frame->script()->setProcessingTimerCallback(false);
  • trunk/WebCore/bindings/js/ScriptControllerMac.mm

    r40031 r40824  
    158158        return;
    159159
    160     Document* document = frame->document();
    161     if (!document)
    162         return;
    163 
    164     document->updateRendering();
     160    frame->document()->updateRendering();
    165161}
    166162
  • trunk/WebCore/dom/Document.cpp

    r40719 r40824  
    41594159        ownerFrame = m_frame->loader()->opener();
    41604160
    4161     if (ownerFrame && ownerFrame->document()) {
     4161    if (ownerFrame) {
    41624162        m_cookieURL = ownerFrame->document()->cookieURL();
    41634163        // We alias the SecurityOrigins to match Firefox, see Bug 15313
  • trunk/WebCore/editing/Editor.cpp

    r40793 r40824  
    223223bool Editor::deleteWithDirection(SelectionController::EDirection direction, TextGranularity granularity, bool killRing, bool isTypingAction)
    224224{
    225     if (!canEdit() || !m_frame->document())
     225    if (!canEdit())
    226226        return false;
    227227
     
    690690{
    691691    Node* target = m_frame->selection()->start().element();
    692     if (!target && m_frame->document())
     692    if (!target)
    693693        target = m_frame->document()->body();
    694694    if (!target)
     
    719719            break;
    720720        case VisibleSelection::RangeSelection:
    721             if (m_frame->document() && style)
     721            if (style)
    722722                applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction));
    723723            break;
     
    738738        case VisibleSelection::CaretSelection:
    739739        case VisibleSelection::RangeSelection:
    740             if (m_frame->document() && style)
     740            if (style)
    741741                applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties));
    742742            break;
  • trunk/WebCore/editing/EditorCommand.cpp

    r40793 r40824  
    14441444    if (!isEnabled(triggeringEvent)) {
    14451445        // 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)
    14471447            return false;
    14481448    }
     
    14631463bool Editor::Command::isEnabled(Event* triggeringEvent) const
    14641464{
    1465     if (!isSupported() || !m_frame || !m_frame->document())
     1465    if (!isSupported() || !m_frame)
    14661466        return false;
    14671467    return m_command->isEnabled(m_frame.get(), triggeringEvent, m_source);
     
    14701470TriState Editor::Command::state(Event* triggeringEvent) const
    14711471{
    1472     if (!isSupported() || !m_frame || !m_frame->document())
     1472    if (!isSupported() || !m_frame)
    14731473        return FalseTriState;
    14741474    return m_command->state(m_frame.get(), triggeringEvent);
     
    14771477String Editor::Command::value(Event* triggeringEvent) const
    14781478{
    1479     if (!isSupported() || !m_frame || !m_frame->document())
     1479    if (!isSupported() || !m_frame)
    14801480        return String();
    14811481    return m_command->value(m_frame.get(), triggeringEvent);
  • trunk/WebCore/editing/SelectionController.cpp

    r40793 r40824  
    831831bool SelectionController::recomputeCaretRect()
    832832{
    833     if (!m_frame || !m_frame->document())
     833    if (!m_frame)
    834834        return false;
    835835       
     
    10441044    // Get to the <iframe> or <frame> (or even <object>) element in the parent frame.
    10451045    Document* doc = m_frame->document();
    1046     if (!doc)
    1047         return;
    10481046    Element* ownerElement = doc->ownerElement();
    10491047    if (!ownerElement)
     
    10731071{
    10741072    Document* document = m_frame->document();
    1075     if (!document)
    1076         return;
    10771073   
    10781074    if (document->focusedNode() && document->focusedNode()->canSelectAll()) {
     
    12081204    focusedOrActiveStateChanged();
    12091205
    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);
    12121207}
    12131208
  • trunk/WebCore/inspector/InspectorController.cpp

    r40794 r40824  
    669669
    670670    Document* document = frame->document();
    671     if (!document)
    672         return undefined;
    673671
    674672    if (document->isPluginDocument() || document->isImageDocument() || document->isMediaDocument())
  • trunk/WebCore/inspector/JavaScriptDebugServer.cpp

    r39880 r40824  
    364364    frame->script()->setPaused(paused);
    365365
    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();
    372371
    373372    setJavaScriptPaused(frame->view(), paused);
  • trunk/WebCore/loader/DocumentLoader.cpp

    r40740 r40824  
    115115   
    116116    // 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());
    119118
    120119    return String::adopt(buffer);
     
    293292        Document* doc = m_frame->document();
    294293       
    295         if (loading || (doc && doc->parsing()))
     294        if (loading || doc->parsing())
    296295            m_frame->loader()->stopLoading(false);
    297296    }
     
    469468        if (!m_subresourceLoaders.isEmpty())
    470469            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())
    473475                return true;
    474             if (Tokenizer* tok = doc->tokenizer())
    475                 if (tok->processingData())
    476                     return true;
    477         }
    478476    }
    479477    return frameLoader()->subframeIsLoading();
     
    553551   
    554552    Document* doc = m_frame->document();
    555     if (!doc)
    556         return archiveResourceForURL(url);
    557553       
    558554    CachedResource* resource = doc->docLoader()->cachedResource(url);
     
    569565
    570566    Document* document = m_frame->document();
    571     if (!document)
    572         return;
    573567
    574568    const DocLoader::DocumentResourceMap& allResources = document->docLoader()->allCachedResources();
  • trunk/WebCore/loader/FrameLoader.cpp

    r40792 r40824  
    411411
    412412    String target = _target;
    413     if (target.isEmpty() && m_frame->document())
     413    if (target.isEmpty())
    414414        target = m_frame->document()->baseTarget();
    415415
     
    646646    RefPtr<Frame> protector(m_frame);
    647647   
    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
    658652    if (m_iconLoader)
    659653        m_iconLoader->stopLoading();
     
    684678
    685679    // 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())
    687681        return KURL(m_frame->document()->iconURL());
    688682
     
    758752
    759753    SecurityOrigin* currentSecurityOrigin = 0;
    760     if (m_frame->document())
    761         currentSecurityOrigin = m_frame->document()->securityOrigin();
     754    currentSecurityOrigin = m_frame->document()->securityOrigin();
    762755
    763756    // FIXME: We should always replace the document, but doing so
     
    816809    m_needsClear = false;
    817810   
    818     if (m_frame->document() && !m_frame->document()->inPageCache()) {
     811    if (!m_frame->document()->inPageCache()) {
    819812        m_frame->document()->cancelParsing();
    820813        m_frame->document()->stopActiveDOMObjects();
     
    913906    RefPtr<SecurityOrigin> forcedSecurityOrigin = origin;
    914907
    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));
    916909    clear(resetScripting, resetScripting);
    917910    if (resetScripting)
    918911        m_frame->script()->updatePlatformScriptObjects();
    919     if (dispatch)
    920         dispatchWindowObjectAvailable();
    921912
    922913    m_needsClear = true;
     
    940931        document = DOMImplementation::createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode());
    941932    m_frame->setDocument(document);
     933
     934    if (dispatch)
     935        dispatchWindowObjectAvailable();
    942936
    943937    document->setURL(m_URL);
     
    10621056void FrameLoader::endIfNotLoadingMainResource()
    10631057{
    1064     if (m_isLoadingMainResource || !m_frame->page())
     1058    if (m_isLoadingMainResource || !m_frame->page() || !m_frame->document())
    10651059        return;
    10661060
     
    10711065
    10721066    // 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();
    10761069#if USE(LOW_BANDWIDTH_DISPLAY)
    1077         if (m_frame->document()->inLowBandwidthDisplay()) {
    1078             m_finishedParsingDuringLowBandwidthDisplay = true;
    1079             switchOutLowBandwidthDisplayIfReady();
    1080         }
     1070    if (m_frame->document()->inLowBandwidthDisplay()) {
     1071        m_finishedParsingDuringLowBandwidthDisplay = true;
     1072        switchOutLowBandwidthDisplayIfReady();
     1073    }
    10811074#endif           
    1082     } else
    1083         // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but
    1084         // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to
    1085         // become true.  An example is when a subframe is a pure text doc, and that subframe is the
    1086         // last one to complete.
    1087         checkCompleted();
    10881075}
    10891076
     
    11971184{
    11981185    Document* doc = m_frame->document();
    1199     if (!doc)
    1200         return;
    12011186       
    12021187    HistoryItem* itemToRestore = 0;
     
    12291214    // and possibly repaint because :target pseudo class may have been
    12301215    // 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())
    12321217        return;
    12331218
     
    12671252void FrameLoader::loadDone()
    12681253{
    1269     if (m_frame->document())
    1270         checkCompleted();
     1254    checkCompleted();
    12711255}
    12721256
     
    12831267
    12841268    // Are we still parsing?
    1285     if (m_frame->document() && m_frame->document()->parsing())
     1269    if (m_frame->document()->parsing())
    12861270        return;
    12871271
    12881272    // 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;
    12921275
    12931276#if USE(LOW_BANDWIDTH_DISPLAY)
    12941277    // 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)
    12961279        return;
    12971280#endif
     
    13391322void FrameLoader::checkCallImplicitClose()
    13401323{
    1341     if (m_didCallImplicitClose || !m_frame->document() || m_frame->document()->parsing())
     1324    if (m_didCallImplicitClose || m_frame->document()->parsing())
    13421325        return;
    13431326
     
    13481331    m_didCallImplicitClose = true;
    13491332    m_wasUnloadEventEmitted = false;
    1350     if (m_frame->document())
    1351         m_frame->document()->implicitClose();
     1333    m_frame->document()->implicitClose();
    13521334}
    13531335
     
    14191401        return;
    14201402
    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;
    14331404    scheduleRedirection(new ScheduledRedirection(type, m_URL.string(), m_outgoingReferrer, true, true, wasUserGesture, true));
    14341405}
     
    16441615    // We need to update the layout before scrolling, otherwise we could
    16451616    // 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();
    16521621 
    16531622    // Scroll nested layers and frames to reveal the anchor.
     
    17881757String FrameLoader::outgoingOrigin() const
    17891758{
    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();
    17941760}
    17951761
     
    18951861        && !m_containsPlugIns
    18961862        && !m_URL.protocolIs("https")
    1897         && m_frame->document()
    18981863        && !m_frame->document()->hasWindowEventListener(eventNames().unloadEvent)
    18991864#if ENABLE(DATABASE)
     
    20382003        if (m_URL.protocolIs("https"))
    20392004            { PCLOG("   -Frame is HTTPS"); cannotCache = true; }
    2040         if (!m_frame->document()) {
    2041             PCLOG("   -There is no Document object");
    2042             cannotCache = true;
    2043             break;
    2044         }
    20452005        if (m_frame->document()->hasWindowEventListener(eventNames().unloadEvent))
    20462006            { PCLOG("   -Frame has an unload event listener"); cannotCache = true; }
     
    20842044void FrameLoader::updatePolicyBaseURL()
    20852045{
    2086     if (m_frame->tree()->parent() && m_frame->tree()->parent()->document())
     2046    if (m_frame->tree()->parent())
    20872047        setPolicyBaseURL(m_frame->tree()->parent()->document()->policyBaseURL());
    20882048    else
     
    20922052void FrameLoader::setPolicyBaseURL(const KURL& url)
    20932053{
    2094     if (m_frame->document())
    2095         m_frame->document()->setPolicyBaseURL(url);
     2054    m_frame->document()->setPolicyBaseURL(url);
    20962055    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
    20972056        child->loader()->setPolicyBaseURL(url);
     
    35233482{
    35243483    stopAllLoaders();
    3525     if (Document* document = m_frame->document())
    3526         document->stopActiveDOMObjects();
     3484    m_frame->document()->stopActiveDOMObjects();
    35273485    detachFromParent();
    35283486}
     
    38813839        // We don't want to just scroll if a link from within a
    38823840        // frameset is trying to reload the frameset into _top.
    3883         && (!m_frame->document() || !m_frame->document()->isFrameSet());
     3841        && !m_frame->document()->isFrameSet();
    38843842}
    38853843
     
    44534411    ASSERT(document);
    44544412   
    4455     if (document && item->isCurrentDocument(document)) {
     4413    if (item->isCurrentDocument(document)) {
    44564414        LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->name().string().utf8().data(), item);
    44574415        item->setDocumentState(document->formElementsState());
  • trunk/WebCore/loader/archive/cf/LegacyWebArchive.cpp

    r40746 r40824  
    507507             (childFrame = static_cast<HTMLFrameOwnerElement*>(*it)->contentFrame())) {
    508508            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());
    513510           
    514511            if (subframeArchive)
  • trunk/WebCore/loader/icon/IconFetcher.cpp

    r39880 r40824  
    102102{
    103103    Document* document = frame->document();
    104     if (!document)
    105         return 0;
    106104   
    107105    HTMLHeadElement* head = document->head();
  • trunk/WebCore/loader/icon/IconLoader.cpp

    r40335 r40824  
    6262    if (m_resourceLoader)
    6363        return;
    64 
    65     // FIXME: http://bugs.webkit.org/show_bug.cgi?id=10902
    66     // 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     }
    7264
    7365    // Set flag so we can detect the case where the load completes before
  • trunk/WebCore/page/AccessibilityRenderObject.cpp

    r40793 r40824  
    17711771        if (!frame)
    17721772            break;
    1773         Document* document = frame->document();
    1774         if (!document)
    1775             break;
    1776         renderView = document->renderView();
     1773        renderView = frame->document()->renderView();
    17771774        frameView = static_cast<FrameView*>(widget);
    17781775    }
  • trunk/WebCore/page/Chrome.cpp

    r40017 r40824  
    458458
    459459#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();
    464462#endif
    465463        }
     
    479477
    480478#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();
    485481#endif
    486482        }
  • trunk/WebCore/page/DOMWindow.cpp

    r40768 r40824  
    325325
    326326    Document* document = m_frame->document();
    327     if (!document)
    328         return 0;
    329327
    330328    RefPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin());
     
    499497        return;
    500498
    501     Document* doc = m_frame->document();
    502     ASSERT(doc);
    503     if (doc)
    504         doc->updateRendering();
     499    m_frame->document()->updateRendering();
    505500
    506501    Page* page = m_frame->page();
     
    516511        return false;
    517512
    518     Document* doc = m_frame->document();
    519     ASSERT(doc);
    520     if (doc)
    521         doc->updateRendering();
     513    m_frame->document()->updateRendering();
    522514
    523515    Page* page = m_frame->page();
     
    533525        return String();
    534526
    535     Document* doc = m_frame->document();
    536     ASSERT(doc);
    537     if (doc)
    538         doc->updateRendering();
     527    m_frame->document()->updateRendering();
    539528
    540529    Page* page = m_frame->page();
     
    644633        return 0;
    645634
    646     Document* doc = m_frame->document();
    647     ASSERT(doc);
    648     if (doc)
    649         doc->updateLayoutIgnorePendingStylesheets();
     635    m_frame->document()->updateLayoutIgnorePendingStylesheets();
    650636
    651637    return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());
     
    661647        return 0;
    662648
    663     Document* doc = m_frame->document();
    664     ASSERT(doc);
    665     if (doc)
    666         doc->updateLayoutIgnorePendingStylesheets();
     649    m_frame->document()->updateLayoutIgnorePendingStylesheets();
    667650
    668651    return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor());
     
    798781
    799782    Document* doc = m_frame->document();
    800     ASSERT(doc);
    801     if (!doc)
    802         return 0;
    803783
    804784    if (!pseudoElt.isEmpty())
     
    826806
    827807    Document* doc = m_frame->document();
    828     ASSERT(doc);
    829     if (!doc)
    830         return 0;
    831808
    832809    Settings* settings = m_frame->settings();
     
    843820        return;
    844821
    845     Document* doc = m_frame->document();
    846     ASSERT(doc);
    847     if (doc)
    848         doc->updateLayoutIgnorePendingStylesheets();
     822    m_frame->document()->updateLayoutIgnorePendingStylesheets();
    849823
    850824    FrameView* view = m_frame->view();
     
    860834        return;
    861835
    862     Document* doc = m_frame->document();
    863     ASSERT(doc);
    864     if (doc)
    865         doc->updateLayoutIgnorePendingStylesheets();
     836    m_frame->document()->updateLayoutIgnorePendingStylesheets();
    866837
    867838    FrameView* view = m_frame->view();
  • trunk/WebCore/page/EventHandler.cpp

    r40793 r40824  
    686686void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
    687687{
    688     if (!m_frame || !m_frame->document()) {
     688    if (!m_frame) {
    689689        flagDHTML = false;
    690690        flagUA = false;
     
    792792bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity granularity)
    793793{
    794     if (!m_frame->document())
    795         return false;
    796    
    797794    Node* node = m_frame->document()->focusedNode();
    798795    if (!node)
     
    10031000bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
    10041001{
    1005     if (!m_frame->document())
    1006         return false;
    1007 
    10081002    RefPtr<FrameView> protector(m_frame->view());
    10091003
     
    11271121bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEvent)
    11281122{
    1129     if (!m_frame->document())
    1130         return false;
    1131 
    11321123    RefPtr<FrameView> protector(m_frame->view());
    11331124
     
    11861177    // builds, if it happens.
    11871178    ASSERT(m_frame);
    1188     if (!m_frame || !m_frame->document())
     1179    if (!m_frame)
    11891180        return false;
    11901181
     
    12841275bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
    12851276{
    1286     if (!m_frame->document())
    1287         return false;
    1288 
    12891277    RefPtr<FrameView> protector(m_frame->view());
    12901278
     
    13551343{
    13561344    bool accept = false;
    1357 
    1358     if (!m_frame->document())
    1359         return false;
    13601345
    13611346    if (!m_frame->view())
     
    16011586{
    16021587    Document* doc = m_frame->document();
    1603     if (!doc)
    1604         return false;
    16051588
    16061589    RenderObject* docRenderer = doc->renderer();
     
    16531636    Document* doc = m_frame->document();
    16541637    FrameView* v = m_frame->view();
    1655     if (!doc || !v)
     1638    if (!v)
    16561639        return false;
    16571640   
     
    22382221void EventHandler::capsLockStateMayHaveChanged()
    22392222{
    2240     if (Document* d = m_frame->document())
    2241         if (Node* node = d->focusedNode())
    2242             if (RenderObject* r = node->renderer())
    2243                 r->capsLockStateMayHaveChanged();
     2223    Document* d = m_frame->document();
     2224    if (Node* node = d->focusedNode())
     2225        if (RenderObject* r = node->renderer())
     2226            r->capsLockStateMayHaveChanged();
    22442227}
    22452228
     
    22732256void EventHandler::sendResizeEvent()
    22742257{
    2275     if (Document* doc = m_frame->document())
    2276         doc->dispatchWindowEvent(eventNames().resizeEvent, false, false);
     2258    m_frame->document()->dispatchWindowEvent(eventNames().resizeEvent, false, false);
    22772259}
    22782260
     
    22832265        return;
    22842266    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);
    22892268}
    22902269
  • trunk/WebCore/page/FocusController.cpp

    r38094 r40824  
    9191
    9292        Document* document = owner->contentFrame()->document();
    93         if (!document)
    94             break;
    9593
    9694        node = (direction == FocusDirectionForward)
     
    116114    ASSERT(frame);
    117115    Document* document = frame->document();
    118     if (!document)
    119         return false;
    120116
    121117    Node* node = (direction == FocusDirectionForward)
     
    130126
    131127        Document* parentDocument = parentFrame->document();
    132         if (!parentDocument)
    133             break;
    134128
    135129        HTMLFrameOwnerElement* owner = frame->ownerElement();
     
    156150
    157151        // Chrome doesn't want focus, so we should wrap focus.
    158         if (Document* d = m_page->mainFrame()->document())
    159             node = (direction == FocusDirectionForward)
    160                 ? d->nextFocusableNode(0, event)
    161                 : d->previousFocusableNode(0, event);
     152        Document* d = m_page->mainFrame()->document();
     153        node = (direction == FocusDirectionForward)
     154            ? d->nextFocusableNode(0, event)
     155            : d->previousFocusableNode(0, event);
    162156
    163157        node = deepFocusableNode(direction, node, event);
  • trunk/WebCore/page/Frame.cpp

    r40793 r40824  
    567567void Frame::setFocusedNodeIfNeeded()
    568568{
    569     if (!document() || selection()->isNone() || !selection()->isFocusedAndActive())
     569    if (selection()->isNone() || !selection()->isFocusedAndActive())
    570570        return;
    571571
     
    697697        return false;
    698698#if ENABLE(SVG)
    699     if (m_doc && m_doc->isSVGDocument())
     699    if (m_doc->isSVGDocument())
    700700        return false;
    701701#endif
     
    708708        return false;
    709709#if ENABLE(SVG)
    710     if (m_doc && m_doc->isSVGDocument())
     710    if (m_doc->isSVGDocument())
    711711        return false;
    712712#endif
     
    722722    // SVG doesn't care if the zoom factor is text only.  It will always apply a
    723723    // zoom to the whole SVG.
    724     if (m_doc && m_doc->isSVGDocument()) {
     724    if (m_doc->isSVGDocument()) {
    725725        if (!static_cast<SVGDocument*>(m_doc.get())->zoomAndPanEnabled())
    726726            return;
     
    736736    m_page->settings()->setZoomsTextOnly(isTextOnly);
    737737
    738     if (m_doc)
    739         m_doc->recalcStyle(Node::Force);
     738    m_doc->recalcStyle(Node::Force);
    740739
    741740    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
    742741        child->setZoomFactor(m_zoomFactor, isTextOnly);
    743742
    744     if (m_doc && m_doc->renderer() && m_doc->renderer()->needsLayout() && view()->didFirstLayout())
     743    if (m_doc->renderer() && m_doc->renderer()->needsLayout() && view()->didFirstLayout())
    745744        view()->layout();
    746745}
     
    748747void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize)
    749748{
    750     if (!m_doc)
    751         return;
    752 
    753749    m_doc->setPrinting(printing);
    754750    view()->setMediaType(printing ? "print" : "screen");
     
    809805    // "reapplyStyles". We should probably eventually move it into its own
    810806    // 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());
    813808       
    814809#if FRAME_LOADS_USER_STYLESHEET
     
    824819    // But we had problems when this code was removed. Details are in
    825820    // <http://bugs.webkit.org/show_bug.cgi?id=8079>.
    826     if (m_doc)
    827         m_doc->updateStyleSelector();
     821    m_doc->updateStyleSelector();
    828822}
    829823
     
    848842    if (m_editor.clientIsEditable())
    849843        return true;
    850     if (!m_doc)
    851         return false;
    852844    return m_doc->inDesignMode();
    853845}
     
    918910    RefPtr<CSSMutableStyleDeclaration> blockStyle = mutableStyle->copyBlockProperties();
    919911    blockStyle->diff(mutableStyle.get());
    920     if (document() && blockStyle->length() > 0)
     912    if (blockStyle->length() > 0)
    921913        applyCommand(ApplyStyleCommand::create(document(), blockStyle.get(), editingAction));
    922914   
     
    946938{
    947939    nodeToRemove = 0;
    948 
    949     if (!document())
    950         return 0;
    951940
    952941    if (selection()->isNone())
     
    10331022void Frame::applyEditingStyleToBodyElement() const
    10341023{
    1035     if (!m_doc)
    1036         return;
    1037        
    10381024    RefPtr<NodeList> list = m_doc->getElementsByTagName("body");
    10391025    unsigned len = list->length();
     
    10451031void Frame::removeEditingStyleFromBodyElement() const
    10461032{
    1047     if (!m_doc)
    1048         return;
    1049        
    10501033    RefPtr<NodeList> list = m_doc->getElementsByTagName("body");
    10511034    unsigned len = list->length();
     
    11281111{
    11291112    Document* doc = document();
    1130     if (!doc)
    1131         return 0;
    11321113    RenderObject* object = doc->renderer();
    11331114    if (!object)
     
    13271308    nodeToRemove = 0;
    13281309   
    1329     if (!document())
    1330         return 0;
    13311310    if (selection()->isNone())
    13321311        return 0;
     
    13651344    // entire WebView is editable or designMode is on for this document).
    13661345    Document *doc = document();
    1367     if (!doc || !selection()->isNone() || !isContentEditable())
     1346    if (!selection()->isNone() || !isContentEditable())
    13681347        return;
    13691348       
     
    13881367bool Frame::findString(const String& target, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection)
    13891368{
    1390     if (target.isEmpty() || !document())
     1369    if (target.isEmpty())
    13911370        return false;
    13921371   
     
    14741453unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsigned limit)
    14751454{
    1476     if (target.isEmpty() || !document())
     1455    if (target.isEmpty())
    14771456        return 0;
    14781457   
     
    15171496    // each text match.
    15181497    Document* doc = document();
    1519     if (doc && m_view && contentRenderer()) {
     1498    if (m_view && contentRenderer()) {
    15201499        doc->updateLayout(); // Ensure layout is up to date.
    15211500        IntRect visibleRect = m_view->visibleContentRect();
     
    15371516void Frame::setMarkedTextMatchesAreHighlighted(bool flag)
    15381517{
    1539     if (flag == m_highlightTextMatches || !document())
     1518    if (flag == m_highlightTextMatches)
    15401519        return;
    15411520   
     
    16171596String Frame::documentTypeString() const
    16181597{
    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);
    16231600
    16241601    return String();
     
    16541631
    16551632    RefPtr<Document> doc = document();
    1656     if (!doc)
    1657         return true;
    16581633    HTMLElement* body = doc->body();
    16591634    if (!body)
     
    16641639    doc->handleWindowEvent(beforeUnloadEvent.get(), false);
    16651640
    1666     if (!beforeUnloadEvent->defaultPrevented() && doc)
     1641    if (!beforeUnloadEvent->defaultPrevented())
    16671642        doc->defaultEventHandler(beforeUnloadEvent.get());
    16681643    if (beforeUnloadEvent->result().isNull())
     
    16851660void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping)
    16861661{
    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);
    17131686                }
    17141687            }
    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);
    17301703
    17311704    editor()->respondToChangedSelection(oldSelection);
  • trunk/WebCore/page/FrameView.cpp

    r40699 r40824  
    133133
    134134    if (m_frame) {
    135         ASSERT(m_frame->view() != this || !m_frame->document() || !m_frame->contentRenderer());
     135        ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
    136136        RenderPart* renderer = m_frame->ownerRenderer();
    137137        if (renderer && renderer->widget() == this)
     
    287287    // FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles).
    288288    Document* doc = m_frame->document();
    289     if (!doc)
    290         return ScrollView::createScrollbar(orientation);
    291289
    292290    // Try the <body> element first as a scrollbar source.
     
    444442
    445443    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     }
    451444
    452445    m_layoutSchedulingEnabled = false;
     
    766759{
    767760#ifdef INSTRUMENT_LAYOUT_SCHEDULING
    768     if (m_frame->document() && !m_frame->document()->ownerElement())
     761    if (!m_frame->document()->ownerElement())
    769762        printf("Layout timer fired at %d\n", m_frame->document()->elapsedTime());
    770763#endif
     
    774767void FrameView::scheduleRelayout()
    775768{
    776     ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());
     769    ASSERT(!m_frame->document()->inPageCache());
    777770    ASSERT(m_frame->view() == this);
    778771
     
    785778    if (!needsLayout())
    786779        return;
    787     if (!m_frame->document() || !m_frame->document()->shouldScheduleLayout())
     780    if (!m_frame->document()->shouldScheduleLayout())
    788781        return;
    789782
     
    866859        || (root && root->needsLayout())
    867860        || m_layoutRoot
    868         || (document && document->hasChangedChild()) // can occur when using WebKit ObjC interface
     861        || document->hasChangedChild() // can occur when using WebKit ObjC interface
    869862        || m_frame->needsReapplyStyles();
    870863}
     
    883876
    884877#ifdef INSTRUMENT_LAYOUT_SCHEDULING
    885     if (m_frame->document() && !m_frame->document()->ownerElement())
     878    if (!m_frame->document()->ownerElement())
    886879        printf("Layout timer unscheduled at %d\n", m_frame->document()->elapsedTime());
    887880#endif
     
    10661059    // Set our clip rect to be our contents.
    10671060    IntRect clipRect = contentsToWindow(visibleContentRect(!clipToContents));
    1068     if (!m_frame || !m_frame->document() || !m_frame->document()->ownerElement())
     1061    if (!m_frame || !m_frame->document()->ownerElement())
    10691062        return clipRect;
    10701063
     
    11921185   
    11931186    Document* document = frame()->document();
    1194     if (!document)
    1195         return;
    11961187
    11971188#ifndef NDEBUG
    11981189    bool fillWithRed;
    1199     if (document || document->printing())
     1190    if (document->printing())
    12001191        fillWithRed = false; // Printing, don't fill with red (can't remember why).
    12011192    else if (document->ownerElement())
  • trunk/WebCore/page/Geolocation.cpp

    r38409 r40824  
    6363{
    6464    m_service->stopUpdating();
    65     if (m_frame->document())
    66         m_frame->document()->setUsingGeolocation(false);
     65    m_frame->document()->setUsingGeolocation(false);
    6766    m_frame = 0;
    6867}
  • trunk/WebCore/page/Page.cpp

    r40793 r40824  
    9494        Document* document = frames[i]->document();
    9595       
    96         if (!document)
    97             continue;
    98 
    9996        // If the document does not have a body the event should be dispatched to the document
    10097        Node* eventTarget = document->body();
     
    159156   
    160157    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    161         if (frame->document())
    162             frame->document()->documentWillBecomeInactive();
     158        frame->document()->documentWillBecomeInactive();
    163159        frame->pageDestroyed();
    164160    }
     
    359355    Frame* frame = mainFrame();
    360356    do {
    361         if (Document* document = frame->document())
    362             document->removeMarkers(DocumentMarker::TextMatch);
     357        frame->document()->removeMarkers(DocumentMarker::TextMatch);
    363358        frame = incrementFrame(frame, true, false);
    364359    } while (frame);
     
    405400    m_mediaVolume = volume;
    406401    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    407         if (frame->document())
    408             frame->document()->mediaVolumeDidChange();
     402        frame->document()->mediaVolumeDidChange();
    409403    }
    410404}
  • trunk/WebCore/page/animation/AnimationController.cpp

    r40706 r40824  
    148148    m_nodeChangesToDispatch.clear();
    149149   
    150     if (m_frame && m_frame->document())
     150    if (m_frame)
    151151        m_frame->document()->updateRendering();
    152152}
  • trunk/WebCore/page/mac/EventHandlerMac.mm

    r38458 r40824  
    8484            PlatformKeyboardEvent platformEvent(event);
    8585            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());
    8787        }
    8888        case NSKeyUp:
    89             return KeyboardEvent::create(event, m_frame->document() ? m_frame->document()->defaultView() : 0);
     89            return KeyboardEvent::create(event, m_frame->document()->defaultView());
    9090        default:
    9191            return 0;
     
    141141   
    142142    Document* document = m_frame->document();
    143     if (!document)
    144         return false;
    145143
    146144    // RSS view needs arrow key keypress events.
  • trunk/WebCore/page/mac/FrameMac.mm

    r40204 r40824  
    491491{
    492492    Document* doc = document();
    493     if (!doc)
    494         return nil;
    495493
    496494    const Vector<DashboardRegionValue>& regions = doc->dashboardRegions();
     
    538536    delete m_userStyleSheetLoader;
    539537    m_userStyleSheetLoader = 0;
    540     if (m_doc && m_doc->docLoader())
     538    if (m_doc->docLoader())
    541539        m_userStyleSheetLoader = new UserStyleSheetLoader(m_doc, url.string());
    542540}
     
    546544    delete m_userStyleSheetLoader;
    547545    m_userStyleSheetLoader = 0;
    548     if (m_doc)
    549         m_doc->setUserStyleSheet(styleSheet);
     546    m_doc->setUserStyleSheet(styleSheet);
    550547}
    551548
  • trunk/WebCore/storage/LocalStorageArea.cpp

    r38094 r40824  
    220220    for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
    221221        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);
    225224        }
    226225    }
  • trunk/WebCore/storage/SessionStorageArea.cpp

    r38094 r40824  
    7676    Vector<RefPtr<Frame> > frames;
    7777    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);
    8180    }
    8281       
  • trunk/WebCore/svg/graphics/SVGImage.cpp

    r40508 r40824  
    104104        return;
    105105
    106     if (!m_frame || !m_frame->document())
     106    if (!m_frame)
    107107        return;
    108108    SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
     
    115115bool SVGImage::usesContainerSize() const
    116116{
    117     if (!m_frame || !m_frame->document())
     117    if (!m_frame)
    118118        return false;
    119119    SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
     
    126126IntSize SVGImage::size() const
    127127{
    128     if (!m_frame || !m_frame->document())
     128    if (!m_frame)
    129129        return IntSize();
    130130   
     
    152152bool SVGImage::hasRelativeWidth() const
    153153{
    154     if (!m_frame || !m_frame->document())
     154    if (!m_frame)
    155155        return false;
    156156    SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
     
    163163bool SVGImage::hasRelativeHeight() const
    164164{
    165     if (!m_frame || !m_frame->document())
     165    if (!m_frame)
    166166        return false;
    167167    SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
Note: See TracChangeset for help on using the changeset viewer.