LayoutChildIterator.h [plain text]
#pragma once
#include "LayoutIterator.h"
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
namespace WebCore {
namespace Layout {
template <typename T>
class LayoutChildtIterator : public LayoutIterator<T> {
public:
LayoutChildtIterator(const Container& parent);
LayoutChildtIterator(const Container& parent, const T* current);
LayoutChildtIterator& operator++();
};
template <typename T>
class LayoutChildtIteratorAdapter {
public:
LayoutChildtIteratorAdapter(const Container& parent);
LayoutChildtIterator<T> begin() const;
LayoutChildtIterator<T> end() const;
const T* first() const;
const T* last() const;
private:
const Container& m_parent;
};
template <typename T> LayoutChildtIteratorAdapter<T> childrenOfType(const Container&);
template <typename T>
inline LayoutChildtIterator<T>::LayoutChildtIterator(const Container& parent)
: LayoutIterator<T>(&parent)
{
}
template <typename T>
inline LayoutChildtIterator<T>::LayoutChildtIterator(const Container& parent, const T* current)
: LayoutIterator<T>(&parent, current)
{
}
template <typename T>
inline LayoutChildtIterator<T>& LayoutChildtIterator<T>::operator++()
{
return static_cast<LayoutChildtIterator<T>&>(LayoutIterator<T>::traverseNextSibling());
}
template <typename T>
inline LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter(const Container& parent)
: m_parent(parent)
{
}
template <typename T>
inline LayoutChildtIterator<T> LayoutChildtIteratorAdapter<T>::begin() const
{
return LayoutChildtIterator<T>(m_parent, Traversal::firstChild<T>(m_parent));
}
template <typename T>
inline LayoutChildtIterator<T> LayoutChildtIteratorAdapter<T>::end() const
{
return LayoutChildtIterator<T>(m_parent);
}
template <typename T>
inline const T* LayoutChildtIteratorAdapter<T>::first() const
{
return Traversal::firstChild<T>(m_parent);
}
template <typename T>
inline const T* LayoutChildtIteratorAdapter<T>::last() const
{
return Traversal::lastChild<T>(m_parent);
}
template <typename T>
inline LayoutChildtIteratorAdapter<T> childrenOfType(const Container& parent)
{
return LayoutChildtIteratorAdapter<T>(parent);
}
}
}
#endif