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

Side by Side Diff: third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 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) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 18 matching lines...) Expand all
29 29
30 #include "core/layout/shapes/ShapeOutsideInfo.h" 30 #include "core/layout/shapes/ShapeOutsideInfo.h"
31 31
32 #include "core/inspector/ConsoleMessage.h" 32 #include "core/inspector/ConsoleMessage.h"
33 #include "core/layout/FloatingObjects.h" 33 #include "core/layout/FloatingObjects.h"
34 #include "core/layout/LayoutBlockFlow.h" 34 #include "core/layout/LayoutBlockFlow.h"
35 #include "core/layout/LayoutBox.h" 35 #include "core/layout/LayoutBox.h"
36 #include "core/layout/LayoutImage.h" 36 #include "core/layout/LayoutImage.h"
37 #include "platform/LengthFunctions.h" 37 #include "platform/LengthFunctions.h"
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 #include "wtf/AutoReset.h"
39 #include <memory> 40 #include <memory>
40 41
41 namespace blink { 42 namespace blink {
42 43
43 CSSBoxType referenceBox(const ShapeValue& shapeValue) 44 CSSBoxType referenceBox(const ShapeValue& shapeValue)
44 { 45 {
45 if (shapeValue.cssBox() == BoxMissing) 46 if (shapeValue.cssBox() == BoxMissing)
46 return MarginBox; 47 return MarginBox;
47 return shapeValue.cssBox(); 48 return shapeValue.cssBox();
48 } 49 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 RefPtr<Image> image = styleImage->image(m_layoutBox, flooredIntSize(imageSiz e), m_layoutBox.style()->effectiveZoom()); 139 RefPtr<Image> image = styleImage->image(m_layoutBox, flooredIntSize(imageSiz e), m_layoutBox.style()->effectiveZoom());
139 140
140 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); 141 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin);
141 } 142 }
142 143
143 const Shape& ShapeOutsideInfo::computedShape() const 144 const Shape& ShapeOutsideInfo::computedShape() const
144 { 145 {
145 if (Shape* shape = m_shape.get()) 146 if (Shape* shape = m_shape.get())
146 return *shape; 147 return *shape;
147 148
148 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); 149 AutoReset<bool> isInComputingShape(&m_isComputingShape, true);
149 150
150 const ComputedStyle& style = *m_layoutBox.style(); 151 const ComputedStyle& style = *m_layoutBox.style();
151 ASSERT(m_layoutBox.containingBlock()); 152 ASSERT(m_layoutBox.containingBlock());
152 const ComputedStyle& containingBlockStyle = *m_layoutBox.containingBlock()-> style(); 153 const ComputedStyle& containingBlockStyle = *m_layoutBox.containingBlock()-> style();
153 154
154 WritingMode writingMode = containingBlockStyle.getWritingMode(); 155 WritingMode writingMode = containingBlockStyle.getWritingMode();
155 // Make sure contentWidth is not negative. This can happen when containing b lock has a vertical scrollbar and 156 // Make sure contentWidth is not negative. This can happen when containing b lock has a vertical scrollbar and
156 // its content is smaller than the scrollbar width. 157 // its content is smaller than the scrollbar width.
157 LayoutUnit maximumValue = m_layoutBox.containingBlock() ? std::max(LayoutUni t(), m_layoutBox.containingBlock()->contentWidth()) : LayoutUnit(); 158 LayoutUnit maximumValue = m_layoutBox.containingBlock() ? std::max(LayoutUni t(), m_layoutBox.containingBlock()->contentWidth()) : LayoutUnit();
158 float margin = floatValueForLength(m_layoutBox.style()->shapeMargin(), maxim umValue.toFloat()); 159 float margin = floatValueForLength(m_layoutBox.style()->shapeMargin(), maxim umValue.toFloat());
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 346 }
346 347
347 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const 348 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const
348 { 349 {
349 if (!m_layoutBox.style()->isHorizontalWritingMode()) 350 if (!m_layoutBox.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 351 return size.transposedSize();
351 return size; 352 return size;
352 } 353 }
353 354
354 } // namespace blink 355 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698