WebCore:
2008-07-25 Jacob Refstrup <jacob.refstrup@hp.com>
Reviewed by mitz.
- fix https://bugs.webkit.org/show_bug.cgi?id=17906
<rdar://problem/5805741> white-space: pre-wrap or -webkit-line-break: after-white-space text can overlap float at end of line
Test: fast/block/float/editable-text-overlapping-float.html
* rendering/RenderBlock.h:
* rendering/bidi.cpp:
(WebCore::RenderBlock::skipTrailingWhitespace):
- renamed to reflect usage and removed call to position floats;
they only get added
(WebCore::RenderBlock::skipLeadingWhitespace):
- renamed to reflect usage
(WebCore::RenderBlock::findNextLineBreak):
- use skipTrailingWhitespace at end of line (as before but with new
name)
LayoutTests:
2008-07-25 Jacob Refstrup <jacob.refstrup@hp.com>
Reviewed by mitz.
- added test case for float being added in trailing whitespace
of an already full line (with pre-wrap or after-white-space set).
<rdar://problem/5805741> https://bugs.webkit.org/show_bug.cgi?id=17906
* fast/block/float/editable-text-overlapping-float.html: Added.
* platform/mac/fast/block/float/editable-text-overlapping-float-expected.checksum: Added.
* platform/mac/fast/block/float/editable-text-overlapping-float-expected.png: Added.
* platform/mac/fast/block/float/editable-text-overlapping-float-expected.txt: Added.
* platform/qt/fast/block/float/editable-text-overlapping-float-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 00b4bea..f1d3d5d 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -1436,19 +1436,18 @@
return !it.atEnd();
}
-// FIXME: The entire concept of the skipWhitespace function is flawed, since we really need to be building
+// FIXME: The entire concept of the skipTrailingWhitespace function is flawed, since we really need to be building
// line boxes even for containers that may ultimately collapse away. Otherwise we'll never get positioned
// elements quite right. In other words, we need to build this function's work into the normal line
// object iteration process.
-int RenderBlock::skipWhitespace(InlineIterator& iterator)
+// NB. this function will insert any floating elements that would otherwise
+// be skipped but it will not position them.
+void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator)
{
- int availableWidth = lineWidth(m_height);
while (!iterator.atEnd() && !requiresLineBox(iterator)) {
RenderObject* object = iterator.obj;
if (object->isFloating()) {
insertFloatingObject(object);
- positionNewFloats();
- availableWidth = lineWidth(m_height);
} else if (object->isPositioned()) {
// FIXME: The math here is actually not really right. It's a best-guess approximation that
// will work for the common cases
@@ -1473,10 +1472,9 @@
}
iterator.increment();
}
- return availableWidth;
}
-int RenderBlock::skipWhitespace(InlineBidiResolver& resolver)
+int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver)
{
int availableWidth = lineWidth(m_height);
while (!resolver.position().atEnd() && !requiresLineBox(resolver.position())) {
@@ -1559,7 +1557,7 @@
bool appliedStartWidth = resolver.position().pos > 0;
- int width = skipWhitespace(resolver);
+ int width = skipLeadingWhitespace(resolver);
int w = 0;
int tmpW = 0;
@@ -1878,7 +1876,7 @@
lineWasTooWide = true;
lBreak.obj = o;
lBreak.pos = pos;
- skipWhitespace(lBreak);
+ skipTrailingWhitespace(lBreak);
}
}
if (lineWasTooWide || w + tmpW > width) {