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

Side by Side Diff: Source/core/rendering/RenderInline.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/RenderInline.h ('k') | Source/core/rendering/RenderLayer.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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 setInline(true); 128 setInline(true);
129 129
130 // FIXME: Support transforms and reflections on inline flows someday. 130 // FIXME: Support transforms and reflections on inline flows someday.
131 setHasTransform(false); 131 setHasTransform(false);
132 setHasReflection(false); 132 setHasReflection(false);
133 } 133 }
134 134
135 static RenderObject* inFlowPositionedInlineAncestor(RenderObject* p) 135 static RenderObject* inFlowPositionedInlineAncestor(RenderObject* p)
136 { 136 {
137 while (p && p->isRenderInline()) { 137 while (p && p->isRenderInline()) {
138 if (p->isInFlowPositioned()) 138 if (p->isRelPositioned())
139 return p; 139 return p;
140 p = p->parent(); 140 p = p->parent();
141 } 141 }
142 return 0; 142 return 0;
143 } 143 }
144 144
145 static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const RenderStyle* newStyle, const RenderStyle* oldStyle) 145 static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const RenderStyle* newStyle, const RenderStyle* oldStyle)
146 { 146 {
147 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { 147 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) {
148 if (!toRenderBlock(block)->isAnonymousBlockContinuation() || block->styl e()->position() == newStyle->position()) 148 if (!toRenderBlock(block)->isAnonymousBlockContinuation() || block->styl e()->position() == newStyle->position())
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 731
732 LayoutUnit RenderInline::marginAfter(const RenderStyle* otherStyle) const 732 LayoutUnit RenderInline::marginAfter(const RenderStyle* otherStyle) const
733 { 733 {
734 return computeMargin(this, style()->marginAfterUsing(otherStyle ? otherStyle : style())); 734 return computeMargin(this, style()->marginAfterUsing(otherStyle ? otherStyle : style()));
735 } 735 }
736 736
737 const char* RenderInline::renderName() const 737 const char* RenderInline::renderName() const
738 { 738 {
739 if (isRelPositioned()) 739 if (isRelPositioned())
740 return "RenderInline (relative positioned)"; 740 return "RenderInline (relative positioned)";
741 if (isStickyPositioned())
742 return "RenderInline (sticky positioned)";
743 // FIXME: Temporary hack while the new generated content system is being imp lemented. 741 // FIXME: Temporary hack while the new generated content system is being imp lemented.
744 if (isPseudoElement()) 742 if (isPseudoElement())
745 return "RenderInline (generated)"; 743 return "RenderInline (generated)";
746 if (isAnonymous()) 744 if (isAnonymous())
747 return "RenderInline (generated)"; 745 return "RenderInline (generated)";
748 return "RenderInline"; 746 return "RenderInline";
749 } 747 }
750 748
751 bool RenderInline::nodeAtPoint(const HitTestRequest& request, HitTestResult& res ult, 749 bool RenderInline::nodeAtPoint(const HitTestRequest& request, HitTestResult& res ult,
752 const HitTestLocation& locationInContainer, cons t LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) 750 const HitTestLocation& locationInContainer, cons t LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // We can not use addNodeToRectBasedTestResult to determine if we fully enclose the hit-test area 788 // We can not use addNodeToRectBasedTestResult to determine if we fully enclose the hit-test area
791 // because it can only handle rectangular targets. 789 // because it can only handle rectangular targets.
792 result.addNodeToRectBasedTestResult(node(), request, locationInContainer ); 790 result.addNodeToRectBasedTestResult(node(), request, locationInContainer );
793 return regionResult.contains(tmpLocation.boundingBox()); 791 return regionResult.contains(tmpLocation.boundingBox());
794 } 792 }
795 return false; 793 return false;
796 } 794 }
797 795
798 PositionWithAffinity RenderInline::positionForPoint(const LayoutPoint& point) 796 PositionWithAffinity RenderInline::positionForPoint(const LayoutPoint& point)
799 { 797 {
800 // FIXME: Does not deal with relative or sticky positioned inlines (should i t?) 798 // FIXME: Does not deal with relative positioned inlines (should it?)
801 RenderBlock* cb = containingBlock(); 799 RenderBlock* cb = containingBlock();
802 if (firstLineBox()) { 800 if (firstLineBox()) {
803 // This inline actually has a line box. We must have clicked in the bor der/padding of one of these boxes. We 801 // This inline actually has a line box. We must have clicked in the bor der/padding of one of these boxes. We
804 // should try to find a result by asking our containing block. 802 // should try to find a result by asking our containing block.
805 return cb->positionForPoint(point); 803 return cb->positionForPoint(point);
806 } 804 }
807 805
808 // Translate the coords from the pre-anonymous block to the post-anonymous b lock. 806 // Translate the coords from the pre-anonymous block to the post-anonymous b lock.
809 LayoutPoint parentBlockPoint = cb->location() + point; 807 LayoutPoint parentBlockPoint = cb->location() + point;
810 RenderBoxModelObject* c = continuation(); 808 RenderBoxModelObject* c = continuation();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 LayoutRect repaintRect(topLeft, rect.size()); 1079 LayoutRect repaintRect(topLeft, rect.size());
1082 cb->adjustRectForColumns(repaintRect); 1080 cb->adjustRectForColumns(repaintRect);
1083 topLeft = repaintRect.location(); 1081 topLeft = repaintRect.location();
1084 rect = repaintRect; 1082 rect = repaintRect;
1085 } 1083 }
1086 } 1084 }
1087 1085
1088 if (style()->hasInFlowPosition() && layer()) { 1086 if (style()->hasInFlowPosition() && layer()) {
1089 // Apply the in-flow position offset when invalidating a rectangle. The layer 1087 // Apply the in-flow position offset when invalidating a rectangle. The layer
1090 // is translated, but the render box isn't, so we need to do this to get the 1088 // is translated, but the render box isn't, so we need to do this to get the
1091 // right dirty rect. Since this is called from RenderObject::setStyle, t he relative or sticky position 1089 // right dirty rect. Since this is called from RenderObject::setStyle, t he relative position
1092 // flag on the RenderObject has been cleared, so use the one on the styl e(). 1090 // flag on the RenderObject has been cleared, so use the one on the styl e().
1093 topLeft += layer()->offsetForInFlowPosition(); 1091 topLeft += layer()->offsetForInFlowPosition();
1094 } 1092 }
1095 1093
1096 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout, 1094 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout,
1097 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. 1095 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
1098 rect.setLocation(topLeft); 1096 rect.setLocation(topLeft);
1099 if (o->hasOverflowClip()) { 1097 if (o->hasOverflowClip()) {
1100 RenderBox* containerBox = toRenderBox(o); 1098 RenderBox* containerBox = toRenderBox(o);
1101 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); 1099 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
1102 if (rect.isEmpty()) 1100 if (rect.isEmpty())
1103 return; 1101 return;
1104 } 1102 }
1105 1103
1106 if (containerSkipped) { 1104 if (containerSkipped) {
1107 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. 1105 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
1108 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o); 1106 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o);
1109 rect.move(-containerOffset); 1107 rect.move(-containerOffset);
1110 return; 1108 return;
1111 } 1109 }
1112 1110
1113 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed ); 1111 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed );
1114 } 1112 }
1115 1113
1116 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons t LayoutPoint& point, bool* offsetDependsOnPoint) const 1114 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons t LayoutPoint& point, bool* offsetDependsOnPoint) const
1117 { 1115 {
1118 ASSERT(container == this->container()); 1116 ASSERT(container == this->container());
1119 1117
1120 LayoutSize offset; 1118 LayoutSize offset;
1121 if (isInFlowPositioned()) 1119 if (isRelPositioned())
1122 offset += offsetForInFlowPosition(); 1120 offset += offsetForInFlowPosition();
1123 1121
1124 offset += container->columnOffset(point); 1122 offset += container->columnOffset(point);
1125 1123
1126 if (container->hasOverflowClip()) 1124 if (container->hasOverflowClip())
1127 offset -= toRenderBox(container)->scrolledContentOffset(); 1125 offset -= toRenderBox(container)->scrolledContentOffset();
1128 1126
1129 if (offsetDependsOnPoint) { 1127 if (offsetDependsOnPoint) {
1130 *offsetDependsOnPoint = container->hasColumns() 1128 *offsetDependsOnPoint = container->hasColumns()
1131 || (container->isBox() && container->style()->isFlippedBlocksWriting Mode()) 1129 || (container->isBox() && container->style()->isFlippedBlocksWriting Mode())
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 { 1291 {
1294 ASSERT(linePositionMode == PositionOnContainingLine); 1292 ASSERT(linePositionMode == PositionOnContainingLine);
1295 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 1293 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
1296 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1294 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1297 } 1295 }
1298 1296
1299 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const 1297 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const
1300 { 1298 {
1301 // FIXME: This function isn't right with mixed writing modes. 1299 // FIXME: This function isn't right with mixed writing modes.
1302 1300
1303 ASSERT(isInFlowPositioned()); 1301 ASSERT(isRelPositioned());
1304 if (!isInFlowPositioned()) 1302 if (!isRelPositioned())
1305 return LayoutSize(); 1303 return LayoutSize();
1306 1304
1307 // When we have an enclosing relpositioned inline, we need to add in the off set of the first line 1305 // When we have an enclosing relpositioned inline, we need to add in the off set of the first line
1308 // box from the rest of the content, but only in the cases where we know we' re positioned 1306 // box from the rest of the content, but only in the cases where we know we' re positioned
1309 // relative to the inline itself. 1307 // relative to the inline itself.
1310 1308
1311 LayoutSize logicalOffset; 1309 LayoutSize logicalOffset;
1312 LayoutUnit inlinePosition; 1310 LayoutUnit inlinePosition;
1313 LayoutUnit blockPosition; 1311 LayoutUnit blockPosition;
1314 if (firstLineBox()) { 1312 if (firstLineBox()) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 container = this; 1562 container = this;
1565 1563
1566 FloatPoint absPos = container->localToAbsolute(); 1564 FloatPoint absPos = container->localToAbsolute();
1567 region.bounds.setX(absPos.x() + region.bounds.x()); 1565 region.bounds.setX(absPos.x() + region.bounds.x());
1568 region.bounds.setY(absPos.y() + region.bounds.y()); 1566 region.bounds.setY(absPos.y() + region.bounds.y());
1569 1567
1570 regions.append(region); 1568 regions.append(region);
1571 } 1569 }
1572 1570
1573 } // namespace WebCore 1571 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698