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 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4879 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent) | 4879 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent) |
4880 { | 4880 { |
4881 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), BLOCK); | 4881 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), BLOCK); |
4882 newStyle->setColumnSpan(ColumnSpanAll); | 4882 newStyle->setColumnSpan(ColumnSpanAll); |
4883 | 4883 |
4884 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document ()); | 4884 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document ()); |
4885 newBox->setStyle(newStyle.release()); | 4885 newBox->setStyle(newStyle.release()); |
4886 return newBox; | 4886 return newBox; |
4887 } | 4887 } |
4888 | 4888 |
4889 bool RenderBlock::recalcChildOverflowAfterStyleChange() | |
4890 { | |
4891 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); | |
4892 setChildNeedsOverflowRecalcAfterStyleChange(false); | |
4893 | |
4894 bool childrenOverflowChanged = false; | |
4895 | |
4896 if (childrenInline()) { | |
4897 ListHashSet<RootInlineBox*> lineBoxes; | |
4898 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | |
4899 RenderObject* renderer = walker.current(); | |
4900 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRec alcAfterStyleChange()) | |
4901 continue; | |
4902 | |
4903 RenderBlock* block = toRenderBlock(renderer); | |
4904 bool overflowChanged = block->recalcOverflowAfterStyleChange(); | |
4905 | |
4906 if (!overflowChanged) | |
4907 continue; | |
4908 | |
4909 childrenOverflowChanged = true; | |
4910 if (InlineBox* inlineBoxWrapper = block->inlineBoxWrapper()) | |
4911 lineBoxes.add(&inlineBoxWrapper->root()); | |
4912 } | |
4913 | |
4914 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal. | |
4915 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | |
4916 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { | |
4917 RootInlineBox* box = *it; | |
4918 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM ap); | |
4919 } | |
4920 } else { | |
4921 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox()) { | |
4922 if (box->isOutOfFlowPositioned() || !box->needsOverflowRecalcAfterSt yleChange()) | |
4923 continue; | |
4924 RenderBlock* block = toRenderBlock(box); | |
4925 bool overflowChanged = block->recalcOverflowAfterStyleChange(); | |
4926 if (!overflowChanged) | |
esprehn
2014/04/10 23:46:14
I don't think you need this local variable
trchen
2014/04/11 22:04:55
Done.
| |
4927 continue; | |
4928 | |
4929 childrenOverflowChanged = true; | |
4930 } | |
4931 } | |
4932 | |
4933 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | |
4934 if (!positionedDescendants) | |
4935 return childrenOverflowChanged; | |
4936 | |
4937 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | |
4938 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { | |
4939 RenderBox* box = *it; | |
4940 | |
4941 if (!box->needsOverflowRecalcAfterStyleChange()) | |
4942 continue; | |
4943 RenderBlock* block = toRenderBlock(box); | |
4944 bool overflowChanged = block->recalcOverflowAfterStyleChange(); | |
4945 if (!overflowChanged || box->style()->position() == FixedPosition) | |
4946 continue; | |
4947 | |
4948 childrenOverflowChanged = true; | |
4949 } | |
4950 return childrenOverflowChanged; | |
4951 } | |
4952 | |
4953 bool RenderBlock::recalcOverflowAfterStyleChange() | |
4954 { | |
4955 ASSERT(needsOverflowRecalcAfterStyleChange()); | |
4956 | |
4957 bool childrenOverflowChanged = false; | |
4958 if (childNeedsOverflowRecalcAfterStyleChange()) | |
4959 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); | |
4960 | |
4961 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) | |
4962 return false; | |
4963 | |
4964 setSelfNeedsOverflowRecalcAfterStyleChange(false); | |
4965 // If the current block needs layout, overflow will be recalculated during | |
4966 // layout time anyway. We can safely exit here. | |
4967 if (needsLayout()) | |
4968 return false; | |
4969 | |
4970 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); | |
4971 computeOverflow(oldClientAfterEdge, true); | |
4972 | |
4973 if (hasOverflowClip()) | |
4974 layer()->scrollableArea()->updateAfterOverflowRecalc(); | |
4975 | |
4976 return !hasOverflowClip(); | |
4977 } | |
4978 | |
4889 #ifndef NDEBUG | 4979 #ifndef NDEBUG |
4890 void RenderBlock::checkPositionedObjectsNeedLayout() | 4980 void RenderBlock::checkPositionedObjectsNeedLayout() |
4891 { | 4981 { |
4892 if (!gPositionedDescendantsMap) | 4982 if (!gPositionedDescendantsMap) |
4893 return; | 4983 return; |
4894 | 4984 |
4895 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects( )) { | 4985 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects( )) { |
4896 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet ->end(); | 4986 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet ->end(); |
4897 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan tSet->begin(); it != end; ++it) { | 4987 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan tSet->begin(); it != end; ++it) { |
4898 RenderBox* currBox = *it; | 4988 RenderBox* currBox = *it; |
4899 ASSERT(!currBox->needsLayout()); | 4989 ASSERT(!currBox->needsLayout()); |
4900 } | 4990 } |
4901 } | 4991 } |
4902 } | 4992 } |
4903 | 4993 |
4904 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 4994 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
4905 { | 4995 { |
4906 showRenderObject(); | 4996 showRenderObject(); |
4907 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 4997 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
4908 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 4998 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
4909 } | 4999 } |
4910 | 5000 |
4911 #endif | 5001 #endif |
4912 | 5002 |
4913 } // namespace WebCore | 5003 } // namespace WebCore |
OLD | NEW |