| OLD | NEW |
| 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 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4001 | 4001 |
| 4002 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. | 4002 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. |
| 4003 | 4003 |
| 4004 LayoutUnit floatLogicalLeft; | 4004 LayoutUnit floatLogicalLeft; |
| 4005 | 4005 |
| 4006 bool insideFlowThread = flowThreadContainingBlock(); | 4006 bool insideFlowThread = flowThreadContainingBlock(); |
| 4007 | 4007 |
| 4008 if (childBox->style()->floating() == LeftFloat) { | 4008 if (childBox->style()->floating() == LeftFloat) { |
| 4009 LayoutUnit heightRemainingLeft = 1; | 4009 LayoutUnit heightRemainingLeft = 1; |
| 4010 LayoutUnit heightRemainingRight = 1; | 4010 LayoutUnit heightRemainingRight = 1; |
| 4011 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLef
tOffset, false, &heightRemainingLeft); | 4011 floatLogicalLeft = logicalLeftOffsetForLineUsingFloatBoundingBox(logical
TopOffset, logicalLeftOffset, false, &heightRemainingLeft); |
| 4012 while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, f
alse, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) { | 4012 while (logicalRightOffsetForLineUsingFloatBoundingBox(logicalTopOffset,
logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogi
calWidth) { |
| 4013 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 4013 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
| 4014 floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logica
lLeftOffset, false, &heightRemainingLeft); | 4014 floatLogicalLeft = logicalLeftOffsetForLineUsingFloatBoundingBox(log
icalTopOffset, logicalLeftOffset, false, &heightRemainingLeft); |
| 4015 if (insideFlowThread) { | 4015 if (insideFlowThread) { |
| 4016 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 4016 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 4017 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 4017 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. |
| 4018 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 4018 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. |
| 4019 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 4019 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
| 4020 } | 4020 } |
| 4021 } | 4021 } |
| 4022 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); | 4022 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); |
| 4023 } else { | 4023 } else { |
| 4024 LayoutUnit heightRemainingLeft = 1; | 4024 LayoutUnit heightRemainingLeft = 1; |
| 4025 LayoutUnit heightRemainingRight = 1; | 4025 LayoutUnit heightRemainingRight = 1; |
| 4026 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight); | 4026 floatLogicalLeft = logicalRightOffsetForLineUsingFloatBoundingBox(logica
lTopOffset, logicalRightOffset, false, &heightRemainingRight); |
| 4027 while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, log
icalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { | 4027 while (floatLogicalLeft - logicalLeftOffsetForLineUsingFloatBoundingBox(
logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogical
Width) { |
| 4028 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 4028 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
| 4029 floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logic
alRightOffset, false, &heightRemainingRight); | 4029 floatLogicalLeft = logicalRightOffsetForLineUsingFloatBoundingBox(lo
gicalTopOffset, logicalRightOffset, false, &heightRemainingRight); |
| 4030 if (insideFlowThread) { | 4030 if (insideFlowThread) { |
| 4031 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 4031 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 4032 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 4032 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. |
| 4033 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 4033 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. |
| 4034 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 4034 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
| 4035 } | 4035 } |
| 4036 } | 4036 } |
| 4037 floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the ori
ginal width of the float here, since the local variable | 4037 floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the ori
ginal width of the float here, since the local variable |
| 4038 // |floatLogic
alWidth| was capped to the available line width. | 4038 // |floatLogic
alWidth| was capped to the available line width. |
| 4039 // See fast/bl
ock/float/clamped-right-float.html. | 4039 // See fast/bl
ock/float/clamped-right-float.html. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region, Layou
tUnit offsetFromLogicalTopOfFirstPage) const | 4304 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region, Layou
tUnit offsetFromLogicalTopOfFirstPage) const |
| 4305 { | 4305 { |
| 4306 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderL
eft() + paddingLeft() : borderTop() + paddingTop(); | 4306 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderL
eft() + paddingLeft() : borderTop() + paddingTop(); |
| 4307 logicalRightOffset += availableLogicalWidth(); | 4307 logicalRightOffset += availableLogicalWidth(); |
| 4308 if (!region) | 4308 if (!region) |
| 4309 return logicalRightOffset; | 4309 return logicalRightOffset; |
| 4310 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir
stPage); | 4310 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir
stPage); |
| 4311 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b
oxRect.maxX() : boxRect.maxY())); | 4311 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b
oxRect.maxX() : boxRect.maxY())); |
| 4312 } | 4312 } |
| 4313 | 4313 |
| 4314 LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUn
it fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit lo
gicalHeight) const | 4314 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay
outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap
eOutsideFloatOffsetMode offsetMode) const |
| 4315 { | 4315 { |
| 4316 LayoutUnit left = fixedOffset; | 4316 LayoutUnit left = fixedOffset; |
| 4317 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { | 4317 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { |
| 4318 if (heightRemaining) | 4318 if (heightRemaining) |
| 4319 *heightRemaining = 1; | 4319 *heightRemaining = 1; |
| 4320 | 4320 |
| 4321 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun
dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemainin
g); | 4321 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun
dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemainin
g); |
| 4322 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | 4322 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); |
| 4323 | 4323 |
| 4324 if (const FloatingObject* lastFloat = adapter.lastFloat()) { | 4324 const FloatingObject* lastFloat = adapter.lastFloat(); |
| 4325 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
| 4325 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { | 4326 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { |
| 4326 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF
loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); | 4327 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF
loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); |
| 4327 left += shapeOutside->rightSegmentShapeBoundingBoxDelta(); | 4328 left += shapeOutside->rightSegmentShapeBoundingBoxDelta(); |
| 4328 } | 4329 } |
| 4329 } | 4330 } |
| 4330 } | 4331 } |
| 4331 | 4332 |
| 4333 return left; |
| 4334 } |
| 4335 |
| 4336 LayoutUnit RenderBlock::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloa
ts, bool applyTextIndent) const |
| 4337 { |
| 4338 LayoutUnit left = offsetFromFloats; |
| 4339 |
| 4332 if (applyTextIndent && style()->isLeftToRightDirection()) | 4340 if (applyTextIndent && style()->isLeftToRightDirection()) |
| 4333 left += textIndentOffset(); | 4341 left += textIndentOffset(); |
| 4334 | 4342 |
| 4335 if (style()->lineAlign() == LineAlignNone) | 4343 if (style()->lineAlign() == LineAlignNone) |
| 4336 return left; | 4344 return left; |
| 4337 | 4345 |
| 4338 // Push in our left offset so that it is aligned with the character grid. | 4346 // Push in our left offset so that it is aligned with the character grid. |
| 4339 LayoutState* layoutState = view()->layoutState(); | 4347 LayoutState* layoutState = view()->layoutState(); |
| 4340 if (!layoutState) | 4348 if (!layoutState) |
| 4341 return left; | 4349 return left; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4356 // 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). |
| 4357 // 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). |
| 4358 // 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. |
| 4359 // 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. |
| 4360 // (https://bugs.webkit.org/show_bug.cgi?id=79944) | 4368 // (https://bugs.webkit.org/show_bug.cgi?id=79944) |
| 4361 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO
ffset, maxCharWidth), maxCharWidth); | 4369 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO
ffset, maxCharWidth), maxCharWidth); |
| 4362 left += remainder; | 4370 left += remainder; |
| 4363 return left; | 4371 return left; |
| 4364 } | 4372 } |
| 4365 | 4373 |
| 4366 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutU
nit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit l
ogicalHeight) const | 4374 LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La
youtUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Sha
peOutsideFloatOffsetMode offsetMode) const |
| 4367 { | 4375 { |
| 4368 LayoutUnit right = fixedOffset; | 4376 LayoutUnit right = fixedOffset; |
| 4369 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { | 4377 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { |
| 4370 if (heightRemaining) | 4378 if (heightRemaining) |
| 4371 *heightRemaining = 1; | 4379 *heightRemaining = 1; |
| 4372 | 4380 |
| 4373 LayoutUnit rightFloatOffset = fixedOffset; | 4381 LayoutUnit rightFloatOffset = fixedOffset; |
| 4374 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); |
| 4375 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | 4383 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); |
| 4376 | 4384 |
| 4377 if (const FloatingObject* lastFloat = adapter.lastFloat()) { | 4385 const FloatingObject* lastFloat = adapter.lastFloat(); |
| 4386 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
| 4378 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { | 4387 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { |
| 4379 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF
loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); | 4388 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForF
loat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight); |
| 4380 rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDel
ta(); | 4389 rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDel
ta(); |
| 4381 } | 4390 } |
| 4382 } | 4391 } |
| 4383 | 4392 |
| 4384 right = min(right, rightFloatOffset); | 4393 right = min(right, rightFloatOffset); |
| 4385 } | 4394 } |
| 4395 return right; |
| 4396 } |
| 4386 | 4397 |
| 4398 LayoutUnit RenderBlock::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFlo
ats, bool applyTextIndent) const |
| 4399 { |
| 4400 LayoutUnit right = offsetFromFloats; |
| 4401 |
| 4387 if (applyTextIndent && !style()->isLeftToRightDirection()) | 4402 if (applyTextIndent && !style()->isLeftToRightDirection()) |
| 4388 right -= textIndentOffset(); | 4403 right -= textIndentOffset(); |
| 4389 | 4404 |
| 4390 if (style()->lineAlign() == LineAlignNone) | 4405 if (style()->lineAlign() == LineAlignNone) |
| 4391 return right; | 4406 return right; |
| 4392 | 4407 |
| 4393 // Push in our right offset so that it is aligned with the character grid. | 4408 // Push in our right offset so that it is aligned with the character grid. |
| 4394 LayoutState* layoutState = view()->layoutState(); | 4409 LayoutState* layoutState = view()->layoutState(); |
| 4395 if (!layoutState) | 4410 if (!layoutState) |
| 4396 return right; | 4411 return right; |
| (...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8148 { | 8163 { |
| 8149 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); | 8164 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); |
| 8150 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); | 8165 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); |
| 8151 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); | 8166 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); |
| 8152 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); | 8167 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); |
| 8153 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); | 8168 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); |
| 8154 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); | 8169 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); |
| 8155 } | 8170 } |
| 8156 | 8171 |
| 8157 } // namespace WebCore | 8172 } // namespace WebCore |
| OLD | NEW |