summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2012-07-17 10:30:10 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2012-07-17 12:01:50 (GMT)
commitbbb0c55eb463389f25d04c9f4167b807a93c83ce (patch)
tree0414b596c14692f9ed8a8dac3909a508ed67ebd2
parent764f7cdce7b3e54cbe8bdeccc20e85cd6a0b4aea (diff)
Avoid short variables overflow that can happen when too big negative values
are used for css text-indent property (commonly know as "text-indent hack"). This is currently the case with b.k.o that defines "text-indent:-99999px". (cherry picked from commit bff318095f3e37fbd88771a3dcd7da7121b53cc8)
-rw-r--r--khtml/rendering/render_block.cpp10
-rw-r--r--khtml/rendering/render_text.cpp8
-rw-r--r--khtml/rendering/render_text.h8
3 files changed, 13 insertions, 13 deletions
diff --git a/khtml/rendering/render_block.cpp b/khtml/rendering/render_block.cpp
index 2172b3b..f9c76de 100644
--- a/khtml/rendering/render_block.cpp
+++ b/khtml/rendering/render_block.cpp
@@ -3080,8 +3080,8 @@ void RenderBlock::calcInlineMinMaxWidth()
// the width of the last non-breakable run and use that to start a new line
// (unless we end in whitespace).
RenderStyle* cstyle = child->style();
- short childMin = 0;
- short childMax = 0;
+ int childMin = 0;
+ int childMax = 0;
if (!child->isText()) {
// Case (1) and (2). Inline replaced and inline flow elements.
@@ -3161,7 +3161,7 @@ void RenderBlock::calcInlineMinMaxWidth()
inlineMin += childMin;
} else {
// Now check our line.
- m_minWidth = qMax(childMin, m_minWidth);
+ m_minWidth = qMax(childMin, (int)m_minWidth);
// Now start a new line.
inlineMin = 0;
@@ -3185,9 +3185,9 @@ void RenderBlock::calcInlineMinMaxWidth()
// then they shouldn't be considered in the breakable char
// check.
bool hasBreakableChar, hasBreak;
- short beginMin, endMin;
+ int beginMin, endMin;
bool beginWS, endWS;
- short beginMax, endMax;
+ int beginMax, endMax;
t->trimmedMinMaxWidth(beginMin, beginWS, endMin, endWS, hasBreakableChar,
hasBreak, beginMax, endMax,
childMin, childMax, stripFrontSpaces);
diff --git a/khtml/rendering/render_text.cpp b/khtml/rendering/render_text.cpp
index fe8176b..0ec71fa 100644
--- a/khtml/rendering/render_text.cpp
+++ b/khtml/rendering/render_text.cpp
@@ -1599,11 +1599,11 @@ bool RenderText::containsOnlyWhitespace(unsigned int from, unsigned int len) con
return currPos >= (from+len);
}
-void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
- short& endMinW, bool& endWS,
+void RenderText::trimmedMinMaxWidth(int& beginMinW, bool& beginWS,
+ int& endMinW, bool& endWS,
bool& hasBreakableChar, bool& hasBreak,
- short& beginMaxW, short& endMaxW,
- short& minW, short& maxW, bool& stripFrontSpaces)
+ int& beginMaxW, int& endMaxW,
+ int& minW, int& maxW, bool& stripFrontSpaces)
{
bool preserveWS = style()->preserveWS();
bool preserveLF = style()->preserveLF();
diff --git a/khtml/rendering/render_text.h b/khtml/rendering/render_text.h
index 166a040..9a09dae 100644
--- a/khtml/rendering/render_text.h
+++ b/khtml/rendering/render_text.h
@@ -202,11 +202,11 @@ public:
virtual short minWidth() const { return m_minWidth; }
virtual int maxWidth() const { return m_maxWidth; }
- void trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
- short& endMinW, bool& endWS,
+ void trimmedMinMaxWidth(int& beginMinW, bool& beginWS,
+ int& endMinW, bool& endWS,
bool& hasBreakableChar, bool& hasBreak,
- short& beginMaxW, short& endMaxW,
- short& minW, short& maxW, bool& stripFrontSpaces);
+ int& beginMaxW, int& endMaxW,
+ int& minW, int& maxW, bool& stripFrontSpaces);
bool containsOnlyWhitespace(unsigned int from, unsigned int len) const;