From: Grace Kloba Date: Wed, 11 Nov 2009 04:51:23 +0000 (-0800) Subject: Changing fit column to screen to exclude the padding. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a5605499;p=android-x86%2Fexternal-webkit.git Changing fit column to screen to exclude the padding. Fix http://b/issue?id=2253222 --- diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index 395037200..615a36985 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -964,17 +964,11 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i } if (!isConstrained) { int screenWidth = view()->frameView()->screenWidth(); - if (screenWidth > 0 && width() > screenWidth) { - // 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; + int padding = paddingLeft() + paddingRight(); + if (screenWidth > 0 && width() > (screenWidth + padding)) { + // limit the content width (width excluding padding) to be + // (screenWidth - 2 * ANDROID_FCTS_MARGIN_PADDING) + int maxWidth = screenWidth - 2 * ANDROID_FCTS_MARGIN_PADDING + padding; setWidth(min(width(), maxWidth)); m_minPrefWidth = min(m_minPrefWidth, maxWidth); m_maxPrefWidth = min(m_maxPrefWidth, maxWidth);