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

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

Issue 13909006: Merge patch for stacked floats with shape-outside from WebKit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to reflect movment of WebCore -> core Created 7 years, 8 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) 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 3991 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 4002
4003 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for. 4003 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for.
4004 4004
4005 LayoutUnit floatLogicalLeft; 4005 LayoutUnit floatLogicalLeft;
4006 4006
4007 bool insideFlowThread = flowThreadContainingBlock(); 4007 bool insideFlowThread = flowThreadContainingBlock();
4008 4008
4009 if (childBox->style()->floating() == LeftFloat) { 4009 if (childBox->style()->floating() == LeftFloat) {
4010 LayoutUnit heightRemainingLeft = 1; 4010 LayoutUnit heightRemainingLeft = 1;
4011 LayoutUnit heightRemainingRight = 1; 4011 LayoutUnit heightRemainingRight = 1;
4012 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLef tOffset, false, &heightRemainingLeft); 4012 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLef tOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffset);
4013 while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, f alse, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) { 4013 while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, f alse, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffset) - floatLogic alLeft < floatLogicalWidth) {
4014 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); 4014 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
4015 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logica lLeftOffset, false, &heightRemainingLeft); 4015 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logica lLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffset) ;
4016 if (insideFlowThread) { 4016 if (insideFlowThread) {
4017 // Have to re-evaluate all of our offsets, since they may have c hanged. 4017 // Have to re-evaluate all of our offsets, since they may have c hanged.
4018 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs et); // Constant part of right offset. 4018 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs et); // Constant part of right offset.
4019 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset ); // Constant part of left offset. 4019 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset ); // Constant part of left offset.
4020 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo gicalRightOffset - logicalLeftOffset); 4020 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo gicalRightOffset - logicalLeftOffset);
4021 } 4021 }
4022 } 4022 }
4023 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft() , floatLogicalLeft); 4023 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft() , floatLogicalLeft);
4024 } else { 4024 } else {
4025 LayoutUnit heightRemainingLeft = 1; 4025 LayoutUnit heightRemainingLeft = 1;
4026 LayoutUnit heightRemainingRight = 1; 4026 LayoutUnit heightRemainingRight = 1;
4027 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRi ghtOffset, false, &heightRemainingRight); 4027 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRi ghtOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffset);
4028 while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, log icalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { 4028 while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, log icalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffs et) < floatLogicalWidth) {
4029 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); 4029 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
4030 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logic alRightOffset, false, &heightRemainingRight); 4030 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logic alRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffs et);
4031 if (insideFlowThread) { 4031 if (insideFlowThread) {
4032 // Have to re-evaluate all of our offsets, since they may have c hanged. 4032 // Have to re-evaluate all of our offsets, since they may have c hanged.
4033 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs et); // Constant part of right offset. 4033 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs et); // Constant part of right offset.
4034 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset ); // Constant part of left offset. 4034 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset ); // Constant part of left offset.
4035 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo gicalRightOffset - logicalLeftOffset); 4035 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo gicalRightOffset - logicalLeftOffset);
4036 } 4036 }
4037 } 4037 }
4038 floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the ori ginal width of the float here, since the local variable 4038 floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the ori ginal width of the float here, since the local variable
4039 // |floatLogic alWidth| was capped to the available line width. 4039 // |floatLogic alWidth| was capped to the available line width.
4040 // See fast/bl ock/float/clamped-right-float.html. 4040 // See fast/bl ock/float/clamped-right-float.html.
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4309 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region, Layou tUnit offsetFromLogicalTopOfFirstPage) const 4309 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region, Layou tUnit offsetFromLogicalTopOfFirstPage) const
4310 { 4310 {
4311 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderL eft() + paddingLeft() : borderTop() + paddingTop(); 4311 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderL eft() + paddingLeft() : borderTop() + paddingTop();
4312 logicalRightOffset += availableLogicalWidth(); 4312 logicalRightOffset += availableLogicalWidth();
4313 if (!region) 4313 if (!region)
4314 return logicalRightOffset; 4314 return logicalRightOffset;
4315 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir stPage); 4315 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir stPage);
4316 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b oxRect.maxX() : boxRect.maxY())); 4316 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b oxRect.maxX() : boxRect.maxY()));
4317 } 4317 }
4318 4318
4319 LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUn it fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit lo gicalHeight) const 4319 LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUn it fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit lo gicalHeight, ShapeOutsideFloatOffsetMode offsetMode) const
4320 { 4320 {
4321 LayoutUnit left = fixedOffset; 4321 LayoutUnit left = fixedOffset;
4322 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { 4322 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) {
4323 if (heightRemaining) 4323 if (heightRemaining)
4324 *heightRemaining = 1; 4324 *heightRemaining = 1;
4325 4325
4326 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemainin g); 4326 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemainin g);
4327 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 4327 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
4328 4328
4329 #if ENABLE(CSS_EXCLUSIONS) 4329 #if ENABLE(CSS_EXCLUSIONS)
4330 if (const FloatingObject* lastFloat = adapter.lastFloat()) { 4330 const FloatingObject* lastFloat = adapter.lastFloat();
4331 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
4331 if (ExclusionShapeOutsideInfo* shapeOutside = lastFloat->renderer()- >exclusionShapeOutsideInfo()) { 4332 if (ExclusionShapeOutsideInfo* shapeOutside = lastFloat->renderer()- >exclusionShapeOutsideInfo()) {
4332 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); 4333 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
4333 left += shapeOutside->rightSegmentShapeBoundingBoxDelta(); 4334 left += shapeOutside->rightSegmentShapeBoundingBoxDelta();
4334 } 4335 }
4335 } 4336 }
4336 #endif 4337 #endif
4337 } 4338 }
4338 4339
4339 if (applyTextIndent && style()->isLeftToRightDirection()) 4340 if (applyTextIndent && style()->isLeftToRightDirection())
4340 left += textIndentOffset(); 4341 left += textIndentOffset();
(...skipping 22 matching lines...) Expand all
4363 // FIXME: This is wrong for RTL (https://bugs.webkit.org/show_bug.cgi?id=799 45). 4364 // FIXME: This is wrong for RTL (https://bugs.webkit.org/show_bug.cgi?id=799 45).
4364 // FIXME: This doesn't work with columns or regions (https://bugs.webkit.org /show_bug.cgi?id=79942). 4365 // FIXME: This doesn't work with columns or regions (https://bugs.webkit.org /show_bug.cgi?id=79942).
4365 // FIXME: This doesn't work when the inline position of the object isn't set ahead of time. 4366 // FIXME: This doesn't work when the inline position of the object isn't set ahead of time.
4366 // FIXME: Dynamic changes to the font or to the inline position need to resu lt in a deep relayout. 4367 // FIXME: Dynamic changes to the font or to the inline position need to resu lt in a deep relayout.
4367 // (https://bugs.webkit.org/show_bug.cgi?id=79944) 4368 // (https://bugs.webkit.org/show_bug.cgi?id=79944)
4368 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO ffset, maxCharWidth), maxCharWidth); 4369 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO ffset, maxCharWidth), maxCharWidth);
4369 left += remainder; 4370 left += remainder;
4370 return left; 4371 return left;
4371 } 4372 }
4372 4373
4373 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutU nit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit l ogicalHeight) const 4374 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutU nit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit l ogicalHeight, ShapeOutsideFloatOffsetMode offsetMode) const
4374 { 4375 {
4375 LayoutUnit right = fixedOffset; 4376 LayoutUnit right = fixedOffset;
4376 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { 4377 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) {
4377 if (heightRemaining) 4378 if (heightRemaining)
4378 *heightRemaining = 1; 4379 *heightRemaining = 1;
4379 4380
4380 LayoutUnit rightFloatOffset = fixedOffset; 4381 LayoutUnit rightFloatOffset = fixedOffset;
4381 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, rou ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, h eightRemaining); 4382 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, rou ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, h eightRemaining);
4382 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); 4383 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
4383 4384
4384 #if ENABLE(CSS_EXCLUSIONS) 4385 #if ENABLE(CSS_EXCLUSIONS)
4385 if (const FloatingObject* lastFloat = adapter.lastFloat()) { 4386 const FloatingObject* lastFloat = adapter.lastFloat();
4387 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
4386 if (ExclusionShapeOutsideInfo* shapeOutside = lastFloat->renderer()- >exclusionShapeOutsideInfo()) { 4388 if (ExclusionShapeOutsideInfo* shapeOutside = lastFloat->renderer()- >exclusionShapeOutsideInfo()) {
4387 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); 4389 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
4388 rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDel ta(); 4390 rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDel ta();
4389 } 4391 }
4390 } 4392 }
4391 #endif 4393 #endif
4392 4394
4393 right = min(right, rightFloatOffset); 4395 right = min(right, rightFloatOffset);
4394 } 4396 }
4395 4397
(...skipping 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after
8106 { 8108 {
8107 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren deringStructures); 8109 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren deringStructures);
8108 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor yTypes::RenderingStructures); 8110 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor yTypes::RenderingStructures);
8109 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe moryTypes::RenderingStructures); 8111 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe moryTypes::RenderingStructures);
8110 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT ypes::RenderingStructures); 8112 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT ypes::RenderingStructures);
8111 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo ryTypes::RenderingStructures); 8113 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo ryTypes::RenderingStructures);
8112 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem oryTypes::RenderingStructures); 8114 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem oryTypes::RenderingStructures);
8113 } 8115 }
8114 8116
8115 } // namespace WebCore 8117 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698