Changeset 79875 in webkit


Ignore:
Timestamp:
Feb 28, 2011 9:51:03 AM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2011-02-28 Andreas Kling <kling@webkit.org>

Reviewed by Darin Adler.

Use Frame::ownerElement() directly where appropriate.
https://bugs.webkit.org/show_bug.cgi?id=55385

Don't take the roundabout way through frame->document->ownerElement
which just checks that the document->frame is non-null.

No new test, refactoring only.

  • editing/SelectionController.cpp: (WebCore::SelectionController::selectFrameElementInParentIfFullySelected):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::dispatchLoadEvent):
  • page/EventHandler.cpp: (WebCore::EventHandler::scrollRecursively): (WebCore::EventHandler::logicalScrollRecursively):
  • page/FrameView.cpp: (WebCore::FrameView::init): (WebCore::FrameView::layout): (WebCore::FrameView::repaintContentRectangle): (WebCore::FrameView::windowClipRect): (WebCore::FrameView::paintContents):
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79873 r79875  
     12011-02-28  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Use Frame::ownerElement() directly where appropriate.
     6        https://bugs.webkit.org/show_bug.cgi?id=55385
     7
     8        Don't take the roundabout way through frame->document->ownerElement
     9        which just checks that the document->frame is non-null.
     10
     11        No new test, refactoring only.
     12
     13        * editing/SelectionController.cpp:
     14        (WebCore::SelectionController::selectFrameElementInParentIfFullySelected):
     15        * loader/FrameLoader.cpp:
     16        (WebCore::FrameLoader::loadWithDocumentLoader):
     17        * page/DOMWindow.cpp:
     18        (WebCore::DOMWindow::dispatchLoadEvent):
     19        * page/EventHandler.cpp:
     20        (WebCore::EventHandler::scrollRecursively):
     21        (WebCore::EventHandler::logicalScrollRecursively):
     22        * page/FrameView.cpp:
     23        (WebCore::FrameView::init):
     24        (WebCore::FrameView::layout):
     25        (WebCore::FrameView::repaintContentRectangle):
     26        (WebCore::FrameView::windowClipRect):
     27        (WebCore::FrameView::paintContents):
     28
    1292011-02-28  Pavel Podivilov  <podivilov@chromium.org>
    230
  • trunk/Source/WebCore/editing/SelectionController.cpp

    r79290 r79875  
    13461346
    13471347    // Get to the <iframe> or <frame> (or even <object>) element in the parent frame.
    1348     Element* ownerElement = m_frame->document()->ownerElement();
     1348    Element* ownerElement = m_frame->ownerElement();
    13491349    if (!ownerElement)
    13501350        return;
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r79855 r79875  
    14841484            loader->setTriggeringAction(NavigationAction(newURL, policyChecker()->loadType(), isFormSubmission));
    14851485
    1486         if (Element* ownerElement = m_frame->document()->ownerElement()) {
     1486        if (Element* ownerElement = m_frame->ownerElement()) {
    14871487            if (!ownerElement->dispatchBeforeLoadEvent(loader->request().url().string())) {
    14881488                continueLoadAfterNavigationPolicy(loader->request(), formState, false);
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r79776 r79875  
    15301530    // This is a DOM extension and is independent of bubbling/capturing rules of
    15311531    // the DOM.
    1532     Element* ownerElement = document()->ownerElement();
     1532    Element* ownerElement = m_frame ? m_frame->ownerElement() : 0;
    15331533    if (ownerElement) {
    15341534        RefPtr<Event> ownerEvent = Event::create(eventNames().loadEvent, false, false);
  • trunk/Source/WebCore/page/EventHandler.cpp

    r79606 r79875  
    10391039    if (!frame)
    10401040        return false;
    1041     return frame->eventHandler()->scrollRecursively(direction, granularity, m_frame->document()->ownerElement());
     1041    return frame->eventHandler()->scrollRecursively(direction, granularity, m_frame->ownerElement());
    10421042}
    10431043
     
    10681068        return false;
    10691069
    1070     return frame->eventHandler()->logicalScrollRecursively(direction, granularity, m_frame->document()->ownerElement());
     1070    return frame->eventHandler()->logicalScrollRecursively(direction, granularity, m_frame->ownerElement());
    10711071}
    10721072
  • trunk/Source/WebCore/page/FrameView.cpp

    r79167 r79875  
    261261
    262262    // Propagate the marginwidth/height and scrolling modes to the view.
    263     Element* ownerElement = m_frame && m_frame->document() ? m_frame->document()->ownerElement() : 0;
     263    Element* ownerElement = m_frame ? m_frame->ownerElement() : 0;
    264264    if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
    265265        HTMLFrameElement* frameElt = static_cast<HTMLFrameElement*>(ownerElement);
     
    829829       
    830830#ifdef INSTRUMENT_LAYOUT_SCHEDULING
    831         if (m_firstLayout && !document->ownerElement())
     831        if (m_firstLayout && !m_frame->ownerElement())
    832832            printf("Elapsed time before first layout: %d\n", document->elapsedTime());
    833833#endif       
     
    14301430void FrameView::repaintContentRectangle(const IntRect& r, bool immediate)
    14311431{
    1432     ASSERT(!m_frame->document()->ownerElement());
     1432    ASSERT(!m_frame->ownerElement());
    14331433
    14341434    double delay = adjustedDeferredRepaintDelay();
     
    20192019    // Set our clip rect to be our contents.
    20202020    IntRect clipRect = contentsToWindow(visibleContentRect(!clipToContents));
    2021     if (!m_frame || !m_frame->document() || !m_frame->document()->ownerElement())
     2021    if (!m_frame || !m_frame->ownerElement())
    20222022        return clipRect;
    20232023
    20242024    // Take our owner element and get the clip rect from the enclosing layer.
    2025     Element* elt = m_frame->document()->ownerElement();
     2025    Element* elt = m_frame->ownerElement();
    20262026    RenderLayer* layer = elt->renderer()->enclosingLayer();
    20272027    // FIXME: layer should never be null, but sometimes seems to be anyway.
     
    22442244    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_frame.get(), rect);
    22452245
    2246     Document* document = frame()->document();
     2246    Document* document = m_frame->document();
    22472247
    22482248#ifndef NDEBUG
     
    22502250    if (document->printing())
    22512251        fillWithRed = false; // Printing, don't fill with red (can't remember why).
    2252     else if (document->ownerElement())
     2252    else if (m_frame->ownerElement())
    22532253        fillWithRed = false; // Subframe, don't fill with red.
    22542254    else if (isTransparent())
     
    22982298
    22992299    bool flatteningPaint = m_paintBehavior & PaintBehaviorFlattenCompositingLayers;
    2300     bool isRootFrame = !document->ownerElement();
     2300    bool isRootFrame = !m_frame->ownerElement();
    23012301    if (flatteningPaint && isRootFrame)
    23022302        notifyWidgetsInAllFrames(WillPaintFlattened);
Note: See TracChangeset for help on using the changeset viewer.