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

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

Issue 209443007: Remove shape-inside support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix more (all?) tests Created 6 years, 9 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
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 // We are no longer at the top of the block if we encounter a non-empty chil d. 606 // We are no longer at the top of the block if we encounter a non-empty chil d.
607 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred. 607 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred.
608 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) 608 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing)
609 marginInfo.setAtBeforeSideOfBlock(false); 609 marginInfo.setAtBeforeSideOfBlock(false);
610 610
611 // Now place the child in the correct left position 611 // Now place the child in the correct left position
612 determineLogicalLeftPositionForChild(child, ApplyLayoutDelta); 612 determineLogicalLeftPositionForChild(child, ApplyLayoutDelta);
613 613
614 LayoutSize childOffset = child->location() - oldRect.location(); 614 LayoutSize childOffset = child->location() - oldRect.location();
615 relayoutShapeDescendantIfMoved(childRenderBlock, childOffset);
616 615
617 // Update our height now that the child has been placed in the correct posit ion. 616 // Update our height now that the child has been placed in the correct posit ion.
618 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); 617 setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
619 if (mustSeparateMarginAfterForChild(child)) { 618 if (mustSeparateMarginAfterForChild(child)) {
620 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); 619 setLogicalHeight(logicalHeight() + marginAfterForChild(child));
621 marginInfo.clearMargin(); 620 marginInfo.clearMargin();
622 } 621 }
623 // If the child has overhanging floats that intrude into following siblings (or possibly out 622 // If the child has overhanging floats that intrude into following siblings (or possibly out
624 // of this block), then the parent gets notified of the floats now. 623 // of this block), then the parent gets notified of the floats now.
625 if (childRenderBlockFlow && childRenderBlockFlow->containsFloats()) 624 if (childRenderBlockFlow && childRenderBlockFlow->containsFloats())
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 right -= textIndentOffset(); 2130 right -= textIndentOffset();
2132 2131
2133 return right; 2132 return right;
2134 } 2133 }
2135 2134
2136 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const 2135 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const
2137 { 2136 {
2138 RenderBox* childBox = floatingObject->renderer(); 2137 RenderBox* childBox = floatingObject->renderer();
2139 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa rt of left offset. 2138 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa rt of left offset.
2140 LayoutUnit logicalRightOffset; // Constant part of right offset. 2139 LayoutUnit logicalRightOffset; // Constant part of right offset.
2141 // FIXME Bug 102948: This only works for shape outside directly set on this block. 2140 // FIXME Bug 102948: This only works for shape outside directly set on this block.
Zoltan 2014/03/26 21:01:09 We can remove the FIXME.
2142 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); 2141 logicalRightOffset = logicalRightOffsetForContent();
2143 // FIXME: Implement behavior for right floats.
2144 if (shapeInsideInfo) {
2145 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject);
2146 // floatingObject's logicalSize doesn't contain the actual height at thi s point, so we need to calculate it
2147 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor eForChild(childBox) + marginAfterForChild(childBox));
2148
2149 // FIXME: If the float doesn't fit in the shape we should push it under the content box
2150 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa tLogicalSize);
2151 if (logicalHeight() > logicalTopOffset)
2152 logicalTopOffset = logicalHeight();
2153
2154 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo pOffset, floatLogicalSize.height());
2155 // FIXME: Add support for shapes with multiple segments.
2156 if (segments.size() >= 1) {
2157 // The segment offsets are relative to the content box.
2158 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight;
2159 logicalLeftOffset += segments[0].logicalLeft;
2160 }
2161 } else {
2162 logicalRightOffset = logicalRightOffsetForContent();
2163 }
2164 2142
2165 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for. 2143 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for.
2166 2144
2167 LayoutUnit floatLogicalLeft; 2145 LayoutUnit floatLogicalLeft;
2168 2146
2169 bool insideFlowThread = flowThreadContainingBlock(); 2147 bool insideFlowThread = flowThreadContainingBlock();
2170 2148
2171 if (childBox->style()->floating() == LeftFloat) { 2149 if (childBox->style()->floating() == LeftFloat) {
2172 LayoutUnit heightRemainingLeft = 1; 2150 LayoutUnit heightRemainingLeft = 1;
2173 LayoutUnit heightRemainingRight = 1; 2151 LayoutUnit heightRemainingRight = 1;
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2791 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2814 { 2792 {
2815 if (m_rareData) 2793 if (m_rareData)
2816 return *m_rareData; 2794 return *m_rareData;
2817 2795
2818 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2796 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2819 return *m_rareData; 2797 return *m_rareData;
2820 } 2798 }
2821 2799
2822 } // namespace WebCore 2800 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698