Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 264183002: RAL: Eliminate n^2 walk to find repaint containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: With less asserts :( Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // If the style has unloaded images, want to notify the ResourceLoadPriority Optimizer so that 353 // If the style has unloaded images, want to notify the ResourceLoadPriority Optimizer so that
354 // network priorities can be set. 354 // network priorities can be set.
355 Vector<ImageResource*> images; 355 Vector<ImageResource*> images;
356 appendImagesFromStyle(images, *newStyle); 356 appendImagesFromStyle(images, *newStyle);
357 if (images.isEmpty()) 357 if (images.isEmpty())
358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRe nderObject(this); 358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRe nderObject(this);
359 else 359 else
360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addRende rObject(this); 360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addRende rObject(this);
361 } 361 }
362 362
363 void RenderBlock::repaintTreeAfterLayout() 363 void RenderBlock::repaintTreeAfterLayout(const RenderLayerModelObject& repaintCo ntainer)
364 { 364 {
365 if (!shouldCheckForInvalidationAfterLayout()) 365 if (!shouldCheckForInvalidationAfterLayout())
366 return; 366 return;
367 367
368 RenderBox::repaintTreeAfterLayout(); 368 RenderBox::repaintTreeAfterLayout(repaintContainer);
369 369
370 // Take care of positioned objects. This is required as LayoutState keeps a single clip rect. 370 // Take care of positioned objects. This is required as LayoutState keeps a single clip rect.
371 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) { 371 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) {
372 TrackedRendererListHashSet::iterator end = positionedObjects->end(); 372 TrackedRendererListHashSet::iterator end = positionedObjects->end();
373 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset()); 373 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset());
374 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) {
375 RenderBox* box = *it;
374 376
375 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) { 377 // One of the renderers we're skipping over here may be the child's repaint container,
376 RenderBox* obj = *it; 378 // so we can't pass our own repaint container along.
379 const RenderLayerModelObject& repaintContainerForChild = *box->conta inerForRepaint();
Julien - ping for review 2014/05/16 10:21:06 I don't think Ojan's optimization would work here
377 380
378 // If the positioned renderer is absolutely positioned and it is ins ide 381 // If the positioned renderer is absolutely positioned and it is ins ide
379 // a relatively positioend inline element, we need to account for 382 // a relatively positioend inline element, we need to account for
380 // the inline elements position in LayoutState. 383 // the inline elements position in LayoutState.
381 if (obj->style()->position() == AbsolutePosition) { 384 if (box->style()->position() == AbsolutePosition) {
382 RenderObject* o = obj->container(obj->containerForRepaint(), 0); 385 RenderObject* container = box->container(&repaintContainerForChi ld, 0);
383 if (o->isInFlowPositioned() && o->isRenderInline()) { 386 if (container->isInFlowPositioned() && container->isRenderInline ()) {
384 // FIXME: We should be able to use layout-state for this. 387 // FIXME: We should be able to use layout-state for this.
385 // Currently, we will place absolutly positioned elements in side 388 // Currently, we will place absolutly positioned elements in side
386 // relatively positioned inline blocks in the wrong location . crbug.com/371485 389 // relatively positioned inline blocks in the wrong location . crbug.com/371485
387 LayoutStateDisabler disable(*this); 390 LayoutStateDisabler disable(*this);
388 obj->repaintTreeAfterLayout(); 391 box->repaintTreeAfterLayout(repaintContainerForChild);
389 continue; 392 continue;
390 } 393 }
391 } 394 }
392 395
393 obj->repaintTreeAfterLayout(); 396 box->repaintTreeAfterLayout(repaintContainerForChild);
394 } 397 }
395 } 398 }
396 } 399 }
397 400
398 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) 401 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild)
399 { 402 {
400 if (beforeChild && beforeChild->parent() == this) 403 if (beforeChild && beforeChild->parent() == this)
401 return this; 404 return this;
402 405
403 RenderBlock* curr = toRenderBlock(continuation()); 406 RenderBlock* curr = toRenderBlock(continuation());
(...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after
4982 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4985 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4983 { 4986 {
4984 showRenderObject(); 4987 showRenderObject();
4985 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4988 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4986 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4989 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4987 } 4990 }
4988 4991
4989 #endif 4992 #endif
4990 4993
4991 } // namespace WebCore 4994 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698