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

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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 ASSERT(hasOverflowClip()); 1004 ASSERT(hasOverflowClip());
1005 ASSERT(hasLayer()); 1005 ASSERT(hasLayer());
1006 // FIXME: Return DoubleSize here. crbug.com/414283. 1006 // FIXME: Return DoubleSize here. crbug.com/414283.
1007 PaintLayerScrollableArea* scrollableArea = getScrollableArea(); 1007 PaintLayerScrollableArea* scrollableArea = getScrollableArea();
1008 IntSize result = flooredIntSize(scrollableArea->scrollOffset()) + originAdju stmentForScrollbars(); 1008 IntSize result = flooredIntSize(scrollableArea->scrollOffset()) + originAdju stmentForScrollbars();
1009 if (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLogical Left()) 1009 if (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLogical Left())
1010 result.expand(-verticalScrollbarWidth(), 0); 1010 result.expand(-verticalScrollbarWidth(), 0);
1011 return result; 1011 return result;
1012 } 1012 }
1013 1013
1014
1015 LayoutRect LayoutBox::clippingRect() const
1016 {
1017 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
1018 if (hasOverflowClip() || style()->containsPaint())
1019 result = overflowClipRect(LayoutPoint());
1020
1021 if (hasClip())
1022 result.intersect(clipRect(LayoutPoint()));
1023
1024 return result;
1025 }
1026
1014 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const 1027 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const
1015 { 1028 {
1016 if (!hasOverflowClip()) 1029 if (!hasClipRelatedProperty())
1017 return true; 1030 return true;
1018 1031
1019 if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow()) { 1032 if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow())
1020 return true; 1033 return true;
1034
1035 if (hasOverflowClip()) {
1036 LayoutSize offset = LayoutSize(-scrolledContentOffset());
1037 rect.move(offset);
1021 } 1038 }
1022 1039
1023 LayoutSize offset = LayoutSize(-scrolledContentOffset()); 1040 // This won't work fully correctly for fixed-position elements, who should r eceive CSS clip but for whom the current object
1024 rect.move(offset); 1041 // is not in the containing block chain.
1025 1042 LayoutRect clipRect = clippingRect();
1026 LayoutRect clipRect = overflowClipRect(LayoutPoint());
1027 1043
1028 bool doesIntersect; 1044 bool doesIntersect;
1029 if (visualRectFlags & EdgeInclusive) { 1045 if (visualRectFlags & EdgeInclusive) {
1030 doesIntersect = rect.inclusiveIntersect(clipRect); 1046 doesIntersect = rect.inclusiveIntersect(clipRect);
1031 } else { 1047 } else {
1032 rect.intersect(clipRect); 1048 rect.intersect(clipRect);
1033 doesIntersect = !rect.isEmpty(); 1049 doesIntersect = !rect.isEmpty();
1034 } 1050 }
1051
1035 return doesIntersect; 1052 return doesIntersect;
1036 } 1053 }
1037 1054
1038 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const 1055 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const
1039 { 1056 {
1040 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 1057 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
1041 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 1058 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
1042 } 1059 }
1043 1060
1044 LayoutUnit LayoutBox::minPreferredLogicalWidth() const 1061 LayoutUnit LayoutBox::minPreferredLogicalWidth() const
(...skipping 3723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4768 m_rareData->m_snapAreas->remove(&snapArea); 4785 m_rareData->m_snapAreas->remove(&snapArea);
4769 } 4786 }
4770 } 4787 }
4771 4788
4772 SnapAreaSet* LayoutBox::snapAreas() const 4789 SnapAreaSet* LayoutBox::snapAreas() const
4773 { 4790 {
4774 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4791 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4775 } 4792 }
4776 4793
4777 } // namespace blink 4794 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698