Changeset 73117 in webkit


Ignore:
Timestamp:
Dec 2, 2010 2:12:27 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-02 Mike Lawther <mikelawther@chromium.org>

Reviewed by David Hyatt.

Clean up of iframe scrollbar mode code
https://bugs.webkit.org/show_bug.cgi?id=47797

Pull setChildNeedsLayout/setNeedsLayout calls out of scrollbar mode
calculation method and put back into main layout function.
Early exit from the scrollbar calc when scrollbars are turned off.

  • page/FrameView.cpp: (WebCore::FrameView::calculateScrollbarModesForLayout): (WebCore::FrameView::layout):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73116 r73117  
     12010-12-02  Mike Lawther  <mikelawther@chromium.org>
     2
     3        Reviewed by David Hyatt.
     4
     5        Clean up of iframe scrollbar mode code
     6        https://bugs.webkit.org/show_bug.cgi?id=47797
     7
     8        Pull setChildNeedsLayout/setNeedsLayout calls out of scrollbar mode
     9        calculation method and put back into main layout function.
     10        Early exit from the scrollbar calc when scrollbars are turned off.
     11
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::calculateScrollbarModesForLayout):
     14        (WebCore::FrameView::layout):
     15
    1162010-12-02  Hironori Bono  <hbono@chromium.org>
    217
  • trunk/WebCore/page/FrameView.cpp

    r73063 r73117  
    484484void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode)
    485485{
     486    const HTMLFrameOwnerElement* owner = m_frame->ownerElement();
     487    if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) {
     488        hMode = ScrollbarAlwaysOff;
     489        vMode = ScrollbarAlwaysOff;
     490        return;
     491    } 
     492   
    486493    if (m_canHaveScrollbars) {
    487494        hMode = ScrollbarAuto;
     
    499506        if (body && body->renderer()) {
    500507            if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame->settings()->frameFlatteningEnabled()) {
    501                 body->renderer()->setChildNeedsLayout(true);
    502508                vMode = ScrollbarAlwaysOff;
    503509                hMode = ScrollbarAlwaysOff;
     
    510516        } else if (rootRenderer) {
    511517#if ENABLE(SVG)
    512             if (documentElement->isSVGElement()) {
    513                 if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
    514                     rootRenderer->setChildNeedsLayout(true);
    515             } else
     518            if (!documentElement->isSVGElement()) {
    516519                applyOverflowToViewport(rootRenderer, hMode, vMode);
    517520#else
     
    519522#endif
    520523        }
    521 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
    522         if (m_firstLayout && !document->ownerElement())
    523             printf("Elapsed time before first layout: %d\n", document->elapsedTime());
    524 #endif
    525     }
    526    
    527     HTMLFrameOwnerElement* owner = m_frame->ownerElement();
    528     if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) {
    529         hMode = ScrollbarAlwaysOff;
    530         vMode = ScrollbarAlwaysOff;
    531     }     
     524    }   
     525}
    532526}
    533527   
     
    755749    m_nestedLayoutCount++;
    756750
     751    if (!m_layoutRoot) {
     752        Document* document = m_frame->document();
     753        Node* documentElement = document->documentElement();
     754        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
     755        Node* body = document->body();
     756        if (body && body->renderer()) {
     757            if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame->settings()->frameFlatteningEnabled()) {
     758                body->renderer()->setChildNeedsLayout(true);
     759            } else if (body->hasTagName(bodyTag)) {
     760                if (!m_firstLayout && m_size.height() != layoutHeight() && body->renderer()->enclosingBox()->stretchesToViewport())
     761                    body->renderer()->setChildNeedsLayout(true);
     762            }
     763        } else if (rootRenderer) {
     764#if ENABLE(SVG)
     765            if (documentElement->isSVGElement()) {
     766                if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
     767                    rootRenderer->setChildNeedsLayout(true);
     768            }
     769#endif
     770        }
     771       
     772#ifdef INSTRUMENT_LAYOUT_SCHEDULING
     773        if (m_firstLayout && !document->ownerElement())
     774            printf("Elapsed time before first layout: %d\n", document->elapsedTime());
     775#endif       
     776    }
     777   
    757778    ScrollbarMode hMode;
    758     ScrollbarMode vMode;
    759    
     779    ScrollbarMode vMode;   
    760780    calculateScrollbarModesForLayout(hMode, vMode);
    761781
Note: See TracChangeset for help on using the changeset viewer.