diff options
author | Patrick Scott <> | 2009-04-15 07:10:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-15 07:10:56 -0700 |
commit | 75e7a2d7fc509ddabd80b7f36a3e85fa16cfb26f (patch) | |
tree | 19a72c9a7a1e17dce67e400b0df7f816e34a767a | |
parent | e3185f35ec01f131692b061d4fe786ef5cd5c7bf (diff) | |
parent | 7ad55b5af9aa00b7903d3a73b0ac2555db6a4e91 (diff) | |
download | external_webkit-75e7a2d7fc509ddabd80b7f36a3e85fa16cfb26f.zip external_webkit-75e7a2d7fc509ddabd80b7f36a3e85fa16cfb26f.tar.gz external_webkit-75e7a2d7fc509ddabd80b7f36a3e85fa16cfb26f.tar.bz2 |
Merge branch 'readonly-p4-master'
-rw-r--r-- | WebCore/rendering/RenderPartObject.cpp | 23 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 62 |
2 files changed, 75 insertions, 10 deletions
diff --git a/WebCore/rendering/RenderPartObject.cpp b/WebCore/rendering/RenderPartObject.cpp index 828026e..47a5954 100644 --- a/WebCore/rendering/RenderPartObject.cpp +++ b/WebCore/rendering/RenderPartObject.cpp @@ -349,10 +349,11 @@ void RenderPartObject::layout() // Update the dimensions to get the correct minimum preferred width updateWidgetPosition(); - // Use the preferred width if it is larger. - setWidth(max(w, root->minPrefWidth())); int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight(); int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); + // Use the preferred width if it is larger. + setWidth(max(w, root->minPrefWidth()) + extraWidth); + // Resize the view to recalc the height. int height = h - extraHeight; int width = w - extraWidth; @@ -367,10 +368,10 @@ void RenderPartObject::layout() view->layout(); int contentHeight = view->contentsHeight(); int contentWidth = view->contentsWidth(); - // Do not shrink iframes with specified sizes - if (contentHeight > h || style()->height().isAuto()) - setHeight(contentHeight); - setWidth(contentWidth); + // Do not shrink iframes with a specified height. + if (contentHeight > (h - extraHeight) || style()->height().isAuto()) + setHeight(contentHeight + extraHeight); + setWidth(contentWidth + extraWidth); // Update one last time updateWidgetPosition(); @@ -404,8 +405,9 @@ void RenderPartObject::calcWidth() { // width updateWidgetPosition(); + int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight(); // Set the width - setWidth(max(width(), root->minPrefWidth())); + setWidth(max(width(), root->minPrefWidth()) + extraWidth); // Update based on the new width updateWidgetPosition(); @@ -414,7 +416,7 @@ void RenderPartObject::calcWidth() { while (view->needsLayout()) view->layout(); - setWidth(view->contentsWidth()); + setWidth(view->contentsWidth() + extraWidth); // Update one last time to ensure the dimensions. updateWidgetPosition(); @@ -437,8 +439,9 @@ void RenderPartObject::calcHeight() { // Do not shrink the height if the size is specified int h = view->contentsHeight(); - if (h > height() || style()->height().isAuto()) - setHeight(h); + int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); + if (h > height() - extraHeight || style()->height().isAuto()) + setHeight(h + extraHeight); // Update one last time to ensure the dimensions. updateWidgetPosition(); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index bccca35..afe0da9 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -70,7 +70,9 @@ #include "PluginWidgetAndroid.h" #include "Position.h" #include "ProgressTracker.h" +#include "RenderBox.h" #include "RenderLayer.h" +#include "RenderPart.h" #include "RenderText.h" #include "RenderTextControl.h" #include "RenderThemeAndroid.h" @@ -374,6 +376,66 @@ void WebViewCore::recordPictureSet(PictureSet* content) WebCore::FrameView* view = m_mainFrame->view(); int width = view->contentsWidth(); int height = view->contentsHeight(); + + // Use the contents width and height as a starting point. + SkIRect contentRect; + contentRect.set(0, 0, width, height); + SkIRect total(contentRect); + + // Traverse all the frames and add their sizes if they are in the visible + // rectangle. + for (WebCore::Frame* frame = m_mainFrame->tree()->traverseNext(); frame; + frame = frame->tree()->traverseNext()) { + // If the frame doesn't have an owner then it is the top frame and the + // view size is the frame size. + WebCore::RenderPart* owner = frame->ownerRenderer(); + if (owner) { + int x = owner->x(); + int y = owner->y(); + + // Traverse the tree up to the parent to find the absolute position + // of this frame. + WebCore::Frame* parent = frame->tree()->parent(); + while (parent) { + WebCore::RenderPart* parentOwner = parent->ownerRenderer(); + if (parentOwner) { + x += parentOwner->x(); + y += parentOwner->y(); + } + parent = parent->tree()->parent(); + } + // Use the owner dimensions so that padding and border are + // included. + int right = x + owner->width(); + int bottom = y + owner->height(); + SkIRect frameRect = {x, y, right, bottom}; + if (SkIRect::Intersects(total, frameRect)) + total.join(x, y, right, bottom); + } + } + + // If the new total is larger than the content, resize the view to include + // all the content. + if (!contentRect.contains(total)) { + // Resize the view to change the overflow clip. + view->resize(total.width(), total.height()); + + // We have to force a layout in order for the clip to change. + m_mainFrame->contentRenderer()->setNeedsLayoutAndPrefWidthsRecalc(); + view->forceLayout(); + + // Relayout similar to above + m_skipContentDraw = true; + bool success = layoutIfNeededRecursive(m_mainFrame); + m_skipContentDraw = false; + if (!success) + return; + + // Set the computed content width + width = view->contentsWidth(); + height = view->contentsHeight(); + } + content->checkDimensions(width, height, &m_addInval); // The inval region may replace existing pictures. The existing pictures |