File indexing completed on 2024-05-05 12:15:58

0001 /*
0002  * This file is part of the render object implementation for KHTML.
0003  *
0004  * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
0005  *           (C) 1999-2003 Antti Koivisto (koivisto@kde.org)
0006  *           (C) 2002-2003 Dirk Mueller (mueller@kde.org)
0007  *           (C) 2003 Apple Computer, Inc.
0008  *
0009  * This library is free software; you can redistribute it and/or
0010  * modify it under the terms of the GNU Library General Public
0011  * License as published by the Free Software Foundation; either
0012  * version 2 of the License, or (at your option) any later version.
0013  *
0014  * This library is distributed in the hope that it will be useful,
0015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017  * Library General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU Library General Public License
0020  * along with this library; see the file COPYING.LIB.  If not, write to
0021  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0022  * Boston, MA 02110-1301, USA.
0023  *
0024  */
0025 
0026 #ifndef RENDER_INLINE_H
0027 #define RENDER_INLINE_H
0028 
0029 #include "render_flow.h"
0030 
0031 namespace khtml
0032 {
0033 
0034 class RenderInline : public RenderFlow
0035 {
0036 public:
0037     RenderInline(DOM::NodeImpl *node) : RenderFlow(node), m_isContinuation(false) {}
0038 
0039     const char *renderName() const override;
0040 
0041     bool isRenderInline() const override
0042     {
0043         return true;
0044     }
0045     bool isInlineFlow() const override
0046     {
0047         return true;
0048     }
0049     bool childrenInline() const override
0050     {
0051         return true;
0052     }
0053 
0054     bool isInlineContinuation() const override;
0055 
0056     void addChildToFlow(RenderObject *newChild, RenderObject *beforeChild) override;
0057 
0058     void splitInlines(RenderBlock *fromBlock, RenderBlock *toBlock, RenderBlock *middleBlock,
0059                       RenderObject *beforeChild, RenderFlow *oldCont);
0060 
0061     void splitFlow(RenderObject *beforeChild, RenderBlock *newBlockBox,
0062                    RenderObject *newChild, RenderFlow *oldCont);
0063 
0064     void setStyle(RenderStyle *_style) override;
0065     void attach() override;
0066 
0067     void layout() override
0068     {
0069         setNeedsLayout(false);    // Do nothing for layout()
0070     }
0071 
0072     void paint(PaintInfo &, int tx, int ty) override;
0073 
0074     bool nodeAtPoint(NodeInfo &info, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction, bool inside) override;
0075 
0076     void calcMinMaxWidth() override;
0077 
0078     // overrides RenderObject
0079     bool requiresLayer() const override
0080     {
0081         return isRelPositioned();
0082     }
0083 
0084     short width() const override;
0085     int height() const override;
0086 
0087     int inlineXPos() const override;
0088     int inlineYPos() const override;
0089 
0090     // used to calculate offsetWidth/Height.  Overridden by inlines (render_flow) to return
0091     // the remaining width on a given line (and the height of a single line).
0092     int offsetLeft() const override;
0093     int offsetTop() const override;
0094 
0095     RenderPosition positionForCoordinates(int x, int y) override;
0096 
0097     void caretPos(int offset, int flags, int &_x, int &_y, int &width, int &height) const override;
0098     void paintOutlines(QPainter *p, int tx, int ty);
0099 
0100 protected:
0101     static RenderInline *cloneInline(RenderFlow *src);
0102     void paintOutlinePath(QPainter *p, int tx, int ty, const QPoint *begin, const QPoint *end, BorderSide startingBS, int initialDirection, BorderSide endingBS);
0103 
0104 private:
0105     bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
0106 
0107 };
0108 
0109 } // namespace
0110 
0111 #endif // RENDER_BLOCK_H
0112