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

Side by Side Diff: sky/engine/core/rendering/RenderBlock.cpp

Issue 686633002: First pass at removing position:fixed. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 void RenderBlock::addOverflowFromPositionedObjects() 1089 void RenderBlock::addOverflowFromPositionedObjects()
1090 { 1090 {
1091 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); 1091 TrackedRendererListHashSet* positionedDescendants = positionedObjects();
1092 if (!positionedDescendants) 1092 if (!positionedDescendants)
1093 return; 1093 return;
1094 1094
1095 RenderBox* positionedObject; 1095 RenderBox* positionedObject;
1096 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 1096 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
1097 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { 1097 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
1098 positionedObject = *it; 1098 positionedObject = *it;
1099 1099 addOverflowFromChild(positionedObject, LayoutSize(positionedObject->x(), positionedObject->y()));
1100 // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
1101 if (positionedObject->style()->position() != FixedPosition)
1102 addOverflowFromChild(positionedObject, LayoutSize(positionedObject-> x(), positionedObject->y()));
1103 } 1100 }
1104 } 1101 }
1105 1102
1106 bool RenderBlock::createsBlockFormattingContext() const 1103 bool RenderBlock::createsBlockFormattingContext() const
1107 { 1104 {
1108 return isInlineBlock() || isFloatingOrOutOfFlowPositioned() || hasOverflowCl ip() || isFlexItemIncludingDeprecated() 1105 return isInlineBlock() || isFloatingOrOutOfFlowPositioned() || hasOverflowCl ip() || isFlexItemIncludingDeprecated()
1109 || isWritingModeRoot() || isDocumentElement(); 1106 || isWritingModeRoot() || isDocumentElement();
1110 } 1107 }
1111 1108
1112 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R enderBox* child) 1109 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R enderBox* child)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 updateLayerTransformAfterLayout(); 1194 updateLayerTransformAfterLayout();
1198 1195
1199 updateScrollInfoAfterLayout(); 1196 updateScrollInfoAfterLayout();
1200 1197
1201 clearNeedsLayout(); 1198 clearNeedsLayout();
1202 return true; 1199 return true;
1203 } 1200 }
1204 1201
1205 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope) 1202 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope)
1206 { 1203 {
1207 if (child->style()->position() != FixedPosition) 1204 // FIXME(sky): Remove
1208 return;
1209
1210 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHoriz ontalWritingMode());
1211 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHor izontalWritingMode());
1212 if (!hasStaticBlockPosition && !hasStaticInlinePosition)
1213 return;
1214
1215 RenderObject* o = child->parent();
1216 while (o && !o->isRenderView() && o->style()->position() != AbsolutePosition )
1217 o = o->parent();
1218 if (o->style()->position() != AbsolutePosition)
1219 return;
1220
1221 RenderBox* box = toRenderBox(child);
1222 if (hasStaticInlinePosition) {
1223 LogicalExtentComputedValues computedValues;
1224 box->computeLogicalWidth(computedValues);
1225 LayoutUnit newLeft = computedValues.m_position;
1226 if (newLeft != box->logicalLeft())
1227 layoutScope.setChildNeedsLayout(child);
1228 } else if (hasStaticBlockPosition) {
1229 LayoutUnit oldTop = box->logicalTop();
1230 box->updateLogicalHeight();
1231 if (box->logicalTop() != oldTop)
1232 layoutScope.setChildNeedsLayout(child);
1233 }
1234 } 1205 }
1235 1206
1236 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co nst 1207 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co nst
1237 { 1208 {
1238 // A margin has three types: fixed, percentage, and auto (variable). 1209 // A margin has three types: fixed, percentage, and auto (variable).
1239 // Auto and percentage margins become 0 when computing min/max width. 1210 // Auto and percentage margins become 0 when computing min/max width.
1240 // Fixed margins can be added in as is. 1211 // Fixed margins can be added in as is.
1241 Length marginLeft = child->style()->marginStartUsing(style()); 1212 Length marginLeft = child->style()->marginStartUsing(style());
1242 Length marginRight = child->style()->marginEndUsing(style()); 1213 Length marginRight = child->style()->marginEndUsing(style());
1243 LayoutUnit margin = 0; 1214 LayoutUnit margin = 0;
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 if (!positionedDescendants) 3159 if (!positionedDescendants)
3189 return childrenOverflowChanged; 3160 return childrenOverflowChanged;
3190 3161
3191 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 3162 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
3192 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { 3163 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
3193 RenderBox* box = *it; 3164 RenderBox* box = *it;
3194 3165
3195 if (!box->needsOverflowRecalcAfterStyleChange()) 3166 if (!box->needsOverflowRecalcAfterStyleChange())
3196 continue; 3167 continue;
3197 RenderBlock* block = toRenderBlock(box); 3168 RenderBlock* block = toRenderBlock(box);
3198 if (!block->recalcOverflowAfterStyleChange() || box->style()->position() == FixedPosition) 3169 if (!block->recalcOverflowAfterStyleChange())
3199 continue; 3170 continue;
3200 3171
3201 childrenOverflowChanged = true; 3172 childrenOverflowChanged = true;
3202 } 3173 }
3203 return childrenOverflowChanged; 3174 return childrenOverflowChanged;
3204 } 3175 }
3205 3176
3206 bool RenderBlock::recalcOverflowAfterStyleChange() 3177 bool RenderBlock::recalcOverflowAfterStyleChange()
3207 { 3178 {
3208 ASSERT(needsOverflowRecalcAfterStyleChange()); 3179 ASSERT(needsOverflowRecalcAfterStyleChange());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 3222 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
3252 { 3223 {
3253 showRenderObject(); 3224 showRenderObject();
3254 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3225 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3255 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3226 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3256 } 3227 }
3257 3228
3258 #endif 3229 #endif
3259 3230
3260 } // namespace blink 3231 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/PaintInvalidationState.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698