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 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 4984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4995 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const
RenderObject* parent) | 4995 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const
RenderObject* parent) |
4996 { | 4996 { |
4997 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); | 4997 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), BLOCK); |
4998 newStyle->setColumnSpan(ColumnSpanAll); | 4998 newStyle->setColumnSpan(ColumnSpanAll); |
4999 | 4999 |
5000 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); | 5000 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document
()); |
5001 newBox->setStyle(newStyle.release()); | 5001 newBox->setStyle(newStyle.release()); |
5002 return newBox; | 5002 return newBox; |
5003 } | 5003 } |
5004 | 5004 |
| 5005 static bool recalcNormalFlowChildOverflowIfNeeded(RenderObject* renderer) |
| 5006 { |
| 5007 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRecalcAfter
StyleChange()) |
| 5008 return false; |
| 5009 |
| 5010 ASSERT(renderer->isRenderBlock()); |
| 5011 return toRenderBlock(renderer)->recalcOverflowAfterStyleChange(); |
| 5012 } |
| 5013 |
| 5014 bool RenderBlock::recalcChildOverflowAfterStyleChange() |
| 5015 { |
| 5016 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); |
| 5017 setChildNeedsOverflowRecalcAfterStyleChange(false); |
| 5018 |
| 5019 bool childrenOverflowChanged = false; |
| 5020 |
| 5021 if (childrenInline()) { |
| 5022 ListHashSet<RootInlineBox*> lineBoxes; |
| 5023 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
| 5024 RenderObject* renderer = walker.current(); |
| 5025 if (recalcNormalFlowChildOverflowIfNeeded(renderer)) { |
| 5026 childrenOverflowChanged = true; |
| 5027 if (InlineBox* inlineBoxWrapper = toRenderBlock(renderer)->inlin
eBoxWrapper()) |
| 5028 lineBoxes.add(&inlineBoxWrapper->root()); |
| 5029 } |
| 5030 } |
| 5031 |
| 5032 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. |
| 5033 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
| 5034 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { |
| 5035 RootInlineBox* box = *it; |
| 5036 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM
ap); |
| 5037 } |
| 5038 } else { |
| 5039 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ |
| 5040 if (recalcNormalFlowChildOverflowIfNeeded(box)) |
| 5041 childrenOverflowChanged = true; |
| 5042 } |
| 5043 } |
| 5044 |
| 5045 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
| 5046 if (!positionedDescendants) |
| 5047 return childrenOverflowChanged; |
| 5048 |
| 5049 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
| 5050 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
| 5051 RenderBox* box = *it; |
| 5052 |
| 5053 if (!box->needsOverflowRecalcAfterStyleChange()) |
| 5054 continue; |
| 5055 RenderBlock* block = toRenderBlock(box); |
| 5056 if (!block->recalcOverflowAfterStyleChange() || box->style()->position()
== FixedPosition) |
| 5057 continue; |
| 5058 |
| 5059 childrenOverflowChanged = true; |
| 5060 } |
| 5061 return childrenOverflowChanged; |
| 5062 } |
| 5063 |
| 5064 bool RenderBlock::recalcOverflowAfterStyleChange() |
| 5065 { |
| 5066 ASSERT(needsOverflowRecalcAfterStyleChange()); |
| 5067 |
| 5068 bool childrenOverflowChanged = false; |
| 5069 if (childNeedsOverflowRecalcAfterStyleChange()) |
| 5070 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); |
| 5071 |
| 5072 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) |
| 5073 return false; |
| 5074 |
| 5075 setSelfNeedsOverflowRecalcAfterStyleChange(false); |
| 5076 // If the current block needs layout, overflow will be recalculated during |
| 5077 // layout time anyway. We can safely exit here. |
| 5078 if (needsLayout()) |
| 5079 return false; |
| 5080 |
| 5081 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie
ntAfterEdge() : clientLogicalBottom(); |
| 5082 computeOverflow(oldClientAfterEdge, true); |
| 5083 |
| 5084 if (hasOverflowClip()) |
| 5085 layer()->scrollableArea()->updateAfterOverflowRecalc(); |
| 5086 |
| 5087 return !hasOverflowClip(); |
| 5088 } |
| 5089 |
5005 #ifndef NDEBUG | 5090 #ifndef NDEBUG |
5006 void RenderBlock::checkPositionedObjectsNeedLayout() | 5091 void RenderBlock::checkPositionedObjectsNeedLayout() |
5007 { | 5092 { |
5008 if (!gPositionedDescendantsMap) | 5093 if (!gPositionedDescendantsMap) |
5009 return; | 5094 return; |
5010 | 5095 |
5011 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { | 5096 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { |
5012 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); | 5097 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); |
5013 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { | 5098 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { |
5014 RenderBox* currBox = *it; | 5099 RenderBox* currBox = *it; |
5015 ASSERT(!currBox->needsLayout()); | 5100 ASSERT(!currBox->needsLayout()); |
5016 } | 5101 } |
5017 } | 5102 } |
5018 } | 5103 } |
5019 | 5104 |
5020 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5105 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5021 { | 5106 { |
5022 showRenderObject(); | 5107 showRenderObject(); |
5023 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5108 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5024 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5109 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5025 } | 5110 } |
5026 | 5111 |
5027 #endif | 5112 #endif |
5028 | 5113 |
5029 } // namespace WebCore | 5114 } // namespace WebCore |
OLD | NEW |