Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "core/rendering/shapes/ShapeInfo.h" | 31 #include "core/rendering/shapes/ShapeInfo.h" |
| 32 | 32 |
| 33 #include "core/rendering/RenderBlock.h" | 33 #include "core/rendering/RenderBlock.h" |
| 34 #include "core/rendering/RenderImage.h" | 34 #include "core/rendering/RenderImage.h" |
| 35 | 35 |
| 36 #include "platform/LengthFunctions.h" | |
| 37 | |
| 36 namespace WebCore { | 38 namespace WebCore { |
| 37 | 39 |
| 38 template<class RenderType> | 40 template<class RenderType> |
| 39 void ShapeInfo<RenderType>::setReferenceBoxLogicalSize(LayoutSize newReferenceBo xLogicalSize) | 41 void ShapeInfo<RenderType>::setReferenceBoxLogicalSize(LayoutSize newReferenceBo xLogicalSize) |
| 40 { | 42 { |
| 41 bool isHorizontalWritingMode = this->styleForWritingMode()->isHorizontalWrit ingMode(); | 43 bool isHorizontalWritingMode = this->styleForWritingMode()->isHorizontalWrit ingMode(); |
| 42 switch (referenceBox()) { | 44 switch (referenceBox()) { |
| 43 case MarginBox: | 45 case MarginBox: |
| 44 if (isHorizontalWritingMode) | 46 if (isHorizontalWritingMode) |
| 45 newReferenceBoxLogicalSize.expand(m_renderer.marginWidth(), m_render er.marginHeight()); | 47 newReferenceBoxLogicalSize.expand(m_renderer.marginWidth(), m_render er.marginHeight()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDe lta); | 107 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDe lta); |
| 106 } | 108 } |
| 107 | 109 |
| 108 template<class RenderType> | 110 template<class RenderType> |
| 109 const Shape& ShapeInfo<RenderType>::computedShape() const | 111 const Shape& ShapeInfo<RenderType>::computedShape() const |
| 110 { | 112 { |
| 111 if (Shape* shape = m_shape.get()) | 113 if (Shape* shape = m_shape.get()) |
| 112 return *shape; | 114 return *shape; |
| 113 | 115 |
| 114 WritingMode writingMode = this->styleForWritingMode()->writingMode(); | 116 WritingMode writingMode = this->styleForWritingMode()->writingMode(); |
| 115 Length margin = m_renderer.style()->shapeMargin(); | 117 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit(); |
|
Bem Jones-Bey (adobe)
2014/04/04 23:03:53
Isn't there an implicit conversion from LayoutUnit
leviw_travelin_and_unemployed
2014/04/07 17:54:38
We're actually working on killing the implicit con
| |
| 118 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat()); | |
| 116 float shapeImageThreshold = m_renderer.style()->shapeImageThreshold(); | 119 float shapeImageThreshold = m_renderer.style()->shapeImageThreshold(); |
| 117 const ShapeValue* shapeValue = this->shapeValue(); | 120 const ShapeValue* shapeValue = this->shapeValue(); |
| 118 ASSERT(shapeValue); | 121 ASSERT(shapeValue); |
| 119 | 122 |
| 120 switch (shapeValue->type()) { | 123 switch (shapeValue->type()) { |
| 121 case ShapeValue::Shape: | 124 case ShapeValue::Shape: |
| 122 ASSERT(shapeValue->shape()); | 125 ASSERT(shapeValue->shape()); |
| 123 m_shape = Shape::createShape(shapeValue->shape(), m_referenceBoxLogicalS ize, writingMode, margin); | 126 m_shape = Shape::createShape(shapeValue->shape(), m_referenceBoxLogicalS ize, writingMode, margin); |
| 124 break; | 127 break; |
| 125 case ShapeValue::Image: { | 128 case ShapeValue::Image: { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 case BoxMissing: break; | 247 case BoxMissing: break; |
| 245 } | 248 } |
| 246 | 249 |
| 247 ASSERT_NOT_REACHED(); | 250 ASSERT_NOT_REACHED(); |
| 248 return LayoutUnit(); | 251 return LayoutUnit(); |
| 249 } | 252 } |
| 250 | 253 |
| 251 template class ShapeInfo<RenderBlock>; | 254 template class ShapeInfo<RenderBlock>; |
| 252 template class ShapeInfo<RenderBox>; | 255 template class ShapeInfo<RenderBox>; |
| 253 } | 256 } |
| OLD | NEW |