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

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

Issue 2241663002: Take CSS Clip and contain: paint into account when computing visual rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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 * (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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 ASSERT(hasOverflowClip()); 1001 ASSERT(hasOverflowClip());
1002 ASSERT(hasLayer()); 1002 ASSERT(hasLayer());
1003 // FIXME: Return DoubleSize here. crbug.com/414283. 1003 // FIXME: Return DoubleSize here. crbug.com/414283.
1004 PaintLayerScrollableArea* scrollableArea = getScrollableArea(); 1004 PaintLayerScrollableArea* scrollableArea = getScrollableArea();
1005 IntSize result = flooredIntSize(scrollableArea->scrollOffset()) + originAdju stmentForScrollbars(); 1005 IntSize result = flooredIntSize(scrollableArea->scrollOffset()) + originAdju stmentForScrollbars();
1006 if (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLogical Left()) 1006 if (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLogical Left())
1007 result.expand(-verticalScrollbarWidth(), 0); 1007 result.expand(-verticalScrollbarWidth(), 0);
1008 return result; 1008 return result;
1009 } 1009 }
1010 1010
1011
1012 LayoutRect LayoutBox::clippingRect() const
1013 {
1014 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
1015 if (hasOverflowClip() || style()->containsPaint())
1016 result = overflowClipRect(LayoutPoint());
1017
1018 if (hasClip())
1019 result.intersect(clipRect(LayoutPoint()));
1020
1021 return result;
1022 }
1023
1011 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const 1024 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const
1012 { 1025 {
1013 if (!hasOverflowClip()) 1026 if (!hasClipRelatedProperty())
1014 return true; 1027 return true;
1015 1028
1016 if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow()) { 1029 if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow())
1017 return true; 1030 return true;
1031
1032 if (hasOverflowClip()) {
1033 LayoutSize offset = LayoutSize(-scrolledContentOffset());
1034 rect.move(offset);
1018 } 1035 }
1019 1036
1020 LayoutSize offset = LayoutSize(-scrolledContentOffset()); 1037 LayoutRect clipRect = clippingRect();
1021 rect.move(offset);
1022
1023 LayoutRect clipRect = overflowClipRect(LayoutPoint());
1024 1038
1025 bool doesIntersect; 1039 bool doesIntersect;
1026 if (visualRectFlags & EdgeInclusive) { 1040 if (visualRectFlags & EdgeInclusive) {
1027 doesIntersect = rect.inclusiveIntersect(clipRect); 1041 doesIntersect = rect.inclusiveIntersect(clipRect);
1028 } else { 1042 } else {
1029 rect.intersect(clipRect); 1043 rect.intersect(clipRect);
1030 doesIntersect = !rect.isEmpty(); 1044 doesIntersect = !rect.isEmpty();
1031 } 1045 }
1046
1032 return doesIntersect; 1047 return doesIntersect;
1033 } 1048 }
1034 1049
1035 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const 1050 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const
1036 { 1051 {
1037 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 1052 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
1038 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 1053 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
1039 } 1054 }
1040 1055
1041 LayoutUnit LayoutBox::minPreferredLogicalWidth() const 1056 LayoutUnit LayoutBox::minPreferredLogicalWidth() const
(...skipping 3949 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 m_rareData->m_snapAreas->remove(&snapArea); 5006 m_rareData->m_snapAreas->remove(&snapArea);
4992 } 5007 }
4993 } 5008 }
4994 5009
4995 SnapAreaSet* LayoutBox::snapAreas() const 5010 SnapAreaSet* LayoutBox::snapAreas() const
4996 { 5011 {
4997 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 5012 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4998 } 5013 }
4999 5014
5000 } // namespace blink 5015 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698