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 PaintInvalidationState& paintI
nvalidationState) |
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(paintInvalidationState); |
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 PaintInvalidationSta
te 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 : &paintInvalidationState.paintInvalidationContainer()); |
| 379 PaintInvalidationState childPaintInvalidationState(paintInvalidationStat
e, *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 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 |
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 positioned inline element, we need to account for |
387 // the inline elements position in LayoutState. | 399 // the inline elements position in PaintInvalidationState. |
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 PaintInvalidationState fo
r 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(&childPaintInva
lidationState); |
395 box->invalidateTreeAfterLayout(repaintContainerForChild); | 407 PaintInvalidationState disabledPaintInvalidationState(childP
aintInvalidationState, *this, repaintContainerForChild); |
| 408 box->invalidateTreeAfterLayout(disabledPaintInvalidationStat
e); |
396 continue; | 409 continue; |
397 } | 410 } |
398 } | 411 } |
399 | 412 |
400 box->invalidateTreeAfterLayout(repaintContainerForChild); | 413 box->invalidateTreeAfterLayout(childPaintInvalidationState); |
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 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4004 return 0; | 4017 return 0; |
4005 } | 4018 } |
4006 | 4019 |
4007 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) | 4020 void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
bject* currentChild) |
4008 { | 4021 { |
4009 RenderObject* firstLetter = currentChild->parent(); | 4022 RenderObject* firstLetter = currentChild->parent(); |
4010 RenderObject* firstLetterContainer = firstLetter->parent(); | 4023 RenderObject* firstLetterContainer = firstLetter->parent(); |
4011 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); | 4024 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter
Container); |
4012 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); | 4025 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); |
4013 | 4026 |
4014 ForceHorriblySlowRectMapping slowRectMapping(*this); | |
4015 | |
4016 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) ==
Reattach) { | 4027 if (RenderStyle::stylePropagationDiff(firstLetter->style(), pseudoStyle) ==
Reattach) { |
4017 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. | 4028 // The first-letter renderer needs to be replaced. Create a new renderer
of the right type. |
4018 RenderBoxModelObject* newFirstLetter; | 4029 RenderBoxModelObject* newFirstLetter; |
4019 if (pseudoStyle->display() == INLINE) | 4030 if (pseudoStyle->display() == INLINE) |
4020 newFirstLetter = RenderInline::createAnonymous(&document()); | 4031 newFirstLetter = RenderInline::createAnonymous(&document()); |
4021 else | 4032 else |
4022 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); | 4033 newFirstLetter = RenderBlockFlow::createAnonymous(&document()); |
4023 newFirstLetter->setStyle(pseudoStyle); | 4034 newFirstLetter->setStyle(pseudoStyle); |
4024 | 4035 |
4025 // Move the first letter into the new renderer. | 4036 // Move the first letter into the new renderer. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4186 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 4197 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
4187 updateFirstLetterStyle(firstLetterBlock, currChild); | 4198 updateFirstLetterStyle(firstLetterBlock, currChild); |
4188 return; | 4199 return; |
4189 } | 4200 } |
4190 | 4201 |
4191 // FIXME: This black-list of disallowed RenderText subclasses is fragile. | 4202 // FIXME: This black-list of disallowed RenderText subclasses is fragile. |
4192 // Should counter be on this list? What about RenderTextFragment? | 4203 // Should counter be on this list? What about RenderTextFragment? |
4193 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is
WordBreak()) | 4204 if (!currChild->isText() || currChild->isBR() || toRenderText(currChild)->is
WordBreak()) |
4194 return; | 4205 return; |
4195 | 4206 |
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 | |
4200 createFirstLetterRenderer(firstLetterBlock, currChild, length); | 4207 createFirstLetterRenderer(firstLetterBlock, currChild, length); |
4201 } | 4208 } |
4202 | 4209 |
4203 // Helper methods for obtaining the last line, computing line counts and heights
for line counts | 4210 // Helper methods for obtaining the last line, computing line counts and heights
for line counts |
4204 // (crawling into blocks). | 4211 // (crawling into blocks). |
4205 static bool shouldCheckLines(RenderObject* obj) | 4212 static bool shouldCheckLines(RenderObject* obj) |
4206 { | 4213 { |
4207 return !obj->isFloatingOrOutOfFlowPositioned() | 4214 return !obj->isFloatingOrOutOfFlowPositioned() |
4208 && obj->isRenderBlock() && obj->style()->height().isAuto() | 4215 && obj->isRenderBlock() && obj->style()->height().isAuto() |
4209 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); | 4216 && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERT
ICAL); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4448 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4455 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
4449 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), | 4456 FloatRect localRect(0, -collapsedMarginBefore().toFloat(), |
4450 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa
rginAfter()).toFloat()); | 4457 width().toFloat(), (height() + collapsedMarginBefore() + collapsedMa
rginAfter()).toFloat()); |
4451 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); | 4458 quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed)); |
4452 continuation()->absoluteQuads(quads, wasFixed); | 4459 continuation()->absoluteQuads(quads, wasFixed); |
4453 } else { | 4460 } else { |
4454 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl
oat(), height().toFloat()), 0 /* mode */, wasFixed)); | 4461 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width().toFl
oat(), height().toFloat()), 0 /* mode */, wasFixed)); |
4455 } | 4462 } |
4456 } | 4463 } |
4457 | 4464 |
4458 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth) const | 4465 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const RenderLayerMod
elObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvali
dationState* paintInvalidationState) const |
4459 { | 4466 { |
4460 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth)); | 4467 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); |
4461 if (isAnonymousBlockContinuation()) | 4468 if (isAnonymousBlockContinuation()) |
4462 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f
lows that are horizontal. | 4469 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-f
lows that are horizontal. |
4463 return r; | 4470 return r; |
4464 } | 4471 } |
4465 | 4472 |
4466 RenderObject* RenderBlock::hoverAncestor() const | 4473 RenderObject* RenderBlock::hoverAncestor() const |
4467 { | 4474 { |
4468 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); | 4475 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); |
4469 } | 4476 } |
4470 | 4477 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5057 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5064 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5058 { | 5065 { |
5059 showRenderObject(); | 5066 showRenderObject(); |
5060 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5067 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5061 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5068 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5062 } | 5069 } |
5063 | 5070 |
5064 #endif | 5071 #endif |
5065 | 5072 |
5066 } // namespace WebCore | 5073 } // namespace WebCore |
OLD | NEW |