[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:36:29 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 854f7a812d0799d262421c434b09de046f70859c
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Apr 23 17:18:08 2004 +0000
Reviewed by Darin
Changed inlineBoxForRenderer(RenderObject *, int) helper that was static
in dom_position.cpp into a virtual method on RenderObjects. Function is
now called inlineBox(int). Functionality unchanged.
* khtml/rendering/render_br.cpp:
(RenderBR::inlineBox)
* khtml/rendering/render_br.h:
* khtml/rendering/render_object.cpp:
(RenderObject::caretMaxRenderedOffset)
(RenderObject::inlineBox)
* khtml/rendering/render_object.h:
* khtml/rendering/render_text.cpp:
(RenderText::inlineBox)
* khtml/rendering/render_text.h:
* khtml/xml/dom_position.cpp:
(DOM::renderersOnDifferentLine):
(DOM::nextRenderedEditable)
(DOM::previousRenderedEditable)
(DOM::Position::previousLinePosition)
(DOM::Position::nextLinePosition)
(DOM::Position::rendersInDifferentPosition)
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index cbf346c..d40de51 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,32 @@
Reviewed by Darin
+ Changed inlineBoxForRenderer(RenderObject *, int) helper that was static
+ in dom_position.cpp into a virtual method on RenderObjects. Function is
+ now called inlineBox(int). Functionality unchanged.
+
+ * khtml/rendering/render_br.cpp:
+ (RenderBR::inlineBox)
+ * khtml/rendering/render_br.h:
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::caretMaxRenderedOffset)
+ (RenderObject::inlineBox)
+ * khtml/rendering/render_object.h:
+ * khtml/rendering/render_text.cpp:
+ (RenderText::inlineBox)
+ * khtml/rendering/render_text.h:
+ * khtml/xml/dom_position.cpp:
+ (DOM::renderersOnDifferentLine):
+ (DOM::nextRenderedEditable)
+ (DOM::previousRenderedEditable)
+ (DOM::Position::previousLinePosition)
+ (DOM::Position::nextLinePosition)
+ (DOM::Position::rendersInDifferentPosition)
+
+2004-04-23 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Darin
+
* khtml/editing/htmlediting_impl.cpp:
(DeleteSelectionCommandImpl::doApply): Fix editing test
regression with deleting whitespace at the end of the line.
diff --git a/WebCore/khtml/rendering/render_br.cpp b/WebCore/khtml/rendering/render_br.cpp
index 7b57b7c..2f993f1 100644
--- a/WebCore/khtml/rendering/render_br.cpp
+++ b/WebCore/khtml/rendering/render_br.cpp
@@ -116,3 +116,8 @@ void RenderBR::caretPos(int offset, bool override, int &_x, int &_y, int &_w, in
_x += absx;
_y += absy;
}
+
+InlineBox *RenderBR::inlineBox(long offset)
+{
+ return firstTextBox();
+}
diff --git a/WebCore/khtml/rendering/render_br.h b/WebCore/khtml/rendering/render_br.h
index 3b71433..f7a0e9d 100644
--- a/WebCore/khtml/rendering/render_br.h
+++ b/WebCore/khtml/rendering/render_br.h
@@ -70,6 +70,8 @@ public:
virtual DOM::Position positionForCoordinates(int _x, int _y);
virtual void caretPos(int offset, bool override, int &_x, int &_y, int &_w, int &_h);
+ virtual InlineBox *inlineBox(long offset);
+
private:
int m_x;
int m_y;
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index b595914..9c89c1b 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -26,6 +26,7 @@
#include "rendering/render_object.h"
#include "rendering/render_table.h"
#include "rendering/render_text.h"
+#include "rendering/render_line.h"
#include "rendering/render_list.h"
#include "rendering/render_canvas.h"
#include "xml/dom_elementimpl.h"
@@ -2151,3 +2152,8 @@ unsigned long RenderObject::caretMaxRenderedOffset() const
{
return 0;
}
+
+InlineBox *RenderObject::inlineBox(long offset)
+{
+ return inlineBoxWrapper();
+}
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 92ff8e1..31d820f 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -343,6 +343,8 @@ public:
virtual InlineBox* inlineBoxWrapper() const;
virtual void setInlineBoxWrapper(InlineBox* b);
void deleteLineBoxWrapper();
+
+ virtual InlineBox *inlineBox(long offset);
// for discussion of lineHeight see CSS2 spec
virtual short lineHeight( bool firstLine, bool isRootLineBox=false ) const;
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index addc895..9d8fcee 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -1443,6 +1443,23 @@ unsigned long RenderText::caretMaxRenderedOffset() const
return l;
}
+InlineBox *RenderText::inlineBox(long offset)
+{
+ for (InlineTextBox *box = firstTextBox(); box; box = box->nextTextBox()) {
+ if (offset >= box->m_start && offset <= box->m_start + box->m_len) {
+ return box;
+ }
+ else if (offset < box->m_start) {
+ // The offset we're looking for is before this node
+ // this means the offset must be in content that is
+ // not rendered.
+ return box->prevTextBox() ? box->prevTextBox() : firstTextBox();
+ }
+ }
+
+ return 0;
+}
+
RenderTextFragment::RenderTextFragment(DOM::NodeImpl* _node, DOM::DOMStringImpl* _str,
int startOffset, int endOffset)
:RenderText(_node, _str->substring(startOffset, endOffset)),
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index 07bd50d..8cffa20 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -218,6 +218,8 @@ public:
InlineTextBox* firstTextBox() const { return m_firstTextBox; }
InlineTextBox* lastTextBox() const { return m_lastTextBox; }
+ virtual InlineBox *inlineBox(long offset);
+
#if APPLE_CHANGES
int widthFromCache(const Font *, int start, int len) const;
bool shouldUseMonospaceCache(const Font *) const;
diff --git a/WebCore/khtml/xml/dom_position.cpp b/WebCore/khtml/xml/dom_position.cpp
index 7685b7c..ce7fa68 100644
--- a/WebCore/khtml/xml/dom_position.cpp
+++ b/WebCore/khtml/xml/dom_position.cpp
@@ -59,42 +59,10 @@ using khtml::RootInlineBox;
namespace DOM {
-static InlineBox *inlineBoxForRenderer(RenderObject *renderer, long offset)
-{
- if (!renderer)
- return 0;
-
- if (renderer->isBR() && static_cast<RenderText *>(renderer)->firstTextBox())
- return static_cast<RenderText *>(renderer)->firstTextBox();
-
- if (renderer->isText()) {
- RenderText *textRenderer = static_cast<khtml::RenderText *>(renderer);
- if (textRenderer->isBR() && textRenderer->firstTextBox())
- return textRenderer->firstTextBox();
-
- for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
- if (offset >= box->m_start && offset <= box->m_start + box->m_len) {
- return box;
- }
- else if (offset < box->m_start) {
- // The offset we're looking for is before this node
- // this means the offset must be in content that is
- // not rendered.
- return box->prevTextBox() ? box->prevTextBox() : textRenderer->firstTextBox();
- }
- }
- }
- else {
- return renderer->inlineBoxWrapper();
- }
-
- return 0;
-}
-
static bool renderersOnDifferentLine(RenderObject *r1, long o1, RenderObject *r2, long o2)
{
- InlineBox *b1 = inlineBoxForRenderer(r1, o1);
- InlineBox *b2 = inlineBoxForRenderer(r2, o2);
+ InlineBox *b1 = r1 ? r1->inlineBox(o1) : 0;
+ InlineBox *b2 = r2 ? r2->inlineBox(o2) : 0;
return (b1 && b2 && b1->root() != b2->root());
}
@@ -104,7 +72,9 @@ static NodeImpl *nextRenderedEditable(NodeImpl *node)
node = node->nextEditable();
if (!node)
return 0;
- if (inlineBoxForRenderer(node->renderer(), 0))
+ if (!node->renderer())
+ continue;
+ if (node->renderer()->inlineBox(0))
return node;
}
return 0;
@@ -116,7 +86,9 @@ static NodeImpl *previousRenderedEditable(NodeImpl *node)
node = node->previousEditable();
if (!node)
return 0;
- if (inlineBoxForRenderer(node->renderer(), 0))
+ if (!node->renderer())
+ continue;
+ if (node->renderer()->inlineBox(0))
return node;
}
return 0;
@@ -363,7 +335,7 @@ Position Position::previousLinePosition(int x) const
if (!node()->renderer())
return *this;
- InlineBox *box = inlineBoxForRenderer(node()->renderer(), offset());
+ InlineBox *box = node()->renderer()->inlineBox(offset());
if (!box)
return *this;
@@ -384,7 +356,8 @@ Position Position::previousLinePosition(int x) const
while (n && !Position(n, n->caretMaxOffset()).inRenderedContent())
n = n->previousEditable();
if (n && n->inSameRootEditableBlock(node())) {
- box = inlineBoxForRenderer(n->renderer(), n->caretMaxOffset());
+ ASSERT(n->renderer());
+ box = n->renderer()->inlineBox(n->caretMaxOffset());
ASSERT(box);
// previous root line box found
root = box->root();
@@ -411,7 +384,7 @@ Position Position::nextLinePosition(int x) const
if (!node()->renderer())
return *this;
- InlineBox *box = inlineBoxForRenderer(node()->renderer(), offset());
+ InlineBox *box = node()->renderer()->inlineBox(offset());
if (!box)
return *this;
@@ -432,7 +405,8 @@ Position Position::nextLinePosition(int x) const
while (n && !Position(n, n->caretMinOffset()).inRenderedContent())
n = n->nextEditable();
if (n && n->inSameRootEditableBlock(node())) {
- box = inlineBoxForRenderer(n->renderer(), n->caretMinOffset());
+ ASSERT(n->renderer());
+ box = n->renderer()->inlineBox(n->caretMinOffset());
ASSERT(box);
// previous root line box found
root = box->root();
@@ -698,16 +672,16 @@ bool Position::rendersInDifferentPosition(const Position &pos) const
return false;
LOG(Editing, "onDifferentLine: %s\n", renderersOnDifferentLine(renderer, offset(), posRenderer, pos.offset()) ? "YES" : "NO");
- LOG(Editing, "renderer: %p [%p]\n", renderer, inlineBoxForRenderer(renderer, offset()));
+ LOG(Editing, "renderer: %p [%p]\n", renderer, renderer ? renderer->inlineBox(offset()) : 0);
LOG(Editing, "thisRenderedOffset: %d\n", thisRenderedOffset);
- LOG(Editing, "posRenderer: %p [%p]\n", posRenderer, inlineBoxForRenderer(posRenderer, pos.offset()));
+ LOG(Editing, "posRenderer: %p [%p]\n", posRenderer, posRenderer ? posRenderer->inlineBox(offset()) : 0);
LOG(Editing, "posRenderedOffset: %d\n", posRenderedOffset);
LOG(Editing, "node min/max: %d:%d\n", node()->caretMinOffset(), node()->caretMaxRenderedOffset());
LOG(Editing, "pos node min/max: %d:%d\n", pos.node()->caretMinOffset(), pos.node()->caretMaxRenderedOffset());
LOG(Editing, "----------------------------------------------------------------------\n");
- InlineBox *b1 = inlineBoxForRenderer(renderer, offset());
- InlineBox *b2 = inlineBoxForRenderer(posRenderer, pos.offset());
+ InlineBox *b1 = renderer ? renderer->inlineBox(offset()) : 0;
+ InlineBox *b2 = posRenderer ? posRenderer->inlineBox(pos.offset()) : 0;
if (!b1 || !b2) {
return false;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list