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

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

Powered by Google App Engine
This is Rietveld 408576698