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

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

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO Created 4 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 : LayoutReplaced(node) 43 : LayoutReplaced(node)
44 , m_objectBoundingBoxValid(false) 44 , m_objectBoundingBoxValid(false)
45 , m_isLayoutSizeChanged(false) 45 , m_isLayoutSizeChanged(false)
46 , m_needsBoundariesOrTransformUpdate(true) 46 , m_needsBoundariesOrTransformUpdate(true)
47 , m_hasBoxDecorationBackground(false) 47 , m_hasBoxDecorationBackground(false)
48 , m_hasNonIsolatedBlendingDescendants(false) 48 , m_hasNonIsolatedBlendingDescendants(false)
49 , m_hasNonIsolatedBlendingDescendantsDirty(false) 49 , m_hasNonIsolatedBlendingDescendantsDirty(false)
50 { 50 {
51 LayoutSize intrinsicSize(calculateIntrinsicSize()); 51 LayoutSize intrinsicSize(calculateIntrinsicSize());
52 if (!intrinsicSize.width()) 52 if (!intrinsicSize.width())
53 intrinsicSize.setWidth(defaultWidth); 53 intrinsicSize.setWidth(LayoutUnit(defaultWidth));
54 if (!intrinsicSize.height()) 54 if (!intrinsicSize.height())
55 intrinsicSize.setHeight(defaultHeight); 55 intrinsicSize.setHeight(LayoutUnit(defaultHeight));
56 setIntrinsicSize(intrinsicSize); 56 setIntrinsicSize(intrinsicSize);
57 } 57 }
58 58
59 LayoutSVGRoot::~LayoutSVGRoot() 59 LayoutSVGRoot::~LayoutSVGRoot()
60 { 60 {
61 } 61 }
62 62
63 FloatSize LayoutSVGRoot::calculateIntrinsicSize() const 63 FloatSize LayoutSVGRoot::calculateIntrinsicSize() const
64 { 64 {
65 SVGSVGElement* svg = toSVGSVGElement(node()); 65 SVGSVGElement* svg = toSVGSVGElement(node());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // but we only negotiate if we're in an SVG document inside a embedded objec t (object/embed). 110 // but we only negotiate if we're in an SVG document inside a embedded objec t (object/embed).
111 if (!frame->ownerLayoutObject() || !frame->ownerLayoutObject()->isEmbeddedOb ject()) 111 if (!frame->ownerLayoutObject() || !frame->ownerLayoutObject()->isEmbeddedOb ject())
112 return false; 112 return false;
113 return frame->document()->isSVGDocument(); 113 return frame->document()->isSVGDocument();
114 } 114 }
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 LayoutUnit(m_containerSize.width());
121 121
122 if (isEmbeddedThroughFrameContainingSVGDocument()) 122 if (isEmbeddedThroughFrameContainingSVGDocument())
123 return containingBlock()->availableLogicalWidth(); 123 return containingBlock()->availableLogicalWidth();
124 124
125 return LayoutReplaced::computeReplacedLogicalWidth(shouldComputePreferred); 125 return LayoutReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
126 } 126 }
127 127
128 LayoutUnit LayoutSVGRoot::computeReplacedLogicalHeight() const 128 LayoutUnit LayoutSVGRoot::computeReplacedLogicalHeight() const
129 { 129 {
130 // 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.
131 if (!m_containerSize.isEmpty()) 131 if (!m_containerSize.isEmpty())
132 return m_containerSize.height(); 132 return LayoutUnit(m_containerSize.height());
133 133
134 if (isEmbeddedThroughFrameContainingSVGDocument()) 134 if (isEmbeddedThroughFrameContainingSVGDocument())
135 return containingBlock()->availableLogicalHeight(IncludeMarginBorderPadd ing); 135 return containingBlock()->availableLogicalHeight(IncludeMarginBorderPadd ing);
136 136
137 return LayoutReplaced::computeReplacedLogicalHeight(); 137 return LayoutReplaced::computeReplacedLogicalHeight();
138 } 138 }
139 139
140 void LayoutSVGRoot::layout() 140 void LayoutSVGRoot::layout()
141 { 141 {
142 ASSERT(needsLayout()); 142 ASSERT(needsLayout());
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 updateHitTestResult(result, pointInBorderBox); 399 updateHitTestResult(result, pointInBorderBox);
400 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) 400 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
401 return true; 401 return true;
402 } 402 }
403 } 403 }
404 404
405 return false; 405 return false;
406 } 406 }
407 407
408 } // namespace blink 408 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698