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 4831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4842 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent) | 4842 RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent) |
4843 { | 4843 { |
4844 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), BLOCK); | 4844 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), BLOCK); |
4845 newStyle->setColumnSpan(ColumnSpanAll); | 4845 newStyle->setColumnSpan(ColumnSpanAll); |
4846 | 4846 |
4847 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document ()); | 4847 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document ()); |
4848 newBox->setStyle(newStyle.release()); | 4848 newBox->setStyle(newStyle.release()); |
4849 return newBox; | 4849 return newBox; |
4850 } | 4850 } |
4851 | 4851 |
4852 bool RenderBlock::recalcChildOverflowAfterStyleChange() | |
4853 { | |
4854 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); | |
4855 setChildNeedsOverflowRecalcAfterStyleChange(false); | |
4856 | |
4857 bool childrenOverflowChanged = false; | |
4858 | |
4859 if (childrenInline()) { | |
4860 ListHashSet<RootInlineBox*> lineBoxes; | |
4861 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | |
4862 RenderObject* renderer = walker.current(); | |
4863 if (renderer->isOutOfFlowPositioned() || !renderer->needsOverflowRec alcAfterStyleChange()) | |
4864 continue; | |
4865 | |
4866 RenderBlock* block = toRenderBlock(renderer); | |
4867 if (!block->recalcOverflowAfterStyleChange()) | |
4868 continue; | |
4869 | |
4870 childrenOverflowChanged = true; | |
4871 if (InlineBox* inlineBoxWrapper = block->inlineBoxWrapper()) | |
4872 lineBoxes.add(&inlineBoxWrapper->root()); | |
4873 } | |
4874 | |
4875 // FIXME: Glyph overflow will get lost in this case, but not really a bi g deal. | |
4876 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | |
4877 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { | |
4878 RootInlineBox* box = *it; | |
4879 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM ap); | |
4880 } | |
4881 } else { | |
4882 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox()) { | |
4883 if (box->isOutOfFlowPositioned() || !box->needsOverflowRecalcAfterSt yleChange()) | |
4884 continue; | |
4885 | |
4886 RenderBlock* block = toRenderBlock(box); | |
4887 if (!block->recalcOverflowAfterStyleChange()) | |
4888 continue; | |
ojan
2014/04/19 02:19:30
These 6 lines of code are identical to the ones in
trchen
2014/04/19 05:08:21
Sounds reasonable to me. Will do it.
| |
4889 | |
4890 childrenOverflowChanged = true; | |
4891 } | |
4892 } | |
4893 | |
4894 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | |
4895 if (!positionedDescendants) | |
4896 return childrenOverflowChanged; | |
4897 | |
4898 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | |
4899 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { | |
4900 RenderBox* box = *it; | |
4901 | |
4902 if (!box->needsOverflowRecalcAfterStyleChange()) | |
4903 continue; | |
4904 RenderBlock* block = toRenderBlock(box); | |
4905 if (!block->recalcOverflowAfterStyleChange() || box->style()->position() == FixedPosition) | |
4906 continue; | |
4907 | |
4908 childrenOverflowChanged = true; | |
4909 } | |
4910 return childrenOverflowChanged; | |
4911 } | |
4912 | |
4913 bool RenderBlock::recalcOverflowAfterStyleChange() | |
4914 { | |
4915 ASSERT(needsOverflowRecalcAfterStyleChange()); | |
4916 | |
4917 bool childrenOverflowChanged = false; | |
4918 if (childNeedsOverflowRecalcAfterStyleChange()) | |
4919 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); | |
4920 | |
4921 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) | |
4922 return false; | |
4923 | |
4924 setSelfNeedsOverflowRecalcAfterStyleChange(false); | |
4925 // If the current block needs layout, overflow will be recalculated during | |
4926 // layout time anyway. We can safely exit here. | |
4927 if (needsLayout()) | |
4928 return false; | |
4929 | |
4930 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); | |
4931 computeOverflow(oldClientAfterEdge, true); | |
4932 | |
4933 if (hasOverflowClip()) | |
4934 layer()->scrollableArea()->updateAfterOverflowRecalc(); | |
4935 | |
4936 return !hasOverflowClip(); | |
4937 } | |
4938 | |
4852 #ifndef NDEBUG | 4939 #ifndef NDEBUG |
4853 void RenderBlock::checkPositionedObjectsNeedLayout() | 4940 void RenderBlock::checkPositionedObjectsNeedLayout() |
4854 { | 4941 { |
4855 if (!gPositionedDescendantsMap) | 4942 if (!gPositionedDescendantsMap) |
4856 return; | 4943 return; |
4857 | 4944 |
4858 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects( )) { | 4945 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects( )) { |
4859 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet ->end(); | 4946 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet ->end(); |
4860 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan tSet->begin(); it != end; ++it) { | 4947 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan tSet->begin(); it != end; ++it) { |
4861 RenderBox* currBox = *it; | 4948 RenderBox* currBox = *it; |
4862 ASSERT(!currBox->needsLayout()); | 4949 ASSERT(!currBox->needsLayout()); |
4863 } | 4950 } |
4864 } | 4951 } |
4865 } | 4952 } |
4866 | 4953 |
4867 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 4954 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
4868 { | 4955 { |
4869 showRenderObject(); | 4956 showRenderObject(); |
4870 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 4957 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
4871 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 4958 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
4872 } | 4959 } |
4873 | 4960 |
4874 #endif | 4961 #endif |
4875 | 4962 |
4876 } // namespace WebCore | 4963 } // namespace WebCore |
OLD | NEW |