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

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

Issue 23084002: Use the outermost float for shape-outside (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 4 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
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo w(), interval.high(), m_lineTop, m_lineBottom)) 4281 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo w(), interval.high(), m_lineTop, m_lineBottom))
4282 return; 4282 return;
4283 4283
4284 // Make sure the float hasn't changed since it was added to the placed float s tree. 4284 // Make sure the float hasn't changed since it was added to the placed float s tree.
4285 ASSERT(floatingObject->isPlaced()); 4285 ASSERT(floatingObject->isPlaced());
4286 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floating Object)); 4286 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floating Object));
4287 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floa tingObject)); 4287 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floa tingObject));
4288 4288
4289 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); 4289 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
4290 if (floatIsNewExtreme) 4290 if (floatIsNewExtreme)
4291 m_floatForHeight = floatingObject; 4291 m_outermostFloat = floatingObject;
4292
4293 m_last = floatingObject;
4294 } 4292 }
4295 4293
4296 template <RenderBlock::FloatingObject::Type FloatTypeValue> 4294 template <RenderBlock::FloatingObject::Type FloatTypeValue>
4297 LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRema ining() const 4295 LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRema ining() const
4298 { 4296 {
4299 return m_floatForHeight ? m_renderer->logicalBottomForFloat(m_floatForHeight ) - m_lineTop : LayoutUnit(1); 4297 return m_outermostFloat ? m_renderer->logicalBottomForFloat(m_outermostFloat ) - m_lineTop : LayoutUnit(1);
4300 } 4298 }
4301 4299
4302 LayoutUnit RenderBlock::textIndentOffset() const 4300 LayoutUnit RenderBlock::textIndentOffset() const
4303 { 4301 {
4304 LayoutUnit cw = 0; 4302 LayoutUnit cw = 0;
4305 RenderView* renderView = 0; 4303 RenderView* renderView = 0;
4306 if (style()->textIndent().isPercent()) 4304 if (style()->textIndent().isPercent())
4307 cw = containingBlock()->availableLogicalWidth(); 4305 cw = containingBlock()->availableLogicalWidth();
4308 else if (style()->textIndent().isViewportPercentage()) 4306 else if (style()->textIndent().isViewportPercentage())
4309 renderView = view(); 4307 renderView = view();
(...skipping 22 matching lines...) Expand all
4332 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap eOutsideFloatOffsetMode offsetMode) const 4330 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap eOutsideFloatOffsetMode offsetMode) const
4333 { 4331 {
4334 LayoutUnit left = fixedOffset; 4332 LayoutUnit left = fixedOffset;
4335 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { 4333 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) {
4336 ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(this, round ToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left); 4334 ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(this, round ToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left);
4337 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 4335 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
4338 4336
4339 if (heightRemaining) 4337 if (heightRemaining)
4340 *heightRemaining = adapter.getHeightRemaining(); 4338 *heightRemaining = adapter.getHeightRemaining();
4341 4339
4342 const FloatingObject* lastFloat = adapter.lastFloat(); 4340 const FloatingObject* outermostFloat = adapter.outermostFloat();
4343 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { 4341 if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) {
4344 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { 4342 if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->sha peOutsideInfo()) {
4345 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); 4343 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(outermostFloat), logicalHeight);
4346 left += shapeOutside->rightSegmentMarginBoxDelta(); 4344 left += shapeOutside->rightSegmentMarginBoxDelta();
4347 } 4345 }
4348 } 4346 }
4349 } 4347 }
4350 4348
4351 return left; 4349 return left;
4352 } 4350 }
4353 4351
4354 LayoutUnit RenderBlock::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloa ts, bool applyTextIndent) const 4352 LayoutUnit RenderBlock::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloa ts, bool applyTextIndent) const
4355 { 4353 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4393 { 4391 {
4394 LayoutUnit right = fixedOffset; 4392 LayoutUnit right = fixedOffset;
4395 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { 4393 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) {
4396 LayoutUnit rightFloatOffset = fixedOffset; 4394 LayoutUnit rightFloatOffset = fixedOffset;
4397 ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(this, roun dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset); 4395 ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(this, roun dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset);
4398 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 4396 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
4399 4397
4400 if (heightRemaining) 4398 if (heightRemaining)
4401 *heightRemaining = adapter.getHeightRemaining(); 4399 *heightRemaining = adapter.getHeightRemaining();
4402 4400
4403 const FloatingObject* lastFloat = adapter.lastFloat(); 4401 const FloatingObject* outermostFloat = adapter.outermostFloat();
4404 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { 4402 if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) {
4405 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { 4403 if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->sha peOutsideInfo()) {
4406 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); 4404 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(outermostFloat), logicalHeight);
4407 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); 4405 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta();
4408 } 4406 }
4409 } 4407 }
4410 4408
4411 right = min(right, rightFloatOffset); 4409 right = min(right, rightFloatOffset);
4412 } 4410 }
4413 return right; 4411 return right;
4414 } 4412 }
4415 4413
4416 LayoutUnit RenderBlock::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFlo ats, bool applyTextIndent) const 4414 LayoutUnit RenderBlock::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFlo ats, bool applyTextIndent) const
(...skipping 3761 matching lines...) Expand 10 before | Expand all | Expand 10 after
8178 8176
8179 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 8177 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
8180 { 8178 {
8181 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 8179 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
8182 } 8180 }
8183 8181
8184 8182
8185 #endif 8183 #endif
8186 8184
8187 } // namespace WebCore 8185 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698