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

Side by Side Diff: Source/core/layout/LayoutBox.cpp

Issue 1162623007: Removed redundant rect methods on FrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 LayoutBlock* cb = containingBlock(); 1582 LayoutBlock* cb = containingBlock();
1583 if (cb->hasOverrideLogicalContentHeight()) 1583 if (cb->hasOverrideLogicalContentHeight())
1584 return cb->overrideLogicalContentHeight(); 1584 return cb->overrideLogicalContentHeight();
1585 1585
1586 const ComputedStyle& containingBlockStyle = cb->styleRef(); 1586 const ComputedStyle& containingBlockStyle = cb->styleRef();
1587 Length logicalHeightLength = containingBlockStyle.logicalHeight(); 1587 Length logicalHeightLength = containingBlockStyle.logicalHeight();
1588 1588
1589 // FIXME: For now just support fixed heights. Eventually should support per centage heights as well. 1589 // FIXME: For now just support fixed heights. Eventually should support per centage heights as well.
1590 if (!logicalHeightLength.isFixed()) { 1590 if (!logicalHeightLength.isFixed()) {
1591 LayoutUnit fillFallbackExtent = containingBlockStyle.isHorizontalWriting Mode() 1591 LayoutUnit fillFallbackExtent = containingBlockStyle.isHorizontalWriting Mode()
1592 ? view()->frameView()->unscaledVisibleContentSize().height() 1592 ? view()->frameView()->visibleContentSize().height()
1593 : view()->frameView()->unscaledVisibleContentSize().width(); 1593 : view()->frameView()->visibleContentSize().width();
1594 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig ht(ExcludeMarginBorderPadding); 1594 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig ht(ExcludeMarginBorderPadding);
1595 return std::min(fillAvailableExtent, fillFallbackExtent); 1595 return std::min(fillAvailableExtent, fillFallbackExtent);
1596 } 1596 }
1597 1597
1598 // Use the content box logical height as specified by the style. 1598 // Use the content box logical height as specified by the style.
1599 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val ue()); 1599 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val ue());
1600 } 1600 }
1601 1601
1602 void LayoutBox::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidatio nContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasF ixed, const PaintInvalidationState* paintInvalidationState) const 1602 void LayoutBox::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidatio nContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasF ixed, const PaintInvalidationState* paintInvalidationState) const
1603 { 1603 {
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 2730
2731 LayoutUnit LayoutBox::availableLogicalHeight(AvailableLogicalHeightType heightTy pe) const 2731 LayoutUnit LayoutBox::availableLogicalHeight(AvailableLogicalHeightType heightTy pe) const
2732 { 2732 {
2733 // http://www.w3.org/TR/CSS2/visudet.html#propdef-height - We are interested in the content height. 2733 // http://www.w3.org/TR/CSS2/visudet.html#propdef-height - We are interested in the content height.
2734 return constrainContentBoxLogicalHeightByMinMax(availableLogicalHeightUsing( style()->logicalHeight(), heightType), -1); 2734 return constrainContentBoxLogicalHeightByMinMax(availableLogicalHeightUsing( style()->logicalHeight(), heightType), -1);
2735 } 2735 }
2736 2736
2737 LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi calHeightType heightType) const 2737 LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi calHeightType heightType) const
2738 { 2738 {
2739 if (isLayoutView()) 2739 if (isLayoutView())
2740 return isHorizontalWritingMode() ? toLayoutView(this)->frameView()->unsc aledVisibleContentSize().height() : toLayoutView(this)->frameView()->unscaledVis ibleContentSize().width(); 2740 return isHorizontalWritingMode() ? toLayoutView(this)->frameView()->visi bleContentSize().height() : toLayoutView(this)->frameView()->visibleContentSize( ).width();
2741 2741
2742 // We need to stop here, since we don't want to increase the height of the t able 2742 // We need to stop here, since we don't want to increase the height of the t able
2743 // artificially. We're going to rely on this cell getting expanded to some new 2743 // artificially. We're going to rely on this cell getting expanded to some new
2744 // height, and then when we lay out again we'll use the calculation below. 2744 // height, and then when we lay out again we'll use the calculation below.
2745 if (isTableCell() && (h.isAuto() || h.hasPercent())) { 2745 if (isTableCell() && (h.isAuto() || h.hasPercent())) {
2746 if (hasOverrideLogicalContentHeight()) 2746 if (hasOverrideLogicalContentHeight())
2747 return overrideLogicalContentHeight(); 2747 return overrideLogicalContentHeight();
2748 return logicalHeight() - borderAndPaddingLogicalHeight(); 2748 return logicalHeight() - borderAndPaddingLogicalHeight();
2749 } 2749 }
2750 2750
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 2792
2793 LayoutUnit LayoutBox::containingBlockLogicalWidthForPositioned(const LayoutBoxMo delObject* containingBlock, bool checkForPerpendicularWritingMode) const 2793 LayoutUnit LayoutBox::containingBlockLogicalWidthForPositioned(const LayoutBoxMo delObject* containingBlock, bool checkForPerpendicularWritingMode) const
2794 { 2794 {
2795 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode()) 2795 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode())
2796 return containingBlockLogicalHeightForPositioned(containingBlock, false) ; 2796 return containingBlockLogicalHeightForPositioned(containingBlock, false) ;
2797 2797
2798 // Use viewport as container for top-level fixed-position elements. 2798 // Use viewport as container for top-level fixed-position elements.
2799 if (style()->position() == FixedPosition && containingBlock->isLayoutView()) { 2799 if (style()->position() == FixedPosition && containingBlock->isLayoutView()) {
2800 const LayoutView* view = toLayoutView(containingBlock); 2800 const LayoutView* view = toLayoutView(containingBlock);
2801 if (FrameView* frameView = view->frameView()) { 2801 if (FrameView* frameView = view->frameView()) {
2802 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte ntRect(); 2802 LayoutRect viewportRect = LayoutRect(frameView->visibleContentRect() );
2803 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid th() : viewportRect.height(); 2803 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid th() : viewportRect.height();
2804 } 2804 }
2805 } 2805 }
2806 2806
2807 if (hasOverrideContainingBlockLogicalWidth()) 2807 if (hasOverrideContainingBlockLogicalWidth())
2808 return overrideContainingBlockContentLogicalWidth(); 2808 return overrideContainingBlockContentLogicalWidth();
2809 2809
2810 if (containingBlock->isBox()) 2810 if (containingBlock->isBox())
2811 return toLayoutBox(containingBlock)->clientLogicalWidth(); 2811 return toLayoutBox(containingBlock)->clientLogicalWidth();
2812 2812
(...skipping 22 matching lines...) Expand all
2835 2835
2836 LayoutUnit LayoutBox::containingBlockLogicalHeightForPositioned(const LayoutBoxM odelObject* containingBlock, bool checkForPerpendicularWritingMode) const 2836 LayoutUnit LayoutBox::containingBlockLogicalHeightForPositioned(const LayoutBoxM odelObject* containingBlock, bool checkForPerpendicularWritingMode) const
2837 { 2837 {
2838 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode()) 2838 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode())
2839 return containingBlockLogicalWidthForPositioned(containingBlock, false); 2839 return containingBlockLogicalWidthForPositioned(containingBlock, false);
2840 2840
2841 // Use viewport as container for top-level fixed-position elements. 2841 // Use viewport as container for top-level fixed-position elements.
2842 if (style()->position() == FixedPosition && containingBlock->isLayoutView()) { 2842 if (style()->position() == FixedPosition && containingBlock->isLayoutView()) {
2843 const LayoutView* view = toLayoutView(containingBlock); 2843 const LayoutView* view = toLayoutView(containingBlock);
2844 if (FrameView* frameView = view->frameView()) { 2844 if (FrameView* frameView = view->frameView()) {
2845 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte ntRect(); 2845 LayoutRect viewportRect = LayoutRect(frameView->visibleContentRect() );
2846 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei ght() : viewportRect.width(); 2846 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei ght() : viewportRect.width();
2847 } 2847 }
2848 } 2848 }
2849 2849
2850 if (hasOverrideContainingBlockLogicalHeight()) 2850 if (hasOverrideContainingBlockLogicalHeight())
2851 return overrideContainingBlockContentLogicalHeight(); 2851 return overrideContainingBlockContentLogicalHeight();
2852 2852
2853 if (containingBlock->isBox()) { 2853 if (containingBlock->isBox()) {
2854 const LayoutBlock* cb = containingBlock->isLayoutBlock() ? 2854 const LayoutBlock* cb = containingBlock->isLayoutBlock() ?
2855 toLayoutBlock(containingBlock) : containingBlock->containingBlock(); 2855 toLayoutBlock(containingBlock) : containingBlock->containingBlock();
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 bool LayoutBox::canRenderBorderImage() const 4803 bool LayoutBox::canRenderBorderImage() const
4804 { 4804 {
4805 if (!style()->hasBorder()) 4805 if (!style()->hasBorder())
4806 return false; 4806 return false;
4807 4807
4808 StyleImage* borderImage = style()->borderImage().image(); 4808 StyleImage* borderImage = style()->borderImage().image();
4809 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4809 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4810 } 4810 }
4811 4811
4812 } // namespace blink 4812 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698