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

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

Issue 689853003: Remove CSS Grid Layout and grid media queries. (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
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderGrid.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 22 matching lines...) Expand all
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
35 #include "core/html/HTMLElement.h" 35 #include "core/html/HTMLElement.h"
36 #include "core/page/AutoscrollController.h" 36 #include "core/page/AutoscrollController.h"
37 #include "core/page/EventHandler.h" 37 #include "core/page/EventHandler.h"
38 #include "core/page/Page.h" 38 #include "core/page/Page.h"
39 #include "core/rendering/HitTestResult.h" 39 #include "core/rendering/HitTestResult.h"
40 #include "core/rendering/PaintInfo.h" 40 #include "core/rendering/PaintInfo.h"
41 #include "core/rendering/RenderFlexibleBox.h" 41 #include "core/rendering/RenderFlexibleBox.h"
42 #include "core/rendering/RenderGeometryMap.h" 42 #include "core/rendering/RenderGeometryMap.h"
43 #include "core/rendering/RenderGrid.h"
44 #include "core/rendering/RenderInline.h" 43 #include "core/rendering/RenderInline.h"
45 #include "core/rendering/RenderLayer.h" 44 #include "core/rendering/RenderLayer.h"
46 #include "core/rendering/RenderView.h" 45 #include "core/rendering/RenderView.h"
47 #include "core/rendering/compositing/RenderLayerCompositor.h" 46 #include "core/rendering/compositing/RenderLayerCompositor.h"
48 #include "platform/LengthFunctions.h" 47 #include "platform/LengthFunctions.h"
49 #include "platform/geometry/FloatQuad.h" 48 #include "platform/geometry/FloatQuad.h"
50 #include "platform/geometry/TransformState.h" 49 #include "platform/geometry/TransformState.h"
51 #include "platform/graphics/GraphicsContextStateSaver.h" 50 #include "platform/graphics/GraphicsContextStateSaver.h"
52 #include <algorithm> 51 #include <algorithm>
53 #include <math.h> 52 #include <math.h>
54 53
55 namespace blink { 54 namespace blink {
56 55
57 // Used by flexible boxes when flexing this element and by table cells. 56 // Used by flexible boxes when flexing this element and by table cells.
58 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; 57 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap;
59 58
60 // Used by grid elements to properly size their grid items. 59 //FIXME(sky): Remove
61 // FIXME: Move these into RenderBoxRareData.
62 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; 60 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0;
63 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; 61 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0;
64 62
65 63
66 // Size of border belt for autoscroll. When mouse pointer in border belt, 64 // Size of border belt for autoscroll. When mouse pointer in border belt,
67 // autoscroll is started. 65 // autoscroll is started.
68 static const int autoscrollBeltSize = 20; 66 static const int autoscrollBeltSize = 20;
69 static const unsigned backgroundObscurationTestMaxDepth = 4; 67 static const unsigned backgroundObscurationTestMaxDepth = 4;
70 68
71 RenderBox::RenderBox(ContainerNode* node) 69 RenderBox::RenderBox(ContainerNode* node)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Our opaqueness might have changed without triggering layout. 166 // Our opaqueness might have changed without triggering layout.
169 if (diff.needsPaintInvalidation()) { 167 if (diff.needsPaintInvalidation()) {
170 RenderObject* parentToInvalidate = parent(); 168 RenderObject* parentToInvalidate = parent();
171 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn validate; ++i) { 169 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn validate; ++i) {
172 parentToInvalidate->invalidateBackgroundObscurationStatus(); 170 parentToInvalidate->invalidateBackgroundObscurationStatus();
173 parentToInvalidate = parentToInvalidate->parent(); 171 parentToInvalidate = parentToInvalidate->parent();
174 } 172 }
175 } 173 }
176 174
177 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle); 175 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle);
178 updateGridPositionAfterStyleChange(oldStyle);
179 } 176 }
180 177
181 void RenderBox::updateShapeOutsideInfoAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle) 178 void RenderBox::updateShapeOutsideInfoAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle)
182 { 179 {
183 const ShapeValue* shapeOutside = style.shapeOutside(); 180 const ShapeValue* shapeOutside = style.shapeOutside();
184 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Re nderStyle::initialShapeOutside(); 181 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Re nderStyle::initialShapeOutside();
185 182
186 Length shapeMargin = style.shapeMargin(); 183 Length shapeMargin = style.shapeMargin();
187 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : RenderStyle::in itialShapeMargin(); 184 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : RenderStyle::in itialShapeMargin();
188 185
189 float shapeImageThreshold = style.shapeImageThreshold(); 186 float shapeImageThreshold = style.shapeImageThreshold();
190 float oldShapeImageThreshold = oldStyle ? oldStyle->shapeImageThreshold() : RenderStyle::initialShapeImageThreshold(); 187 float oldShapeImageThreshold = oldStyle ? oldStyle->shapeImageThreshold() : RenderStyle::initialShapeImageThreshold();
191 188
192 // FIXME: A future optimization would do a deep comparison for equality. (bu g 100811) 189 // FIXME: A future optimization would do a deep comparison for equality. (bu g 100811)
193 if (shapeOutside == oldShapeOutside && shapeMargin == oldShapeMargin && shap eImageThreshold == oldShapeImageThreshold) 190 if (shapeOutside == oldShapeOutside && shapeMargin == oldShapeMargin && shap eImageThreshold == oldShapeImageThreshold)
194 return; 191 return;
195 192
196 if (!shapeOutside) 193 if (!shapeOutside)
197 ShapeOutsideInfo::removeInfo(*this); 194 ShapeOutsideInfo::removeInfo(*this);
198 else 195 else
199 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); 196 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty();
200 197
201 if (shapeOutside || shapeOutside != oldShapeOutside) 198 if (shapeOutside || shapeOutside != oldShapeOutside)
202 markShapeOutsideDependentsForLayout(); 199 markShapeOutsideDependentsForLayout();
203 } 200 }
204 201
205 void RenderBox::updateGridPositionAfterStyleChange(const RenderStyle* oldStyle)
206 {
207 if (!oldStyle || !parent() || !parent()->isRenderGrid())
208 return;
209
210 if (oldStyle->gridColumnStart() == style()->gridColumnStart()
211 && oldStyle->gridColumnEnd() == style()->gridColumnEnd()
212 && oldStyle->gridRowStart() == style()->gridRowStart()
213 && oldStyle->gridRowEnd() == style()->gridRowEnd()
214 && oldStyle->order() == style()->order()
215 && oldStyle->hasOutOfFlowPosition() == style()->hasOutOfFlowPosition())
216 return;
217
218 // It should be possible to not dirty the grid in some cases (like moving an explicitly placed grid item).
219 // For now, it's more simple to just always recompute the grid.
220 toRenderGrid(parent())->dirtyGrid();
221 }
222
223 void RenderBox::updateFromStyle() 202 void RenderBox::updateFromStyle()
224 { 203 {
225 RenderBoxModelObject::updateFromStyle(); 204 RenderBoxModelObject::updateFromStyle();
226 205
227 RenderStyle* styleToUse = style(); 206 RenderStyle* styleToUse = style();
228 bool isRootObject = isDocumentElement(); 207 bool isRootObject = isDocumentElement();
229 bool isViewObject = isRenderView(); 208 bool isViewObject = isRenderView();
230 209
231 // The root and the RenderView always paint their backgrounds/borders. 210 // The root and the RenderView always paint their backgrounds/borders.
232 if (isRootObject || isViewObject) 211 if (isRootObject || isViewObject)
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 containerWidthInInlineDirection = perpendicularContainingBlockLogica lHeight(); 1792 containerWidthInInlineDirection = perpendicularContainingBlockLogica lHeight();
1814 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); 1793 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse->logicalWidth(), containerWidthInInlineDirection, cb);
1815 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb); 1794 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
1816 } 1795 }
1817 1796
1818 // Margin calculations. 1797 // Margin calculations.
1819 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start, 1798 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start,
1820 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd()); 1799 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd());
1821 1800
1822 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end) 1801 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end)
1823 && !isFloating() && !isInline() && !cb->isFlexibleBox() && !cb->isRender Grid()) { 1802 && !isFloating() && !isInline() && !cb->isFlexibleBox()) {
1824 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(this); 1803 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(this);
1825 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty le()->isLeftToRightDirection(); 1804 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty le()->isLeftToRightDirection();
1826 if (hasInvertedDirection) 1805 if (hasInvertedDirection)
1827 computedValues.m_margins.m_start = newMargin; 1806 computedValues.m_margins.m_start = newMargin;
1828 else 1807 else
1829 computedValues.m_margins.m_end = newMargin; 1808 computedValues.m_margins.m_end = newMargin;
1830 } 1809 }
1831 } 1810 }
1832 1811
1833 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) con st 1812 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) con st
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3977 3956
3978 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3957 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3979 { 3958 {
3980 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3959 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3981 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3960 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3982 ASSERT(hasBackground == style.hasBackground()); 3961 ASSERT(hasBackground == style.hasBackground());
3983 hasBorder = style.hasBorder(); 3962 hasBorder = style.hasBorder();
3984 } 3963 }
3985 3964
3986 } // namespace blink 3965 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698