RenderNamedFlowThread.h [plain text]
#ifndef RenderNamedFlowThread_h
#define RenderNamedFlowThread_h
#include "RenderFlowThread.h"
#include "Timer.h"
#include <wtf/HashCountedSet.h>
#include <wtf/ListHashSet.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
class Node;
class RenderNamedFlowThread;
class WebKitNamedFlow;
typedef ListHashSet<RenderNamedFlowThread*> RenderNamedFlowThreadList;
typedef HashCountedSet<RenderNamedFlowThread*> RenderNamedFlowThreadCountedSet;
typedef ListHashSet<Node*> NamedFlowContentNodes;
class RenderNamedFlowThread : public RenderFlowThread {
public:
virtual ~RenderNamedFlowThread();
static RenderNamedFlowThread* createAnonymous(Document*, PassRefPtr<WebKitNamedFlow>);
const AtomicString& flowThreadName() const;
const RenderRegionList& invalidRenderRegionList() const { return m_invalidRegionList; }
RenderObject* nextRendererForNode(Node*) const;
RenderObject* previousRendererForNode(Node*) const;
void addFlowChild(RenderObject* newChild);
void removeFlowChild(RenderObject*);
bool hasChildren() const { return !m_flowThreadChildList.isEmpty(); }
#ifndef NDEBUG
bool hasChild(RenderObject* child) const { return m_flowThreadChildList.contains(child); }
#endif
void pushDependencies(RenderNamedFlowThreadList&);
virtual void addRegionToThread(RenderRegion*) OVERRIDE;
virtual void removeRegionFromThread(RenderRegion*) OVERRIDE;
void registerNamedFlowContentNode(Node*);
void unregisterNamedFlowContentNode(Node*);
const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; }
bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); }
bool isMarkedForDestruction() const;
void getRanges(Vector<RefPtr<Range> >&, const RenderRegion*) const;
protected:
void setMarkForDestruction();
void resetMarkForDestruction();
private:
RenderNamedFlowThread(PassRefPtr<WebKitNamedFlow>);
virtual const char* renderName() const OVERRIDE;
virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; }
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
virtual void dispatchRegionLayoutUpdateEvent() OVERRIDE;
bool dependsOn(RenderNamedFlowThread* otherRenderFlowThread) const;
void addDependencyOnFlowThread(RenderNamedFlowThread*);
void removeDependencyOnFlowThread(RenderNamedFlowThread*);
void addRegionToNamedFlowThread(RenderRegion*);
void checkInvalidRegions();
bool canBeDestroyed() const { return m_invalidRegionList.isEmpty() && m_regionList.isEmpty() && m_contentNodes.isEmpty(); }
void regionLayoutUpdateEventTimerFired(Timer<RenderNamedFlowThread>*);
void clearContentNodes();
private:
RenderNamedFlowThreadCountedSet m_observerThreadsSet;
RenderNamedFlowThreadCountedSet m_layoutBeforeThreadsSet;
typedef ListHashSet<RenderObject*> FlowThreadChildList;
FlowThreadChildList m_flowThreadChildList;
NamedFlowContentNodes m_contentNodes;
RenderRegionList m_invalidRegionList;
RefPtr<WebKitNamedFlow> m_namedFlow;
Timer<RenderNamedFlowThread> m_regionLayoutUpdateEventTimer;
};
inline RenderNamedFlowThread* toRenderNamedFlowThread(RenderObject* object)
{
ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowThread());
return static_cast<RenderNamedFlowThread*>(object);
}
inline const RenderNamedFlowThread* toRenderNamedFlowThread(const RenderObject* object)
{
ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderNamedFlowThread());
return static_cast<const RenderNamedFlowThread*>(object);
}
void toRenderNamedFlowThread(const RenderNamedFlowThread*);
}
#endif // RenderNamedFlowThread_h