WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Carry out the move
0003-Move-Frame-forceLayout-Frame-adjustPageHeight-and.patch (text/plain), 15.96 KB, created by
Holger Freyther
on 2009-01-20 04:38:14 PST
(
hide
)
Description:
Carry out the move
Filename:
MIME Type:
Creator:
Holger Freyther
Created:
2009-01-20 04:38:14 PST
Size:
15.96 KB
patch
obsolete
>From 6dbdfdb9b7d1307a902f40db3ec540b14150eb6a Mon Sep 17 00:00:00 2001 >From: Holger Hans Peter Freyther <zecke@selfish.org> >Date: Thu, 25 Dec 2008 01:22:37 +0100 >Subject: [PATCH] Move Frame::forceLayout, Frame::adjustPageHeight and Frame::forceLayoutWithPageWidthRange to FrameView > >FrameView::forceLayout could be killed but the comment might >contain a value over the the plain FrameView::layout... > >Adjust the WebCore/WebKit consumers of these methods. >--- > WebCore/WebCore.base.exp | 6 +- > WebCore/page/Frame.cpp | 61 +------------------- > WebCore/page/Frame.h | 5 -- > WebCore/page/FrameView.cpp | 56 ++++++++++++++++++ > WebCore/page/FrameView.h | 6 ++ > WebCore/page/PrintContext.cpp | 2 +- > WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 4 +- > WebKit/gtk/webkit/webkitwebview.cpp | 2 +- > WebKit/mac/WebView/WebFrame.mm | 2 +- > WebKit/mac/WebView/WebHTMLView.mm | 7 +- > WebKit/qt/Api/qwebpage.cpp | 2 +- > WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 4 +- > WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp | 4 +- > 13 files changed, 83 insertions(+), 78 deletions(-) > >diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp >index 91424ff..0203032 100644 >--- a/WebCore/WebCore.base.exp >+++ b/WebCore/WebCore.base.exp >@@ -472,12 +472,10 @@ __ZN7WebCore5Cache11setDisabledEb > __ZN7WebCore5Cache13getStatisticsEv > __ZN7WebCore5Cache13setCapacitiesEjjj > __ZN7WebCore5Frame10findStringERKNS_6StringEbbbb >-__ZN7WebCore5Frame11forceLayoutEb > __ZN7WebCore5Frame11shouldCloseEv > __ZN7WebCore5Frame13reapplyStylesEv > __ZN7WebCore5Frame13setZoomFactorEfb > __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE >-__ZN7WebCore5Frame16adjustPageHeightEPffff > __ZN7WebCore5Frame17setIsDisconnectedEb > __ZN7WebCore5Frame19setInViewSourceModeEb > __ZN7WebCore5Frame20setSelectionFromNoneEv >@@ -487,7 +485,6 @@ __ZN7WebCore5Frame24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10Edit > __ZN7WebCore5Frame24setExcludeFromTextSearchEb > __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE > __ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementE >-__ZN7WebCore5Frame29forceLayoutWithPageWidthRangeEffb > __ZN7WebCore5Frame34setMarkedTextMatchesAreHighlightedEb > __ZN7WebCore5Frame4initEv > __ZN7WebCore5Frame6scriptEv >@@ -638,6 +635,9 @@ __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv > __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb > __ZN7WebCore9FrameViewC1EPNS_5FrameE > __ZN7WebCore9FrameViewC1EPNS_5FrameERKNS_7IntSizeE >+__ZN7WebCore9FrameView16adjustPageHeightEPffff >+__ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb >+__ZN7WebCore9FrameView11forceLayoutEb > __ZN7WebCore9HTMLNames10listingTagE > __ZN7WebCore9HTMLNames13blockquoteTagE > __ZN7WebCore9HTMLNames4aTagE >diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp >index 8c395c3..9596b40 100644 >--- a/WebCore/page/Frame.cpp >+++ b/WebCore/page/Frame.cpp >@@ -753,7 +753,7 @@ void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, b > m_doc->setPrinting(printing); > view()->setMediaType(printing ? "print" : "screen"); > m_doc->updateStyleSelector(); >- forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); >+ view()->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); > > for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) > child->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize); >@@ -1295,22 +1295,6 @@ void Frame::revealCaret(const RenderLayer::ScrollAlignment& alignment) const > } > } > >-void Frame::adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) >-{ >- RenderView* root = contentRenderer(); >- if (root) { >- // Use a context with painting disabled. >- GraphicsContext context((PlatformGraphicsContext*)0); >- root->setTruncatedAt((int)floorf(oldBottom)); >- IntRect dirtyRect(0, (int)floorf(oldTop), root->docWidth(), (int)ceilf(oldBottom - oldTop)); >- root->layer()->paint(&context, dirtyRect); >- *newBottom = root->bestTruncatedAt(); >- if (*newBottom == 0) >- *newBottom = oldBottom; >- } else >- *newBottom = oldBottom; >-} >- > Frame* Frame::frameForWidget(const Widget* widget) > { > ASSERT_ARG(widget, widget); >@@ -1325,49 +1309,6 @@ Frame* Frame::frameForWidget(const Widget* widget) > return static_cast<const FrameView*>(widget)->frame(); > } > >-void Frame::forceLayout(bool allowSubtree) >-{ >- FrameView *v = m_view.get(); >- if (v) { >- v->layout(allowSubtree); >- // We cannot unschedule a pending relayout, since the force can be called with >- // a tiny rectangle from a drawRect update. By unscheduling we in effect >- // "validate" and stop the necessary full repaint from occurring. Basically any basic >- // append/remove DHTML is broken by this call. For now, I have removed the optimization >- // until we have a better invalidation stategy. -dwh >- //v->unscheduleRelayout(); >- } >-} >- >-void Frame::forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize) >-{ >- // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see >- // the state of things before and after the layout >- RenderView *root = static_cast<RenderView*>(document()->renderer()); >- if (root) { >- // This magic is basically copied from khtmlview::print >- int pageW = (int)ceilf(minPageWidth); >- root->setWidth(pageW); >- root->setNeedsLayoutAndPrefWidthsRecalc(); >- forceLayout(); >- >- // If we don't fit in the minimum page width, we'll lay out again. If we don't fit in the >- // maximum page width, we will lay out to the maximum page width and clip extra content. >- // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping >- // implementation should not do this! >- int rightmostPos = root->rightmostPosition(); >- if (rightmostPos > minPageWidth) { >- pageW = min(rightmostPos, (int)ceilf(maxPageWidth)); >- root->setWidth(pageW); >- root->setNeedsLayoutAndPrefWidthsRecalc(); >- forceLayout(); >- } >- } >- >- if (adjustViewSize && view()) >- view()->adjustViewSize(); >-} >- > void Frame::clearTimers(FrameView *view, Document *document) > { > if (view) { >diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h >index fb8a283..e35f963 100644 >--- a/WebCore/page/Frame.h >+++ b/WebCore/page/Frame.h >@@ -175,11 +175,6 @@ private: > // === to be moved into FrameView > > public: >- void forceLayout(bool allowSubtree = false); >- void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); >- >- void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); >- > void setZoomFactor(float scale, bool isTextOnly); > float zoomFactor() const; > bool isZoomFactorTextOnly() const; >diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp >index d8c6e81..1799853 100644 >--- a/WebCore/page/FrameView.cpp >+++ b/WebCore/page/FrameView.cpp >@@ -1239,4 +1239,60 @@ void FrameView::layoutIfNeededRecursive() > static_cast<FrameView*>(*current)->layoutIfNeededRecursive(); > } > >+void FrameView::forceLayout(bool allowSubtree) >+{ >+ layout(allowSubtree); >+ // We cannot unschedule a pending relayout, since the force can be called with >+ // a tiny rectangle from a drawRect update. By unscheduling we in effect >+ // "validate" and stop the necessary full repaint from occurring. Basically any basic >+ // append/remove DHTML is broken by this call. For now, I have removed the optimization >+ // until we have a better invalidation stategy. -dwh >+ //v->unscheduleRelayout(); >+} >+ >+void FrameView::forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool _adjustViewSize) >+{ >+ // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see >+ // the state of things before and after the layout >+ RenderView *root = static_cast<RenderView*>(m_frame->document()->renderer()); >+ if (root) { >+ // This magic is basically copied from khtmlview::print >+ int pageW = (int)ceilf(minPageWidth); >+ root->setWidth(pageW); >+ root->setNeedsLayoutAndPrefWidthsRecalc(); >+ forceLayout(); >+ >+ // If we don't fit in the minimum page width, we'll lay out again. If we don't fit in the >+ // maximum page width, we will lay out to the maximum page width and clip extra content. >+ // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping >+ // implementation should not do this! >+ int rightmostPos = root->rightmostPosition(); >+ if (rightmostPos > minPageWidth) { >+ pageW = std::min(rightmostPos, (int)ceilf(maxPageWidth)); >+ root->setWidth(pageW); >+ root->setNeedsLayoutAndPrefWidthsRecalc(); >+ forceLayout(); >+ } >+ } >+ >+ if (_adjustViewSize) >+ adjustViewSize(); >+} >+ >+void FrameView::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) >+{ >+ RenderView* root = m_frame->contentRenderer(); >+ if (root) { >+ // Use a context with painting disabled. >+ GraphicsContext context((PlatformGraphicsContext*)0); >+ root->setTruncatedAt((int)floorf(oldBottom)); >+ IntRect dirtyRect(0, (int)floorf(oldTop), root->docWidth(), (int)ceilf(oldBottom - oldTop)); >+ root->layer()->paint(&context, dirtyRect); >+ *newBottom = root->bestTruncatedAt(); >+ if (*newBottom == 0) >+ *newBottom = oldBottom; >+ } else >+ *newBottom = oldBottom; >+} >+ > } // namespace WebCore >diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h >index a1d514f..eb5e127 100644 >--- a/WebCore/page/FrameView.h >+++ b/WebCore/page/FrameView.h >@@ -168,6 +168,12 @@ public: > > void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } > >+ void forceLayout(bool allowSubtree = false); >+ void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); >+ >+ void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); >+ >+ > private: > void reset(); > void init(); >diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp >index 79672a3..b83d714 100644 >--- a/WebCore/page/PrintContext.cpp >+++ b/WebCore/page/PrintContext.cpp >@@ -85,7 +85,7 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig > float printedPagesHeight = 0.0; > do { > float proposedBottom = std::min(docHeight, printedPagesHeight + pageHeight); >- m_frame->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight); >+ m_frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight); > currPageHeight = max(1.0f, proposedBottom - printedPagesHeight); > > m_pageRects.append(IntRect(0, (int)printedPagesHeight, (int)currPageWidth, (int)currPageHeight)); >diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp >index 1b410c7..f4d1f16 100644 >--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp >+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp >@@ -524,7 +524,9 @@ void FrameLoaderClient::makeRepresentation(DocumentLoader*) > > void FrameLoaderClient::forceLayout() > { >- core(m_frame)->forceLayout(true); >+ FrameView* view = core(m_frame)->view(); >+ if (view) >+ view->forceLayout(true); > } > > void FrameLoaderClient::forceLayoutForNonHTML() >diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp >index 358ace9..ce820f8 100644 >--- a/WebKit/gtk/webkit/webkitwebview.cpp >+++ b/WebKit/gtk/webkit/webkitwebview.cpp >@@ -535,7 +535,7 @@ static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allo > return; > > frame->view()->resize(allocation->width, allocation->height); >- frame->forceLayout(); >+ frame->view()->forceLayout(); > frame->view()->adjustViewSize(); > } > >diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm >index 6c568a4..879a9cc 100644 >--- a/WebKit/mac/WebView/WebFrame.mm >+++ b/WebKit/mac/WebView/WebFrame.mm >@@ -616,7 +616,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) > // We need to give the part the opportunity to adjust the page height at each step. > for (float i = 0; i < docHeight; i += currPageHeight) { > float proposedBottom = min(docHeight, i + printHeight); >- _private->coreFrame->adjustPageHeight(&proposedBottom, i, proposedBottom, i); >+ view->adjustPageHeight(&proposedBottom, i, proposedBottom, i); > currPageHeight = max(1.0f, proposedBottom - i); > for (float j = 0; j < docWidth; j += printWidth) { > NSValue* val = [NSValue valueWithRect: NSMakeRect(j, i, printWidth, currPageHeight)]; >diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm >index 3ceb49e..66fb4e7 100644 >--- a/WebKit/mac/WebView/WebHTMLView.mm >+++ b/WebKit/mac/WebView/WebHTMLView.mm >@@ -2812,9 +2812,9 @@ static void _updateFocusedAndActiveStateTimerCallback(CFRunLoopTimerRef timer, v > } > > if (minPageWidth > 0.0) >- coreFrame->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); >+ coreFrame->view()->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); > else { >- coreFrame->forceLayout(!adjustViewSize); >+ coreFrame->view()->forceLayout(!adjustViewSize); > if (adjustViewSize) > coreFrame->view()->adjustViewSize(); > } >@@ -3443,7 +3443,8 @@ noPromisedData: > [self _setPrinting:YES minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:NO]; > > float newBottomFloat = *newBottom; >- core([self _frame])->adjustPageHeight(&newBottomFloat, oldTop, oldBottom, bottomLimit); >+ if (FrameView* view = core([self _frame])->view()) >+ view->adjustPageHeight(&newBottomFloat, oldTop, oldBottom, bottomLimit); > > #ifdef __LP64__ > // If the new bottom is equal to the old bottom (when both are treated as floats), we just copy >diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp >index 7482381..52d9b66 100644 >--- a/WebKit/qt/Api/qwebpage.cpp >+++ b/WebKit/qt/Api/qwebpage.cpp >@@ -1546,7 +1546,7 @@ void QWebPage::setViewportSize(const QSize &size) const > if (frame->d->frame && frame->d->frame->view()) { > WebCore::FrameView* view = frame->d->frame->view(); > view->setFrameRect(QRect(QPoint(0, 0), size)); >- frame->d->frame->forceLayout(); >+ view->forceLayout(); > view->adjustViewSize(); > } > } >diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp >index 40f6357..dbb377e 100644 >--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp >+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp >@@ -231,7 +231,9 @@ void FrameLoaderClientQt::makeRepresentation(DocumentLoader*) > > void FrameLoaderClientQt::forceLayout() > { >- m_frame->forceLayout(true); >+ FrameView* view = m_frame->view(); >+ if (view) >+ view->forceLayout(true); > } > > >diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp >index 2df4ea7..7fe89e1 100644 >--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -91,7 +91,9 @@ bool WebFrameLoaderClient::hasWebView() const > > void WebFrameLoaderClient::forceLayout() > { >- core(m_webFrame)->forceLayout(true); >+ FrameView* view = core(m_webFrame)->view(); >+ if (view) >+ view->forceLayout(true); > } > > void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request) >-- >1.6.0.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 23428
: 26858