| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 gDelayedUpdateScrollInfoSet->remove(this); | 269 gDelayedUpdateScrollInfoSet->remove(this); |
| 270 | 270 |
| 271 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 271 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
| 272 textAutosizer->destroy(this); | 272 textAutosizer->destroy(this); |
| 273 | 273 |
| 274 RenderBox::willBeDestroyed(); | 274 RenderBox::willBeDestroyed(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void RenderBlock::styleWillChange(StyleDifference diff, const LayoutStyle& newSt
yle) | 277 void RenderBlock::styleWillChange(StyleDifference diff, const LayoutStyle& newSt
yle) |
| 278 { | 278 { |
| 279 const LayoutStyle* oldStyle = style(); | 279 LayoutStyle* oldStyle = style(); |
| 280 | 280 |
| 281 setReplaced(newStyle.isDisplayInlineType()); | 281 setReplaced(newStyle.isDisplayInlineType()); |
| 282 | 282 |
| 283 if (oldStyle && parent()) { | 283 if (oldStyle && parent()) { |
| 284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); | 284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); |
| 285 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS
tyle.hasTransformRelatedProperty(); | 285 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS
tyle.hasTransformRelatedProperty(); |
| 286 | 286 |
| 287 if (oldStyleIsContainer && !newStyleIsContainer) { | 287 if (oldStyleIsContainer && !newStyleIsContainer) { |
| 288 // Clear our positioned objects list. Our absolutely positioned desc
endants will be | 288 // Clear our positioned objects list. Our absolutely positioned desc
endants will be |
| 289 // inserted into our containing block's positioned objects list duri
ng layout. | 289 // inserted into our containing block's positioned objects list duri
ng layout. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow
()) | 329 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow
()) |
| 330 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); | 330 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); |
| 331 | 331 |
| 332 const LayoutStyle& newStyle = styleRef(); | 332 const LayoutStyle& newStyle = styleRef(); |
| 333 | 333 |
| 334 if (!isAnonymousBlock()) { | 334 if (!isAnonymousBlock()) { |
| 335 // Ensure that all of our continuation blocks pick up the new style. | 335 // Ensure that all of our continuation blocks pick up the new style. |
| 336 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC
ont = currCont->blockElementContinuation()) { | 336 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC
ont = currCont->blockElementContinuation()) { |
| 337 LayoutBoxModelObject* nextCont = currCont->continuation(); | 337 LayoutBoxModelObject* nextCont = currCont->continuation(); |
| 338 currCont->setContinuation(0); | 338 currCont->setContinuation(0); |
| 339 currCont->setStyle(mutableStyle()); | 339 currCont->setStyle(style()); |
| 340 currCont->setContinuation(nextCont); | 340 currCont->setContinuation(nextCont); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 344 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
| 345 textAutosizer->record(this); | 345 textAutosizer->record(this); |
| 346 | 346 |
| 347 propagateStyleToAnonymousChildren(true); | 347 propagateStyleToAnonymousChildren(true); |
| 348 | 348 |
| 349 // It's possible for our border/padding to change, but for the overall logic
al width of the block to | 349 // It's possible for our border/padding to change, but for the overall logic
al width of the block to |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 RenderBlock* RenderBlock::clone() const | 581 RenderBlock* RenderBlock::clone() const |
| 582 { | 582 { |
| 583 RenderBlock* cloneBlock; | 583 RenderBlock* cloneBlock; |
| 584 if (isAnonymousBlock()) { | 584 if (isAnonymousBlock()) { |
| 585 cloneBlock = createAnonymousBlock(); | 585 cloneBlock = createAnonymousBlock(); |
| 586 cloneBlock->setChildrenInline(childrenInline()); | 586 cloneBlock->setChildrenInline(childrenInline()); |
| 587 } | 587 } |
| 588 else { | 588 else { |
| 589 LayoutObject* cloneRenderer = toElement(node())->createRenderer(styleRef
()); | 589 LayoutObject* cloneRenderer = toElement(node())->createRenderer(styleRef
()); |
| 590 cloneBlock = toRenderBlock(cloneRenderer); | 590 cloneBlock = toRenderBlock(cloneRenderer); |
| 591 cloneBlock->setStyle(mutableStyle()); | 591 cloneBlock->setStyle(style()); |
| 592 | 592 |
| 593 // This takes care of setting the right value of childrenInline in case | 593 // This takes care of setting the right value of childrenInline in case |
| 594 // generated content is added to cloneBlock and 'this' does not have | 594 // generated content is added to cloneBlock and 'this' does not have |
| 595 // generated content added yet. | 595 // generated content added yet. |
| 596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); | 596 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); |
| 597 } | 597 } |
| 598 cloneBlock->setFlowThreadState(flowThreadState()); | 598 cloneBlock->setFlowThreadState(flowThreadState()); |
| 599 return cloneBlock; | 599 return cloneBlock; |
| 600 } | 600 } |
| 601 | 601 |
| (...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 RenderBlock* containingBlock = this->containingBlock(); | 3044 RenderBlock* containingBlock = this->containingBlock(); |
| 3045 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | 3045 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; |
| 3046 while (child) { | 3046 while (child) { |
| 3047 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max | 3047 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max |
| 3048 // width of the multicol container, not the flow thread. | 3048 // width of the multicol container, not the flow thread. |
| 3049 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { | 3049 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { |
| 3050 child = child->nextSibling(); | 3050 child = child->nextSibling(); |
| 3051 continue; | 3051 continue; |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 const LayoutStyle& childStyle = child->styleRef(); | 3054 RefPtr<LayoutStyle> childStyle = child->style(); |
| 3055 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids
Floats())) { | 3055 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids
Floats())) { |
| 3056 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; | 3056 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; |
| 3057 if (childStyle.clear() & CLEFT) { | 3057 if (childStyle->clear() & CLEFT) { |
| 3058 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 3058 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
| 3059 floatLeftWidth = 0; | 3059 floatLeftWidth = 0; |
| 3060 } | 3060 } |
| 3061 if (childStyle.clear() & CRIGHT) { | 3061 if (childStyle->clear() & CRIGHT) { |
| 3062 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 3062 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
| 3063 floatRightWidth = 0; | 3063 floatRightWidth = 0; |
| 3064 } | 3064 } |
| 3065 } | 3065 } |
| 3066 | 3066 |
| 3067 // A margin basically has three types: fixed, percentage, and auto (vari
able). | 3067 // A margin basically has three types: fixed, percentage, and auto (vari
able). |
| 3068 // Auto and percentage margins simply become 0 when computing min/max wi
dth. | 3068 // Auto and percentage margins simply become 0 when computing min/max wi
dth. |
| 3069 // Fixed margins can be added in as is. | 3069 // Fixed margins can be added in as is. |
| 3070 Length startMarginLength = childStyle.marginStartUsing(&styleToUse); | 3070 Length startMarginLength = childStyle->marginStartUsing(&styleToUse); |
| 3071 Length endMarginLength = childStyle.marginEndUsing(&styleToUse); | 3071 Length endMarginLength = childStyle->marginEndUsing(&styleToUse); |
| 3072 LayoutUnit margin = 0; | 3072 LayoutUnit margin = 0; |
| 3073 LayoutUnit marginStart = 0; | 3073 LayoutUnit marginStart = 0; |
| 3074 LayoutUnit marginEnd = 0; | 3074 LayoutUnit marginEnd = 0; |
| 3075 if (startMarginLength.isFixed()) | 3075 if (startMarginLength.isFixed()) |
| 3076 marginStart += startMarginLength.value(); | 3076 marginStart += startMarginLength.value(); |
| 3077 if (endMarginLength.isFixed()) | 3077 if (endMarginLength.isFixed()) |
| 3078 marginEnd += endMarginLength.value(); | 3078 marginEnd += endMarginLength.value(); |
| 3079 margin = marginStart + marginEnd; | 3079 margin = marginStart + marginEnd; |
| 3080 | 3080 |
| 3081 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; | 3081 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3110 LayoutUnit maxRight = marginLogicalRight > 0 ? std::max(floatRig
htWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; | 3110 LayoutUnit maxRight = marginLogicalRight > 0 ? std::max(floatRig
htWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; |
| 3111 w = childMaxPreferredLogicalWidth + maxLeft + maxRight; | 3111 w = childMaxPreferredLogicalWidth + maxLeft + maxRight; |
| 3112 w = std::max(w, floatLeftWidth + floatRightWidth); | 3112 w = std::max(w, floatLeftWidth + floatRightWidth); |
| 3113 } else { | 3113 } else { |
| 3114 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, max
LogicalWidth); | 3114 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, max
LogicalWidth); |
| 3115 } | 3115 } |
| 3116 floatLeftWidth = floatRightWidth = 0; | 3116 floatLeftWidth = floatRightWidth = 0; |
| 3117 } | 3117 } |
| 3118 | 3118 |
| 3119 if (child->isFloating()) { | 3119 if (child->isFloating()) { |
| 3120 if (childStyle.floating() == LeftFloat) | 3120 if (childStyle->floating() == LeftFloat) |
| 3121 floatLeftWidth += w; | 3121 floatLeftWidth += w; |
| 3122 else | 3122 else |
| 3123 floatRightWidth += w; | 3123 floatRightWidth += w; |
| 3124 } else { | 3124 } else { |
| 3125 maxLogicalWidth = std::max(w, maxLogicalWidth); | 3125 maxLogicalWidth = std::max(w, maxLogicalWidth); |
| 3126 } | 3126 } |
| 3127 | 3127 |
| 3128 child = child->nextSibling(); | 3128 child = child->nextSibling(); |
| 3129 } | 3129 } |
| 3130 | 3130 |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 3946 { | 3946 { |
| 3947 showLayoutObject(); | 3947 showLayoutObject(); |
| 3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3950 } | 3950 } |
| 3951 | 3951 |
| 3952 #endif | 3952 #endif |
| 3953 | 3953 |
| 3954 } // namespace blink | 3954 } // namespace blink |
| OLD | NEW |