blob: c31bb1f66926a874055bc303fc56c65f3bab6144 [file] [log] [blame]
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +01001/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 *
24 */
25
26#ifndef NodeRenderingContext_h
27#define NodeRenderingContext_h
28
29#include "core/dom/NodeRenderingTraversal.h"
30
Ben Murdoch591b9582013-07-10 11:41:44 +010031#include "wtf/RefPtr.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010032
33namespace WebCore {
34
35class ContainerNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010036class Node;
37class RenderNamedFlowThread;
38class RenderObject;
39class RenderStyle;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010040
41class NodeRenderingContext {
42public:
Ben Murdoch83750172013-07-24 10:36:59 +010043 NodeRenderingContext(Node*, RenderStyle* = 0);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010044
45 void createRendererForTextIfNeeded();
46 void createRendererForElementIfNeeded();
47
Ben Murdoch3464d022013-07-25 10:06:57 +010048 Node* node() const { return m_node; }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010049 RenderObject* parentRenderer() const;
50 RenderObject* nextRenderer() const;
51 RenderObject* previousRenderer() const;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010052
Ben Murdoch3464d022013-07-25 10:06:57 +010053 const RenderStyle* style() const { return m_style.get(); }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010054
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010055private:
56 bool shouldCreateRenderer() const;
57 void moveToFlowThreadIfNeeded();
Ben Murdoch591b9582013-07-10 11:41:44 +010058 bool elementInsideRegionNeedsRenderer();
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010059
60 Node* m_node;
61 ContainerNode* m_renderingParent;
62 NodeRenderingTraversal::ParentDetails m_parentDetails;
63 RefPtr<RenderStyle> m_style;
64 RenderNamedFlowThread* m_parentFlowRenderer;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010065};
66
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010067} // namespace WebCore
68
69#endif