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 4231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 // The bottom of the object overlaps the float | 4242 // The bottom of the object overlaps the float |
4243 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f
loatBottom) | 4243 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f
loatBottom) |
4244 return true; | 4244 return true; |
4245 | 4245 |
4246 return false; | 4246 return false; |
4247 } | 4247 } |
4248 | 4248 |
4249 template<> | 4249 template<> |
4250 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatL
eft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const | 4250 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatL
eft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const |
4251 { | 4251 { |
4252 if (m_renderer->logicalRightForFloat(floatingObject) > m_offset) { | 4252 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
4253 m_offset = m_renderer->logicalRightForFloat(floatingObject); | 4253 if (logicalRight > m_offset) { |
| 4254 m_offset = logicalRight; |
4254 return true; | 4255 return true; |
4255 } | 4256 } |
4256 return false; | 4257 return false; |
4257 } | 4258 } |
4258 | 4259 |
4259 template<> | 4260 template<> |
4260 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatR
ight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const | 4261 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatR
ight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const |
4261 { | 4262 { |
4262 if (m_renderer->logicalLeftForFloat(floatingObject) < m_offset) { | 4263 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
4263 m_offset = m_renderer->logicalLeftForFloat(floatingObject); | 4264 if (logicalLeft < m_offset) { |
| 4265 m_offset = logicalLeft; |
4264 return true; | 4266 return true; |
4265 } | 4267 } |
4266 return false; | 4268 return false; |
4267 } | 4269 } |
4268 | 4270 |
4269 template <RenderBlock::FloatingObject::Type FloatTypeValue> | 4271 template <RenderBlock::FloatingObject::Type FloatTypeValue> |
4270 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) const | 4272 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) |
4271 { | 4273 { |
4272 const FloatingObject* floatingObject = interval.data(); | 4274 const FloatingObject* floatingObject = interval.data(); |
4273 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo
w(), interval.high(), m_lowValue, m_highValue)) | 4275 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo
w(), interval.high(), m_lowValue, m_highValue)) |
4274 return; | 4276 return; |
4275 | 4277 |
4276 // All the objects returned from the tree should be already placed. | 4278 // All the objects returned from the tree should be already placed. |
4277 ASSERT(floatingObject->isPlaced()); | 4279 ASSERT(floatingObject->isPlaced()); |
4278 ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingOb
ject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue
, m_highValue)); | 4280 ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingOb
ject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue
, m_highValue)); |
4279 | 4281 |
4280 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); | 4282 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); |
4281 if (floatIsNewExtreme && m_heightRemaining) | 4283 if (floatIsNewExtreme) |
4282 *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) -
m_lowValue; | 4284 m_floatForHeight = floatingObject; |
4283 | 4285 |
4284 m_last = floatingObject; | 4286 m_last = floatingObject; |
4285 } | 4287 } |
4286 | 4288 |
| 4289 template <RenderBlock::FloatingObject::Type FloatTypeValue> |
| 4290 LayoutUnit RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::getHeightRem
aining() const |
| 4291 { |
| 4292 return m_floatForHeight ? m_renderer->logicalBottomForFloat(m_floatForHeight
) - m_lowValue : LayoutUnit(1); |
| 4293 } |
| 4294 |
4287 LayoutUnit RenderBlock::textIndentOffset() const | 4295 LayoutUnit RenderBlock::textIndentOffset() const |
4288 { | 4296 { |
4289 LayoutUnit cw = 0; | 4297 LayoutUnit cw = 0; |
4290 RenderView* renderView = 0; | 4298 RenderView* renderView = 0; |
4291 if (style()->textIndent().isPercent()) | 4299 if (style()->textIndent().isPercent()) |
4292 cw = containingBlock()->availableLogicalWidth(); | 4300 cw = containingBlock()->availableLogicalWidth(); |
4293 else if (style()->textIndent().isViewportPercentage()) | 4301 else if (style()->textIndent().isViewportPercentage()) |
4294 renderView = view(); | 4302 renderView = view(); |
4295 return minimumValueForLength(style()->textIndent(), cw, renderView); | 4303 return minimumValueForLength(style()->textIndent(), cw, renderView); |
4296 } | 4304 } |
(...skipping 14 matching lines...) Expand all Loading... |
4311 if (!region) | 4319 if (!region) |
4312 return logicalRightOffset; | 4320 return logicalRightOffset; |
4313 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir
stPage); | 4321 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir
stPage); |
4314 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b
oxRect.maxX() : boxRect.maxY())); | 4322 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b
oxRect.maxX() : boxRect.maxY())); |
4315 } | 4323 } |
4316 | 4324 |
4317 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay
outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap
eOutsideFloatOffsetMode offsetMode) const | 4325 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay
outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap
eOutsideFloatOffsetMode offsetMode) const |
4318 { | 4326 { |
4319 LayoutUnit left = fixedOffset; | 4327 LayoutUnit left = fixedOffset; |
4320 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { | 4328 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { |
| 4329 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun
dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left); |
| 4330 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); |
| 4331 |
4321 if (heightRemaining) | 4332 if (heightRemaining) |
4322 *heightRemaining = 1; | 4333 *heightRemaining = adapter.getHeightRemaining(); |
4323 | |
4324 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun
dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemainin
g); | |
4325 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | |
4326 | 4334 |
4327 const FloatingObject* lastFloat = adapter.lastFloat(); | 4335 const FloatingObject* lastFloat = adapter.lastFloat(); |
4328 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { | 4336 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
4329 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { | 4337 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { |
4330 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop,
logicalTopForFloat(lastFloat), logicalHeight); | 4338 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop,
logicalTopForFloat(lastFloat), logicalHeight); |
4331 left += shapeOutside->rightSegmentMarginBoxDelta(); | 4339 left += shapeOutside->rightSegmentMarginBoxDelta(); |
4332 } | 4340 } |
4333 } | 4341 } |
4334 } | 4342 } |
4335 | 4343 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4371 // (https://bugs.webkit.org/show_bug.cgi?id=79944) | 4379 // (https://bugs.webkit.org/show_bug.cgi?id=79944) |
4372 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO
ffset, maxCharWidth), maxCharWidth); | 4380 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO
ffset, maxCharWidth), maxCharWidth); |
4373 left += remainder; | 4381 left += remainder; |
4374 return left; | 4382 return left; |
4375 } | 4383 } |
4376 | 4384 |
4377 LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La
youtUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Sha
peOutsideFloatOffsetMode offsetMode) const | 4385 LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La
youtUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Sha
peOutsideFloatOffsetMode offsetMode) const |
4378 { | 4386 { |
4379 LayoutUnit right = fixedOffset; | 4387 LayoutUnit right = fixedOffset; |
4380 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { | 4388 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { |
| 4389 LayoutUnit rightFloatOffset = fixedOffset; |
| 4390 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, rou
ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset); |
| 4391 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); |
| 4392 |
4381 if (heightRemaining) | 4393 if (heightRemaining) |
4382 *heightRemaining = 1; | 4394 *heightRemaining = adapter.getHeightRemaining(); |
4383 | |
4384 LayoutUnit rightFloatOffset = fixedOffset; | |
4385 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, rou
ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, h
eightRemaining); | |
4386 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | |
4387 | 4395 |
4388 const FloatingObject* lastFloat = adapter.lastFloat(); | 4396 const FloatingObject* lastFloat = adapter.lastFloat(); |
4389 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { | 4397 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
4390 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { | 4398 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut
sideInfo()) { |
4391 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop,
logicalTopForFloat(lastFloat), logicalHeight); | 4399 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop,
logicalTopForFloat(lastFloat), logicalHeight); |
4392 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); | 4400 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); |
4393 } | 4401 } |
4394 } | 4402 } |
4395 | 4403 |
4396 right = min(right, rightFloatOffset); | 4404 right = min(right, rightFloatOffset); |
(...skipping 3766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8163 | 8171 |
8164 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 8172 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
8165 { | 8173 { |
8166 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 8174 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
8167 } | 8175 } |
8168 | 8176 |
8169 | 8177 |
8170 #endif | 8178 #endif |
8171 | 8179 |
8172 } // namespace WebCore | 8180 } // namespace WebCore |
OLD | NEW |