| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 break; | 73 break; |
| 74 case ContentBox: | 74 case ContentBox: |
| 75 if (isHorizontalWritingMode) | 75 if (isHorizontalWritingMode) |
| 76 newReferenceBoxLogicalSize.shrink(m_layoutBox.borderAndPaddingWidth(), | 76 newReferenceBoxLogicalSize.shrink(m_layoutBox.borderAndPaddingWidth(), |
| 77 m_layoutBox.borderAndPaddingHeight()); | 77 m_layoutBox.borderAndPaddingHeight()); |
| 78 else | 78 else |
| 79 newReferenceBoxLogicalSize.shrink(m_layoutBox.borderAndPaddingHeight(), | 79 newReferenceBoxLogicalSize.shrink(m_layoutBox.borderAndPaddingHeight(), |
| 80 m_layoutBox.borderAndPaddingWidth()); | 80 m_layoutBox.borderAndPaddingWidth()); |
| 81 break; | 81 break; |
| 82 case BoxMissing: | 82 case BoxMissing: |
| 83 ASSERT_NOT_REACHED(); | 83 NOTREACHED(); |
| 84 break; | 84 break; |
| 85 } | 85 } |
| 86 | 86 |
| 87 newReferenceBoxLogicalSize.clampNegativeToZero(); | 87 newReferenceBoxLogicalSize.clampNegativeToZero(); |
| 88 | 88 |
| 89 if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize) | 89 if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize) |
| 90 return; | 90 return; |
| 91 markShapeAsDirty(); | 91 markShapeAsDirty(); |
| 92 m_referenceBoxLogicalSize = newReferenceBoxLogicalSize; | 92 m_referenceBoxLogicalSize = newReferenceBoxLogicalSize; |
| 93 } | 93 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 WritingMode writingMode) { | 227 WritingMode writingMode) { |
| 228 switch (writingMode) { | 228 switch (writingMode) { |
| 229 case WritingMode::kHorizontalTb: | 229 case WritingMode::kHorizontalTb: |
| 230 return LayoutUnit(layoutBox.borderTop()); | 230 return LayoutUnit(layoutBox.borderTop()); |
| 231 case WritingMode::kVerticalLr: | 231 case WritingMode::kVerticalLr: |
| 232 return LayoutUnit(layoutBox.borderLeft()); | 232 return LayoutUnit(layoutBox.borderLeft()); |
| 233 case WritingMode::kVerticalRl: | 233 case WritingMode::kVerticalRl: |
| 234 return LayoutUnit(layoutBox.borderRight()); | 234 return LayoutUnit(layoutBox.borderRight()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 ASSERT_NOT_REACHED(); | 237 NOTREACHED(); |
| 238 return LayoutUnit(layoutBox.borderBefore()); | 238 return LayoutUnit(layoutBox.borderBefore()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 inline LayoutUnit borderAndPaddingBeforeInWritingMode( | 241 inline LayoutUnit borderAndPaddingBeforeInWritingMode( |
| 242 const LayoutBox& layoutBox, | 242 const LayoutBox& layoutBox, |
| 243 WritingMode writingMode) { | 243 WritingMode writingMode) { |
| 244 switch (writingMode) { | 244 switch (writingMode) { |
| 245 case WritingMode::kHorizontalTb: | 245 case WritingMode::kHorizontalTb: |
| 246 return layoutBox.borderTop() + layoutBox.paddingTop(); | 246 return layoutBox.borderTop() + layoutBox.paddingTop(); |
| 247 case WritingMode::kVerticalLr: | 247 case WritingMode::kVerticalLr: |
| 248 return layoutBox.borderLeft() + layoutBox.paddingLeft(); | 248 return layoutBox.borderLeft() + layoutBox.paddingLeft(); |
| 249 case WritingMode::kVerticalRl: | 249 case WritingMode::kVerticalRl: |
| 250 return layoutBox.borderRight() + layoutBox.paddingRight(); | 250 return layoutBox.borderRight() + layoutBox.paddingRight(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 ASSERT_NOT_REACHED(); | 253 NOTREACHED(); |
| 254 return layoutBox.borderAndPaddingBefore(); | 254 return layoutBox.borderAndPaddingBefore(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 LayoutUnit ShapeOutsideInfo::logicalTopOffset() const { | 257 LayoutUnit ShapeOutsideInfo::logicalTopOffset() const { |
| 258 switch (referenceBox(*m_layoutBox.style()->shapeOutside())) { | 258 switch (referenceBox(*m_layoutBox.style()->shapeOutside())) { |
| 259 case MarginBox: | 259 case MarginBox: |
| 260 return -m_layoutBox.marginBefore(m_layoutBox.containingBlock()->style()); | 260 return -m_layoutBox.marginBefore(m_layoutBox.containingBlock()->style()); |
| 261 case BorderBox: | 261 case BorderBox: |
| 262 return LayoutUnit(); | 262 return LayoutUnit(); |
| 263 case PaddingBox: | 263 case PaddingBox: |
| 264 return borderBeforeInWritingMode( | 264 return borderBeforeInWritingMode( |
| 265 m_layoutBox, | 265 m_layoutBox, |
| 266 m_layoutBox.containingBlock()->style()->getWritingMode()); | 266 m_layoutBox.containingBlock()->style()->getWritingMode()); |
| 267 case ContentBox: | 267 case ContentBox: |
| 268 return borderAndPaddingBeforeInWritingMode( | 268 return borderAndPaddingBeforeInWritingMode( |
| 269 m_layoutBox, | 269 m_layoutBox, |
| 270 m_layoutBox.containingBlock()->style()->getWritingMode()); | 270 m_layoutBox.containingBlock()->style()->getWritingMode()); |
| 271 case BoxMissing: | 271 case BoxMissing: |
| 272 break; | 272 break; |
| 273 } | 273 } |
| 274 | 274 |
| 275 ASSERT_NOT_REACHED(); | 275 NOTREACHED(); |
| 276 return LayoutUnit(); | 276 return LayoutUnit(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 inline LayoutUnit borderStartWithStyleForWritingMode( | 279 inline LayoutUnit borderStartWithStyleForWritingMode( |
| 280 const LayoutBox& layoutBox, | 280 const LayoutBox& layoutBox, |
| 281 const ComputedStyle* style) { | 281 const ComputedStyle* style) { |
| 282 if (style->isHorizontalWritingMode()) { | 282 if (style->isHorizontalWritingMode()) { |
| 283 if (style->isLeftToRightDirection()) | 283 if (style->isLeftToRightDirection()) |
| 284 return LayoutUnit(layoutBox.borderLeft()); | 284 return LayoutUnit(layoutBox.borderLeft()); |
| 285 | 285 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 315 case PaddingBox: | 315 case PaddingBox: |
| 316 return borderStartWithStyleForWritingMode( | 316 return borderStartWithStyleForWritingMode( |
| 317 m_layoutBox, m_layoutBox.containingBlock()->style()); | 317 m_layoutBox, m_layoutBox.containingBlock()->style()); |
| 318 case ContentBox: | 318 case ContentBox: |
| 319 return borderAndPaddingStartWithStyleForWritingMode( | 319 return borderAndPaddingStartWithStyleForWritingMode( |
| 320 m_layoutBox, m_layoutBox.containingBlock()->style()); | 320 m_layoutBox, m_layoutBox.containingBlock()->style()); |
| 321 case BoxMissing: | 321 case BoxMissing: |
| 322 break; | 322 break; |
| 323 } | 323 } |
| 324 | 324 |
| 325 ASSERT_NOT_REACHED(); | 325 NOTREACHED(); |
| 326 return LayoutUnit(); | 326 return LayoutUnit(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool ShapeOutsideInfo::isEnabledFor(const LayoutBox& box) { | 329 bool ShapeOutsideInfo::isEnabledFor(const LayoutBox& box) { |
| 330 ShapeValue* shapeValue = box.style()->shapeOutside(); | 330 ShapeValue* shapeValue = box.style()->shapeOutside(); |
| 331 if (!box.isFloating() || !shapeValue) | 331 if (!box.isFloating() || !shapeValue) |
| 332 return false; | 332 return false; |
| 333 | 333 |
| 334 switch (shapeValue->type()) { | 334 switch (shapeValue->type()) { |
| 335 case ShapeValue::Shape: | 335 case ShapeValue::Shape: |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 return result; | 434 return result; |
| 435 } | 435 } |
| 436 | 436 |
| 437 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const { | 437 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const { |
| 438 if (!m_layoutBox.style()->isHorizontalWritingMode()) | 438 if (!m_layoutBox.style()->isHorizontalWritingMode()) |
| 439 return size.transposedSize(); | 439 return size.transposedSize(); |
| 440 return size; | 440 return size; |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace blink | 443 } // namespace blink |
| OLD | NEW |