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

Side by Side Diff: Source/core/rendering/shapes/ShapeInfo.cpp

Issue 19865002: [CSS Shapes] Port shape-inside on regions and shape's content overflow from WebKit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [CSS Shapes] Port shape-inside on regions and shape's content overflow from WebKit Created 7 years, 4 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 | « Source/core/rendering/shapes/ShapeInfo.h ('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) 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 BasicShape* shape = (shapeValue && shapeValue->type() == ShapeValue::Shape) ? shapeValue->shape() : 0; 45 BasicShape* shape = (shapeValue && shapeValue->type() == ShapeValue::Shape) ? shapeValue->shape() : 0;
46 46
47 ASSERT(shape); 47 ASSERT(shape);
48 48
49 m_shape = Shape::createShape(shape, LayoutSize(m_shapeLogicalWidth, m_shapeL ogicalHeight), m_renderer->style()->writingMode(), m_renderer->style()->shapeMar gin(), m_renderer->style()->shapePadding()); 49 m_shape = Shape::createShape(shape, LayoutSize(m_shapeLogicalWidth, m_shapeL ogicalHeight), m_renderer->style()->writingMode(), m_renderer->style()->shapeMar gin(), m_renderer->style()->shapePadding());
50 ASSERT(m_shape); 50 ASSERT(m_shape);
51 return m_shape.get(); 51 return m_shape.get();
52 } 52 }
53 53
54 template<class RenderType, ShapeValue* (RenderStyle::*shapeGetter)() const, void (Shape::*intervalGetter)(LayoutUnit, LayoutUnit, SegmentList&) const> 54 template<class RenderType, ShapeValue* (RenderStyle::*shapeGetter)() const, void (Shape::*intervalGetter)(LayoutUnit, LayoutUnit, SegmentList&) const>
55 LayoutUnit ShapeInfo<RenderType, shapeGetter, intervalGetter>::logicalTopOffset( ) const
56 {
57 LayoutUnit logicalTopOffset = m_renderer->style()->boxSizing() == CONTENT_BO X ? m_renderer->borderBefore() + m_renderer->paddingBefore() : LayoutUnit();
58 // Content in a flow thread is relative to the beginning of the thread, but the shape calculation should be relative to the current region.
59 if (m_renderer->isRenderRegion())
60 logicalTopOffset += toRenderRegion(m_renderer)->logicalTopForFlowThreadC ontent();
61 return logicalTopOffset;
62 }
63
64 template<class RenderType, ShapeValue* (RenderStyle::*shapeGetter)() const, void (Shape::*intervalGetter)(LayoutUnit, LayoutUnit, SegmentList&) const>
65 bool ShapeInfo<RenderType, shapeGetter, intervalGetter>::computeSegmentsForLine( LayoutUnit lineTop, LayoutUnit lineHeight) 55 bool ShapeInfo<RenderType, shapeGetter, intervalGetter>::computeSegmentsForLine( LayoutUnit lineTop, LayoutUnit lineHeight)
66 { 56 {
67 ASSERT(lineHeight >= 0); 57 ASSERT(lineHeight >= 0);
68 m_shapeLineTop = lineTop - logicalTopOffset(); 58 m_shapeLineTop = lineTop - logicalTopOffset();
69 m_lineHeight = lineHeight; 59 m_lineHeight = lineHeight;
70 m_segments.clear(); 60 m_segments.clear();
71 61
72 if (lineOverlapsShapeBounds()) 62 if (lineOverlapsShapeBounds())
73 (computedShape()->*intervalGetter)(m_shapeLineTop, std::min(m_lineHeight , shapeLogicalBottom() - lineTop), m_segments); 63 (computedShape()->*intervalGetter)(m_shapeLineTop, std::min(m_lineHeight , shapeLogicalBottom() - lineTop), m_segments);
74 64
75 LayoutUnit logicalLeftOffset = this->logicalLeftOffset(); 65 LayoutUnit logicalLeftOffset = this->logicalLeftOffset();
76 for (size_t i = 0; i < m_segments.size(); i++) { 66 for (size_t i = 0; i < m_segments.size(); i++) {
77 m_segments[i].logicalLeft += logicalLeftOffset; 67 m_segments[i].logicalLeft += logicalLeftOffset;
78 m_segments[i].logicalRight += logicalLeftOffset; 68 m_segments[i].logicalRight += logicalLeftOffset;
79 } 69 }
80 70
81 return m_segments.size(); 71 return m_segments.size();
82 } 72 }
83 73
84 template class ShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &Shape: :getIncludedIntervals>; 74 template class ShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &Shape: :getIncludedIntervals>;
85 template class ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExclu dedIntervals>; 75 template class ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExclu dedIntervals>;
86 } 76 }
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/ShapeInfo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698