Commit a18024a4 authored by hyatt's avatar hyatt

Fix for 3134133. Back out the render_text code I gave to rjw

	to check in.  It wasn't filling in a value for hasBreak, so it
	became random whether or not you'd break or not.

        Reviewed by rjw

        * khtml/rendering/render_text.cpp:
        (RenderText::trimmedMinMaxWidth):
        (RenderText::calcMinMaxWidth):
        * khtml/rendering/render_text.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 38a9e98d
2002-12-20 David Hyatt <hyatt@apple.com>
Fix for 3134133. Back out the render_text code I gave to rjw
to check in. It wasn't filling in a value for hasBreak, so it
became random whether or not you'd break or not.
Reviewed by rjw
* khtml/rendering/render_text.cpp:
(RenderText::trimmedMinMaxWidth):
(RenderText::calcMinMaxWidth):
* khtml/rendering/render_text.h:
2002-12-20 Darin Adler <darin@apple.com>
Reviewed by Trey.
......
2002-12-20 David Hyatt <hyatt@apple.com>
Fix for 3134133. Back out the render_text code I gave to rjw
to check in. It wasn't filling in a value for hasBreak, so it
became random whether or not you'd break or not.
Reviewed by rjw
* khtml/rendering/render_text.cpp:
(RenderText::trimmedMinMaxWidth):
(RenderText::calcMinMaxWidth):
* khtml/rendering/render_text.h:
2002-12-20 Darin Adler <darin@apple.com>
Reviewed by Trey.
......
......@@ -837,6 +837,7 @@ void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
endMinW = m_endMinWidth;
hasBreakableChar = m_hasBreakableChar;
hasBreak = m_hasBreak;
if (len == 0)
return;
......@@ -855,8 +856,38 @@ void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
else if (minW > maxW)
minW = maxW;
beginMaxW = m_beginMaxWidth;
endMaxW = m_endMaxWidth;
// Compute our max widths by scanning the string for newlines.
if (hasBreak) {
const Font *f = htmlFont( false );
bool firstLine = true;
beginMaxW = endMaxW = maxW;
for(int i = 0; i < len; i++)
{
int linelen = 0;
while( i+linelen < len && str->s[i+linelen] != '\n')
linelen++;
if (linelen)
{
#if !APPLE_CHANGES
endMaxW = f->width(str->s, str->l, i, linelen);
#else
endMaxW = widthFromBuffer(f, i, linelen);
#endif
if (firstLine) {
firstLine = false;
beginMaxW = endMaxW;
}
i += linelen;
if (i == len-1)
endMaxW = 0;
}
else if (firstLine) {
beginMaxW = 0;
firstLine = false;
}
}
}
}
void RenderText::calcMinMaxWidth()
......@@ -865,7 +896,7 @@ void RenderText::calcMinMaxWidth()
// ### calc Min and Max width...
m_minWidth = m_beginMinWidth = m_endMinWidth = 0;
m_maxWidth = m_beginMaxWidth = m_endMaxWidth = 0;
m_maxWidth = 0;
if (isBR())
return;
......@@ -963,39 +994,6 @@ void RenderText::calcMinMaxWidth()
if (style()->whiteSpace() == NOWRAP)
m_minWidth = m_maxWidth;
// Compute our max widths by scanning the string for newlines.
m_beginMaxWidth = m_endMaxWidth = m_maxWidth;
if (m_hasBreak) {
const Font *f = htmlFont( false );
bool firstLine = true;
for(int i = 0; i < len; i++)
{
int linelen = 0;
while( i+linelen < len && str->s[i+linelen] != '\n')
linelen++;
if (linelen)
{
#if !APPLE_CHANGES
m_endMaxWidth = f->width(str->s, str->l, i, linelen);
#else
m_endMaxWidth = widthFromBuffer(f, i, linelen);
#endif
if (firstLine) {
firstLine = false;
m_beginMaxWidth = m_endMaxWidth;
}
i += linelen;
if (i == len-1)
m_endMaxWidth = 0;
}
else if (firstLine) {
m_beginMaxWidth = 0;
firstLine = false;
}
}
}
setMinMaxKnown();
//kdDebug( 6040 ) << "Text::calcMinMaxWidth(): min = " << m_minWidth << " max = " << m_maxWidth << endl;
}
......
......@@ -238,8 +238,6 @@ protected: // members
short m_maxWidth;
short m_beginMinWidth;
short m_endMinWidth;
short m_beginMaxWidth;
short m_endMaxWidth;
SelectionState m_selectionState : 3 ;
bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment