fix logic
[personal-kdelibs.git] / khtml / rendering / render_inline.h
blobca79180f98b6ed49498aef3d97337b630171b86b
1 /*
2 * This file is part of the render object implementation for KHTML.
4 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
5 * (C) 1999-2003 Antti Koivisto (koivisto@kde.org)
6 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
7 * (C) 2003 Apple Computer, Inc.
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.
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.
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.
26 #ifndef RENDER_INLINE_H
27 #define RENDER_INLINE_H
29 #include "render_flow.h"
31 namespace DOM {
32 class Position;
35 namespace khtml {
37 class RenderInline : public RenderFlow
39 public:
40 RenderInline(DOM::NodeImpl* node) : RenderFlow( node ), m_isContinuation( false ) {}
42 virtual const char *renderName() const;
44 virtual bool isRenderInline() const { return true; }
45 virtual bool isInlineFlow() const { return true; }
46 virtual bool childrenInline() const { return true; }
48 virtual bool isInlineContinuation() const;
50 virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
52 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
53 RenderObject* beforeChild, RenderFlow* oldCont);
55 void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
56 RenderObject* newChild, RenderFlow* oldCont);
58 virtual void setStyle(RenderStyle* _style);
59 virtual void attach();
61 virtual void layout() { setNeedsLayout(false); } // Do nothing for layout()
63 virtual void paint(PaintInfo&, int tx, int ty);
65 virtual bool nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction, bool inside);
67 virtual void calcMinMaxWidth();
69 // overrides RenderObject
70 virtual bool requiresLayer() const { return isRelPositioned(); }
72 virtual short width() const;
73 virtual int height() const;
75 virtual int inlineXPos() const;
76 virtual int inlineYPos() const;
78 // used to calculate offsetWidth/Height. Overridden by inlines (render_flow) to return
79 // the remaining width on a given line (and the height of a single line).
80 virtual int offsetLeft() const;
81 virtual int offsetTop() const;
83 virtual DOM::Position positionForCoordinates(int x, int y);
85 virtual void caretPos(int offset, int flags, int &_x, int &_y, int &width, int &height) const;
86 void paintOutlines(QPainter *p, int tx, int ty);
88 protected:
89 static RenderInline* cloneInline(RenderFlow* src);
90 void paintOutlinePath(QPainter *p, int tx, int ty, const QPoint *begin, const QPoint *end, BorderSide startingBS, int initialDirection, BorderSide endingBS);
92 private:
93 bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
97 } // namespace
99 #endif // RENDER_BLOCK_H