diff options
author | Grace Kloba <klobag@google.com> | 2009-08-04 13:59:47 -0700 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-08-04 13:59:47 -0700 |
commit | 7b6d5776535672a588bdf68d374b7d1b03c21cec (patch) | |
tree | 5286926c5a4f535bd340ff33fcaa2e6d7da9f1a7 | |
parent | e65a5905dd4459ab5e4ef22d6dcb85e1d1a0b7cb (diff) | |
download | external_webkit-7b6d5776535672a588bdf68d374b7d1b03c21cec.zip external_webkit-7b6d5776535672a588bdf68d374b7d1b03c21cec.tar.gz external_webkit-7b6d5776535672a588bdf68d374b7d1b03c21cec.tar.bz2 |
Another tweak for text wrap screen. We add a fixed padding when wrapping text
around the screen width. If the block already has a padding, we should put
it under consideration so that we won't add too much padding.
-rw-r--r-- | WebCore/rendering/bidi.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp index 24c2051..dc5176e 100644 --- a/WebCore/rendering/bidi.cpp +++ b/WebCore/rendering/bidi.cpp @@ -953,7 +953,16 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i if (!isConstrained) { int screenWidth = view()->frameView()->screenWidth(); if (screenWidth > 0 && width() > screenWidth) { - int maxWidth = screenWidth - 2 * ANDROID_FCTS_MARGIN_PADDING; + // if the current padding is smaller, add an extra to make + // it 2 * ANDROID_FCTS_MARGIN_PADDING so that the text won't + // overlap with the screen edge. If the current padding is + // negative, leave it alone. + int padding = paddingLeft() + paddingRight(); + if (padding < 0 || padding >= 2 * ANDROID_FCTS_MARGIN_PADDING) + padding = 0; + else + padding = 2 * ANDROID_FCTS_MARGIN_PADDING - padding; + int maxWidth = screenWidth - padding; setWidth(min(width(), maxWidth)); m_minPrefWidth = min(m_minPrefWidth, maxWidth); m_maxPrefWidth = min(m_maxPrefWidth, maxWidth); |