| 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 PaintInvalidationState& paintI
nvalidationState) | 365 void RenderBlock::invalidateTreeAfterLayout(const RenderLayerModelObject& invali
dationContainer) |
| 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(paintInvalidationState); | 372 RenderBox::invalidateTreeAfterLayout(invalidationContainer); |
| 373 | 373 |
| 374 // Take care of positioned objects. This is required as PaintInvalidationSta
te keeps a single clip rect. | 374 // Take care of positioned objects. This is required as LayoutState 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 bool establishesNewPaintInvalidationContainer = isPaintInvalidationConta
iner(); | 377 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset())
; |
| 378 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCom
positedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? t
his : &paintInvalidationState.paintInvalidationContainer()); | |
| 379 PaintInvalidationState childPaintInvalidationState(paintInvalidationStat
e, *this, newPaintInvalidationContainer); | |
| 380 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { | 378 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { |
| 381 RenderBox* box = *it; | 379 RenderBox* box = *it; |
| 382 | 380 |
| 383 // 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, |
| 384 // so we can't pass our own repaint container along. | 382 // so we can't pass our own repaint container along. |
| 385 const RenderLayerModelObject& repaintContainerForChild = *box->conta
inerForPaintInvalidation(); | 383 const RenderLayerModelObject& repaintContainerForChild = *box->conta
inerForPaintInvalidation(); |
| 386 | 384 |
| 387 // If it's a new paint invalidation container, we won't have properl
y accumulated the offset into the | |
| 388 // PaintInvalidationState. | |
| 389 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co
m/371485 | |
| 390 if (&repaintContainerForChild != newPaintInvalidationContainer) { | |
| 391 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida
tionState); | |
| 392 PaintInvalidationState disabledPaintInvalidationState(childPaint
InvalidationState, *this, repaintContainerForChild); | |
| 393 box->invalidateTreeAfterLayout(disabledPaintInvalidationState); | |
| 394 continue; | |
| 395 } | |
| 396 | |
| 397 // If the positioned renderer is absolutely positioned and it is ins
ide | 385 // If the positioned renderer is absolutely positioned and it is ins
ide |
| 398 // a relatively positioned inline element, we need to account for | 386 // a relatively positioend inline element, we need to account for |
| 399 // the inline elements position in PaintInvalidationState. | 387 // the inline elements position in LayoutState. |
| 400 if (box->style()->position() == AbsolutePosition) { | 388 if (box->style()->position() == AbsolutePosition) { |
| 401 RenderObject* container = box->container(&repaintContainerForChi
ld, 0); | 389 RenderObject* container = box->container(&repaintContainerForChi
ld, 0); |
| 402 if (container->isRelPositioned() && container->isRenderInline())
{ | 390 if (container->isRelPositioned() && container->isRenderInline())
{ |
| 403 // FIXME: We should be able to use PaintInvalidationState fo
r this. | 391 // FIXME: We should be able to use layout-state for this. |
| 404 // Currently, we will place absolutely positioned elements i
nside | 392 // Currently, we will place absolutly positioned elements in
side |
| 405 // relatively positioned inline blocks in the wrong location
. crbug.com/371485 | 393 // relatively positioned inline blocks in the wrong location
. crbug.com/371485 |
| 406 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva
lidationState); | 394 ForceHorriblySlowRectMapping slowRectMapping(*this); |
| 407 PaintInvalidationState disabledPaintInvalidationState(childP
aintInvalidationState, *this, repaintContainerForChild); | 395 box->invalidateTreeAfterLayout(repaintContainerForChild); |
| 408 box->invalidateTreeAfterLayout(disabledPaintInvalidationStat
e); | |
| 409 continue; | 396 continue; |
| 410 } | 397 } |
| 411 } | 398 } |
| 412 | 399 |
| 413 box->invalidateTreeAfterLayout(childPaintInvalidationState); | 400 box->invalidateTreeAfterLayout(repaintContainerForChild); |
| 414 } | 401 } |
| 415 } | 402 } |
| 416 } | 403 } |
| 417 | 404 |
| 418 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) | 405 RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) |
| 419 { | 406 { |
| 420 if (beforeChild && beforeChild->parent() == this) | 407 if (beforeChild && beforeChild->parent() == this) |
| 421 return this; | 408 return this; |
| 422 | 409 |
| 423 RenderBlock* curr = toRenderBlock(continuation()); | 410 RenderBlock* curr = toRenderBlock(continuation()); |
| (...skipping 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4017 return 0; | 4004 return 0; |
| 4018 } | 4005 } |
| 4019 | 4006 |
| 4020 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) | 4007 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) |
| 4021 { | 4008 { |
| 4022 RenderObject* firstLetter = currentChild->parent(); | 4009 RenderObject* firstLetter = currentChild->parent(); |
| 4023 RenderObject* firstLetterContainer = firstLetter->parent(); | 4010 RenderObject* firstLetterContainer = firstLetter->parent(); |
| 4024 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); | 4011 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); |
| 4025 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); | 4012 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); |
| 4026 | 4013 |
| 4014 ForceHorriblySlowRectMapping slowRectMapping(*this); |
| 4015 |
| 4027 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) ==
Reattach) { | 4016 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) ==
Reattach) { |
| 4028 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. | 4017 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. |
| 4029 RenderBoxModelObject* newFirstLetter; | 4018 RenderBoxModelObject* newFirstLetter; |
| 4030 if (pseudoStyle->display() == INLINE) | 4019 if (pseudoStyle->display() == INLINE) |
| 4031 newFirstLetter = RenderInline::createAnonymous(&document()); | 4020 newFirstLetter = RenderInline::createAnonymous(&document()); |
| 4032 else | 4021 else |
| 4033 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); | 4022 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); |
| 4034 newFirstLetter->setStyle(pseudoStyle); | 4023 newFirstLetter->setStyle(pseudoStyle); |
| 4035 | 4024 |
| 4036 // Move the first letter into the new renderer. | 4025 // Move the first letter into the new renderer. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 4186 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
| 4198 updateFirstLetterStyle(firstLetterBlock, currChild); | 4187 updateFirstLetterStyle(firstLetterBlock, currChild); |
| 4199 return; | 4188 return; |
| 4200 } | 4189 } |
| 4201 | 4190 |
| 4202 // FIXME: This black-list of disallowed RenderText subclasses is fragile. | 4191 // FIXME: This black-list of disallowed RenderText subclasses is fragile. |
| 4203 // Should counter be on this list? What about RenderTextFragment? | 4192 // Should counter be on this list? What about RenderTextFragment? |
| 4204 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is
WordBreak()) | 4193 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is
WordBreak()) |
| 4205 return; | 4194 return; |
| 4206 | 4195 |
| 4196 // Our layout state is not valid for the repaints we are going to trigger by |
| 4197 // adding and removing children of firstLetterContainer. |
| 4198 ForceHorriblySlowRectMapping slowRectMapping(*this); |
| 4199 |
| 4207 createFirstLetterRenderer(firstLetterBlock, currChild, length); | 4200 createFirstLetterRenderer(firstLetterBlock, currChild, length); |
| 4208 } | 4201 } |
| 4209 | 4202 |
| 4210 // Helper methods for obtaining the last line, computing line counts and heights
for line counts | 4203 // Helper methods for obtaining the last line, computing line counts and heights
for line counts |
| 4211 // (crawling into blocks). | 4204 // (crawling into blocks). |
| 4212 static bool shouldCheckLines(RenderObject* obj) | 4205 static bool shouldCheckLines(RenderObject* obj) |
| 4213 { | 4206 { |
| 4214 return !obj->isFloatingOrOutOfFlowPositioned() | 4207 return !obj->isFloatingOrOutOfFlowPositioned() |
| 4215 && obj->isRenderBlock() && obj->style()->height().isAuto() | 4208 && obj->isRenderBlock() && obj->style()->height().isAuto() |
| 4216 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); | 4209 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4455 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4448 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
| 4456 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), | 4449 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), |
| 4457 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa
rginAfter()).toFloat()); | 4450 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa
rginAfter()).toFloat()); |
| 4458 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); | 4451 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); |
| 4459 continuation()->absoluteQuads(quads, wasFixed); | 4452 continuation()->absoluteQuads(quads, wasFixed); |
| 4460 } else { | 4453 } else { |
| 4461 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl
oat(), height().toFloat()), 0 /* mode */, wasFixed)); | 4454 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl
oat(), height().toFloat()), 0 /* mode */, wasFixed)); |
| 4462 } | 4455 } |
| 4463 } | 4456 } |
| 4464 | 4457 |
| 4465 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvali
dationState* paintInvalidationState) const | 4458 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth) const |
| 4466 { | 4459 { |
| 4467 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); | 4460 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth)); |
| 4468 if (isAnonymousBlockContinuation()) | 4461 if (isAnonymousBlockContinuation()) |
| 4469 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f
lows that are horizontal. | 4462 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f
lows that are horizontal. |
| 4470 return r; | 4463 return r; |
| 4471 } | 4464 } |
| 4472 | 4465 |
| 4473 RenderObject* RenderBlock::hoverAncestor() const | 4466 RenderObject* RenderBlock::hoverAncestor() const |
| 4474 { | 4467 { |
| 4475 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); | 4468 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); |
| 4476 } | 4469 } |
| 4477 | 4470 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5064 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5057 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 5065 { | 5058 { |
| 5066 showRenderObject(); | 5059 showRenderObject(); |
| 5067 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5060 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 5068 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5061 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 5069 } | 5062 } |
| 5070 | 5063 |
| 5071 #endif | 5064 #endif |
| 5072 | 5065 |
| 5073 } // namespace WebCore | 5066 } // namespace WebCore |
| OLD | NEW |