Home | History | Annotate | Download | only in dom
      1 /*
      2  * Copyright (C) 1999 Lars Knoll (knoll (at) kde.org)
      3  *           (C) 1999 Antti Koivisto (koivisto (at) kde.org)
      4  *           (C) 2001 Dirk Mueller (mueller (at) 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 
     31 #include "wtf/RefPtr.h"
     32 
     33 namespace WebCore {
     34 
     35 class ContainerNode;
     36 class Node;
     37 class RenderNamedFlowThread;
     38 class RenderObject;
     39 class RenderStyle;
     40 
     41 class NodeRenderingContext {
     42 public:
     43     NodeRenderingContext(Node*, RenderStyle* = 0);
     44 
     45     void createRendererForTextIfNeeded();
     46     void createRendererForElementIfNeeded();
     47 
     48     Node* node() const { return m_node; }
     49     RenderObject* parentRenderer() const;
     50     RenderObject* nextRenderer() const;
     51     RenderObject* previousRenderer() const;
     52 
     53     const RenderStyle* style() const { return m_style.get(); }
     54 
     55 private:
     56     bool shouldCreateRenderer() const;
     57     void moveToFlowThreadIfNeeded();
     58     bool elementInsideRegionNeedsRenderer();
     59 
     60     Node* m_node;
     61     ContainerNode* m_renderingParent;
     62     NodeRenderingTraversal::ParentDetails m_parentDetails;
     63     RefPtr<RenderStyle> m_style;
     64     RenderNamedFlowThread* m_parentFlowRenderer;
     65 };
     66 
     67 } // namespace WebCore
     68 
     69 #endif
     70