[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:40:32 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit b478f409cfff7ed8ae05e2f438e4ba86ae87089c
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed May 19 02:54:33 2004 +0000
WebCore:
Improve layout scheduling and add instrumentation for debugging layout scheduling
Reviewed by kocienda
* khtml/khtml_part.cpp:
(KHTMLPart::slotFinishedParsing):
(KHTMLPart::checkCompleted):
* khtml/khtmlview.cpp:
(KHTMLViewPrivate::KHTMLViewPrivate):
(KHTMLViewPrivate::reset):
(KHTMLView::layout):
(KHTMLView::scheduleRelayout):
(KHTMLView::haveDelayedLayoutScheduled):
(KHTMLView::unscheduleRelayout):
* khtml/khtmlview.h:
* khtml/rendering/render_object.cpp:
(RenderObject::repaintAfterLayoutIfNeeded):
* khtml/rendering/render_replaced.cpp:
(RenderWidget::updateWidgetPositions):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::DocumentImpl):
(DocumentImpl::close):
(DocumentImpl::setParsing):
(DocumentImpl::shouldScheduleLayout):
(DocumentImpl::minimumLayoutDelay):
(DocumentImpl::elapsedTime):
(DocumentImpl::finishParsing):
(DocumentImpl::updateStyleSelector):
* khtml/xml/dom_docimpl.h:
(DOM::DocumentImpl::allDataReceived):
* kwq/KWQDateTime.h:
* kwq/KWQDateTime.mm:
(QTime::elapsed):
* kwq/KWQWidget.mm:
(QWidget::setFrameGeometry):
WebKit:
Improve layout scheduling.
Reviewed by kocienda
* WebView.subproj/WebFrame.m:
(-[WebFrame _transitionToLayoutAcceptable]):
(-[WebFrame _checkLoadCompleteForThisFrame]):
* WebView.subproj/WebHTMLRepresentation.m:
(-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f2f0e45..ad115fa 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,41 @@
+2004-05-18 David Hyatt <hyatt at apple.com>
+
+ Improve layout scheduling and add instrumentation for debugging layout scheduling
+
+ Reviewed by kocienda
+
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::slotFinishedParsing):
+ (KHTMLPart::checkCompleted):
+ * khtml/khtmlview.cpp:
+ (KHTMLViewPrivate::KHTMLViewPrivate):
+ (KHTMLViewPrivate::reset):
+ (KHTMLView::layout):
+ (KHTMLView::scheduleRelayout):
+ (KHTMLView::haveDelayedLayoutScheduled):
+ (KHTMLView::unscheduleRelayout):
+ * khtml/khtmlview.h:
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::repaintAfterLayoutIfNeeded):
+ * khtml/rendering/render_replaced.cpp:
+ (RenderWidget::updateWidgetPositions):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::DocumentImpl):
+ (DocumentImpl::close):
+ (DocumentImpl::setParsing):
+ (DocumentImpl::shouldScheduleLayout):
+ (DocumentImpl::minimumLayoutDelay):
+ (DocumentImpl::elapsedTime):
+ (DocumentImpl::finishParsing):
+ (DocumentImpl::updateStyleSelector):
+ * khtml/xml/dom_docimpl.h:
+ (DOM::DocumentImpl::allDataReceived):
+ * kwq/KWQDateTime.h:
+ * kwq/KWQDateTime.mm:
+ (QTime::elapsed):
+ * kwq/KWQWidget.mm:
+ (QWidget::setFrameGeometry):
+
2004-05-18 Richard Williamson <rjw at apple.com>
Finished implementing support for windowScriptObject.
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 2abddd6..e95438a 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -1671,18 +1671,18 @@ void KHTMLPart::gotoAnchor()
void KHTMLPart::slotFinishedParsing()
{
d->m_doc->setParsing(false);
- checkEmitLoadEvent();
disconnect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing()));
if (!d->m_view)
return; // We are probably being destructed.
+
+ checkCompleted();
+
// check if the scrollbars are really needed for the content
// if not, remove them, relayout, and repaint
d->m_view->restoreScrollBar();
gotoAnchor();
-
- checkCompleted();
}
void KHTMLPart::slotLoaderRequestStarted( khtml::DocLoader* dl, khtml::CachedObject *obj )
@@ -1803,8 +1803,6 @@ void KHTMLPart::checkCompleted()
d->m_extension->urlArgs().yOffset );
#endif
- d->m_view->complete();
-
#if APPLE_CHANGES
} // if (d->m_view)
#endif
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 48337b5..f74d745 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -66,6 +66,8 @@
#define PAINT_BUFFER_HEIGHT 128
+//#define INSTRUMENT_LAYOUT_SCHEDULING 1
+
using namespace DOM;
using namespace khtml;
class KHTMLToolTip;
@@ -104,7 +106,7 @@ public:
paintBuffer=0;
formCompletions=0;
layoutTimerId = 0;
- complete = false;
+ layoutTimerParsing = false;
mousePressed = false;
tooltip = 0;
doFullRepaint = true;
@@ -158,7 +160,7 @@ public:
isDoubleClick = false;
scrollingSelf = false;
layoutTimerId = 0;
- complete = false;
+ layoutTimerParsing = false;
mousePressed = false;
doFullRepaint = true;
layoutSchedulingEnabled = true;
@@ -200,8 +202,8 @@ public:
int prevMouseX, prevMouseY;
bool scrollingSelf;
int layoutTimerId;
-
- bool complete;
+ bool layoutTimerParsing;
+
bool layoutSchedulingEnabled;
bool layoutSuppressed;
#if APPLE_CHANGES
@@ -532,6 +534,7 @@ void KHTMLView::layout()
d->layoutSchedulingEnabled=false;
killTimer(d->layoutTimerId);
d->layoutTimerId = 0;
+ d->layoutTimerParsing = false;
if (!m_part) {
// FIXME: Do we need to set _width here?
@@ -569,6 +572,11 @@ void KHTMLView::layout()
}
}
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (d->firstLayout && !document->ownerElement())
+ printf("Elapsed time before first layout: %d\n", document->elapsedTime());
+#endif
+
d->doFullRepaint = d->firstLayout || root->printingMode();
if (d->repaintRects)
d->repaintRects->clear();
@@ -1827,9 +1835,21 @@ void KHTMLView::scheduleRelayout()
if (d->layoutTimerId || (m_part->xmlDocImpl() && !m_part->xmlDocImpl()->shouldScheduleLayout()))
return;
+ d->layoutTimerParsing = m_part->xmlDocImpl() && !m_part->xmlDocImpl()->allDataReceived();
+
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!m_part->xmlDocImpl()->ownerElement())
+ printf("Scheduling layout for %d\n", m_part->xmlDocImpl()->minimumLayoutDelay());
+#endif
+
d->layoutTimerId = startTimer(m_part->xmlDocImpl() ? m_part->xmlDocImpl()->minimumLayoutDelay() : 0);
}
+bool KHTMLView::haveDelayedLayoutScheduled()
+{
+ return d->layoutTimerId && d->layoutTimerParsing;
+}
+
void KHTMLView::unscheduleRelayout()
{
if (!d->layoutTimerId)
@@ -1837,22 +1857,7 @@ void KHTMLView::unscheduleRelayout()
killTimer(d->layoutTimerId);
d->layoutTimerId = 0;
-}
-
-void KHTMLView::complete()
-{
-// kdDebug() << "KHTMLView::complete()" << endl;
-
- d->complete = true;
-
- // is there a relayout pending?
- if (d->layoutTimerId)
- {
-// kdDebug() << "requesting relayout now" << endl;
- // do it now
- killTimer(d->layoutTimerId);
- d->layoutTimerId = startTimer( 0 );
- }
+ d->layoutTimerParsing = false;
}
bool KHTMLView::isTransparent() const
diff --git a/WebCore/khtml/khtmlview.h b/WebCore/khtml/khtmlview.h
index 4ec9a65..0b746f7 100644
--- a/WebCore/khtml/khtmlview.h
+++ b/WebCore/khtml/khtmlview.h
@@ -229,6 +229,7 @@ private:
void scheduleRelayout();
void unscheduleRelayout();
+ bool haveDelayedLayoutScheduled();
/**
* Paints the HTML document to a QPainter.
@@ -274,8 +275,6 @@ private:
int detail,QMouseEvent *_mouse, bool setUnder,
int mouseEventType);
- void complete();
-
void applyBodyScrollQuirk(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
// ------------------------------------- member variables ------------------------------------
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index e8387e5..00d8d53 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -1162,15 +1162,12 @@ bool RenderObject::repaintAfterLayoutIfNeeded(const QRect& oldBounds, const QRec
QRect newBounds, newFullBounds;
getAbsoluteRepaintRectIncludingFloats(newBounds, newFullBounds);
if (newBounds != oldBounds || selfNeedsLayout()) {
- RenderObject* c = canvas();
- if (!c || !c->isCanvas())
- return false;
- RenderCanvas* canvasObj = static_cast<RenderCanvas*>(c);
- if (canvasObj->printingMode())
+ RenderCanvas* c = canvas();
+ if (c->printingMode())
return false; // Don't repaint if we're printing.
- canvasObj->repaintViewRectangle(oldFullBounds);
+ c->repaintViewRectangle(oldFullBounds);
if (newBounds != oldBounds)
- canvasObj->repaintViewRectangle(newFullBounds);
+ c->repaintViewRectangle(newFullBounds);
return true;
}
return false;
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index f1193c7..b2f9699 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -514,8 +514,17 @@ void RenderWidget::updateWidgetPositions()
width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
QRect newBounds(x,y,width,height);
- if (newBounds != m_widget->frameGeometry()) {
+ QRect oldBounds(m_widget->frameGeometry());
+ if (newBounds != oldBounds) {
// The widget changed positions. Update the frame geometry.
+ if (checkForRepaintDuringLayout()) {
+ RenderCanvas* c = canvas();
+ if (!c->printingMode()) {
+ c->repaintViewRectangle(oldBounds);
+ c->repaintViewRectangle(newBounds);
+ }
+ }
+
RenderArena *arena = ref();
element()->ref();
m_widget->setFrameGeometry(newBounds);
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 2202f03..eb365e1 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -89,6 +89,8 @@ using XBL::XBLBindingManager;
using namespace DOM;
using namespace khtml;
+//#define INSTRUMENT_LAYOUT_SCHEDULING 1
+
DOMImplementationImpl *DOMImplementationImpl::m_instance = 0;
DOMImplementationImpl::DOMImplementationImpl()
@@ -270,6 +272,7 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
visuallyOrdered = false;
m_loadingSheet = false;
m_bParsing = false;
+ m_bAllDataReceived = false;
m_docChanged = false;
m_sheet = 0;
m_elemSheet = 0;
@@ -1299,6 +1302,10 @@ void DocumentImpl::close()
m_tokenizer = 0;
dispatchImageLoadEventsNow();
body()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!ownerElement())
+ printf("onload fired at %d\n", elapsedTime());
+#endif
}
m_processingLoadEvent = false;
@@ -1353,34 +1360,37 @@ void DocumentImpl::closeInternal( bool checkTokenizer )
void DocumentImpl::setParsing(bool b)
{
- if (m_bParsing != b) {
- m_bParsing = b;
- if (!b && haveStylesheetsLoaded() && !minimumLayoutDelay() &&
- (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->renderer()->needsLayout())) &&
- renderer() && renderer()->needsLayout())
- updateLayout();
- }
+ m_bParsing = b;
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!ownerElement() && !m_bParsing)
+ printf("Parsing turned off at %d\n", elapsedTime());
+#endif
}
bool DocumentImpl::shouldScheduleLayout()
{
- return renderer() && haveStylesheetsLoaded() && (!m_tokenizer || m_overMinimumLayoutThreshold || m_startTime.elapsed() > cLayoutScheduleThreshold);
+ return renderer() && haveStylesheetsLoaded();
}
int DocumentImpl::minimumLayoutDelay()
{
- if (!parsing() && m_overMinimumLayoutThreshold)
+ if (allDataReceived() && m_overMinimumLayoutThreshold)
return 0;
int elapsed = m_startTime.elapsed();
m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold;
- if (parsing()) // Always want the nearest multiple of the timer delay.
+ if (!allDataReceived()) // Always want the nearest multiple of the timer delay.
return cLayoutTimerDelay - elapsed % cLayoutTimerDelay;
// We'll want to schedule the timer to fire at the minimum layout threshold.
return kMax(0, cLayoutScheduleThreshold - elapsed);
}
+int DocumentImpl::elapsedTime() const
+{
+ return m_startTime.elapsed();
+}
+
void DocumentImpl::write( const DOMString &text )
{
write(text.string());
@@ -1404,10 +1414,41 @@ void DocumentImpl::writeln( const DOMString &text )
write(DOMString("\n"));
}
-void DocumentImpl::finishParsing ( )
+void DocumentImpl::finishParsing()
{
- if(m_tokenizer)
+ // Let the tokenizer go through as much data as it can. There will be three possible outcomes after
+ // finish() is called:
+ // (1) All remaining data is parsed, document isn't loaded yet
+ // (2) All remaining data is parsed, document is loaded, tokenizer gets deleted
+ // (3) Data is still remaining to be parsed.
+ if (m_tokenizer)
m_tokenizer->finish();
+
+ // Don't say we've really received all the data until we've given the tokenizer
+ // a chance to try to eat as much of the data as it can.
+ m_bAllDataReceived = true;
+
+ if (m_tokenizer) {
+ // Update layout *now* if possible. If we don't have a tokenizer any more, we already updated
+ // layout because of the onload firing.
+
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!ownerElement())
+ printf("Received all data and parsed as much as possible at time: %d with delay until next layout of %d\n", elapsedTime(), minimumLayoutDelay());
+#endif
+
+ // We can update layout if:
+ // (a) we're an XML document or we're an HTML document and our body has been parsed (ensuring we'll have
+ // the background ready to paint)
+ // (b) our stylesheets are all loaded
+ // (c) we're over the minimum layout threshold
+ // (d) we are an iframe in a document that has flowed us already or we aren't an iframe at all
+ // (e) we actually need a layout
+ if ((!isHTMLDocument() || body()) && haveStylesheetsLoaded() && !minimumLayoutDelay() &&
+ (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->renderer()->needsLayout())) &&
+ renderer() && renderer()->needsLayout())
+ updateLayout();
+ }
}
void DocumentImpl::clear()
@@ -2085,8 +2126,19 @@ void DocumentImpl::updateStyleSelector()
m_styleSelectorDirty = true;
#endif
- if (renderer())
+
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!ownerElement())
+ printf("Dirtying renderer from stylesheet load at time %d\n", elapsedTime());
+#endif
+
+ if (renderer()) {
renderer()->setNeedsLayoutAndMinMaxRecalc();
+ if (allDataReceived() && view()->haveDelayedLayoutScheduled()) {
+ view()->unscheduleRelayout();
+ view()->scheduleRelayout();
+ }
+ }
}
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index 30ab8db..46cdad9 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -347,9 +347,11 @@ public:
void setParsing(bool b);
bool parsing() const { return m_bParsing; }
+ bool allDataReceived() const { return m_bAllDataReceived; }
int minimumLayoutDelay();
bool shouldScheduleLayout();
-
+ int elapsedTime() const;
+
void setTextColor( QColor color ) { m_textColor = color; }
QColor textColor() const { return m_textColor; }
@@ -597,6 +599,7 @@ protected:
bool m_loadingSheet;
bool visuallyOrdered;
bool m_bParsing;
+ bool m_bAllDataReceived;
bool m_docChanged;
bool m_styleSelectorDirty;
bool m_inStyleRecalc;
diff --git a/WebCore/kwq/KWQDateTime.h b/WebCore/kwq/KWQDateTime.h
index 83c1681..288ac2a 100644
--- a/WebCore/kwq/KWQDateTime.h
+++ b/WebCore/kwq/KWQDateTime.h
@@ -41,7 +41,7 @@ public:
int msec() const;
void start() { timeInSeconds = CFAbsoluteTimeGetCurrent(); }
- int elapsed();
+ int elapsed() const;
int restart();
private:
diff --git a/WebCore/kwq/KWQDateTime.mm b/WebCore/kwq/KWQDateTime.mm
index 5109b7c..f9bcfb9 100644
--- a/WebCore/kwq/KWQDateTime.mm
+++ b/WebCore/kwq/KWQDateTime.mm
@@ -51,7 +51,7 @@ int QTime::msec() const
return (int)(seconds * 1000) % 1000;
}
-int QTime::elapsed()
+int QTime::elapsed() const
{
CFTimeInterval elapsed = CFAbsoluteTimeGetCurrent() - timeInSeconds;
return (int)(elapsed * 1000);
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 2b6beda..cf54d11 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -424,9 +424,8 @@ void QWidget::setFrameGeometry(const QRect &rect)
NSView *v = getOuterView();
NSRect f = rect;
if (!NSEqualRects(f, [v frame])) {
- [v setNeedsDisplay:YES];
[v setFrame:f];
- [v setNeedsDisplay:YES];
+ [v setNeedsDisplay: NO];
}
KWQ_UNBLOCK_EXCEPTIONS;
}
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c796d8f..17ae84b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,15 @@
+2004-05-18 David Hyatt <hyatt at apple.com>
+
+ Improve layout scheduling.
+
+ Reviewed by kocienda
+
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame _transitionToLayoutAcceptable]):
+ (-[WebFrame _checkLoadCompleteForThisFrame]):
+ * WebView.subproj/WebHTMLRepresentation.m:
+ (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
+
2004-05-18 Richard Williamson <rjw at apple.com>
Finished implementation of windowScriptObject.
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 9f1db11..69c5288 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -596,6 +596,16 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
case WebFrameStateCommittedPage:
{
[self _setState: WebFrameStateLayoutAcceptable];
+ if (!([[self dataSource] _isDocumentHTML])) {
+ // Go ahead and lay out/display non-HTML the minute we have some data. This makes
+ // more sense for text files (which can always be immediately displayed).
+ WebFrameView *thisView = [self frameView];
+ NSView <WebDocumentView> *thisDocumentView = [thisView documentView];
+ ASSERT(thisDocumentView != nil);
+ [thisDocumentView setNeedsLayout:YES];
+ [thisDocumentView layout];
+ [thisDocumentView setNeedsDisplay:YES];
+ }
return;
}
@@ -1014,9 +1024,6 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
// non-HTML content, or make a call to the document and let it deal with the bridge.
[self _setState:WebFrameStateComplete];
- if ([ds _isDocumentHTML]) {
- [_private->bridge end];
- }
// FIXME: Is this subsequent work important if we already navigated away?
// Maybe there are bugs because of that, or extra work we can skip because
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index ab9860c..f68b7e4 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -124,6 +124,7 @@
// way to get work done that is normally done when the first bit of data is
// received, even for the case of a document with no data (like about:blank).
[_private->bridge receivedData:nil textEncodingName:[[_private->dataSource response] textEncodingName]];
+ [_private->bridge end];
}
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list