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

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

Issue 2634493007: Introduce LayoutObject::AncestorSkipInfo. (Closed)
Patch Set: Turn AncestorSkipInfo into a proper class with private data members. Only look for filters when tol… Created 3 years, 11 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 | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 2321
2322 bool LayoutBox::mapToVisualRectInAncestorSpace( 2322 bool LayoutBox::mapToVisualRectInAncestorSpace(
2323 const LayoutBoxModelObject* ancestor, 2323 const LayoutBoxModelObject* ancestor,
2324 LayoutRect& rect, 2324 LayoutRect& rect,
2325 VisualRectFlags visualRectFlags) const { 2325 VisualRectFlags visualRectFlags) const {
2326 inflateVisualRectForFilter(rect); 2326 inflateVisualRectForFilter(rect);
2327 2327
2328 if (ancestor == this) 2328 if (ancestor == this)
2329 return true; 2329 return true;
2330 2330
2331 bool ancestorSkipped; 2331 AncestorSkipInfo skipInfo(ancestor, true);
2332 bool filterSkipped; 2332 LayoutObject* container = this->container(&skipInfo);
2333 LayoutObject* container =
2334 this->container(ancestor, &ancestorSkipped, &filterSkipped);
2335 LayoutBox* tableRowContainer = nullptr; 2333 LayoutBox* tableRowContainer = nullptr;
2336 // Skip table row because cells and rows are in the same coordinate space (see 2334 // Skip table row because cells and rows are in the same coordinate space (see
2337 // below, however for more comments about when |ancestor| is the table row). 2335 // below, however for more comments about when |ancestor| is the table row).
2338 if (isTableCell()) { 2336 if (isTableCell()) {
2339 DCHECK(container->isTableRow() && parentBox() == container); 2337 DCHECK(container->isTableRow() && parentBox() == container);
2340 if (container != ancestor) 2338 if (container != ancestor)
2341 container = container->parent(); 2339 container = container->parent();
2342 else 2340 else
2343 tableRowContainer = toLayoutBox(container); 2341 tableRowContainer = toLayoutBox(container);
2344 } 2342 }
2345 if (!container) 2343 if (!container)
2346 return true; 2344 return true;
2347 2345
2348 if (filterSkipped) 2346 if (skipInfo.filterSkipped())
2349 inflateVisualRectForFilterUnderContainer(rect, *container, ancestor); 2347 inflateVisualRectForFilterUnderContainer(rect, *container, ancestor);
2350 2348
2351 // We are now in our parent container's coordinate space. Apply our transform 2349 // We are now in our parent container's coordinate space. Apply our transform
2352 // to obtain a bounding box in the parent's coordinate space that encloses us. 2350 // to obtain a bounding box in the parent's coordinate space that encloses us.
2353 if (hasLayer() && layer()->transform()) { 2351 if (hasLayer() && layer()->transform()) {
2354 // Use enclosingIntRect because we cannot properly compute pixel snapping 2352 // Use enclosingIntRect because we cannot properly compute pixel snapping
2355 // for painted elements within the transform since we don't know the desired 2353 // for painted elements within the transform since we don't know the desired
2356 // subpixel accumulation at this point, and the transform may include a 2354 // subpixel accumulation at this point, and the transform may include a
2357 // scale. 2355 // scale.
2358 rect = LayoutRect(layer()->transform()->mapRect(enclosingIntRect(rect))); 2356 rect = LayoutRect(layer()->transform()->mapRect(enclosingIntRect(rect)));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 // FIXME: We ignore the lightweight clipping rect that controls use, since if 2392 // FIXME: We ignore the lightweight clipping rect that controls use, since if
2395 // |o| is in mid-layout, its controlClipRect will be wrong. For overflow clip 2393 // |o| is in mid-layout, its controlClipRect will be wrong. For overflow clip
2396 // we use the values cached by the layer. 2394 // we use the values cached by the layer.
2397 rect.setLocation(topLeft); 2395 rect.setLocation(topLeft);
2398 2396
2399 if (container->isBox() && container != ancestor && 2397 if (container->isBox() && container != ancestor &&
2400 !toLayoutBox(container)->mapScrollingContentsRectToBoxSpace( 2398 !toLayoutBox(container)->mapScrollingContentsRectToBoxSpace(
2401 rect, visualRectFlags)) 2399 rect, visualRectFlags))
2402 return false; 2400 return false;
2403 2401
2404 if (ancestorSkipped) { 2402 if (skipInfo.ancestorSkipped()) {
2405 // If the ancestor is below the container, then we need to map the rect into 2403 // If the ancestor is below the container, then we need to map the rect into
2406 // ancestor's coordinates. 2404 // ancestor's coordinates.
2407 LayoutSize containerOffset = 2405 LayoutSize containerOffset =
2408 ancestor->offsetFromAncestorContainer(container); 2406 ancestor->offsetFromAncestorContainer(container);
2409 rect.move(-containerOffset); 2407 rect.move(-containerOffset);
2410 // If the ancestor is fixed, then the rect is already in its coordinates so 2408 // If the ancestor is fixed, then the rect is already in its coordinates so
2411 // doesn't need viewport-adjusting. 2409 // doesn't need viewport-adjusting.
2412 if (ancestor->style()->position() != FixedPosition && 2410 if (ancestor->style()->position() != FixedPosition &&
2413 container->isLayoutView() && position == FixedPosition) 2411 container->isLayoutView() && position == FixedPosition)
2414 rect.move(toLayoutView(container)->offsetForFixedPosition(true)); 2412 rect.move(toLayoutView(container)->offsetForFixedPosition(true));
(...skipping 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after
5689 block->adjustChildDebugRect(rect); 5687 block->adjustChildDebugRect(rect);
5690 5688
5691 return rect; 5689 return rect;
5692 } 5690 }
5693 5691
5694 bool LayoutBox::shouldClipOverflow() const { 5692 bool LayoutBox::shouldClipOverflow() const {
5695 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5693 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5696 } 5694 }
5697 5695
5698 } // namespace blink 5696 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698