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

Side by Side Diff: Source/core/layout/svg/SVGLayoutSupport.cpp

Issue 945803004: Merge back LayoutLayerModelObject into RenderBoxModelObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Better rebasing. Created 5 years, 10 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/layout/svg/SVGLayoutSupport.h ('k') | Source/core/paint/BoxPainter.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) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 namespace blink { 46 namespace blink {
47 47
48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) 48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect)
49 { 49 {
50 if (rect.isEmpty()) 50 if (rect.isEmpty())
51 return LayoutRect(); 51 return LayoutRect();
52 return enclosingIntRect(rect); 52 return enclosingIntRect(rect);
53 } 53 }
54 54
55 LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(const Layou tObject* object, const LayoutLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) 55 LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(const Layou tObject* object, const LayoutBoxModelObject* paintInvalidationContainer, const P aintInvalidationState* paintInvalidationState)
56 { 56 {
57 // Return early for any cases where we don't actually paint 57 // Return early for any cases where we don't actually paint
58 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h asVisibleContent()) 58 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h asVisibleContent())
59 return LayoutRect(); 59 return LayoutRect();
60 60
61 // Pass our local paint rect to computeRectForPaintInvalidation() which will 61 // Pass our local paint rect to computeRectForPaintInvalidation() which will
62 // map to parent coords and recurse up the parent chain. 62 // map to parent coords and recurse up the parent chain.
63 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi nates(); 63 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi nates();
64 paintInvalidationRect.inflate(object->style()->outlineWidth()); 64 paintInvalidationRect.inflate(object->style()->outlineWidth());
65 65
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 parent = parent->parent(); 97 parent = parent->parent();
98 } while (!parent->isSVGRoot()); 98 } while (!parent->isSVGRoot());
99 99
100 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(*parent); 100 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(*parent);
101 101
102 paintInvalidationRect = svgRoot.localToBorderBoxTransform().mapRect(paintInv alidationRect); 102 paintInvalidationRect = svgRoot.localToBorderBoxTransform().mapRect(paintInv alidationRect);
103 rect = enclosingIntRectIfNotEmpty(paintInvalidationRect); 103 rect = enclosingIntRectIfNotEmpty(paintInvalidationRect);
104 return svgRoot; 104 return svgRoot;
105 } 105 }
106 106
107 void SVGLayoutSupport::mapLocalToContainer(const LayoutObject* object, const Lay outLayerModelObject* paintInvalidationContainer, TransformState& transformState, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) 107 void SVGLayoutSupport::mapLocalToContainer(const LayoutObject* object, const Lay outBoxModelObject* paintInvalidationContainer, TransformState& transformState, b ool* wasFixed, const PaintInvalidationState* paintInvalidationState)
108 { 108 {
109 transformState.applyTransform(object->localToParentTransform()); 109 transformState.applyTransform(object->localToParentTransform());
110 110
111 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) { 111 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) {
112 // |svgTransform| contains localToBorderBoxTransform mentioned below. 112 // |svgTransform| contains localToBorderBoxTransform mentioned below.
113 transformState.applyTransform(paintInvalidationState->svgTransform()); 113 transformState.applyTransform(paintInvalidationState->svgTransform());
114 transformState.move(paintInvalidationState->paintOffset()); 114 transformState.move(paintInvalidationState->paintOffset());
115 return; 115 return;
116 } 116 }
117 117
118 LayoutObject* parent = object->parent(); 118 LayoutObject* parent = object->parent();
119 119
120 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the localToBorderB oxTransform 120 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the localToBorderB oxTransform
121 // to map an element from SVG viewport coordinates to CSS box coordinates. 121 // to map an element from SVG viewport coordinates to CSS box coordinates.
122 // LayoutSVGRoot's mapLocalToContainer method expects CSS box coordinates. 122 // LayoutSVGRoot's mapLocalToContainer method expects CSS box coordinates.
123 if (parent->isSVGRoot()) 123 if (parent->isSVGRoot())
124 transformState.applyTransform(toLayoutSVGRoot(parent)->localToBorderBoxT ransform()); 124 transformState.applyTransform(toLayoutSVGRoot(parent)->localToBorderBoxT ransform());
125 125
126 MapCoordinatesFlags mode = UseTransforms; 126 MapCoordinatesFlags mode = UseTransforms;
127 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode , wasFixed, paintInvalidationState); 127 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode , wasFixed, paintInvalidationState);
128 } 128 }
129 129
130 const LayoutObject* SVGLayoutSupport::pushMappingToContainer(const LayoutObject* object, const LayoutLayerModelObject* ancestorToStopAt, LayoutGeometryMap& geom etryMap) 130 const LayoutObject* SVGLayoutSupport::pushMappingToContainer(const LayoutObject* object, const LayoutBoxModelObject* ancestorToStopAt, LayoutGeometryMap& geomet ryMap)
131 { 131 {
132 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object); 132 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object);
133 133
134 LayoutObject* parent = object->parent(); 134 LayoutObject* parent = object->parent();
135 135
136 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the localToBorderB oxTransform 136 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the localToBorderB oxTransform
137 // to map an element from SVG viewport coordinates to CSS box coordinates. 137 // to map an element from SVG viewport coordinates to CSS box coordinates.
138 // LayoutSVGRoot's mapLocalToContainer method expects CSS box coordinates. 138 // LayoutSVGRoot's mapLocalToContainer method expects CSS box coordinates.
139 if (parent->isSVGRoot()) { 139 if (parent->isSVGRoot()) {
140 TransformationMatrix matrix(object->localToParentTransform()); 140 TransformationMatrix matrix(object->localToParentTransform());
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 layer = layer->parent(); 511 layer = layer->parent();
512 } 512 }
513 513
514 ctm.scale(deviceScaleFactor); 514 ctm.scale(deviceScaleFactor);
515 515
516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2)); 516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2));
517 } 517 }
518 518
519 } 519 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/SVGLayoutSupport.h ('k') | Source/core/paint/BoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698