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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 346603007: Remove position: sticky (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 mode |= IsFixed; 1865 mode |= IsFixed;
1866 1866
1867 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); 1867 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState);
1868 } 1868 }
1869 1869
1870 LayoutSize RenderBox::offsetFromContainer(const RenderObject* o, const LayoutPoi nt& point, bool* offsetDependsOnPoint) const 1870 LayoutSize RenderBox::offsetFromContainer(const RenderObject* o, const LayoutPoi nt& point, bool* offsetDependsOnPoint) const
1871 { 1871 {
1872 ASSERT(o == container()); 1872 ASSERT(o == container());
1873 1873
1874 LayoutSize offset; 1874 LayoutSize offset;
1875 if (isInFlowPositioned()) 1875 if (isRelPositioned())
1876 offset += offsetForInFlowPosition(); 1876 offset += offsetForInFlowPosition();
1877 1877
1878 if (!isInline() || isReplaced()) { 1878 if (!isInline() || isReplaced()) {
1879 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { 1879 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) {
1880 const RenderBlock* block = toRenderBlock(o); 1880 const RenderBlock* block = toRenderBlock(o);
1881 LayoutRect columnRect(frameRect()); 1881 LayoutRect columnRect(frameRect());
1882 block->adjustStartEdgeForWritingModeIncludingColumns(columnRect); 1882 block->adjustStartEdgeForWritingModeIncludingColumns(columnRect);
1883 offset += toSize(columnRect.location()); 1883 offset += toSize(columnRect.location());
1884 LayoutPoint columnPoint = block->flipForWritingModeIncludingColumns( point + offset); 1884 LayoutPoint columnPoint = block->flipForWritingModeIncludingColumns( point + offset);
1885 offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLa youtPoint(offset))); 1885 offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLa youtPoint(offset)));
(...skipping 12 matching lines...) Expand all
1898 offset += o->columnOffset(pointInContainer); 1898 offset += o->columnOffset(pointInContainer);
1899 if (offsetDependsOnPoint) 1899 if (offsetDependsOnPoint)
1900 *offsetDependsOnPoint = true; 1900 *offsetDependsOnPoint = true;
1901 } 1901 }
1902 } 1902 }
1903 } 1903 }
1904 1904
1905 if (o->hasOverflowClip()) 1905 if (o->hasOverflowClip())
1906 offset -= toRenderBox(o)->scrolledContentOffset(); 1906 offset -= toRenderBox(o)->scrolledContentOffset();
1907 1907
1908 if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o- >isRenderInline()) 1908 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is RenderInline())
1909 offset += toRenderInline(o)->offsetForInFlowPositionedInline(*this); 1909 offset += toRenderInline(o)->offsetForInFlowPositionedInline(*this);
1910 1910
1911 return offset; 1911 return offset;
1912 } 1912 }
1913 1913
1914 InlineBox* RenderBox::createInlineBox() 1914 InlineBox* RenderBox::createInlineBox()
1915 { 1915 {
1916 return new InlineBox(*this); 1916 return new InlineBox(*this);
1917 } 1917 }
1918 1918
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box 2038 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box
2039 // in the parent's coordinate space that encloses us. 2039 // in the parent's coordinate space that encloses us.
2040 if (hasLayer() && layer()->transform()) { 2040 if (hasLayer() && layer()->transform()) {
2041 fixed = position == FixedPosition; 2041 fixed = position == FixedPosition;
2042 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); 2042 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
2043 topLeft = rect.location(); 2043 topLeft = rect.location();
2044 topLeft.move(locationOffset()); 2044 topLeft.move(locationOffset());
2045 } else if (position == FixedPosition) 2045 } else if (position == FixedPosition)
2046 fixed = true; 2046 fixed = true;
2047 2047
2048 if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderIn line()) { 2048 if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInlin e()) {
2049 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(*this); 2049 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(*this);
2050 } else if (styleToUse->hasInFlowPosition() && layer()) { 2050 } else if (styleToUse->hasInFlowPosition() && layer()) {
2051 // Apply the relative position offset when invalidating a rectangle. Th e layer 2051 // Apply the relative position offset when invalidating a rectangle. Th e layer
2052 // is translated, but the render box isn't, so we need to do this to get the 2052 // is translated, but the render box isn't, so we need to do this to get the
2053 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position 2053 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position
2054 // flag on the RenderObject has been cleared, so use the one on the styl e(). 2054 // flag on the RenderObject has been cleared, so use the one on the styl e().
2055 topLeft += layer()->offsetForInFlowPosition(); 2055 topLeft += layer()->offsetForInFlowPosition();
2056 } 2056 }
2057 2057
2058 if (position != AbsolutePosition && position != FixedPosition && o->hasColum ns() && o->isRenderBlockFlow()) { 2058 if (position != AbsolutePosition && position != FixedPosition && o->hasColum ns() && o->isRenderBlockFlow()) {
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 const RenderView* view = toRenderView(containingBlock); 2899 const RenderView* view = toRenderView(containingBlock);
2900 if (FrameView* frameView = view->frameView()) { 2900 if (FrameView* frameView = view->frameView()) {
2901 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte ntRect(); 2901 LayoutRect viewportRect = frameView->viewportConstrainedVisibleConte ntRect();
2902 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid th() : viewportRect.height(); 2902 return containingBlock->isHorizontalWritingMode() ? viewportRect.wid th() : viewportRect.height();
2903 } 2903 }
2904 } 2904 }
2905 2905
2906 if (containingBlock->isBox()) 2906 if (containingBlock->isBox())
2907 return toRenderBox(containingBlock)->clientLogicalWidth(); 2907 return toRenderBox(containingBlock)->clientLogicalWidth();
2908 2908
2909 ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositio ned()); 2909 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned ());
2910 2910
2911 const RenderInline* flow = toRenderInline(containingBlock); 2911 const RenderInline* flow = toRenderInline(containingBlock);
2912 InlineFlowBox* first = flow->firstLineBox(); 2912 InlineFlowBox* first = flow->firstLineBox();
2913 InlineFlowBox* last = flow->lastLineBox(); 2913 InlineFlowBox* last = flow->lastLineBox();
2914 2914
2915 // If the containing block is empty, return a width of 0. 2915 // If the containing block is empty, return a width of 0.
2916 if (!first || !last) 2916 if (!first || !last)
2917 return 0; 2917 return 0;
2918 2918
2919 LayoutUnit fromLeft; 2919 LayoutUnit fromLeft;
(...skipping 22 matching lines...) Expand all
2942 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei ght() : viewportRect.width(); 2942 return containingBlock->isHorizontalWritingMode() ? viewportRect.hei ght() : viewportRect.width();
2943 } 2943 }
2944 } 2944 }
2945 2945
2946 if (containingBlock->isBox()) { 2946 if (containingBlock->isBox()) {
2947 const RenderBlock* cb = containingBlock->isRenderBlock() ? 2947 const RenderBlock* cb = containingBlock->isRenderBlock() ?
2948 toRenderBlock(containingBlock) : containingBlock->containingBlock(); 2948 toRenderBlock(containingBlock) : containingBlock->containingBlock();
2949 return cb->clientLogicalHeight(); 2949 return cb->clientLogicalHeight();
2950 } 2950 }
2951 2951
2952 ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositio ned()); 2952 ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned ());
2953 2953
2954 const RenderInline* flow = toRenderInline(containingBlock); 2954 const RenderInline* flow = toRenderInline(containingBlock);
2955 InlineFlowBox* first = flow->firstLineBox(); 2955 InlineFlowBox* first = flow->firstLineBox();
2956 InlineFlowBox* last = flow->lastLineBox(); 2956 InlineFlowBox* last = flow->lastLineBox();
2957 2957
2958 // If the containing block is empty, return a height of 0. 2958 // If the containing block is empty, return a height of 0.
2959 if (!first || !last) 2959 if (!first || !last)
2960 return 0; 2960 return 0;
2961 2961
2962 LayoutUnit heightResult; 2962 LayoutUnit heightResult;
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 LayoutRect rect = borderBoxRect(); 4433 LayoutRect rect = borderBoxRect();
4434 // We want to include the margin, but only when it adds height. Quirky margi ns don't contribute height 4434 // We want to include the margin, but only when it adds height. Quirky margi ns don't contribute height
4435 // nor do the margins of self-collapsing blocks. 4435 // nor do the margins of self-collapsing blocks.
4436 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock()) 4436 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock())
4437 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA fter()) : LayoutSize(marginAfter(), LayoutUnit())); 4437 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA fter()) : LayoutSize(marginAfter(), LayoutUnit()));
4438 4438
4439 if (!hasOverflowClip()) 4439 if (!hasOverflowClip())
4440 rect.unite(layoutOverflowRect()); 4440 rect.unite(layoutOverflowRect());
4441 4441
4442 bool hasTransform = hasLayer() && layer()->transform(); 4442 bool hasTransform = hasLayer() && layer()->transform();
4443 if (isInFlowPositioned() || hasTransform) { 4443 if (isRelPositioned() || hasTransform) {
4444 // If we are relatively positioned or if we have a transform, then we ha ve to convert 4444 // If we are relatively positioned or if we have a transform, then we ha ve to convert
4445 // this rectangle into physical coordinates, apply relative positioning and transforms 4445 // this rectangle into physical coordinates, apply relative positioning and transforms
4446 // to it, and then convert it back. 4446 // to it, and then convert it back.
4447 flipForWritingMode(rect); 4447 flipForWritingMode(rect);
4448 4448
4449 if (hasTransform) 4449 if (hasTransform)
4450 rect = layer()->currentTransform().mapRect(rect); 4450 rect = layer()->currentTransform().mapRect(rect);
4451 4451
4452 if (isInFlowPositioned()) 4452 if (isRelPositioned())
4453 rect.move(offsetForInFlowPosition()); 4453 rect.move(offsetForInFlowPosition());
4454 4454
4455 // Now we need to flip back. 4455 // Now we need to flip back.
4456 flipForWritingMode(rect); 4456 flipForWritingMode(rect);
4457 } 4457 }
4458 4458
4459 // If the writing modes of the child and parent match, then we don't have to 4459 // If the writing modes of the child and parent match, then we don't have to
4460 // do anything fancy. Just return the result. 4460 // do anything fancy. Just return the result.
4461 if (parentStyle->writingMode() == style()->writingMode()) 4461 if (parentStyle->writingMode() == style()->writingMode())
4462 return rect; 4462 return rect;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4677 return 0; 4677 return 0;
4678 4678
4679 if (!layoutState && !flowThreadContainingBlock()) 4679 if (!layoutState && !flowThreadContainingBlock())
4680 return 0; 4680 return 0;
4681 4681
4682 RenderBlock* containerBlock = containingBlock(); 4682 RenderBlock* containerBlock = containingBlock();
4683 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4683 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4684 } 4684 }
4685 4685
4686 } // namespace WebCore 4686 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698