[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:46:44 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a8e189197706fd03d585e612fbcd00275b84bdbc
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jun 16 00:00:13 2004 +0000
Implement canAccommodateEllipsis. The basic idea is that everything on a line will allow an ellipsis to be
drawn on top of it unless it's a replaced element. Then, if the replaced element overlaps, the ellipsis won't
be allowed.
Reviewed by john
* khtml/rendering/bidi.cpp:
(khtml::RenderBlock::checkLinesForTextOverflow):
* khtml/rendering/render_line.cpp:
(InlineBox::closestLeafChildForXPos):
(InlineBox::canAccommodateEllipsis):
(InlineFlowBox::canAccommodateEllipsis):
(RootInlineBox::canAccommodateEllipsis):
* khtml/rendering/render_line.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6858 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index eeada08..db99c8f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2004-06-15 David Hyatt <hyatt at apple.com>
+
+ Implement canAccommodateEllipsis. The basic idea is that everything on a line will allow an ellipsis to be
+ drawn on top of it unless it's a replaced element. Then, if the replaced element overlaps, the ellipsis won't
+ be allowed.
+
+ Reviewed by john
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::RenderBlock::checkLinesForTextOverflow):
+ * khtml/rendering/render_line.cpp:
+ (InlineBox::closestLeafChildForXPos):
+ (InlineBox::canAccommodateEllipsis):
+ (InlineFlowBox::canAccommodateEllipsis):
+ (RootInlineBox::canAccommodateEllipsis):
+ * khtml/rendering/render_line.h:
+
2004-06-15 Vicki Murley <vicki at apple.com>
- added a few layout tests, rdar://3694510
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 14e3296..be93a53 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -2281,7 +2281,7 @@ void RenderBlock::checkLinesForTextOverflow()
// accommodate our truncation string, and no replaced elements (images, tables) can overlap the ellipsis
// space.
int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellipsisWidth;
- if (curr->canAccommodateEllipsis(blockEdge, ltr, width))
+ if (curr->canAccommodateEllipsis(ltr, lineBoxEdge, blockEdge, width))
curr->placeEllipsis(&ellipsis, blockEdge, ltr, width);
}
}
diff --git a/WebCore/khtml/rendering/render_line.cpp b/WebCore/khtml/rendering/render_line.cpp
index 82d9f91..7277862 100644
--- a/WebCore/khtml/rendering/render_line.cpp
+++ b/WebCore/khtml/rendering/render_line.cpp
@@ -165,6 +165,33 @@ InlineBox* InlineBox::lastLeafChild()
return this;
}
+InlineBox* InlineBox::closestLeafChildForXPos(int _x, int _tx)
+{
+ if (!isInlineFlowBox())
+ return this;
+
+ InlineFlowBox *flowBox = static_cast<InlineFlowBox*>(this);
+ if (!flowBox->firstChild())
+ return this;
+
+ InlineBox *box = flowBox->closestChildForXPos(_x, _tx);
+ if (!box)
+ return this;
+
+ return box->closestLeafChildForXPos(_x, _tx);
+}
+
+bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth)
+{
+ // Non-replaced elements can always accommodate an ellipsis.
+ if (!m_object || !m_object->isReplaced())
+ return true;
+
+ QRect boxRect(m_x, 0, m_width, 1);
+ QRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsisWidth, 1);
+ return !(boxRect.intersects(ellipsisRect));
+}
+
int InlineFlowBox::marginLeft()
{
if (!includeLeftEdge())
@@ -784,20 +811,13 @@ InlineBox* InlineFlowBox::closestChildForXPos(int _x, int _tx)
return 0;
}
-InlineBox* InlineBox::closestLeafChildForXPos(int _x, int _tx)
+bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth)
{
- if (!isInlineFlowBox())
- return this;
-
- InlineFlowBox *flowBox = static_cast<InlineFlowBox*>(this);
- if (!flowBox->firstChild())
- return this;
-
- InlineBox *box = flowBox->closestChildForXPos(_x, _tx);
- if (!box)
- return this;
-
- return box->closestLeafChildForXPos(_x, _tx);
+ for (InlineBox *box = firstChild(); box; box = box->nextOnLine()) {
+ if (!box->canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth))
+ return false;
+ }
+ return true;
}
void RootInlineBox::detach(RenderArena* arena)
@@ -814,15 +834,16 @@ void RootInlineBox::detachEllipsisBox(RenderArena* arena)
}
}
-bool RootInlineBox::canAccommodateEllipsis(int blockEdge, bool ltr, int ellipsisWidth)
+bool RootInlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth)
{
- // First sanity-check the width of the whole line to see if there is sufficient room.
- if (width() < ellipsisWidth)
+ // First sanity-check the unoverflowed width of the whole line to see if there is sufficient room.
+ int delta = ltr ? lineBoxEdge - blockEdge : blockEdge - lineBoxEdge;
+ if (width() - delta < ellipsisWidth)
return false;
-
+
// Next iterate over all the line boxes on the line. If we find a replaced element that intersects
// then we refuse to accommodate the ellipsis. Otherwise we're ok.
- return false;
+ return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth);
}
void RootInlineBox::placeEllipsis(QChar* ellipsisStr, int blockEdge, bool ltr, int ellipsisWidth)
diff --git a/WebCore/khtml/rendering/render_line.h b/WebCore/khtml/rendering/render_line.h
index 1edfbd5..fb24bc4 100644
--- a/WebCore/khtml/rendering/render_line.h
+++ b/WebCore/khtml/rendering/render_line.h
@@ -130,6 +130,8 @@ public:
void dirtyLineBoxes();
+ virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
+
public: // FIXME: Would like to make this protected, but methods are accessing these
// members over in the part.
RenderObject* m_object;
@@ -260,6 +262,8 @@ public:
void removeChild(InlineBox* child);
+ virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
+
protected:
InlineBox* m_firstChild;
InlineBox* m_lastChild;
@@ -303,7 +307,7 @@ public:
void childRemoved(InlineBox* box);
- bool canAccommodateEllipsis(int blockEdge, bool ltr, int ellipsisWidth);
+ bool canAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth);
void placeEllipsis(QChar* ellipsisStr, int blockEdge, bool ltr, int ellipsisWidth);
protected:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list