Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp

Issue 1785123003: Rework embeddedContentBox into embeddedReplacedContent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 LayoutUnit xOffset = minimumValueForLength(style()->objectPosition().x(), co ntentRect.width() - finalRect.width()); 524 LayoutUnit xOffset = minimumValueForLength(style()->objectPosition().x(), co ntentRect.width() - finalRect.width());
525 LayoutUnit yOffset = minimumValueForLength(style()->objectPosition().y(), co ntentRect.height() - finalRect.height()); 525 LayoutUnit yOffset = minimumValueForLength(style()->objectPosition().y(), co ntentRect.height() - finalRect.height());
526 finalRect.move(xOffset, yOffset); 526 finalRect.move(xOffset, yOffset);
527 527
528 return finalRect; 528 return finalRect;
529 } 529 }
530 530
531 void LayoutReplaced::computeIntrinsicSizingInfo(IntrinsicSizingInfo& intrinsicSi zingInfo) const 531 void LayoutReplaced::computeIntrinsicSizingInfo(IntrinsicSizingInfo& intrinsicSi zingInfo) const
532 { 532 {
533 // If there's an embeddedContentBox() of a remote, referenced document avail able, this code-path should never be used. 533 // If there's an embeddedReplacedContent() of a remote, referenced document available, this code-path should never be used.
534 ASSERT(!embeddedContentBox()); 534 ASSERT(!embeddedReplacedContent());
535 intrinsicSizingInfo.size = FloatSize(intrinsicLogicalWidth().toFloat(), intr insicLogicalHeight().toFloat()); 535 intrinsicSizingInfo.size = FloatSize(intrinsicLogicalWidth().toFloat(), intr insicLogicalHeight().toFloat());
536 536
537 // Figure out if we need to compute an intrinsic ratio. 537 // Figure out if we need to compute an intrinsic ratio.
538 if (intrinsicSizingInfo.size.isEmpty() || !layoutObjectHasAspectRatio(this)) 538 if (intrinsicSizingInfo.size.isEmpty() || !layoutObjectHasAspectRatio(this))
539 return; 539 return;
540 540
541 intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size; 541 intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size;
542 } 542 }
543 543
544 static inline LayoutUnit resolveWidthForRatio(LayoutUnit height, const FloatSize & aspectRatio) 544 static inline LayoutUnit resolveWidthForRatio(LayoutUnit height, const FloatSize & aspectRatio)
545 { 545 {
546 return LayoutUnit(height * aspectRatio.width() / aspectRatio.height()); 546 return LayoutUnit(height * aspectRatio.width() / aspectRatio.height());
547 } 547 }
548 548
549 static inline LayoutUnit resolveHeightForRatio(LayoutUnit width, const FloatSize & aspectRatio) 549 static inline LayoutUnit resolveHeightForRatio(LayoutUnit width, const FloatSize & aspectRatio)
550 { 550 {
551 return LayoutUnit(width * aspectRatio.height() / aspectRatio.width()); 551 return LayoutUnit(width * aspectRatio.height() / aspectRatio.width());
552 } 552 }
553 553
554 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh ouldComputePreferred) const 554 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh ouldComputePreferred) const
555 { 555 {
556 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri nsic()) 556 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri nsic())
557 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL ogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePre ferred); 557 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL ogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePre ferred);
558 558
559 LayoutBox* contentLayoutObject = embeddedContentBox(); 559 LayoutReplaced* contentLayoutObject = embeddedReplacedContent();
560 560
561 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width 561 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width
562 IntrinsicSizingInfo intrinsicSizingInfo; 562 IntrinsicSizingInfo intrinsicSizingInfo;
563 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo); 563 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo);
564 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo); 564 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo);
565 565
566 if (style()->logicalWidth().isAuto()) { 566 if (style()->logicalWidth().isAuto()) {
567 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight (); 567 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight ();
568 568
569 // If 'height' and 'width' both have computed values of 'auto' and the e lement also has an intrinsic width, then that intrinsic width is the used value of 'width'. 569 // If 'height' and 'width' both have computed values of 'auto' and the e lement also has an intrinsic width, then that intrinsic width is the used value of 'width'.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 610
611 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidt h(), shouldComputePreferred); 611 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidt h(), shouldComputePreferred);
612 } 612 }
613 613
614 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const 614 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const
615 { 615 {
616 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi sudet.html#propdef-height 616 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi sudet.html#propdef-height
617 if (hasReplacedLogicalHeight()) 617 if (hasReplacedLogicalHeight())
618 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace dLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); 618 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace dLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()));
619 619
620 LayoutBox* contentLayoutObject = embeddedContentBox(); 620 LayoutReplaced* contentLayoutObject = embeddedReplacedContent();
621 621
622 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height 622 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height
623 IntrinsicSizingInfo intrinsicSizingInfo; 623 IntrinsicSizingInfo intrinsicSizingInfo;
624 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo); 624 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo);
625 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo); 625 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo);
626 626
627 bool widthIsAuto = style()->logicalWidth().isAuto(); 627 bool widthIsAuto = style()->logicalWidth().isAuto();
628 628
629 // If 'height' and 'width' both have computed values of 'auto' and the eleme nt also has an intrinsic height, then that intrinsic height is the used value of 'height'. 629 // If 'height' and 'width' both have computed values of 'auto' and the eleme nt also has an intrinsic height, then that intrinsic height is the used value of 'height'.
630 if (widthIsAuto && intrinsicSizingInfo.hasHeight) 630 if (widthIsAuto && intrinsicSizingInfo.hasHeight)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 // We only include the space below the baseline in our layer's cached paint invalidation rect if the 752 // We only include the space below the baseline in our layer's cached paint invalidation rect if the
753 // image is selected. Since the selection state has changed update the rect. 753 // image is selected. Since the selection state has changed update the rect.
754 if (hasLayer()) 754 if (hasLayer())
755 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); 755 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation()));
756 756
757 if (canUpdateSelectionOnRootLineBoxes()) 757 if (canUpdateSelectionOnRootLineBoxes())
758 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); 758 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone );
759 } 759 }
760 760
761 } // namespace blink 761 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutReplaced.h ('k') | third_party/WebKit/Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698