| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 LayoutUnit startPosition = borderStart() + paddingStart(); | 130 LayoutUnit startPosition = borderStart() + paddingStart(); |
| 131 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 131 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 132 startPosition -= verticalScrollbarWidth(); | 132 startPosition -= verticalScrollbarWidth(); |
| 133 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); | 133 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); |
| 134 | 134 |
| 135 LayoutUnit childMarginStart = marginStartForChild(child); | 135 LayoutUnit childMarginStart = marginStartForChild(child); |
| 136 LayoutUnit newPosition = startPosition + childMarginStart; | 136 LayoutUnit newPosition = startPosition + childMarginStart; |
| 137 | 137 |
| 138 // If the child has an offset from the content edge to avoid floats then use
that, otherwise let any negative | 138 // If the child has an offset from the content edge to avoid floats then use
that, otherwise let any negative |
| 139 // margin pull it back over the content edge or any positive margin push it
out. | 139 // margin pull it back over the content edge or any positive margin push it
out. |
| 140 // If the child is being centred then the margin calculated to do that has f
actored in any offset required to | 140 if (child->style()->marginStartUsing(style()).isAuto()) |
| 141 // avoid floats, so use it if necessary. | |
| 142 if (style()->textAlign() == WEBKIT_CENTER || child->style()->marginStartUsin
g(style()).isAuto()) | |
| 143 newPosition = std::max(newPosition, childMarginStart); | 141 newPosition = std::max(newPosition, childMarginStart); |
| 144 | 142 |
| 145 child->setX(style()->isLeftToRightDirection() ? newPosition : totalAvailable
LogicalWidth - newPosition - logicalWidthForChild(child)); | 143 child->setX(style()->isLeftToRightDirection() ? newPosition : totalAvailable
LogicalWidth - newPosition - logicalWidthForChild(child)); |
| 146 } | 144 } |
| 147 | 145 |
| 148 void RenderBlockFlow::layoutBlockChild(RenderBox* child) | 146 void RenderBlockFlow::layoutBlockChild(RenderBox* child) |
| 149 { | 147 { |
| 150 child->computeAndSetBlockDirectionMargins(this); | 148 child->computeAndSetBlockDirectionMargins(this); |
| 151 LayoutUnit marginBefore = marginBeforeForChild(child); | 149 LayoutUnit marginBefore = marginBeforeForChild(child); |
| 152 child->setY(logicalHeight() + marginBefore); | 150 child->setY(logicalHeight() + marginBefore); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 349 } |
| 352 return logicalRight; | 350 return logicalRight; |
| 353 } | 351 } |
| 354 | 352 |
| 355 RootInlineBox* RenderBlockFlow::createRootInlineBox() | 353 RootInlineBox* RenderBlockFlow::createRootInlineBox() |
| 356 { | 354 { |
| 357 return new RootInlineBox(*this); | 355 return new RootInlineBox(*this); |
| 358 } | 356 } |
| 359 | 357 |
| 360 } // namespace blink | 358 } // namespace blink |
| OLD | NEW |