| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/rendering/RenderFlexibleBox.h" | 32 #include "core/rendering/RenderFlexibleBox.h" |
| 33 | 33 |
| 34 #include "core/frame/UseCounter.h" |
| 34 #include "core/rendering/FastTextAutosizer.h" | 35 #include "core/rendering/FastTextAutosizer.h" |
| 35 #include "core/rendering/RenderLayer.h" | 36 #include "core/rendering/RenderLayer.h" |
| 36 #include "core/rendering/RenderView.h" | 37 #include "core/rendering/RenderView.h" |
| 37 #include "platform/LengthFunctions.h" | 38 #include "platform/LengthFunctions.h" |
| 38 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
| 39 #include <limits> | 40 #include <limits> |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 struct RenderFlexibleBox::LineContext { | 44 struct RenderFlexibleBox::LineContext { |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 606 |
| 606 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render
Box* child, bool hasInfiniteLineLength) const | 607 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render
Box* child, bool hasInfiniteLineLength) const |
| 607 { | 608 { |
| 608 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI
nfiniteLineLength) && hasOrthogonalFlow(child); | 609 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI
nfiniteLineLength) && hasOrthogonalFlow(child); |
| 609 } | 610 } |
| 610 | 611 |
| 611 LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox*
child, bool hasInfiniteLineLength, bool relayoutChildren) | 612 LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox*
child, bool hasInfiniteLineLength, bool relayoutChildren) |
| 612 { | 613 { |
| 613 child->clearOverrideSize(); | 614 child->clearOverrideSize(); |
| 614 | 615 |
| 616 if (child->style()->hasAspectRatio() || child->isImage() || child->isVideo()
|| child->isCanvas()) |
| 617 UseCounter::count(document(), UseCounter::AspectRatioFlexItem); |
| 618 |
| 615 Length flexBasis = flexBasisForChild(child); | 619 Length flexBasis = flexBasisForChild(child); |
| 616 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength)
) { | 620 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength)
) { |
| 617 LayoutUnit mainAxisExtent; | 621 LayoutUnit mainAxisExtent; |
| 618 if (hasOrthogonalFlow(child)) { | 622 if (hasOrthogonalFlow(child)) { |
| 619 if (child->needsLayout() || relayoutChildren) { | 623 if (child->needsLayout() || relayoutChildren) { |
| 620 m_intrinsicSizeAlongMainAxis.remove(child); | 624 m_intrinsicSizeAlongMainAxis.remove(child); |
| 621 child->forceChildLayout(); | 625 child->forceChildLayout(); |
| 622 m_intrinsicSizeAlongMainAxis.set(child, child->logicalHeight()); | 626 m_intrinsicSizeAlongMainAxis.set(child, child->logicalHeight()); |
| 623 } | 627 } |
| 624 ASSERT(m_intrinsicSizeAlongMainAxis.contains(child)); | 628 ASSERT(m_intrinsicSizeAlongMainAxis.contains(child)); |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 ASSERT(child); | 1401 ASSERT(child); |
| 1398 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1402 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1399 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1403 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1400 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1404 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1401 adjustAlignmentForChild(child, newOffset - originalOffset); | 1405 adjustAlignmentForChild(child, newOffset - originalOffset); |
| 1402 } | 1406 } |
| 1403 } | 1407 } |
| 1404 } | 1408 } |
| 1405 | 1409 |
| 1406 } | 1410 } |
| OLD | NEW |