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

Side by Side Diff: Source/WebCore/rendering/svg/RenderSVGRoot.cpp

Issue 8390012: Merge 98263 - <svg> fails to use explicit width and height inside <html> inside IFRAME (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html ('k') | no next file » | 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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@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. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 LayoutUnit RenderSVGRoot::computeIntrinsicHeight(LayoutUnit replacedHeight) cons t 125 LayoutUnit RenderSVGRoot::computeIntrinsicHeight(LayoutUnit replacedHeight) cons t
126 { 126 {
127 if (!style()->height().isPercent()) 127 if (!style()->height().isPercent())
128 return replacedHeight; 128 return replacedHeight;
129 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/ 63656 129 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/ 63656
130 return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom())); 130 return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom()));
131 } 131 }
132 132
133 static inline bool isEmbeddedThroughFrameContainingSVGDocument(const Frame* fram e)
134 {
135 ASSERT(frame);
136 ASSERT(frame->document());
137 // If our frame has an owner renderer, we're embedded through eg. object/emb ed/iframe,
138 // but we only negotiate if we're in an SVG document.
139 return !frame->ownerRenderer() || !frame->document()->isSVGDocument();
140 }
141
133 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) cons t 142 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) cons t
134 { 143 {
135 LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMax Width); 144 LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMax Width);
136 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 145 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
137 if (!frame) 146 if (!frame)
138 return computeIntrinsicWidth(replacedWidth); 147 return computeIntrinsicWidth(replacedWidth);
139 148
140 // If our frame has an owner renderer, we're embedded through eg. object/emb ed. 149 if (isEmbeddedThroughFrameContainingSVGDocument(frame))
141 RenderPart* ownerRenderer = frame->ownerRenderer();
142 if (!ownerRenderer)
143 return computeIntrinsicWidth(replacedWidth); 150 return computeIntrinsicWidth(replacedWidth);
144 151
152 RenderPart* ownerRenderer = frame->ownerRenderer();
145 RenderStyle* ownerRendererStyle = ownerRenderer->style(); 153 RenderStyle* ownerRendererStyle = ownerRenderer->style();
146 ASSERT(ownerRendererStyle); 154 ASSERT(ownerRendererStyle);
147 ASSERT(frame->contentRenderer()); 155 ASSERT(frame->contentRenderer());
148 156
149 Length ownerWidth = ownerRendererStyle->width(); 157 Length ownerWidth = ownerRendererStyle->width();
150 if (ownerWidth.isAuto()) 158 if (ownerWidth.isAuto())
151 return replacedWidth; 159 return replacedWidth;
152 160
153 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSp ace 161 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSp ace
154 // The SVG user agent negotiates with its parent user agent to determine the viewport into which the SVG user agent can render 162 // The SVG user agent negotiates with its parent user agent to determine the viewport into which the SVG user agent can render
(...skipping 17 matching lines...) Expand all
172 } 180 }
173 181
174 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const 182 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const
175 { 183 {
176 LayoutUnit replacedHeight = RenderBox::computeReplacedLogicalHeight(); 184 LayoutUnit replacedHeight = RenderBox::computeReplacedLogicalHeight();
177 185
178 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 186 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0;
179 if (!frame) 187 if (!frame)
180 return computeIntrinsicHeight(replacedHeight); 188 return computeIntrinsicHeight(replacedHeight);
181 189
182 // If our frame has an owner renderer, we're embedded through eg. object/emb ed. 190 if (isEmbeddedThroughFrameContainingSVGDocument(frame))
183 RenderPart* ownerRenderer = frame->ownerRenderer();
184 if (!ownerRenderer)
185 return computeIntrinsicHeight(replacedHeight); 191 return computeIntrinsicHeight(replacedHeight);
186 192
193 RenderPart* ownerRenderer = frame->ownerRenderer();
187 RenderStyle* ownerRendererStyle = ownerRenderer->style(); 194 RenderStyle* ownerRendererStyle = ownerRenderer->style();
188 ASSERT(ownerRendererStyle); 195 ASSERT(ownerRendererStyle);
189 ASSERT(frame->contentRenderer()); 196 ASSERT(frame->contentRenderer());
190 197
191 Length ownerHeight = ownerRendererStyle->height(); 198 Length ownerHeight = ownerRendererStyle->height();
192 if (ownerHeight.isAuto()) 199 if (ownerHeight.isAuto())
193 return replacedHeight; 200 return replacedHeight;
194 201
195 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSp ace 202 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSp ace
196 // See comment in RenderSVGRoot::computeReplacedLogicalWidth(). 203 // See comment in RenderSVGRoot::computeReplacedLogicalWidth().
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 updateHitTestResult(result, roundedLayoutPoint(localPoint)); 459 updateHitTestResult(result, roundedLayoutPoint(localPoint));
453 return true; 460 return true;
454 } 461 }
455 462
456 return false; 463 return false;
457 } 464 }
458 465
459 } 466 }
460 467
461 #endif // ENABLE(SVG) 468 #endif // ENABLE(SVG)
OLDNEW
« no previous file with comments | « LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698