Changeset 14658 in webkit
- Timestamp:
- May 31, 2006 10:56:54 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r14657 r14658 1 2006-05-31 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 Reviewed by Hyatt. 4 5 - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8969 6 REGRESSION: typing in textfield repaints whole web page at gamefaqs.com 7 8 No test possible (no functionality change) 9 10 * dom/Document.cpp: 11 (WebCore::Document::updateLayout): Changed to ensure that pending subtree 12 layouts are performed too. 13 * page/Frame.cpp: 14 (WebCore::Frame::forceLayout): Force a full layout. 15 * page/FrameView.cpp: 16 (WebCore::FrameViewPrivate::reset): 17 (WebCore::FrameView::layout): Changed to relayout only the subtree rooted 18 at d->layoutRoot if it's non-zero and allowSubtree is true. 19 (WebCore::FrameView::scheduleRelayout): Change pending subtree relayout into 20 normal relayout by clearing d->layoutRoot and propagating needsLayout to the 21 root. 22 (WebCore::FrameView::scheduleRelayoutOfSubtree): Added. 23 * page/FrameView.h: 24 * rendering/RenderObject.cpp: 25 (WebCore::RenderObject::markContainingBlocksForLayout): Added scheduleRelayout 26 parameter. FrameView passes false to force marking all the way to the root 27 when turning a pending subtree relayout into a full relayout. Otherwise, 28 marking stops at the first textField (or at the root) and 29 relayout of the last object reached is scheduled. 30 (WebCore::RenderObject::scheduleRelayout): 31 * rendering/RenderObject.h: 32 1 33 2006-05-31 Sam Weinig <sam.weinig@gmail.com> 2 34 -
trunk/WebCore/dom/Document.cpp
r14646 r14658 886 886 887 887 // Only do a layout if changes have occurred that make it necessary. 888 if (m_view && renderer() && renderer()->needsLayout())888 if (m_view && renderer() && (m_view->layoutPending() || renderer()->needsLayout())) 889 889 m_view->layout(); 890 890 } -
trunk/WebCore/page/Frame.cpp
r14646 r14658 2989 2989 FrameView *v = d->m_view.get(); 2990 2990 if (v) { 2991 v->layout( );2991 v->layout(false); 2992 2992 // We cannot unschedule a pending relayout, since the force can be called with 2993 2993 // a tiny rectangle from a drawRect update. By unscheduling we in effect -
trunk/WebCore/page/FrameView.cpp
r14638 r14658 87 87 scrollingSelf = false; 88 88 layoutTimer.stop(); 89 layoutRoot = 0; 89 90 delayedLayout = false; 90 91 mousePressed = false; … … 123 124 Timer<FrameView> layoutTimer; 124 125 bool delayedLayout; 126 RefPtr<Node> layoutRoot; 125 127 126 128 bool layoutSchedulingEnabled; … … 299 301 } 300 302 301 void FrameView::layout( )303 void FrameView::layout(bool allowSubtree) 302 304 { 303 305 if (d->layoutSuppressed) … … 314 316 } 315 317 318 if (!allowSubtree && d->layoutRoot) { 319 if (d->layoutRoot->renderer()) 320 d->layoutRoot->renderer()->markContainingBlocksForLayout(false); 321 d->layoutRoot = 0; 322 } 323 324 bool subtree = d->layoutRoot; 316 325 Document* document = m_frame->document(); 317 326 if (!document) { … … 321 330 } 322 331 332 Node* rootNode = subtree ? d->layoutRoot.get() : document; 323 333 d->layoutSchedulingEnabled = false; 324 334 … … 328 338 document->recalcStyle(); 329 339 330 Render View* root = static_cast<RenderView*>(document->renderer());340 RenderObject* root = rootNode->renderer(); 331 341 if (!root) { 332 342 // FIXME: Do we need to set m_size here? … … 338 348 ScrollBarMode vMode = d->vmode; 339 349 340 RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0; 341 if (document->isHTMLDocument()) { 342 Node *body = static_cast<HTMLDocument*>(document)->body(); 343 if (body && body->renderer()) { 344 if (body->hasTagName(framesetTag)) { 345 body->renderer()->setNeedsLayout(true); 346 vMode = ScrollBarAlwaysOff; 347 hMode = ScrollBarAlwaysOff; 350 if (!subtree) { 351 Document* document = static_cast<Document*>(rootNode); 352 RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0; 353 if (document->isHTMLDocument()) { 354 Node *body = static_cast<HTMLDocument*>(document)->body(); 355 if (body && body->renderer()) { 356 if (body->hasTagName(framesetTag)) { 357 body->renderer()->setNeedsLayout(true); 358 vMode = ScrollBarAlwaysOff; 359 hMode = ScrollBarAlwaysOff; 360 } else if (body->hasTagName(bodyTag)) { 361 RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer; 362 applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs 363 } 348 364 } 349 else if (body->hasTagName(bodyTag)) { 350 RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer; 351 applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs 352 } 353 } 354 } 355 else if (rootRenderer) 356 applyOverflowToViewport(rootRenderer, hMode, vMode); // XML/XHTML UAs use the root element. 357 365 } else if (rootRenderer) 366 applyOverflowToViewport(rootRenderer, hMode, vMode); // XML/XHTML UAs use the root element. 358 367 #if INSTRUMENT_LAYOUT_SCHEDULING 359 if (d->firstLayout && !document->ownerElement())360 printf("Elapsed time before first layout: %d\n", document->elapsedTime());368 if (d->firstLayout && !document->ownerElement()) 369 printf("Elapsed time before first layout: %d\n", document->elapsedTime()); 361 370 #endif 362 363 d->doFullRepaint = d->firstLayout || root->printingMode(); 371 } 372 373 d->doFullRepaint = !subtree && (d->firstLayout || static_cast<RenderView*>(root)->printingMode()); 364 374 if (d->repaintRects) 365 375 d->repaintRects->clear(); 366 376 367 // Now set our scrollbar state for the layout.368 ScrollBarMode currentHMode = hScrollBarMode();369 ScrollBarMode currentVMode = vScrollBarMode();370 371 377 bool didFirstLayout = false; 372 if (d->firstLayout || (hMode != currentHMode || vMode != currentVMode)) { 373 suppressScrollBars(true); 374 if (d->firstLayout) { 375 d->firstLayout = false; 376 didFirstLayout = true; 378 if (!subtree) { 379 // Now set our scrollbar state for the layout. 380 ScrollBarMode currentHMode = hScrollBarMode(); 381 ScrollBarMode currentVMode = vScrollBarMode(); 382 383 if (d->firstLayout || (hMode != currentHMode || vMode != currentVMode)) { 384 suppressScrollBars(true); 385 if (d->firstLayout) { 386 d->firstLayout = false; 387 didFirstLayout = true; 388 389 // Set the initial vMode to AlwaysOn if we're auto. 390 if (vMode == ScrollBarAuto) 391 ScrollView::setVScrollBarMode(ScrollBarAlwaysOn); // This causes a vertical scrollbar to appear. 392 // Set the initial hMode to AlwaysOff if we're auto. 393 if (hMode == ScrollBarAuto) 394 ScrollView::setHScrollBarMode(ScrollBarAlwaysOff); // This causes a horizontal scrollbar to disappear. 395 } 377 396 378 // Set the initial vMode to AlwaysOn if we're auto. 379 if (vMode == ScrollBarAuto) 380 ScrollView::setVScrollBarMode(ScrollBarAlwaysOn); // This causes a vertical scrollbar to appear. 381 // Set the initial hMode to AlwaysOff if we're auto. 382 if (hMode == ScrollBarAuto) 383 ScrollView::setHScrollBarMode(ScrollBarAlwaysOff); // This causes a horizontal scrollbar to disappear. 397 if (hMode == vMode) 398 ScrollView::setScrollBarsMode(hMode); 399 else { 400 ScrollView::setHScrollBarMode(hMode); 401 ScrollView::setVScrollBarMode(vMode); 402 } 403 404 suppressScrollBars(false, true); 384 405 } 385 386 if (hMode == vMode) 387 ScrollView::setScrollBarsMode(hMode); 388 else { 389 ScrollView::setHScrollBarMode(hMode); 390 ScrollView::setVScrollBarMode(vMode); 391 } 392 393 suppressScrollBars(false, true); 394 } 395 396 IntSize oldSize = m_size; 397 398 m_size = IntSize(visibleWidth(), visibleHeight()); 399 400 if (oldSize != m_size) 401 d->doFullRepaint = true; 402 403 RenderLayer* layer = root->layer(); 406 407 IntSize oldSize = m_size; 408 409 m_size = IntSize(visibleWidth(), visibleHeight()); 410 411 if (oldSize != m_size) 412 d->doFullRepaint = true; 413 } 414 415 RenderLayer* layer = root->enclosingLayer(); 404 416 405 417 if (!d->doFullRepaint) { … … 408 420 } 409 421 422 if (subtree) { 423 if (root->recalcMinMax()) 424 root->recalcMinMaxWidths(); 425 } 410 426 root->layout(); 427 d->layoutRoot = 0; 411 428 412 429 m_frame->invalidateSelection(); … … 415 432 d->layoutSuppressed = false; 416 433 417 if (! root->printingMode())434 if (!subtree && !static_cast<RenderView*>(root)->printingMode()) 418 435 resizeContents(layer->width(), layer->height()); 419 436 … … 422 439 423 440 // We update our widget positions right after doing a layout. 424 root->updateWidgetPositions(); 441 if (!subtree) 442 static_cast<RenderView*>(root)->updateWidgetPositions(); 425 443 426 444 if (d->repaintRects && !d->repaintRects->isEmpty()) { … … 1066 1084 void FrameView::scheduleRelayout() 1067 1085 { 1086 if (d->layoutRoot) { 1087 if (d->layoutRoot->renderer()) 1088 d->layoutRoot->renderer()->markContainingBlocksForLayout(false); 1089 d->layoutRoot = 0; 1090 } 1068 1091 if (!d->layoutSchedulingEnabled) 1069 1092 return; … … 1088 1111 } 1089 1112 1113 void FrameView::scheduleRelayoutOfSubtree(Node* n) 1114 { 1115 if (!d->layoutSchedulingEnabled || m_frame->document() && m_frame->document()->renderer() && m_frame->document()->renderer()->needsLayout()) { 1116 if (n->renderer()) 1117 n->renderer()->markContainingBlocksForLayout(false); 1118 return; 1119 } 1120 1121 if (layoutPending()) { 1122 if (d->layoutRoot != n) { 1123 // Just do a full relayout 1124 if (d->layoutRoot && d->layoutRoot->renderer()) 1125 d->layoutRoot->renderer()->markContainingBlocksForLayout(false); 1126 d->layoutRoot = 0; 1127 if (n->renderer()) 1128 n->renderer()->markContainingBlocksForLayout(false); 1129 } 1130 } else { 1131 int delay = m_frame->document()->minimumLayoutDelay(); 1132 d->layoutRoot = n; 1133 d->delayedLayout = delay != 0; 1134 d->layoutTimer.startOneShot(delay * 0.001); 1135 } 1136 } 1137 1090 1138 bool FrameView::layoutPending() 1091 1139 { -
trunk/WebCore/page/FrameView.h
r14638 r14658 116 116 void print(); 117 117 118 void layout( );118 void layout(bool allowSubtree = true); 119 119 120 120 bool inLayout() const; … … 153 153 154 154 void scheduleRelayout(); 155 void scheduleRelayoutOfSubtree(Node*); 155 156 void unscheduleRelayout(); 156 157 bool haveDelayedLayoutScheduled(); -
trunk/WebCore/rendering/RenderObject.cpp
r14650 r14658 690 690 } 691 691 692 void RenderObject::markContainingBlocksForLayout( )692 void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout) 693 693 { 694 694 RenderObject *o = container(); … … 700 700 return; 701 701 o->m_posChildNeedsLayout = true; 702 } 703 else { 702 } else { 704 703 if (o->m_normalChildNeedsLayout) 705 704 return; … … 708 707 709 708 last = o; 709 if (scheduleRelayout && last->isTextField()) 710 break; 710 711 o = o->container(); 711 712 } 712 713 713 last->scheduleRelayout(); 714 if (scheduleRelayout) 715 last->scheduleRelayout(); 714 716 } 715 717 … … 2560 2562 void RenderObject::scheduleRelayout() 2561 2563 { 2562 if (!isRenderView()) 2563 return; 2564 FrameView *view = static_cast<RenderView *>(this)->frameView(); 2565 if (view) 2566 view->scheduleRelayout(); 2564 if (isRenderView()) { 2565 FrameView* view = static_cast<RenderView*>(this)->frameView(); 2566 if (view) 2567 view->scheduleRelayout(); 2568 } else { 2569 FrameView* v = view() ? view()->frameView() : 0; 2570 if (v) 2571 v->scheduleRelayoutOfSubtree(node()); 2572 } 2567 2573 } 2568 2574 -
trunk/WebCore/rendering/RenderObject.h
r14650 r14658 340 340 341 341 virtual void markAllDescendantsWithFloatsForLayout(RenderObject* floatToRemove = 0); 342 void markContainingBlocksForLayout( );342 void markContainingBlocksForLayout(bool scheduleRelayout = true); 343 343 void setNeedsLayout(bool b, bool markParents = true); 344 344 void setChildNeedsLayout(bool b, bool markParents = true);
Note: See TracChangeset
for help on using the changeset viewer.