Chromium Code Reviews| 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) { |
|
eseidel
2013/08/12 22:13:29
I believe webkit style drops these {}
shatch
2013/08/12 22:20:33
Done.
| |
| 4282 *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) - m_lowValue; | 4284 m_floatForHeight = floatingObject; |
| 4285 } | |
| 4283 | 4286 |
| 4284 m_last = floatingObject; | 4287 m_last = floatingObject; |
| 4285 } | 4288 } |
| 4286 | 4289 |
| 4290 template <RenderBlock::FloatingObject::Type FloatTypeValue> | |
| 4291 LayoutUnit RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::getHeightRem aining() const | |
| 4292 { | |
| 4293 return m_floatForHeight ? m_renderer->logicalBottomForFloat(m_floatForHeight ) - m_lowValue : LayoutUnit(1); | |
| 4294 } | |
| 4295 | |
| 4287 LayoutUnit RenderBlock::textIndentOffset() const | 4296 LayoutUnit RenderBlock::textIndentOffset() const |
| 4288 { | 4297 { |
| 4289 LayoutUnit cw = 0; | 4298 LayoutUnit cw = 0; |
| 4290 RenderView* renderView = 0; | 4299 RenderView* renderView = 0; |
| 4291 if (style()->textIndent().isPercent()) | 4300 if (style()->textIndent().isPercent()) |
| 4292 cw = containingBlock()->availableLogicalWidth(); | 4301 cw = containingBlock()->availableLogicalWidth(); |
| 4293 else if (style()->textIndent().isViewportPercentage()) | 4302 else if (style()->textIndent().isViewportPercentage()) |
| 4294 renderView = view(); | 4303 renderView = view(); |
| 4295 return minimumValueForLength(style()->textIndent(), cw, renderView); | 4304 return minimumValueForLength(style()->textIndent(), cw, renderView); |
| 4296 } | 4305 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 4311 if (!region) | 4320 if (!region) |
| 4312 return logicalRightOffset; | 4321 return logicalRightOffset; |
| 4313 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir stPage); | 4322 LayoutRect boxRect = borderBoxRectInRegion(region, offsetFromLogicalTopOfFir stPage); |
| 4314 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b oxRect.maxX() : boxRect.maxY())); | 4323 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b oxRect.maxX() : boxRect.maxY())); |
| 4315 } | 4324 } |
| 4316 | 4325 |
| 4317 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap eOutsideFloatOffsetMode offsetMode) const | 4326 LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay outUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Shap eOutsideFloatOffsetMode offsetMode) const |
| 4318 { | 4327 { |
| 4319 LayoutUnit left = fixedOffset; | 4328 LayoutUnit left = fixedOffset; |
| 4320 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { | 4329 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { |
| 4330 FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roun dToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left); | |
| 4331 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | |
| 4332 | |
| 4321 if (heightRemaining) | 4333 if (heightRemaining) |
| 4322 *heightRemaining = 1; | 4334 *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 | 4335 |
| 4327 const FloatingObject* lastFloat = adapter.lastFloat(); | 4336 const FloatingObject* lastFloat = adapter.lastFloat(); |
| 4328 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { | 4337 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
| 4329 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { | 4338 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { |
| 4330 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); | 4339 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); |
| 4331 left += shapeOutside->rightSegmentMarginBoxDelta(); | 4340 left += shapeOutside->rightSegmentMarginBoxDelta(); |
| 4332 } | 4341 } |
| 4333 } | 4342 } |
| 4334 } | 4343 } |
| 4335 | 4344 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4371 // (https://bugs.webkit.org/show_bug.cgi?id=79944) | 4380 // (https://bugs.webkit.org/show_bug.cgi?id=79944) |
| 4372 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO ffset, maxCharWidth), maxCharWidth); | 4381 float remainder = fmodf(maxCharWidth - fmodf(left + layoutOffset - lineGridO ffset, maxCharWidth), maxCharWidth); |
| 4373 left += remainder; | 4382 left += remainder; |
| 4374 return left; | 4383 return left; |
| 4375 } | 4384 } |
| 4376 | 4385 |
| 4377 LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La youtUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Sha peOutsideFloatOffsetMode offsetMode) const | 4386 LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La youtUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, Sha peOutsideFloatOffsetMode offsetMode) const |
| 4378 { | 4387 { |
| 4379 LayoutUnit right = fixedOffset; | 4388 LayoutUnit right = fixedOffset; |
| 4380 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { | 4389 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { |
| 4390 LayoutUnit rightFloatOffset = fixedOffset; | |
| 4391 FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, rou ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset); | |
| 4392 m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); | |
| 4393 | |
| 4381 if (heightRemaining) | 4394 if (heightRemaining) |
| 4382 *heightRemaining = 1; | 4395 *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 | 4396 |
| 4388 const FloatingObject* lastFloat = adapter.lastFloat(); | 4397 const FloatingObject* lastFloat = adapter.lastFloat(); |
| 4389 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { | 4398 if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { |
| 4390 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { | 4399 if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOut sideInfo()) { |
| 4391 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); | 4400 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); |
| 4392 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); | 4401 rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); |
| 4393 } | 4402 } |
| 4394 } | 4403 } |
| 4395 | 4404 |
| 4396 right = min(right, rightFloatOffset); | 4405 right = min(right, rightFloatOffset); |
| (...skipping 3766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8163 | 8172 |
| 8164 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) | 8173 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) |
| 8165 { | 8174 { |
| 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()); | 8175 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 } | 8176 } |
| 8168 | 8177 |
| 8169 | 8178 |
| 8170 #endif | 8179 #endif |
| 8171 | 8180 |
| 8172 } // namespace WebCore | 8181 } // namespace WebCore |
| OLD | NEW |