OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 LayoutUnit difference = | 294 LayoutUnit difference = |
295 availableSpace - (logicalLeftValue + logicalRightValue); | 295 availableSpace - (logicalLeftValue + logicalRightValue); |
296 if (difference > LayoutUnit()) { | 296 if (difference > LayoutUnit()) { |
297 marginLogicalLeftAlias = difference / 2; // split the difference | 297 marginLogicalLeftAlias = difference / 2; // split the difference |
298 marginLogicalRightAlias = | 298 marginLogicalRightAlias = |
299 difference - | 299 difference - |
300 marginLogicalLeftAlias; // account for odd valued differences | 300 marginLogicalLeftAlias; // account for odd valued differences |
301 } else { | 301 } else { |
302 // Use the containing block's direction rather than the parent block's | 302 // Use the containing block's direction rather than the parent block's |
303 // per CSS 2.1 reference test abspos-replaced-width-margin-000. | 303 // per CSS 2.1 reference test abspos-replaced-width-margin-000. |
304 if (containerDirection == TextDirection::Ltr) { | 304 if (containerDirection == TextDirection::kLtr) { |
305 marginLogicalLeftAlias = LayoutUnit(); | 305 marginLogicalLeftAlias = LayoutUnit(); |
306 marginLogicalRightAlias = difference; // will be negative | 306 marginLogicalRightAlias = difference; // will be negative |
307 } else { | 307 } else { |
308 marginLogicalLeftAlias = difference; // will be negative | 308 marginLogicalLeftAlias = difference; // will be negative |
309 marginLogicalRightAlias = LayoutUnit(); | 309 marginLogicalRightAlias = LayoutUnit(); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 // ------------------------------------------------------------------------- | 313 // ------------------------------------------------------------------------- |
314 // 5. If at this point there is an 'auto' left, solve the equation for that | 314 // 5. If at this point there is an 'auto' left, solve the equation for that |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } else { | 359 } else { |
360 // Nothing is 'auto', just calculate the values. | 360 // Nothing is 'auto', just calculate the values. |
361 marginLogicalLeftAlias = | 361 marginLogicalLeftAlias = |
362 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); | 362 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); |
363 marginLogicalRightAlias = | 363 marginLogicalRightAlias = |
364 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); | 364 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); |
365 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); | 365 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
366 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); | 366 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
367 // If the containing block is right-to-left, then push the left position as | 367 // If the containing block is right-to-left, then push the left position as |
368 // far to the right as possible | 368 // far to the right as possible |
369 if (containerDirection == TextDirection::Rtl) { | 369 if (containerDirection == TextDirection::kRtl) { |
370 int totalLogicalWidth = | 370 int totalLogicalWidth = |
371 (computedValues.m_extent + logicalLeftValue + logicalRightValue + | 371 (computedValues.m_extent + logicalLeftValue + logicalRightValue + |
372 marginLogicalLeftAlias + marginLogicalRightAlias) | 372 marginLogicalLeftAlias + marginLogicalRightAlias) |
373 .toInt(); | 373 .toInt(); |
374 logicalLeftValue = | 374 logicalLeftValue = |
375 containerLogicalWidth - (totalLogicalWidth - logicalLeftValue); | 375 containerLogicalWidth - (totalLogicalWidth - logicalLeftValue); |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 // --------------------------------------------------------------------------- | 379 // --------------------------------------------------------------------------- |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); | 938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); |
939 } | 939 } |
940 | 940 |
941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { | 941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { |
942 size = size.transposedSize(); | 942 size = size.transposedSize(); |
943 aspectRatio = aspectRatio.transposedSize(); | 943 aspectRatio = aspectRatio.transposedSize(); |
944 std::swap(hasWidth, hasHeight); | 944 std::swap(hasWidth, hasHeight); |
945 } | 945 } |
946 | 946 |
947 } // namespace blink | 947 } // namespace blink |
OLD | NEW |