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