khtml Library API Documentation

render_br.cpp

00001 
00023 #include "render_br.h"
00024 
00025 using namespace khtml;
00026 
00027 
00028 RenderBR::RenderBR(DOM::NodeImpl* node)
00029     : RenderText(node, new DOM::DOMStringImpl(QChar('\n')))
00030 {
00031     m_hasReturn = true;
00032 }
00033 
00034 RenderBR::~RenderBR()
00035 {
00036 }
00037 
00038 void RenderBR::cursorPos(int /*offset*/, int &_x, int &_y, int &height)
00039 {
00040     if (previousSibling() && !previousSibling()->isBR() && !previousSibling()->isFloating()) {
00041         int offset = 0;
00042         if (previousSibling()->isText())
00043             offset = static_cast<RenderText*>(previousSibling())->length();
00044 
00045         previousSibling()->cursorPos(offset,_x,_y,height);
00046         return;
00047     }
00048 
00049     int absx, absy;
00050     absolutePosition(absx,absy);
00051     if (absx == -1) {
00052         // we don't know out absoluate position, and there is not point returning
00053         // just a relative one
00054         _x = _y = -1;
00055     }
00056     else {
00057         _x += absx;
00058         _y += absy;
00059     }
00060     height = RenderText::verticalPositionHint( false );
00061 
00062 }
00063 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:39 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001