OLD | NEW |
---|---|
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 Loading... | |
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::invalidateTreeAfterLayout(const RenderLayerModelObject& invali dationContainer) | 363 void RenderBlock::invalidateTreeAfterLayout(const InvalidationTreeWalkState& inv alidationTreeWalkState) |
364 { | 364 { |
365 // Note, we don't want to early out here using shouldCheckForInvalidationAft erLayout as | 365 // Note, we don't want to early out here using shouldCheckForInvalidationAft erLayout as |
366 // we have to make sure we go through any positioned objects as they won't b e seen in | 366 // we have to make sure we go through any positioned objects as they won't b e seen in |
367 // the normal tree walk. | 367 // the normal tree walk. |
368 | 368 |
369 if (shouldCheckForPaintInvalidationAfterLayout()) | 369 if (shouldCheckForPaintInvalidationAfterLayout()) |
370 RenderBox::invalidateTreeAfterLayout(invalidationContainer); | 370 RenderBox::invalidateTreeAfterLayout(invalidationTreeWalkState); |
371 | 371 |
372 // Take care of positioned objects. This is required as LayoutState keeps a single clip rect. | 372 // Take care of positioned objects. This is required as InvalidationTreeWalk State keeps a single clip rect. |
373 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) { | 373 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) { |
374 TrackedRendererListHashSet::iterator end = positionedObjects->end(); | 374 TrackedRendererListHashSet::iterator end = positionedObjects->end(); |
375 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset()) ; | 375 bool establishesNewPaintInvalidationContainer = isPaintInvalidationConta iner(); |
376 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCom positedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? t his : &invalidationTreeWalkState.paintInvalidationContainer()); | |
377 InvalidationTreeWalkState childInvalidationTreeWalkState(invalidationTre eWalkState, *this, newPaintInvalidationContainer); | |
376 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) { | 378 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) { |
377 RenderBox* box = *it; | 379 RenderBox* box = *it; |
378 | 380 |
379 // One of the renderers we're skipping over here may be the child's repaint container, | 381 // One of the renderers we're skipping over here may be the child's repaint container, |
380 // so we can't pass our own repaint container along. | 382 // so we can't pass our own repaint container along. |
381 const RenderLayerModelObject& repaintContainerForChild = *box->conta inerForPaintInvalidation(); | 383 const RenderLayerModelObject& repaintContainerForChild = *box->conta inerForPaintInvalidation(); |
382 | 384 |
385 // If it's a new repaint container, we won't have properly accumulat ed the offset into the | |
386 // InvalidationTreeWalkState. | |
387 // FIXME: Teach InvalidationTreeWalkState to handle this case. | |
Julien - ping for review
2014/07/02 00:27:28
Link to the existing bug for LayoutState.
| |
388 if (&repaintContainerForChild != newPaintInvalidationContainer) { | |
389 ForceHorriblySlowRectMapping slowRectMapping(&childInvalidationT reeWalkState); | |
390 InvalidationTreeWalkState disabledTreeWalkState(childInvalidatio nTreeWalkState, *this, repaintContainerForChild); | |
391 box->invalidateTreeAfterLayout(childInvalidationTreeWalkState); | |
392 continue; | |
393 } | |
394 | |
383 // If the positioned renderer is absolutely positioned and it is ins ide | 395 // If the positioned renderer is absolutely positioned and it is ins ide |
384 // a relatively positioend inline element, we need to account for | 396 // a relatively positioend inline element, we need to account for |
385 // the inline elements position in LayoutState. | 397 // the inline elements position in InvalidationTreeWalkState. |
386 if (box->style()->position() == AbsolutePosition) { | 398 if (box->style()->position() == AbsolutePosition) { |
387 RenderObject* container = box->container(&repaintContainerForChi ld, 0); | 399 RenderObject* container = box->container(&repaintContainerForChi ld, 0); |
388 if (container->isRelPositioned() && container->isRenderInline()) { | 400 if (container->isRelPositioned() && container->isRenderInline()) { |
389 // FIXME: We should be able to use layout-state for this. | 401 // FIXME: We should be able to use InvalidationTreeWalkState for this. |
390 // Currently, we will place absolutly positioned elements in side | 402 // Currently, we will place absolutely positioned elements i nside |
391 // relatively positioned inline blocks in the wrong location . crbug.com/371485 | 403 // relatively positioned inline blocks in the wrong location . crbug.com/371485 |
392 ForceHorriblySlowRectMapping slowRectMapping(*this); | 404 ForceHorriblySlowRectMapping slowRectMapping(&childInvalidat ionTreeWalkState); |
393 box->invalidateTreeAfterLayout(repaintContainerForChild); | 405 InvalidationTreeWalkState disabledTreeWalkState(childInvalid ationTreeWalkState, *this, repaintContainerForChild); |
Julien - ping for review
2014/07/02 00:27:28
|disabledTreeWalkState| is unused.
| |
406 box->invalidateTreeAfterLayout(childInvalidationTreeWalkStat e); | |
394 continue; | 407 continue; |
395 } | 408 } |
396 } | 409 } |
397 | 410 |
398 box->invalidateTreeAfterLayout(repaintContainerForChild); | 411 box->invalidateTreeAfterLayout(childInvalidationTreeWalkState); |
399 } | 412 } |
400 } | 413 } |
401 } | 414 } |
402 | 415 |
403 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) | 416 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) |
404 { | 417 { |
405 if (beforeChild && beforeChild->parent() == this) | 418 if (beforeChild && beforeChild->parent() == this) |
406 return this; | 419 return this; |
407 | 420 |
408 RenderBlock* curr = toRenderBlock(continuation()); | 421 RenderBlock* curr = toRenderBlock(continuation()); |
(...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3994 return 0; | 4007 return 0; |
3995 } | 4008 } |
3996 | 4009 |
3997 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO bject* currentChild) | 4010 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO bject* currentChild) |
3998 { | 4011 { |
3999 RenderObject* firstLetter = currentChild->parent(); | 4012 RenderObject* firstLetter = currentChild->parent(); |
4000 RenderObject* firstLetterContainer = firstLetter->parent(); | 4013 RenderObject* firstLetterContainer = firstLetter->parent(); |
4001 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter Container); | 4014 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter Container); |
4002 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); | 4015 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); |
4003 | 4016 |
4004 ForceHorriblySlowRectMapping slowRectMapping(*this); | |
4005 | |
4006 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) == Reattach) { | 4017 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) == Reattach) { |
4007 // The first-letter renderer needs to be replaced. Create a new renderer of the right type. | 4018 // The first-letter renderer needs to be replaced. Create a new renderer of the right type. |
4008 RenderBoxModelObject* newFirstLetter; | 4019 RenderBoxModelObject* newFirstLetter; |
4009 if (pseudoStyle->display() == INLINE) | 4020 if (pseudoStyle->display() == INLINE) |
4010 newFirstLetter = RenderInline::createAnonymous(&document()); | 4021 newFirstLetter = RenderInline::createAnonymous(&document()); |
4011 else | 4022 else |
4012 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); | 4023 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); |
4013 newFirstLetter->setStyle(pseudoStyle); | 4024 newFirstLetter->setStyle(pseudoStyle); |
4014 | 4025 |
4015 // Move the first letter into the new renderer. | 4026 // Move the first letter into the new renderer. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4176 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 4187 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
4177 updateFirstLetterStyle(firstLetterBlock, currChild); | 4188 updateFirstLetterStyle(firstLetterBlock, currChild); |
4178 return; | 4189 return; |
4179 } | 4190 } |
4180 | 4191 |
4181 // FIXME: This black-list of disallowed RenderText subclasses is fragile. | 4192 // FIXME: This black-list of disallowed RenderText subclasses is fragile. |
4182 // Should counter be on this list? What about RenderTextFragment? | 4193 // Should counter be on this list? What about RenderTextFragment? |
4183 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is WordBreak()) | 4194 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is WordBreak()) |
4184 return; | 4195 return; |
4185 | 4196 |
4186 // Our layout state is not valid for the repaints we are going to trigger by | |
4187 // adding and removing children of firstLetterContainer. | |
4188 ForceHorriblySlowRectMapping slowRectMapping(*this); | |
4189 | |
4190 createFirstLetterRenderer(firstLetterBlock, currChild, length); | 4197 createFirstLetterRenderer(firstLetterBlock, currChild, length); |
4191 } | 4198 } |
4192 | 4199 |
4193 // Helper methods for obtaining the last line, computing line counts and heights for line counts | 4200 // Helper methods for obtaining the last line, computing line counts and heights for line counts |
4194 // (crawling into blocks). | 4201 // (crawling into blocks). |
4195 static bool shouldCheckLines(RenderObject* obj) | 4202 static bool shouldCheckLines(RenderObject* obj) |
4196 { | 4203 { |
4197 return !obj->isFloatingOrOutOfFlowPositioned() | 4204 return !obj->isFloatingOrOutOfFlowPositioned() |
4198 && obj->isRenderBlock() && obj->style()->height().isAuto() | 4205 && obj->isRenderBlock() && obj->style()->height().isAuto() |
4199 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT ICAL); | 4206 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT ICAL); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4438 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4445 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
4439 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), | 4446 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), |
4440 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa rginAfter()).toFloat()); | 4447 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa rginAfter()).toFloat()); |
4441 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); | 4448 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); |
4442 continuation()->absoluteQuads(quads, wasFixed); | 4449 continuation()->absoluteQuads(quads, wasFixed); |
4443 } else { | 4450 } else { |
4444 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl oat(), height().toFloat()), 0 /* mode */, wasFixed)); | 4451 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl oat(), height().toFloat()), 0 /* mode */, wasFixed)); |
4445 } | 4452 } |
4446 } | 4453 } |
4447 | 4454 |
4448 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod elObject* paintInvalidationContainer, LayoutUnit outlineWidth) const | 4455 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod elObject* paintInvalidationContainer, LayoutUnit outlineWidth, const Invalidatio nTreeWalkState* invalidationTreeWalkState) const |
4449 { | 4456 { |
4450 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio nContainer, outlineWidth)); | 4457 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio nContainer, outlineWidth, invalidationTreeWalkState)); |
4451 if (isAnonymousBlockContinuation()) | 4458 if (isAnonymousBlockContinuation()) |
4452 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f lows that are horizontal. | 4459 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f lows that are horizontal. |
4453 return r; | 4460 return r; |
4454 } | 4461 } |
4455 | 4462 |
4456 RenderObject* RenderBlock::hoverAncestor() const | 4463 RenderObject* RenderBlock::hoverAncestor() const |
4457 { | 4464 { |
4458 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc estor(); | 4465 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc estor(); |
4459 } | 4466 } |
4460 | 4467 |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5037 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 5044 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
5038 { | 5045 { |
5039 showRenderObject(); | 5046 showRenderObject(); |
5040 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 5047 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
5041 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 5048 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
5042 } | 5049 } |
5043 | 5050 |
5044 #endif | 5051 #endif |
5045 | 5052 |
5046 } // namespace WebCore | 5053 } // namespace WebCore |
OLD | NEW |