KHTML
khtml_caret.cpp
Go to the documentation of this file.
37};
49};
105static inline RenderObject *renderObjectBelow(RenderObject *obj, ObjectTraversalState &trav, RenderObject *base)
125static inline RenderObject *renderObjectAbove(RenderObject *obj, ObjectTraversalState &trav, RenderObject *base)
208kDebug(6200) << "a " << a << " trav " << trav << " origtrav " << origtrav << " ignoreOD " << ignoreOutsideDesc;
431 kDebug(6200) << "mapDTR: child " << child << "@" << (child ? child->nodeName().string() : QString()) << " atEnd " << atEnd;
489 kDebug(6200) << "mapRTD: r " << r << '@' << (r ? r->renderName() : QString()) << (r && r->element() ? QString(".node ") + QString::number((unsigned)r->element(),16) + '@' + r->element()->nodeName().string() : QString()) << " outside " << outside << " outsideEnd " << outsideEnd;
515 kDebug(6200) << node << "@" << (node ? node->nodeName().string() : QString()) << " offset " << offset;
592 kDebug(6200) << "findRenderer: node " << node << " " << (node ? node->nodeName().string() : QString()) << " offset " << offset << " r " << r << "[" << (r ? r->renderName() : QString()) << "] r_ofs " << r_ofs << " outside " << outside << " outsideEnd " << outsideEnd;
674kDebug(6200) << "x " << box->m_x << " y " << box->m_y << " w " << box->m_width << " h " << box->m_height << " baseline " << box->m_baseline << " ifb " << box->isInlineFlowBox() << " itb " << box->isInlineTextBox() << " rlb " << box->isRootInlineBox();
711kDebug(6200) << "this " << this << " flowBox " << flowBox << " firstChild " << flowBox->firstChild();
733kDebug(6200) << "isinlinetextbox " << box << (box->object() ? QString(" contains \"%1\"").arg(QConstString(static_cast<RenderText *>(box->object())->str->s+box->minOffset(), qMin(box->maxOffset() - box->minOffset(), 15L)).string()) : QString());
771void CaretBoxLine::addCreatedFlowBoxInside(InlineFlowBox *flowBox, const QFontMetrics &fm) /*KDE_NO_EXPORT*/
785void CaretBoxLine::addCreatedFlowBoxEdge(InlineFlowBox *flowBox, const QFontMetrics &fm, bool left, bool rtl) /*KDE_NO_EXPORT*/
798void CaretBoxLine::addCreatedInlineBoxEdge(InlineBox *box, const QFontMetrics &fm, bool left, bool rtl) /*KDE_NO_EXPORT*/
973 kDebug(6200) << "node " << node << " offset: " << offset << " r " << r->renderName() << "[" << r << "].node " << r->element()->nodeName().string() << "[" << r->element() << "]" << " r_ofs " << r_ofs << " outside " << outside << " outsideEnd " << outsideEnd;
1002 kDebug(6200) << "text-box b: " << b << " baseFlowBox: " << baseFlowBox << (b && b->object() ? QString(" contains \"%1\"").arg(QConstString(static_cast<RenderText *>(b->object())->str->s+b->minOffset(), qMin(b->maxOffset() - b->minOffset(), 15L)).string()) : QString());
1005 if (t->containingBlock()->isListItem()) dumpLineBoxes(static_cast<RenderFlow *>(t->containingBlock()));
1026 kDebug(6200) << "=================== end findCaretBoxLine (box " << (outside ? (outsideEnd ? "outside end" : "outside begin") : "inside") << ")";
1093 CaretBoxLine *cbl = findCaretBoxLine(nextLeafNode(node, base ? base->element() : 0), 0, cblDeleter, base, r_ofs, caretBoxIt);
1155 kDebug(6201) << "cee: r " << (r ? r->renderName() : QString()) << "@" << r << " cb " << cb << " withinCb " << withinCb << " modWithinCb " << modWithinCb << " tempTable " << tempTable;
1225 kDebug(6201) << "cece: r " << (r ? r->renderName() : QString()) << "@" << r << " cb " << cb << " withinCb " << withinCb << " modWithinCb " << modWithinCb << " tempTable " << tempTable;
1359 kDebug(6200) << "nextBlock: before adv r" << r << ' ' << (r ? r->renderName() : QString()) << (r && r->isText() ? " contains \"" + QString(((RenderText *)r)->str->s, qMin(((RenderText *)r)->str->l,15)) + "\"" : QString()) << " trav " << trav << " cb_outside " << cb_outside << " cb_outside_end " << cb_outside_end;
1369 kDebug(6200) << "nextBlock: after r" << r << " trav " << trav << " cb_outside " << cb_outside << " cb_outside_end " << cb_outside_end;
1395 kDebug(6200) << "++: flowBox " << flowBox << " cb " << cb << '[' << (cb?cb->renderName()+QString(".node ")+QString::number((unsigned)cb->element(),16)+(cb->element()?'@'+cb->element()->nodeName().string():QString()):QString()) << ']';
1428 kDebug(6200) << "prevBlock: before adv r" << r << " " << (r ? r->renderName() : QString()) << (r && r->isText() ? " contains \"" + QString(((RenderText *)r)->str->s, qMin(((RenderText *)r)->str->l,15)) + "\"" : QString()) << " trav " << trav << " cb_outside " << cb_outside << " cb_outside_end " << cb_outside_end;
1438 kDebug(6200) << "prevBlock: after r" << r << " trav " << trav << " cb_outside " << cb_outside << " cb_outside_end " << cb_outside_end;
1465 kDebug(6200) << "--: flowBox " << flowBox << " cb " << cb << "[" << (cb?cb->renderName()+QString(".node ")+QString::number((unsigned)cb->element(),16)+(cb->element()?"@"+cb->element()->nodeName().string():QString()):QString()) << "]";
1486 flowBox = static_cast<InlineFlowBox *>(toBegin ? flowBox->prevLineBox() : flowBox->nextLineBox());
1520// kDebug(6200) << "ebit::advance: before: " << (**this)->object() << "@" << (**this)->object()->renderName() << ".node " << (**this)->object()->element() << "[" << ((**this)->object()->element() ? (**this)->object()->element()->nodeName().string() : QString()) << "] inline " << (**this)->isInline() << " outside " << (**this)->isOutside() << " outsideEnd " << (**this)->isOutsideEnd();
1540 kDebug(6200) << "ebit::advance: " << (*curbox)->object() << "@" << (*curbox)->object()->renderName() << ".node " << (*curbox)->object()->element() << "[" << ((*curbox)->object()->element() ? (*curbox)->object()->element()->nodeName().string() : QString()) << "] inline " << (*curbox)->isInline() << " outside " << (*curbox)->isOutside() << " outsideEnd " << (*curbox)->isOutsideEnd();
1575 kDebug(6200) << "prev " << prev << " haslast " << haslast << " islastuseable " << islastuseable << " left " << left << " next " << next << " hascoming " << hascoming << " iscominguseable " << iscominguseable << " right " << right << " text2indicated " << text2indicated << " indicated2text " << indicated2text;
1591 kDebug(6200) << "inside " << (!ibox->isInlineFlowBox() || static_cast<InlineFlowBox *>(ibox)->firstChild() ? "non-empty" : "empty") << (isIndicatedInlineBox(ibox) ? " indicated" : "") << " adjacent=" << adjacent;
1648// if (b->isInlineFlowBox()) kDebug(6200) << "b is inline flow box" << (outside ? " (outside)" : "");
1649 kDebug(6200) << "isEditable r" << r << ": " << (r ? r->renderName() : QString()) << (r && r->isText() ? " contains \"" + QString(((RenderText *)r)->str->s, qMin(((RenderText *)r)->str->l,15)) + "\"" : QString());
1700 kDebug(6200) << "advance: " << cbl->enclosingObject() << "@" << cbl->enclosingObject()->renderName() << ".node " << cbl->enclosingObject()->element() << "[" << (cbl->enclosingObject()->element() ? cbl->enclosingObject()->element()->nodeName().string() : QString()) << "]";
1775 kDebug(6200) << "box->maxOffset() " << box->maxOffset() << " box->minOffset() " << box->minOffset();
1784kDebug(6200) << "_offset > maxofs: " << _offset << " > " << maxofs /*<< " _peekNext: " << _peekNext*/;
1856kDebug(6200) << "_offset: " << _offset /*<< " _peekNext: " << _peekNext*/ << " char '" << (char)_char << "'";
1863 kDebug(6200) << "echit++(1): box " << box << (box && box->isInlineTextBox() ? QString(" contains \"%1\"").arg(QConstString(static_cast<RenderText *>(box->object())->str->s+box->minOffset(), box->maxOffset() - box->minOffset()).string()) : QString()) << " _r " << (_r ? _r->element()->nodeName().string() : QString("<nil>"));
1880 kDebug(6200) << "box->maxOffset() " << box->maxOffset() << " box->minOffset() " << box->minOffset();
1914kDebug(6200) << "_offset < minofs: " << _offset << " < " << minofs /*<< " _peekNext: " << _peekNext*/;
1930kDebug(6200) << "box " << box << " b " << box->inlineBox() << " isText " << box->isInlineTextBox();
1936 kDebug(6200) << "echit--(2): box " << box << " b " << box->inlineBox() << (box->isInlineTextBox() ? QString(" contains \"%1\"").arg(QConstString(static_cast<RenderText *>(box->object())->str->s+box->minOffset(), box->maxOffset() - box->minOffset()).string()) : QString());
1946 kDebug(6200) << "adjacent " << adjacent << " _peekNext " << _peekNext << " _peekNext->isInlineTextBox: " << (_peekNext ? _peekNext->isInlineTextBox() : false) << " !((*ebit)->isInlineTextBox): " << (*ebit ? !(*ebit)->isInlineTextBox() : true);
1974 kDebug(6200) << "(*ebit)->obj " << (*ebit)->object()->renderName() << "[" << (*ebit)->object() << "]" << " minOffset: " << (*ebit)->minOffset() << " maxOffset: " << (*ebit)->maxOffset();
1992 _char = static_cast<RenderText *>(_peekNext->object())->text()[_peekNext->minOffset()].unicode();
2002 kDebug(6200) << "echit--(1): box " << box << " b " << box->inlineBox() << (box->isInlineTextBox() ? QString(" contains \"%1\"").arg(QConstString(static_cast<RenderText *>(box->object())->str->s+box->minOffset(), box->maxOffset() - box->minOffset()).string()) : QString());
2480// kDebug(6200) << "approximate r" << r << ": " << (r ? r->renderName() : QString()) << (r && r->isText() ? " contains \"" + QString(((RenderText *)r)->str->s, ((RenderText *)r)->str->l) + "\"" : QString());
2574 if (!it.isEnd()) kDebug(6200) << "reading2 '" << (*it).toLatin1().constData() << "' (" << (int)(*it).toLatin1().constData() << ") box " << it.caretBox();
2580 if (!it.isEnd()) kDebug(6200) << "effective '" << (*it).toLatin1().constData() << "' (" << (int)(*it).toLatin1().constData() << ") box " << it.caretBox();
bool isEditable() const
Returns true if the document is editable, false otherwise.
Definition: khtml_part.cpp:2904
Iterates over the elements of a caret box line.
Definition: khtml_caret_p.h:221
CaretBoxIterator & operator++()
increments the iterator to point to the next caret box.
Definition: khtml_caret_p.h:255
CaretBoxIterator & operator--()
decrements the iterator to point to the previous caret box.
Definition: khtml_caret_p.h:258
void addCreatedFlowBoxEdge(InlineFlowBox *flowBox, const QFontMetrics &fm, bool left, bool rtl)
creates and adds the edge of an inline flow box
Definition: khtml_caret.cpp:785
void addCreatedInlineBoxEdge(InlineBox *box, const QFontMetrics &fm, bool left, bool rtl)
creates and adds the edge of a generic inline box
Definition: khtml_caret.cpp:798
bool isOutside() const
returns whether this caret box line is outside.
Definition: khtml_caret_p.h:349
void addCreatedFlowBoxInside(InlineFlowBox *flowBox, const QFontMetrics &fm)
creates and adds the inside of an inline flow box
Definition: khtml_caret.cpp:771
bool isOutsideEnd() const
returns whether this caret box line is at the outside end.
Definition: khtml_caret_p.h:359
static CaretBoxLine * constructCaretBoxLine(MassDeleter< CaretBoxLine > *deleter, InlineFlowBox *baseFlowBox, InlineBox *seekBox, bool seekOutside, bool seekOutsideEnd, CaretBoxIterator &iter, RenderObject *seekObject=0)
constructs a new caret box line out of the given inline flow box
InlineFlowBox * baseFlowBox() const
returns the base inline flow box which the caret boxes of this caret box line have been constructed f...
Definition: khtml_caret_p.h:338
void addConvertedInlineBox(InlineBox *, SeekBoxParams &)
recursively converts the given inline box into caret boxes and adds them to this caret box line.
Definition: khtml_caret.cpp:664
Represents a rectangular box within which the caret is located.
Definition: khtml_caret_p.h:126
bool isInlineTextBox() const
returns true if this caret box represents an inline text box.
Definition: khtml_caret_p.h:178
bool isInline() const
returns the replaced render object if this caret box represents one, 0 otherwise.
Definition: khtml_caret_p.h:175
RenderBlock * containingBlock() const
returns the containing block of this caret box.
Definition: khtml_caret_p.h:165
bool isOutside() const
returns true when this caret box represents an ouside position of an element.
Definition: khtml_caret_p.h:188
bool isOutsideEnd() const
returns the position at which the outside is targeted at.
Definition: khtml_caret_p.h:195
Iterates over the editable inner elements of a caret line box.
Definition: khtml_caret_p.h:742
void advance(bool toBegin)
advances to the editable caret box to come
Definition: khtml_caret.cpp:1505
bool isAdjacent() const
returns true when the current caret box is adjacent to the previously iterated caret box,...
Definition: khtml_caret_p.h:769
bool isEditable(const CaretBoxIterator &boxit, bool fromEnd)
finds out if the given box is editable.
Definition: khtml_caret.cpp:1642
Provides iterating through the document in terms of characters.
Definition: khtml_caret_p.h:984
EditableCharacterIterator & operator++()
returns whether the current line box represents the outside of its render object.
Definition: khtml_caret.cpp:1767
void peekNext()
reads ahead the next node and updates the data structures accordingly
Definition: khtml_caret_p.h:1066
void initFirstChar()
initializes the _char member by reading the character at the current offset, peeking ahead as necessa...
Definition: khtml_caret.cpp:1744
EditableCharacterIterator & operator--()
moves to the previous editable character.
Definition: khtml_caret.cpp:1869
bool isEnd() const
returns true when the end of the document has been reached.
Definition: khtml_caret_p.h:1027
bool isEditable(LineIterator &it)
finds out if the current line is editable.
Definition: khtml_caret_p.h:853
Iterates through the editable lines of a document, in a topological order.
Definition: khtml_caret_p.h:929
void determineTopologicalElement(RenderTableCell *oldCell, RenderObject *newObject, bool toBegin)
determines the topologically next render object.
Definition: khtml_caret.cpp:2282
void calcAndStoreNewLine(RenderBlock *newBlock, bool toBegin)
initializes the iterator to point to the first previous/following editable line.
Definition: khtml_caret.cpp:2262
Represents the whole document in terms of lines.
Definition: khtml_caret_p.h:622
Iterator preEnd()
Returns a line iterator pointing to the very last line of the document.
Definition: khtml_caret.cpp:1290
Iterator begin()
Returns a line iterator pointing to the very first line of the document.
Definition: khtml_caret.cpp:1276
Iterator current()
Returns a line iterator containing the current position as its starting value.
Definition: khtml_caret.cpp:1271
CaretAdvancePolicy advancePolicy() const
Returns the current caret advance policy.
Definition: khtml_caret_p.h:697
LinearDocument(KHTMLPart *part, DOM::NodeImpl *node, long offset, CaretAdvancePolicy advancePolicy, DOM::ElementImpl *baseElem)
Creates a new instance, and initializes it to the line specified by the parameters below.
Definition: khtml_caret.cpp:1244
RenderObject * baseObject() const
Returns the base render object which the caret must not advance beyond.
Definition: khtml_caret_p.h:706
const Iterator & preBegin() const
Returns a line iterator pointing just before the very first line of the document (this is somewhat an...
Definition: khtml_caret_p.h:692
void initPreBeginIterator()
Definition: khtml_caret.cpp:1304
const Iterator & end() const
Returns a line iterator pointing right after the end of the document.
Definition: khtml_caret_p.h:676
Represents a render table as a linear list of rows.
Definition: khtml_caret_p.h:868
#define kDebug
#define kWarning
KAction * copy(const QObject *recvr, const char *slot, QObject *parent)
KAction * next(const QObject *recvr, const char *slot, QObject *parent)
const KShortcut & end()
static RenderObject * renderObjectBelow(RenderObject *obj, ObjectTraversalState &trav, RenderObject *base)
Like RenderObject::objectBelow, but confined to stay within base.
Definition: khtml_caret.cpp:105
static RenderObject * commonAncestorTableSectionOrCell(RenderObject *r1, RenderObject *r2)
returns the nearest common ancestor of two objects that is a table cell, a table section,...
Definition: khtml_caret.cpp:2160
ObjectTraversalState
All possible states that may occur during render object traversal.
Definition: khtml_caret.cpp:47
static CaretBox * nearestCaretBox(LineIterator &it, CaretViewContext *cv, int &x, int &absx, int &absy)
seeks the caret box which contains or is the nearest to x
Definition: khtml_caret.cpp:2447
InlineFlowBox * seekBaseFlowBox(InlineBox *b, RenderObject *base=0)
seeks the root line box that is the parent of the given inline box.
Definition: khtml_caret.cpp:931
static bool isCaretBoxEmpty(CaretBox *box)
returns true when the given caret box is empty, i.
Definition: khtml_caret.cpp:1759
static bool containsEditableChildElement(KHTMLPart *part, RenderBlock *cb, RenderTable *&table, bool fromEnd, RenderObject *start)
checks whether the given block contains at least one editable child element, beginning with but exclu...
Definition: khtml_caret.cpp:1187
static RenderObject * renderObjectAbove(RenderObject *obj, ObjectTraversalState &trav, RenderObject *base)
Like RenderObject::objectAbove, but confined to stay within base.
Definition: khtml_caret.cpp:125
static bool containsEditableElement(KHTMLPart *part, RenderBlock *cb, RenderTable *&table, bool fromEnd=false)
checks whether the given block contains at least one editable element.
Definition: khtml_caret.cpp:1130
static RenderTableCell * containingTableCell(RenderObject *r)
looks for the table cell the given object r is contained within.
Definition: khtml_caret.cpp:2256
void mapDOMPosToRenderPos(NodeImpl *node, long offset, RenderObject *&r, long &r_ofs, bool &outside, bool &outsideEnd)
Maps a DOM Range position to the corresponding caret position.
Definition: khtml_caret.cpp:411
static RenderObject * advanceObject(RenderObject *r, ObjectTraversalState &trav, bool toBegin, RenderObject *base, int &state)
Advances to the next render object, taking into account the current traversal state.
Definition: khtml_caret.cpp:187
ObjectAdvanceState
Flags representing the type of advance that has been made.
Definition: khtml_caret.cpp:35
static NodeImpl * nextLeafNode(NodeImpl *r, NodeImpl *baseElem)
Returns the next leaf node.
Definition: khtml_caret.cpp:327
static void mapRenderPosToTraversalState(bool outside, bool atEnd, bool toBegin, ObjectTraversalState &trav)
Converts a caret position to its respective object traversal state.
Definition: khtml_caret.cpp:541
void mapRenderPosToDOMPos(RenderObject *r, long r_ofs, bool outside, bool outsideEnd, NodeImpl *&node, long &offset)
Maps a caret position to the corresponding DOM Range position.
Definition: khtml_caret.cpp:483
static RenderTableCell * findNearestTableCellInRow(KHTMLPart *part, int x, RenderTableSection::RowStruct *row, bool fromEnd)
finds the nearest editable cell around the given absolute x-coordinate
Definition: khtml_caret.cpp:2098
static void moveItToPrevWord(EditableCharacterIterator &it)
moves the given iterator to the beginning of the previous word.
Definition: khtml_caret.cpp:2547
static bool isIndicatedInlineBox(InlineBox *box)
Checks whether the given inline box matches the IndicatedFlows policy.
Definition: khtml_caret.cpp:144
bool isBlockRenderReplaced(RenderObject *r)
determines whether the given element is a block level replaced element.
Definition: khtml_caret.cpp:943
static bool isDescendant(RenderObject *r, RenderObject *cb)
checks whether r is a descendant of cb, or r == cb
Definition: khtml_caret.cpp:1114
static void moveIteratorByPage(LinearDocument &ld, ErgonomicEditableLineIterator &it, int mindist, bool next)
moves the iterator by one page.
Definition: khtml_caret.cpp:2591
static CaretBoxLine * findCaretBoxLine(DOM::NodeImpl *node, long offset, CaretBoxLineDeleter *cblDeleter, RenderObject *base, long &r_ofs, CaretBoxIterator &caretBoxIt)
determines the caret line box that contains the given position.
Definition: khtml_caret.cpp:964
static void moveItToNextWord(EditableCharacterIterator &it)
moves the given iterator to the beginning of the next word.
Definition: khtml_caret.cpp:2512
static void ensureLeafNode(NodeImpl *&node, NodeImpl *base)
Make sure the given node is a leaf node.
Definition: khtml_caret.cpp:530
static RenderObject * findRenderer(NodeImpl *&node, long offset, RenderObject *base, long &r_ofs, bool &outside, bool &outsideEnd)
Finds the next node that has a renderer.
Definition: khtml_caret.cpp:584
static RenderObject * traverseRenderObjects(RenderObject *obj, ObjectTraversalState &trav, bool toBegin, RenderObject *base, int &state)
Traverses the render object tree in a fine granularity.
Definition: khtml_caret.cpp:60
static RenderTable * findTableUpTo(RenderObject *r, RenderFlow *cb)
finds the innermost table object r is contained within, but no farther than cb.
Definition: khtml_caret.cpp:1106
static int findRowInSection(RenderTableSection *section, RenderTableCell *cell, RenderTableSection::RowStruct *&row, RenderTableCell *&directCell)
Finds the row that contains the given cell, directly, or indirectly.
Definition: khtml_caret.cpp:2209
MassDeleter< CaretBoxLine > CaretBoxLineDeleter
Definition: khtml_caret_p.h:475
static RenderTableCell * findNearestTableCell(KHTMLPart *part, int x, TableRowIterator &it, bool fromEnd)
finds the cell corresponding to absolute x-coordinate x in the given table.
Definition: khtml_caret.cpp:2070
static bool isIndicatedFlow(RenderObject *r)
Checks whether the given render object matches the IndicatedFlows policy.
Definition: khtml_caret.cpp:162
static ElementImpl * determineBaseElement(NodeImpl *caretNode)
returns a suitable base element
Definition: khtml_caret.cpp:622
static RenderObject * advanceSuitableObject(RenderObject *r, ObjectTraversalState &trav, bool toBegin, RenderObject *base, int &state)
Advances to the next render object, taking into account the current traversal state,...
Definition: khtml_caret.cpp:305
static RenderTable * findFirstDescendantTable(RenderObject *leaf, RenderBlock *block)
finds the table that is the first direct or indirect descendant of block.
Definition: khtml_caret.cpp:2243
static bool isUnsuitable(RenderObject *r, ObjectTraversalState trav)
Check whether the current render object is unsuitable in caret mode handling.
Definition: khtml_caret.cpp:283
static void mapTraversalStateToRenderPos(ObjectTraversalState trav, bool toBegin, bool &outside, bool &atEnd)
Converts a traversal state to its respective caret position.
Definition: khtml_caret.cpp:557
bool equalsBox(const InlineBox *box, bool outside, bool outsideEnd) const
compares whether this seek box matches the given specification
Definition: khtml_caret_p.h:415
bool check(const CaretBoxIterator &chit)
checks whether this box matches the given iterator.
Definition: khtml_caret_p.h:432
contextual information about the caret which is related to the view.
Definition: khtml_caret_p.h:60
int origX
For natural traversal of lines, the original x position is saved, and the actual x is set to the firs...
Definition: khtml_caret_p.h:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.