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

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

Issue 2157243002: Add in row offset if self-composited. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/paint/invalidation/invalidate-cell-in-row-with-offset-expected.txt ('k') | no next file » | 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 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const 2036 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const
2037 { 2037 {
2038 inflateVisualRectForReflectionAndFilter(rect); 2038 inflateVisualRectForReflectionAndFilter(rect);
2039 2039
2040 if (ancestor == this) 2040 if (ancestor == this)
2041 return true; 2041 return true;
2042 2042
2043 bool ancestorSkipped; 2043 bool ancestorSkipped;
2044 bool filterOrReflectionSkipped; 2044 bool filterOrReflectionSkipped;
2045 LayoutObject* container = this->container(ancestor, &ancestorSkipped, &filte rOrReflectionSkipped); 2045 LayoutObject* container = this->container(ancestor, &ancestorSkipped, &filte rOrReflectionSkipped);
2046 // Skip table row because cells and rows are in the same coordinate space, e xcept when we're already at the ancestor. 2046 LayoutBox* tableRowContainer = nullptr;
2047 if (container->isTableRow() && container != ancestor) { 2047 // Skip table row because cells and rows are in the same coordinate space
2048 DCHECK(isTableCell()); 2048 // (see below, however for more comments about when |ancestor| is the table row).
2049 container = container->parent(); 2049 if (container->isTableRow()) {
2050 DCHECK(isTableCell() && parentBox() == container);
2051 if (container != ancestor)
2052 container = container->parent();
2053 else
2054 tableRowContainer = toLayoutBox(container);
2050 } 2055 }
2051 if (!container) 2056 if (!container)
2052 return true; 2057 return true;
2053 2058
2054 if (filterOrReflectionSkipped) 2059 if (filterOrReflectionSkipped)
2055 inflateVisualRectForReflectionAndFilterUnderContainer(rect, *container, ancestor); 2060 inflateVisualRectForReflectionAndFilterUnderContainer(rect, *container, ancestor);
2056 2061
2057 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box 2062 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box
2058 // in the parent's coordinate space that encloses us. 2063 // in the parent's coordinate space that encloses us.
2059 if (hasLayer() && layer()->transform()) { 2064 if (hasLayer() && layer()->transform()) {
2060 // Use enclosingIntRect because we cannot properly compute pixel snappin g for painted elements within 2065 // Use enclosingIntRect because we cannot properly compute pixel snappin g for painted elements within
2061 // the transform since we don't know the desired subpixel accumulation a t this point, and the transform may 2066 // the transform since we don't know the desired subpixel accumulation a t this point, and the transform may
2062 // include a scale. 2067 // include a scale.
2063 rect = LayoutRect(layer()->transform()->mapRect(enclosingIntRect(rect))) ; 2068 rect = LayoutRect(layer()->transform()->mapRect(enclosingIntRect(rect))) ;
2064 } 2069 }
2065 LayoutPoint topLeft = rect.location(); 2070 LayoutPoint topLeft = rect.location();
2066 // TODO(wkorman): Look into and document why this conditional is needed. 2071 if (container->isBox()) {
2067 // Currently present following logic in PaintLayer::updateLayerPosition.
2068 if (container->isBox())
2069 topLeft.moveBy(topLeftLocation(toLayoutBox(container))); 2072 topLeft.moveBy(topLeftLocation(toLayoutBox(container)));
2070 else 2073 // If the row is the ancestor, however, add its offset back in. In effec t, this passes from the joint <td> / <tr>
2071 topLeft.move(locationOffset()); 2074 // coordinate space to the parent space, then back to <tr> / <td>.
2075 if (tableRowContainer)
2076 topLeft.moveBy(-tableRowContainer->topLeftLocation(toLayoutBox(conta iner)));
2077 } else {
2078 topLeft.moveBy(location());
2079 }
2072 2080
2073 const ComputedStyle& styleToUse = styleRef(); 2081 const ComputedStyle& styleToUse = styleRef();
2074 EPosition position = styleToUse.position(); 2082 EPosition position = styleToUse.position();
2075 if (position == AbsolutePosition && container->isInFlowPositioned() && conta iner->isLayoutInline()) { 2083 if (position == AbsolutePosition && container->isInFlowPositioned() && conta iner->isLayoutInline()) {
2076 topLeft += toLayoutInline(container)->offsetForInFlowPositionedInline(*t his); 2084 topLeft += toLayoutInline(container)->offsetForInFlowPositionedInline(*t his);
2077 } else if (styleToUse.hasInFlowPosition() && layer()) { 2085 } else if (styleToUse.hasInFlowPosition() && layer()) {
2078 // Apply the relative position offset when invalidating a rectangle. Th e layer 2086 // Apply the relative position offset when invalidating a rectangle. Th e layer
2079 // is translated, but the layout box isn't, so we need to do this to get the 2087 // is translated, but the layout box isn't, so we need to do this to get the
2080 // right dirty rect. Since this is called from LayoutObject::setStyle, the relative position 2088 // right dirty rect. Since this is called from LayoutObject::setStyle, the relative position
2081 // flag on the LayoutObject has been cleared, so use the one on the styl e(). 2089 // flag on the LayoutObject has been cleared, so use the one on the styl e().
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after
4926 m_rareData->m_snapAreas->remove(&snapArea); 4934 m_rareData->m_snapAreas->remove(&snapArea);
4927 } 4935 }
4928 } 4936 }
4929 4937
4930 SnapAreaSet* LayoutBox::snapAreas() const 4938 SnapAreaSet* LayoutBox::snapAreas() const
4931 { 4939 {
4932 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4940 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4933 } 4941 }
4934 4942
4935 } // namespace blink 4943 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/invalidate-cell-in-row-with-offset-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698