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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); 141 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin);
142 } 142 }
143 143
144 const Shape& ShapeOutsideInfo::computedShape() const 144 const Shape& ShapeOutsideInfo::computedShape() const
145 { 145 {
146 if (Shape* shape = m_shape.get()) 146 if (Shape* shape = m_shape.get())
147 return *shape; 147 return *shape;
148 148
149 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); 149 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true);
150 150
151 const LayoutStyle& style = *m_renderer.style(); 151 const ComputedStyle& style = *m_renderer.style();
152 ASSERT(m_renderer.containingBlock()); 152 ASSERT(m_renderer.containingBlock());
153 const LayoutStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); 153 const ComputedStyle& containingBlockStyle = *m_renderer.containingBlock()->s tyle();
154 154
155 WritingMode writingMode = containingBlockStyle.writingMode(); 155 WritingMode writingMode = containingBlockStyle.writingMode();
156 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit(); 156 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit();
157 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat()); 157 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat());
158 158
159 float shapeImageThreshold = style.shapeImageThreshold(); 159 float shapeImageThreshold = style.shapeImageThreshold();
160 ASSERT(style.shapeOutside()); 160 ASSERT(style.shapeOutside());
161 const ShapeValue& shapeValue = *style.shapeOutside(); 161 const ShapeValue& shapeValue = *style.shapeOutside();
162 162
163 switch (shapeValue.type()) { 163 switch (shapeValue.type()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 case BorderBox: return LayoutUnit(); 213 case BorderBox: return LayoutUnit();
214 case PaddingBox: return borderBeforeInWritingMode(m_renderer, m_renderer.con tainingBlock()->style()->writingMode()); 214 case PaddingBox: return borderBeforeInWritingMode(m_renderer, m_renderer.con tainingBlock()->style()->writingMode());
215 case ContentBox: return borderAndPaddingBeforeInWritingMode(m_renderer, m_re nderer.containingBlock()->style()->writingMode()); 215 case ContentBox: return borderAndPaddingBeforeInWritingMode(m_renderer, m_re nderer.containingBlock()->style()->writingMode());
216 case BoxMissing: break; 216 case BoxMissing: break;
217 } 217 }
218 218
219 ASSERT_NOT_REACHED(); 219 ASSERT_NOT_REACHED();
220 return LayoutUnit(); 220 return LayoutUnit();
221 } 221 }
222 222
223 inline LayoutUnit borderStartWithStyleForWritingMode(const LayoutBox& renderer, const LayoutStyle* style) 223 inline LayoutUnit borderStartWithStyleForWritingMode(const LayoutBox& renderer, const ComputedStyle* style)
224 { 224 {
225 if (style->isHorizontalWritingMode()) { 225 if (style->isHorizontalWritingMode()) {
226 if (style->isLeftToRightDirection()) 226 if (style->isLeftToRightDirection())
227 return renderer.borderLeft(); 227 return renderer.borderLeft();
228 228
229 return renderer.borderRight(); 229 return renderer.borderRight();
230 } 230 }
231 if (style->isLeftToRightDirection()) 231 if (style->isLeftToRightDirection())
232 return renderer.borderTop(); 232 return renderer.borderTop();
233 233
234 return renderer.borderBottom(); 234 return renderer.borderBottom();
235 } 235 }
236 236
237 inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const LayoutBox& renderer, const LayoutStyle* style) 237 inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const LayoutBox& renderer, const ComputedStyle* style)
238 { 238 {
239 if (style->isHorizontalWritingMode()) { 239 if (style->isHorizontalWritingMode()) {
240 if (style->isLeftToRightDirection()) 240 if (style->isLeftToRightDirection())
241 return renderer.borderLeft() + renderer.paddingLeft(); 241 return renderer.borderLeft() + renderer.paddingLeft();
242 242
243 return renderer.borderRight() + renderer.paddingRight(); 243 return renderer.borderRight() + renderer.paddingRight();
244 } 244 }
245 if (style->isLeftToRightDirection()) 245 if (style->isLeftToRightDirection())
246 return renderer.borderTop() + renderer.paddingTop(); 246 return renderer.borderTop() + renderer.paddingTop();
247 247
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 345 }
346 346
347 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 347 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
348 { 348 {
349 if (!m_renderer.style()->isHorizontalWritingMode()) 349 if (!m_renderer.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 350 return size.transposedSize();
351 return size; 351 return size;
352 } 352 }
353 353
354 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/shapes/ShapeOutsideInfo.h ('k') | Source/core/layout/style/AppliedTextDecoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698