| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 const RoundedRect& shapeRect = style.getRoundedBorderFor(LayoutRect(Layo
utPoint(), m_referenceBoxLogicalSize), m_renderer.view()); | 136 const RoundedRect& shapeRect = style.getRoundedBorderFor(LayoutRect(Layo
utPoint(), m_referenceBoxLogicalSize), m_renderer.view()); |
| 137 m_shape = Shape::createLayoutBoxShape(shapeRect, margin); | 137 m_shape = Shape::createLayoutBoxShape(shapeRect, margin); |
| 138 break; | 138 break; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 ASSERT(m_shape); | 142 ASSERT(m_shape); |
| 143 return *m_shape; | 143 return *m_shape; |
| 144 } | 144 } |
| 145 | 145 |
| 146 inline LayoutUnit borderBeforeInWritingMode(const RenderBox& renderer) | |
| 147 { | |
| 148 // FIXME(sky): Remove | |
| 149 return renderer.borderBefore(); | |
| 150 } | |
| 151 | |
| 152 inline LayoutUnit borderAndPaddingBeforeInWritingMode(const RenderBox& renderer) | |
| 153 { | |
| 154 // FIXME(sky): Remove | |
| 155 return renderer.borderAndPaddingBefore(); | |
| 156 } | |
| 157 | |
| 158 LayoutUnit ShapeOutsideInfo::logicalTopOffset() const | 146 LayoutUnit ShapeOutsideInfo::logicalTopOffset() const |
| 159 { | 147 { |
| 160 switch (referenceBox(*m_renderer.style()->shapeOutside())) { | 148 switch (referenceBox(*m_renderer.style()->shapeOutside())) { |
| 161 case MarginBox: return -m_renderer.marginBefore(m_renderer.containingBlock()
->style()); | 149 case MarginBox: return -m_renderer.marginBefore(m_renderer.containingBlock()
->style()); |
| 162 case BorderBox: return LayoutUnit(); | 150 case BorderBox: return LayoutUnit(); |
| 163 case PaddingBox: return borderBeforeInWritingMode(m_renderer); | 151 case PaddingBox: return m_renderer.borderBefore(); |
| 164 case ContentBox: return borderAndPaddingBeforeInWritingMode(m_renderer); | 152 case ContentBox: return m_renderer.borderAndPaddingBefore(); |
| 165 case BoxMissing: break; | 153 case BoxMissing: break; |
| 166 } | 154 } |
| 167 | 155 |
| 168 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
| 169 return LayoutUnit(); | 157 return LayoutUnit(); |
| 170 } | 158 } |
| 171 | 159 |
| 172 inline LayoutUnit borderStartWithStyleForWritingMode(const RenderBox& renderer,
const RenderStyle* style) | 160 inline LayoutUnit borderStartWithStyle(const RenderBox& renderer, const RenderSt
yle* style) |
| 173 { | 161 { |
| 174 if (style->isLeftToRightDirection()) | 162 if (style->isLeftToRightDirection()) |
| 175 return renderer.borderLeft(); | 163 return renderer.borderLeft(); |
| 176 return renderer.borderRight(); | 164 return renderer.borderRight(); |
| 177 } | 165 } |
| 178 | 166 |
| 179 inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const RenderBox&
renderer, const RenderStyle* style) | 167 inline LayoutUnit borderAndPaddingStartWithStyle(const RenderBox& renderer, cons
t RenderStyle* style) |
| 180 { | 168 { |
| 181 if (style->isLeftToRightDirection()) | 169 if (style->isLeftToRightDirection()) |
| 182 return renderer.borderLeft() + renderer.paddingLeft(); | 170 return renderer.borderLeft() + renderer.paddingLeft(); |
| 183 | 171 |
| 184 return renderer.borderRight() + renderer.paddingRight(); | 172 return renderer.borderRight() + renderer.paddingRight(); |
| 185 } | 173 } |
| 186 | 174 |
| 187 LayoutUnit ShapeOutsideInfo::logicalLeftOffset() const | 175 LayoutUnit ShapeOutsideInfo::logicalLeftOffset() const |
| 188 { | 176 { |
| 189 switch (referenceBox(*m_renderer.style()->shapeOutside())) { | 177 switch (referenceBox(*m_renderer.style()->shapeOutside())) { |
| 190 case MarginBox: return -m_renderer.marginStart(m_renderer.containingBlock()-
>style()); | 178 case MarginBox: return -m_renderer.marginStart(m_renderer.containingBlock()-
>style()); |
| 191 case BorderBox: return LayoutUnit(); | 179 case BorderBox: return LayoutUnit(); |
| 192 case PaddingBox: return borderStartWithStyleForWritingMode(m_renderer, m_ren
derer.containingBlock()->style()); | 180 case PaddingBox: return borderStartWithStyle(m_renderer, m_renderer.containi
ngBlock()->style()); |
| 193 case ContentBox: return borderAndPaddingStartWithStyleForWritingMode(m_rende
rer, m_renderer.containingBlock()->style()); | 181 case ContentBox: return borderAndPaddingStartWithStyle(m_renderer, m_rendere
r.containingBlock()->style()); |
| 194 case BoxMissing: break; | 182 case BoxMissing: break; |
| 195 } | 183 } |
| 196 | 184 |
| 197 ASSERT_NOT_REACHED(); | 185 ASSERT_NOT_REACHED(); |
| 198 return LayoutUnit(); | 186 return LayoutUnit(); |
| 199 } | 187 } |
| 200 | 188 |
| 201 | 189 |
| 202 bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box) | 190 bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box) |
| 203 { | 191 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 { | 227 { |
| 240 return FloatPoint(point.x() + logicalLeftOffset(), point.y() + logicalTopOff
set()); | 228 return FloatPoint(point.x() + logicalLeftOffset(), point.y() + logicalTopOff
set()); |
| 241 } | 229 } |
| 242 | 230 |
| 243 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const | 231 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const |
| 244 { | 232 { |
| 245 return size; | 233 return size; |
| 246 } | 234 } |
| 247 | 235 |
| 248 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |