Changeset 187493 in webkit


Ignore:
Timestamp:
Jul 28, 2015, 11:22:53 AM (11 years ago)
Author:
Simon Fraser
Message:

Change markContainingBlocksForLayout() to take an enum, rather than a bool
https://bugs.webkit.org/show_bug.cgi?id=147345

Reviewed by Daniel Bates.

Change markContainingBlocksForLayout to take an enum class for the scheduleRelayout
argument, for better code readability.

  • page/FrameView.cpp:

(WebCore::FrameView::layout):
(WebCore::FrameView::scheduleRelayout):
(WebCore::FrameView::scheduleRelayoutOfSubtree):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::markContainingBlocksForLayout):

  • rendering/RenderObject.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r187492 r187493  
     12015-07-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Change markContainingBlocksForLayout() to take an enum, rather than a bool
     4        https://bugs.webkit.org/show_bug.cgi?id=147345
     5
     6        Reviewed by Daniel Bates.
     7       
     8        Change markContainingBlocksForLayout to take an enum class for the scheduleRelayout
     9        argument, for better code readability.
     10
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::layout):
     13        (WebCore::FrameView::scheduleRelayout):
     14        (WebCore::FrameView::scheduleRelayoutOfSubtree):
     15        * rendering/RenderObject.cpp:
     16        (WebCore::RenderObject::markContainingBlocksForLayout):
     17        * rendering/RenderObject.h:
     18
    1192015-07-27  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebCore/page/FrameView.cpp

    r187134 r187493  
    12141214   
    12151215    if (!allowSubtree && m_layoutRoot) {
    1216         m_layoutRoot->markContainingBlocksForLayout(false);
     1216        m_layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No);
    12171217        m_layoutRoot = nullptr;
    12181218    }
     
    25512551
    25522552    if (m_layoutRoot) {
    2553         m_layoutRoot->markContainingBlocksForLayout(false);
     2553        m_layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No);
    25542554        m_layoutRoot = nullptr;
    25552555    }
     
    26012601
    26022602    if (renderView.needsLayout()) {
    2603         newRelayoutRoot.markContainingBlocksForLayout(false);
     2603        newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No);
    26042604        return;
    26052605    }
     
    26202620    if (!m_layoutRoot) {
    26212621        // Just relayout the subtree.
    2622         newRelayoutRoot.markContainingBlocksForLayout(false);
     2622        newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No);
    26232623        InspectorInstrumentation::didInvalidateLayout(frame());
    26242624        return;
     
    26272627    if (isObjectAncestorContainerOf(m_layoutRoot, &newRelayoutRoot)) {
    26282628        // Keep the current root.
    2629         newRelayoutRoot.markContainingBlocksForLayout(false, m_layoutRoot);
     2629        newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No, m_layoutRoot);
    26302630        ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
    26312631        return;
     
    26342634    if (isObjectAncestorContainerOf(&newRelayoutRoot, m_layoutRoot)) {
    26352635        // Re-root at newRelayoutRoot.
    2636         m_layoutRoot->markContainingBlocksForLayout(false, &newRelayoutRoot);
     2636        m_layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No, &newRelayoutRoot);
    26372637        m_layoutRoot = &newRelayoutRoot;
    26382638        ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
     
    26422642
    26432643    // Just do a full relayout.
    2644     m_layoutRoot->markContainingBlocksForLayout(false);
     2644    m_layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No);
    26452645    m_layoutRoot = nullptr;
    2646     newRelayoutRoot.markContainingBlocksForLayout(false);
     2646    newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No);
    26472647    InspectorInstrumentation::didInvalidateLayout(frame());
    26482648}
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r186474 r187493  
    581581}
    582582
    583 void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderElement* newRoot)
    584 {
    585     ASSERT(!scheduleRelayout || !newRoot);
     583void RenderObject::markContainingBlocksForLayout(ScheduleRelayout scheduleRelayout, RenderElement* newRoot)
     584{
     585    ASSERT(scheduleRelayout == ScheduleRelayout::No || !newRoot);
    586586    ASSERT(!isSetNeedsLayoutForbidden());
    587587
     
    627627            return;
    628628
    629         if (scheduleRelayout && objectIsRelayoutBoundary(ancestor))
     629        if (scheduleRelayout == ScheduleRelayout::Yes && objectIsRelayoutBoundary(ancestor))
    630630            break;
    631631
     
    634634    }
    635635
    636     if (scheduleRelayout && ancestor)
     636    if (scheduleRelayout == ScheduleRelayout::Yes && ancestor)
    637637        scheduleRelayoutForSubtree(*ancestor);
    638638}
  • trunk/Source/WebCore/rendering/RenderObject.h

    r184395 r187493  
    106106};
    107107
     108enum class ScheduleRelayout { No, Yes };
     109
    108110enum MapCoordinatesMode {
    109111    IsFixed             = 1 << 0,
     
    591593    RenderBoxModelObject* offsetParent() const;
    592594
    593     void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderElement* newRoot = nullptr);
     595    void markContainingBlocksForLayout(ScheduleRelayout = ScheduleRelayout::Yes, RenderElement* newRoot = nullptr);
    594596    void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain);
    595597    void clearNeedsLayout();
Note: See TracChangeset for help on using the changeset viewer.