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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp

Issue 1610603002: Simplify LayoutSVGRoot::computeReplacedLogical{Width,Height} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 LayoutUnit LayoutSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred sho uldComputePreferred) const 116 LayoutUnit LayoutSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred sho uldComputePreferred) const
117 { 117 {
118 // When we're embedded through SVGImage (border-image/background-image/<html :img>/...) we're forced to resize to a specific size. 118 // When we're embedded through SVGImage (border-image/background-image/<html :img>/...) we're forced to resize to a specific size.
119 if (!m_containerSize.isEmpty()) 119 if (!m_containerSize.isEmpty())
120 return m_containerSize.width(); 120 return m_containerSize.width();
121 121
122 if (isEmbeddedThroughFrameContainingSVGDocument()) 122 if (isEmbeddedThroughFrameContainingSVGDocument())
123 return containingBlock()->availableLogicalWidth(); 123 return containingBlock()->availableLogicalWidth();
124 124
125 if (style()->logicalWidth().isSpecified() || style()->logicalMaxWidth().isSp ecified())
126 return LayoutReplaced::computeReplacedLogicalWidth(shouldComputePreferre d);
127
128 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G.
129 return LayoutReplaced::computeReplacedLogicalWidth(shouldComputePreferred); 125 return LayoutReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
130 } 126 }
131 127
132 LayoutUnit LayoutSVGRoot::computeReplacedLogicalHeight() const 128 LayoutUnit LayoutSVGRoot::computeReplacedLogicalHeight() const
133 { 129 {
134 // When we're embedded through SVGImage (border-image/background-image/<html :img>/...) we're forced to resize to a specific size. 130 // When we're embedded through SVGImage (border-image/background-image/<html :img>/...) we're forced to resize to a specific size.
135 if (!m_containerSize.isEmpty()) 131 if (!m_containerSize.isEmpty())
136 return m_containerSize.height(); 132 return m_containerSize.height();
137 133
138 if (isEmbeddedThroughFrameContainingSVGDocument()) 134 if (isEmbeddedThroughFrameContainingSVGDocument())
139 return containingBlock()->availableLogicalHeight(IncludeMarginBorderPadd ing); 135 return containingBlock()->availableLogicalHeight(IncludeMarginBorderPadd ing);
140 136
141 if (style()->logicalHeight().isSpecified() || style()->logicalMaxHeight().is Specified())
142 return LayoutReplaced::computeReplacedLogicalHeight();
143
144 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G.
145 return LayoutReplaced::computeReplacedLogicalHeight(); 137 return LayoutReplaced::computeReplacedLogicalHeight();
146 } 138 }
147 139
148 void LayoutSVGRoot::layout() 140 void LayoutSVGRoot::layout()
149 { 141 {
150 ASSERT(needsLayout()); 142 ASSERT(needsLayout());
151 LayoutAnalyzer::Scope analyzer(*this); 143 LayoutAnalyzer::Scope analyzer(*this);
152 144
153 bool needsLayout = selfNeedsLayout(); 145 bool needsLayout = selfNeedsLayout();
154 146
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 updateHitTestResult(result, pointInBorderBox); 401 updateHitTestResult(result, pointInBorderBox);
410 if (!result.addNodeToListBasedTestResult(node(), locationInContainer , boundsRect)) 402 if (!result.addNodeToListBasedTestResult(node(), locationInContainer , boundsRect))
411 return true; 403 return true;
412 } 404 }
413 } 405 }
414 406
415 return false; 407 return false;
416 } 408 }
417 409
418 } 410 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698