Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 { 170 {
171 } 171 }
172 172
173 RenderBlockFlow* RenderBlockFlow::createAnonymous(Document* document) 173 RenderBlockFlow* RenderBlockFlow::createAnonymous(Document* document)
174 { 174 {
175 RenderBlockFlow* renderer = new RenderBlockFlow(0); 175 RenderBlockFlow* renderer = new RenderBlockFlow(0);
176 renderer->setDocumentForAnonymous(document); 176 renderer->setDocumentForAnonymous(document);
177 return renderer; 177 return renderer;
178 } 178 }
179 179
180 RenderObject* RenderBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope) 180 LayoutObject* RenderBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
181 { 181 {
182 RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread(); 182 RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread();
183 if (!flowThread) 183 if (!flowThread)
184 return 0; 184 return 0;
185 setLogicalTopForChild(*flowThread, borderBefore() + paddingBefore()); 185 setLogicalTopForChild(*flowThread, borderBefore() + paddingBefore());
186 flowThread->layoutColumns(relayoutChildren, layoutScope); 186 flowThread->layoutColumns(relayoutChildren, layoutScope);
187 determineLogicalLeftPositionForChild(*flowThread); 187 determineLogicalLeftPositionForChild(*flowThread);
188 return flowThread; 188 return flowThread;
189 } 189 }
190 190
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 463 }
464 464
465 // Calculate our new height. 465 // Calculate our new height.
466 LayoutUnit oldHeight = logicalHeight(); 466 LayoutUnit oldHeight = logicalHeight();
467 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 467 LayoutUnit oldClientAfterEdge = clientLogicalBottom();
468 468
469 updateLogicalHeight(); 469 updateLogicalHeight();
470 LayoutUnit newHeight = logicalHeight(); 470 LayoutUnit newHeight = logicalHeight();
471 if (oldHeight > newHeight && !childrenInline()) { 471 if (oldHeight > newHeight && !childrenInline()) {
472 // One of our children's floats may have become an overhanging float for us. 472 // One of our children's floats may have become an overhanging float for us.
473 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) { 473 for (LayoutObject* child = lastChild(); child; child = child->previousSi bling()) {
474 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) { 474 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) {
475 RenderBlockFlow* block = toRenderBlockFlow(child); 475 RenderBlockFlow* block = toRenderBlockFlow(child);
476 if (block->lowestFloatLogicalBottom() + block->logicalTop() <= n ewHeight) 476 if (block->lowestFloatLogicalBottom() + block->logicalTop() <= n ewHeight)
477 break; 477 break;
478 addOverhangingFloats(block, false); 478 addOverhangingFloats(block, false);
479 } 479 }
480 } 480 }
481 } 481 }
482 482
483 bool heightChanged = (previousHeight != newHeight); 483 bool heightChanged = (previousHeight != newHeight);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 // floats in an invalid context. This will cause a crash arising from a bad cast on the parent. 920 // floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
921 // See <rdar://problem/8049753>, where float property is applied on a text n ode in a SVG. 921 // See <rdar://problem/8049753>, where float property is applied on a text n ode in a SVG.
922 if (!parent() || !parent()->isRenderBlockFlow()) 922 if (!parent() || !parent()->isRenderBlockFlow())
923 return; 923 return;
924 924
925 // Attempt to locate a previous sibling with overhanging floats. We skip any elements that 925 // Attempt to locate a previous sibling with overhanging floats. We skip any elements that
926 // may have shifted to avoid floats, and any objects whose floats cannot int eract with objects 926 // may have shifted to avoid floats, and any objects whose floats cannot int eract with objects
927 // outside it (i.e. objects that create a new block formatting context). 927 // outside it (i.e. objects that create a new block formatting context).
928 RenderBlockFlow* parentBlockFlow = toRenderBlockFlow(parent()); 928 RenderBlockFlow* parentBlockFlow = toRenderBlockFlow(parent());
929 bool parentHasFloats = false; 929 bool parentHasFloats = false;
930 RenderObject* prev = previousSibling(); 930 LayoutObject* prev = previousSibling();
931 while (prev && (!prev->isBox() || !prev->isRenderBlock() || toRenderBlock(pr ev)->avoidsFloats() || toRenderBlock(prev)->createsNewFormattingContext())) { 931 while (prev && (!prev->isBox() || !prev->isRenderBlock() || toRenderBlock(pr ev)->avoidsFloats() || toRenderBlock(prev)->createsNewFormattingContext())) {
932 if (prev->isFloating()) 932 if (prev->isFloating())
933 parentHasFloats = true; 933 parentHasFloats = true;
934 prev = prev->previousSibling(); 934 prev = prev->previousSibling();
935 } 935 }
936 936
937 // First add in floats from the parent. Self-collapsing blocks let their par ent track any floats that intrude into 937 // First add in floats from the parent. Self-collapsing blocks let their par ent track any floats that intrude into
938 // them (as opposed to floats they contain themselves) so check for those he re too. 938 // them (as opposed to floats they contain themselves) so check for those he re too.
939 LayoutUnit logicalTopOffset = logicalTop(); 939 LayoutUnit logicalTopOffset = logicalTop();
940 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toRenderBlockF low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom () > logicalTopOffset; 940 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toRenderBlockF low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom () > logicalTopOffset;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) 1019 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge)
1020 { 1020 {
1021 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 1021 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
1022 1022
1023 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts, 1023 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts,
1024 MarginInfo marginInfo(this, beforeEdge, afterEdge); 1024 MarginInfo marginInfo(this, beforeEdge, afterEdge);
1025 1025
1026 // Fieldsets need to find their legend and position it inside the border of the object. 1026 // Fieldsets need to find their legend and position it inside the border of the object.
1027 // The legend then gets skipped during normal layout. The same is true for r uby text. 1027 // The legend then gets skipped during normal layout. The same is true for r uby text.
1028 // It doesn't get included in the normal layout process but is instead skipp ed. 1028 // It doesn't get included in the normal layout process but is instead skipp ed.
1029 RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); 1029 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope);
1030 1030
1031 LayoutUnit previousFloatLogicalBottom = 0; 1031 LayoutUnit previousFloatLogicalBottom = 0;
1032 1032
1033 RenderBox* next = firstChildBox(); 1033 RenderBox* next = firstChildBox();
1034 RenderBox* lastNormalFlowChild = 0; 1034 RenderBox* lastNormalFlowChild = 0;
1035 1035
1036 while (next) { 1036 while (next) {
1037 RenderBox* child = next; 1037 RenderBox* child = next;
1038 next = child->nextSiblingBox(); 1038 next = child->nextSiblingBox();
1039 1039
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 marginInfo.clearMargin(); 1232 marginInfo.clearMargin();
1233 } 1233 }
1234 1234
1235 if (marginInfo.quirkContainer() && marginInfo.atBeforeSideOfBlock() && (posT op - negTop)) 1235 if (marginInfo.quirkContainer() && marginInfo.atBeforeSideOfBlock() && (posT op - negTop))
1236 marginInfo.setHasMarginBeforeQuirk(topQuirk); 1236 marginInfo.setHasMarginBeforeQuirk(topQuirk);
1237 1237
1238 LayoutUnit beforeCollapseLogicalTop = logicalHeight(); 1238 LayoutUnit beforeCollapseLogicalTop = logicalHeight();
1239 LayoutUnit logicalTop = beforeCollapseLogicalTop; 1239 LayoutUnit logicalTop = beforeCollapseLogicalTop;
1240 1240
1241 LayoutUnit clearanceForSelfCollapsingBlock; 1241 LayoutUnit clearanceForSelfCollapsingBlock;
1242 RenderObject* prev = child.previousSibling(); 1242 LayoutObject* prev = child.previousSibling();
1243 RenderBlockFlow* previousBlockFlow = prev && prev->isRenderBlockFlow() && ! prev->isFloatingOrOutOfFlowPositioned() ? toRenderBlockFlow(prev) : 0; 1243 RenderBlockFlow* previousBlockFlow = prev && prev->isRenderBlockFlow() && ! prev->isFloatingOrOutOfFlowPositioned() ? toRenderBlockFlow(prev) : 0;
1244 // If the child's previous sibling is a self-collapsing block that cleared a float then its top border edge has been set at the bottom border edge 1244 // If the child's previous sibling is a self-collapsing block that cleared a float then its top border edge has been set at the bottom border edge
1245 // of the float. Since we want to collapse the child's top margin with the s elf-collapsing block's top and bottom margins we need to adjust our parent's hei ght to match the 1245 // of the float. Since we want to collapse the child's top margin with the s elf-collapsing block's top and bottom margins we need to adjust our parent's hei ght to match the
1246 // margin top of the self-collapsing block. If the resulting collapsed margi n leaves the child still intruding into the float then we will want to clear it. 1246 // margin top of the self-collapsing block. If the resulting collapsed margi n leaves the child still intruding into the float then we will want to clear it.
1247 if (!marginInfo.canCollapseWithMarginBefore() && previousBlockFlow && previo usBlockFlow->isSelfCollapsingBlock()) { 1247 if (!marginInfo.canCollapseWithMarginBefore() && previousBlockFlow && previo usBlockFlow->isSelfCollapsingBlock()) {
1248 clearanceForSelfCollapsingBlock = previousBlockFlow->marginOffsetForSelf CollapsingBlock(); 1248 clearanceForSelfCollapsingBlock = previousBlockFlow->marginOffsetForSelf CollapsingBlock();
1249 setLogicalHeight(logicalHeight() - clearanceForSelfCollapsingBlock); 1249 setLogicalHeight(logicalHeight() - clearanceForSelfCollapsingBlock);
1250 } 1250 }
1251 1251
1252 if (childIsSelfCollapsing) { 1252 if (childIsSelfCollapsing) {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 m_descendantsWithFloatsMarkedForLayout |= !floatToRemove; 1821 m_descendantsWithFloatsMarkedForLayout |= !floatToRemove;
1822 1822
1823 MarkingBehavior markParents = inLayout ? MarkOnlyThis : MarkContainingBlockC hain; 1823 MarkingBehavior markParents = inLayout ? MarkOnlyThis : MarkContainingBlockC hain;
1824 setChildNeedsLayout(markParents); 1824 setChildNeedsLayout(markParents);
1825 1825
1826 if (floatToRemove) 1826 if (floatToRemove)
1827 removeFloatingObject(floatToRemove); 1827 removeFloatingObject(floatToRemove);
1828 1828
1829 // Iterate over our children and mark them as needed. 1829 // Iterate over our children and mark them as needed.
1830 if (!childrenInline() || floatToRemove) { 1830 if (!childrenInline() || floatToRemove) {
1831 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { 1831 for (LayoutObject* child = firstChild(); child; child = child->nextSibli ng()) {
1832 if ((!floatToRemove && child->isFloatingOrOutOfFlowPositioned()) || !child->isRenderBlock()) 1832 if ((!floatToRemove && child->isFloatingOrOutOfFlowPositioned()) || !child->isRenderBlock())
1833 continue; 1833 continue;
1834 if (!child->isRenderBlockFlow()) { 1834 if (!child->isRenderBlockFlow()) {
1835 RenderBlock* childBlock = toRenderBlock(child); 1835 RenderBlock* childBlock = toRenderBlock(child);
1836 if (childBlock->shrinkToAvoidFloats() && childBlock->everHadLayo ut()) 1836 if (childBlock->shrinkToAvoidFloats() && childBlock->everHadLayo ut())
1837 childBlock->setChildNeedsLayout(markParents); 1837 childBlock->setChildNeedsLayout(markParents);
1838 continue; 1838 continue;
1839 } 1839 }
1840 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); 1840 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child);
1841 if ((floatToRemove ? childBlockFlow->containsFloat(floatToRemove) : childBlockFlow->containsFloats()) || childBlockFlow->shrinkToAvoidFloats()) 1841 if ((floatToRemove ? childBlockFlow->containsFloat(floatToRemove) : childBlockFlow->containsFloats()) || childBlockFlow->shrinkToAvoidFloats())
1842 childBlockFlow->markAllDescendantsWithFloatsForLayout(floatToRem ove, inLayout); 1842 childBlockFlow->markAllDescendantsWithFloatsForLayout(floatToRem ove, inLayout);
1843 } 1843 }
1844 } 1844 }
1845 } 1845 }
1846 1846
1847 void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove) 1847 void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove)
1848 { 1848 {
1849 if (!m_floatingObjects) 1849 if (!m_floatingObjects)
1850 return; 1850 return;
1851 1851
1852 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 1852 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
1853 FloatingObjectSetIterator end = floatingObjectSet.end(); 1853 FloatingObjectSetIterator end = floatingObjectSet.end();
1854 1854
1855 for (RenderObject* next = nextSibling(); next; next = next->nextSibling()) { 1855 for (LayoutObject* next = nextSibling(); next; next = next->nextSibling()) {
1856 if (!next->isRenderBlockFlow() || next->isFloatingOrOutOfFlowPositioned( ) || toRenderBlockFlow(next)->avoidsFloats()) 1856 if (!next->isRenderBlockFlow() || next->isFloatingOrOutOfFlowPositioned( ) || toRenderBlockFlow(next)->avoidsFloats())
1857 continue; 1857 continue;
1858 1858
1859 RenderBlockFlow* nextBlock = toRenderBlockFlow(next); 1859 RenderBlockFlow* nextBlock = toRenderBlockFlow(next);
1860 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { 1860 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
1861 RenderBox* floatingBox = (*it)->renderer(); 1861 RenderBox* floatingBox = (*it)->renderer();
1862 if (floatToRemove && floatingBox != floatToRemove) 1862 if (floatToRemove && floatingBox != floatToRemove)
1863 continue; 1863 continue;
1864 if (nextBlock->containsFloat(floatingBox)) 1864 if (nextBlock->containsFloat(floatingBox))
1865 nextBlock->markAllDescendantsWithFloatsForLayout(floatingBox); 1865 nextBlock->markAllDescendantsWithFloatsForLayout(floatingBox);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 // After our style changed, if we lose our ability to propagate floats into next sibling 1948 // After our style changed, if we lose our ability to propagate floats into next sibling
1949 // blocks, then we need to find the top most parent containing that overhang ing float and 1949 // blocks, then we need to find the top most parent containing that overhang ing float and
1950 // then mark its descendants with floats for layout and clear all floats fro m its next 1950 // then mark its descendants with floats for layout and clear all floats fro m its next
1951 // sibling blocks that exist in our floating objects list. See bug 56299 and 62875. 1951 // sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
1952 bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !a voidsFloats(); 1952 bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !a voidsFloats();
1953 if (diff.needsFullLayout() && s_canPropagateFloatIntoSibling && !canPropagat eFloatIntoSibling && hasOverhangingFloats()) { 1953 if (diff.needsFullLayout() && s_canPropagateFloatIntoSibling && !canPropagat eFloatIntoSibling && hasOverhangingFloats()) {
1954 RenderBlockFlow* parentBlockFlow = this; 1954 RenderBlockFlow* parentBlockFlow = this;
1955 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 1955 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
1956 FloatingObjectSetIterator end = floatingObjectSet.end(); 1956 FloatingObjectSetIterator end = floatingObjectSet.end();
1957 1957
1958 for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) { 1958 for (LayoutObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
1959 if (curr->isRenderBlockFlow()) { 1959 if (curr->isRenderBlockFlow()) {
1960 RenderBlockFlow* currBlock = toRenderBlockFlow(curr); 1960 RenderBlockFlow* currBlock = toRenderBlockFlow(curr);
1961 1961
1962 if (currBlock->hasOverhangingFloats()) { 1962 if (currBlock->hasOverhangingFloats()) {
1963 for (FloatingObjectSetIterator it = floatingObjectSet.begin( ); it != end; ++it) { 1963 for (FloatingObjectSetIterator it = floatingObjectSet.begin( ); it != end; ++it) {
1964 RenderBox* renderer = (*it)->renderer(); 1964 RenderBox* renderer = (*it)->renderer();
1965 if (currBlock->hasOverhangingFloat(renderer)) { 1965 if (currBlock->hasOverhangingFloat(renderer)) {
1966 parentBlockFlow = currBlock; 1966 parentBlockFlow = currBlock;
1967 break; 1967 break;
1968 } 1968 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false)); 2004 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false));
2005 else 2005 else
2006 setStaticInlinePositionForChild(child, startOffsetForContent()); 2006 setStaticInlinePositionForChild(child, startOffsetForContent());
2007 } 2007 }
2008 2008
2009 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox& child, LayoutUn it inlinePosition) 2009 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox& child, LayoutUn it inlinePosition)
2010 { 2010 {
2011 child.layer()->setStaticInlinePosition(inlinePosition); 2011 child.layer()->setStaticInlinePosition(inlinePosition);
2012 } 2012 }
2013 2013
2014 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild ) 2014 void RenderBlockFlow::addChild(LayoutObject* newChild, LayoutObject* beforeChild )
2015 { 2015 {
2016 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { 2016 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) {
2017 if (beforeChild == flowThread) 2017 if (beforeChild == flowThread)
2018 beforeChild = flowThread->firstChild(); 2018 beforeChild = flowThread->firstChild();
2019 ASSERT(!beforeChild || beforeChild->isDescendantOf(flowThread)); 2019 ASSERT(!beforeChild || beforeChild->isDescendantOf(flowThread));
2020 flowThread->addChild(newChild, beforeChild); 2020 flowThread->addChild(newChild, beforeChild);
2021 return; 2021 return;
2022 } 2022 }
2023 RenderBlock::addChild(newChild, beforeChild); 2023 RenderBlock::addChild(newChild, beforeChild);
2024 } 2024 }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 } else if (childState != SelectionNone && curr->isRenderBlockFlow()) { 2923 } else if (childState != SelectionNone && curr->isRenderBlockFlow()) {
2924 // We must be a block that has some selected object inside it. Go a head and recur. 2924 // We must be a block that has some selected object inside it. Go a head and recur.
2925 result.unite(toRenderBlockFlow(curr)->selectionGaps(rootBlock, rootB lockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->location(). x(), offsetFromRootBlock.height() + curr->location().y()), 2925 result.unite(toRenderBlockFlow(curr)->selectionGaps(rootBlock, rootB lockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->location(). x(), offsetFromRootBlock.height() + curr->location().y()),
2926 lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo)); 2926 lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo));
2927 } 2927 }
2928 } 2928 }
2929 return result; 2929 return result;
2930 } 2930 }
2931 2931
2932 LayoutRect RenderBlockFlow::logicalLeftSelectionGap(const RenderBlock* rootBlock , const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRoot Block, 2932 LayoutRect RenderBlockFlow::logicalLeftSelectionGap(const RenderBlock* rootBlock , const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRoot Block,
2933 const RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, L ayoutUnit logicalHeight, const PaintInfo* paintInfo) const 2933 const LayoutObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, L ayoutUnit logicalHeight, const PaintInfo* paintInfo) const
2934 { 2934 {
2935 LayoutUnit rootBlockLogicalTop = rootBlock->blockDirectionOffset(offsetFromR ootBlock) + logicalTop; 2935 LayoutUnit rootBlockLogicalTop = rootBlock->blockDirectionOffset(offsetFromR ootBlock) + logicalTop;
2936 LayoutUnit rootBlockLogicalLeft = std::max(logicalLeftSelectionOffset(rootBl ock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeig ht)); 2936 LayoutUnit rootBlockLogicalLeft = std::max(logicalLeftSelectionOffset(rootBl ock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeig ht));
2937 LayoutUnit rootBlockLogicalRight = std::min(rootBlock->inlineDirectionOffset (offsetFromRootBlock) + logicalLeft, std::min(logicalRightSelectionOffset(rootBl ock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHei ght))); 2937 LayoutUnit rootBlockLogicalRight = std::min(rootBlock->inlineDirectionOffset (offsetFromRootBlock) + logicalLeft, std::min(logicalRightSelectionOffset(rootBl ock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHei ght)));
2938 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalL eft; 2938 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalL eft;
2939 if (rootBlockLogicalWidth <= 0) 2939 if (rootBlockLogicalWidth <= 0)
2940 return LayoutRect(); 2940 return LayoutRect();
2941 2941
2942 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalP osition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalW idth, logicalHeight)); 2942 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalP osition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalW idth, logicalHeight));
2943 if (paintInfo) { 2943 if (paintInfo) {
2944 IntRect selectionGapRect = alignSelectionRectToDevicePixels(gapRect); 2944 IntRect selectionGapRect = alignSelectionRectToDevicePixels(gapRect);
2945 RenderDrawingRecorder recorder(paintInfo->context, *this, paintInfo->pha se, selectionGapRect); 2945 RenderDrawingRecorder recorder(paintInfo->context, *this, paintInfo->pha se, selectionGapRect);
2946 if (!recorder.canUseCachedDrawing()) 2946 if (!recorder.canUseCachedDrawing())
2947 paintInfo->context->fillRect(selectionGapRect, selObj->selectionBack groundColor()); 2947 paintInfo->context->fillRect(selectionGapRect, selObj->selectionBack groundColor());
2948 } 2948 }
2949 return gapRect; 2949 return gapRect;
2950 } 2950 }
2951 2951
2952 LayoutRect RenderBlockFlow::logicalRightSelectionGap(const RenderBlock* rootBloc k, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRoo tBlock, 2952 LayoutRect RenderBlockFlow::logicalRightSelectionGap(const RenderBlock* rootBloc k, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRoo tBlock,
2953 const RenderObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo) const 2953 const LayoutObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo) const
2954 { 2954 {
2955 LayoutUnit rootBlockLogicalTop = rootBlock->blockDirectionOffset(offsetFromR ootBlock) + logicalTop; 2955 LayoutUnit rootBlockLogicalTop = rootBlock->blockDirectionOffset(offsetFromR ootBlock) + logicalTop;
2956 LayoutUnit rootBlockLogicalLeft = std::max(rootBlock->inlineDirectionOffset( offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, l ogicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight))); 2956 LayoutUnit rootBlockLogicalLeft = std::max(rootBlock->inlineDirectionOffset( offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, l ogicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)));
2957 LayoutUnit rootBlockLogicalRight = std::min(logicalRightSelectionOffset(root Block, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalH eight)); 2957 LayoutUnit rootBlockLogicalRight = std::min(logicalRightSelectionOffset(root Block, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalH eight));
2958 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalL eft; 2958 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalL eft;
2959 if (rootBlockLogicalWidth <= 0) 2959 if (rootBlockLogicalWidth <= 0)
2960 return LayoutRect(); 2960 return LayoutRect();
2961 2961
2962 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalP osition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalW idth, logicalHeight)); 2962 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalP osition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalW idth, logicalHeight));
2963 if (paintInfo) { 2963 if (paintInfo) {
2964 IntRect selectionGapRect = alignSelectionRectToDevicePixels(gapRect); 2964 IntRect selectionGapRect = alignSelectionRectToDevicePixels(gapRect);
2965 RenderDrawingRecorder recorder(paintInfo->context, *this, paintInfo->pha se, selectionGapRect); 2965 RenderDrawingRecorder recorder(paintInfo->context, *this, paintInfo->pha se, selectionGapRect);
2966 if (!recorder.canUseCachedDrawing()) 2966 if (!recorder.canUseCachedDrawing())
2967 paintInfo->context->fillRect(selectionGapRect, selObj->selectionBack groundColor()); 2967 paintInfo->context->fillRect(selectionGapRect, selObj->selectionBack groundColor());
2968 } 2968 }
2969 return gapRect; 2969 return gapRect;
2970 } 2970 }
2971 2971
2972 void RenderBlockFlow::getSelectionGapInfo(SelectionState state, bool& leftGap, b ool& rightGap) const 2972 void RenderBlockFlow::getSelectionGapInfo(SelectionState state, bool& leftGap, b ool& rightGap) const
2973 { 2973 {
2974 bool ltr = style()->isLeftToRightDirection(); 2974 bool ltr = style()->isLeftToRightDirection();
2975 leftGap = (state == RenderObject::SelectionInside) 2975 leftGap = (state == LayoutObject::SelectionInside)
2976 || (state == RenderObject::SelectionEnd && ltr) 2976 || (state == LayoutObject::SelectionEnd && ltr)
2977 || (state == RenderObject::SelectionStart && !ltr); 2977 || (state == LayoutObject::SelectionStart && !ltr);
2978 rightGap = (state == RenderObject::SelectionInside) 2978 rightGap = (state == LayoutObject::SelectionInside)
2979 || (state == RenderObject::SelectionStart && ltr) 2979 || (state == LayoutObject::SelectionStart && ltr)
2980 || (state == RenderObject::SelectionEnd && !ltr); 2980 || (state == LayoutObject::SelectionEnd && !ltr);
2981 } 2981 }
2982 2982
2983 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut) 2983 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut)
2984 { 2984 {
2985 if (!m_rareData) { 2985 if (!m_rareData) {
2986 if (!strut) 2986 if (!strut)
2987 return; 2987 return;
2988 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2988 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2989 } 2989 }
2990 m_rareData->m_paginationStrut = strut; 2990 m_rareData->m_paginationStrut = strut;
2991 } 2991 }
2992 2992
2993 void RenderBlockFlow::positionSpannerDescendant(RenderMultiColumnSpannerPlacehol der& child) 2993 void RenderBlockFlow::positionSpannerDescendant(RenderMultiColumnSpannerPlacehol der& child)
2994 { 2994 {
2995 RenderBox& spanner = *child.rendererInFlowThread(); 2995 RenderBox& spanner = *child.rendererInFlowThread();
2996 // FIXME: |spanner| is a descendant, but never a direct child, so the names here are bad, if 2996 // FIXME: |spanner| is a descendant, but never a direct child, so the names here are bad, if
2997 // nothing else. 2997 // nothing else.
2998 setLogicalTopForChild(spanner, child.logicalTop()); 2998 setLogicalTopForChild(spanner, child.logicalTop());
2999 determineLogicalLeftPositionForChild(spanner); 2999 determineLogicalLeftPositionForChild(spanner);
3000 } 3000 }
3001 3001
3002 bool RenderBlockFlow::avoidsFloats() const 3002 bool RenderBlockFlow::avoidsFloats() const
3003 { 3003 {
3004 // Floats can't intrude into our box if we have a non-auto column count or w idth. 3004 // Floats can't intrude into our box if we have a non-auto column count or w idth.
3005 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true. 3005 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true.
3006 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth(); 3006 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth();
3007 } 3007 }
3008 3008
3009 void RenderBlockFlow::moveChildrenTo(RenderBoxModelObject* toBoxModelObject, Ren derObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool f ullRemoveInsert) 3009 void RenderBlockFlow::moveChildrenTo(RenderBoxModelObject* toBoxModelObject, Lay outObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool f ullRemoveInsert)
3010 { 3010 {
3011 if (childrenInline()) 3011 if (childrenInline())
3012 deleteLineBoxTree(); 3012 deleteLineBoxTree();
3013 RenderBoxModelObject::moveChildrenTo(toBoxModelObject, startChild, endChild, beforeChild, fullRemoveInsert); 3013 RenderBoxModelObject::moveChildrenTo(toBoxModelObject, startChild, endChild, beforeChild, fullRemoveInsert);
3014 } 3014 }
3015 3015
3016 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(const RenderBlock* rootBl ock, LayoutUnit position) const 3016 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(const RenderBlock* rootBl ock, LayoutUnit position) const
3017 { 3017 {
3018 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false); 3018 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false);
3019 if (logicalLeft == logicalLeftOffsetForContent()) 3019 if (logicalLeft == logicalLeftOffsetForContent())
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 FrameView* frameView = document().view(); 3140 FrameView* frameView = document().view();
3141 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3141 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3142 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3142 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3143 if (size().height() < visibleHeight) 3143 if (size().height() < visibleHeight)
3144 top += (visibleHeight - size().height()) / 2; 3144 top += (visibleHeight - size().height()) / 2;
3145 setY(top); 3145 setY(top);
3146 dialog->setCentered(top); 3146 dialog->setCentered(top);
3147 } 3147 }
3148 3148
3149 } // namespace blink 3149 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698