Ignore:
Timestamp:
Nov 4, 2013, 12:46:06 AM (12 years ago)
Author:
[email protected]
Message:

Add an ancestor renderer iterator.
<https://webkit.org/b/123718>

Add ancestor iterators for renderers, analogous to element ancestor
iterators. They walk the chain of parent renderers, stopping at each
ancestor of a certain type.

Just like child renderer iterators, this requires isRendererOfType()
to be implemented for the targeted renderer class.

You use them like this:

auto frameSets = ancestorsOfType<RenderFrameSet>(*this);
for (auto frameSet = frameSets.begin(), end = frameSets.end(); frameSet != end; ++frameSet)

frameSet->thisOrThat();

To complete the patch, I put them to use in a couple of random places.

Reviewed by Antti Koivisto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderFrameSet.cpp

    r158163 r158561  
    33 *           (C) 2000 Simon Hausmann <[email protected]>
    44 *           (C) 2000 Stefan Schimanski ([email protected])
    5  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2005, 2006, 2013 Apple Computer, Inc.
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    3838#include "PaintInfo.h"
    3939#include "RenderFrame.h"
     40#include "RenderIterator.h"
    4041#include "RenderLayer.h"
    4142#include "RenderView.h"
     
    709710{
    710711    m_isResizing = isResizing;
    711     for (auto ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
    712         if (ancestor->isFrameSet())
    713             toRenderFrameSet(ancestor)->m_isChildResizing = isResizing;
    714     }
     712    auto ancestors = ancestorsOfType<RenderFrameSet>(*this);
     713    for (auto ancestor = ancestors.begin(), end = ancestors.end(); ancestor != end; ++ancestor)
     714        ancestor->m_isChildResizing = isResizing;
    715715    frame().eventHandler().setResizingFrameSet(isResizing ? &frameSetElement() : 0);
    716716}
Note: See TracChangeset for help on using the changeset viewer.