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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize); | 135 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize); |
| 136 | 136 |
| 137 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); | 137 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); |
| 138 } | 138 } |
| 139 | 139 |
| 140 const Shape& ShapeOutsideInfo::computedShape() const | 140 const Shape& ShapeOutsideInfo::computedShape() const |
| 141 { | 141 { |
| 142 if (Shape* shape = m_shape.get()) | 142 if (Shape* shape = m_shape.get()) |
| 143 return *shape; | 143 return *shape; |
| 144 | 144 |
| 145 m_computingShape = true; | |
|
Julien - ping for review
2014/10/08 18:13:27
TemporaryChange<bool> isInComputingShape(m_computi
| |
| 145 const RenderStyle& style = *m_renderer.style(); | 146 const RenderStyle& style = *m_renderer.style(); |
| 146 ASSERT(m_renderer.containingBlock()); | 147 ASSERT(m_renderer.containingBlock()); |
| 147 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); | 148 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); |
| 148 | 149 |
| 149 WritingMode writingMode = containingBlockStyle.writingMode(); | 150 WritingMode writingMode = containingBlockStyle.writingMode(); |
| 150 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit(); | 151 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit(); |
| 151 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat()); | 152 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat()); |
| 152 | 153 |
| 153 float shapeImageThreshold = style.shapeImageThreshold(); | 154 float shapeImageThreshold = style.shapeImageThreshold(); |
| 154 ASSERT(style.shapeOutside()); | 155 ASSERT(style.shapeOutside()); |
| 155 const ShapeValue& shapeValue = *style.shapeOutside(); | 156 const ShapeValue& shapeValue = *style.shapeOutside(); |
| 156 | 157 |
| 157 switch (shapeValue.type()) { | 158 switch (shapeValue.type()) { |
| 158 case ShapeValue::Shape: | 159 case ShapeValue::Shape: |
| 159 ASSERT(shapeValue.shape()); | 160 ASSERT(shapeValue.shape()); |
| 160 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin); | 161 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin); |
| 161 break; | 162 break; |
| 162 case ShapeValue::Image: | 163 case ShapeValue::Image: |
| 163 ASSERT(shapeValue.isImageValid()); | 164 ASSERT(shapeValue.isImageValid()); |
| 164 m_shape = createShapeForImage(shapeValue.image(), shapeImageThreshold, w ritingMode, margin); | 165 m_shape = createShapeForImage(shapeValue.image(), shapeImageThreshold, w ritingMode, margin); |
| 165 break; | 166 break; |
| 166 case ShapeValue::Box: { | 167 case ShapeValue::Box: { |
| 167 const RoundedRect& shapeRect = style.getRoundedBorderFor(LayoutRect(Layo utPoint(), m_referenceBoxLogicalSize), m_renderer.view()); | 168 const RoundedRect& shapeRect = style.getRoundedBorderFor(LayoutRect(Layo utPoint(), m_referenceBoxLogicalSize), m_renderer.view()); |
| 168 m_shape = Shape::createLayoutBoxShape(shapeRect, writingMode, margin); | 169 m_shape = Shape::createLayoutBoxShape(shapeRect, writingMode, margin); |
| 169 break; | 170 break; |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 | 173 |
| 174 m_computingShape = false; | |
| 173 ASSERT(m_shape); | 175 ASSERT(m_shape); |
| 174 return *m_shape; | 176 return *m_shape; |
| 175 } | 177 } |
| 176 | 178 |
| 177 inline LayoutUnit borderBeforeInWritingMode(const RenderBox& renderer, WritingMo de writingMode) | 179 inline LayoutUnit borderBeforeInWritingMode(const RenderBox& renderer, WritingMo de writingMode) |
| 178 { | 180 { |
| 179 switch (writingMode) { | 181 switch (writingMode) { |
| 180 case TopToBottomWritingMode: return renderer.borderTop(); | 182 case TopToBottomWritingMode: return renderer.borderTop(); |
| 181 case BottomToTopWritingMode: return renderer.borderBottom(); | 183 case BottomToTopWritingMode: return renderer.borderBottom(); |
| 182 case LeftToRightWritingMode: return renderer.borderLeft(); | 184 case LeftToRightWritingMode: return renderer.borderLeft(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 } | 341 } |
| 340 | 342 |
| 341 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const | 343 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const |
| 342 { | 344 { |
| 343 if (!m_renderer.style()->isHorizontalWritingMode()) | 345 if (!m_renderer.style()->isHorizontalWritingMode()) |
| 344 return size.transposedSize(); | 346 return size.transposedSize(); |
| 345 return size; | 347 return size; |
| 346 } | 348 } |
| 347 | 349 |
| 348 } // namespace blink | 350 } // namespace blink |
| OLD | NEW |