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

Side by Side Diff: Source/core/rendering/shapes/Shape.h

Issue 226373002: [CSS Shapes] shape-margin in percentage units always computes to 0px (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove webkit prefixes Created 6 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
« no previous file with comments | « Source/core/rendering/shapes/BoxShapeTest.cpp ('k') | Source/core/rendering/shapes/Shape.cpp » ('j') | 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 typedef Vector<LineSegment> SegmentList; 54 typedef Vector<LineSegment> SegmentList;
55 55
56 56
57 // A representation of a BasicShape that enables layout code to determine how to break a line up into segments 57 // A representation of a BasicShape that enables layout code to determine how to break a line up into segments
58 // that will fit within or around a shape. The line is defined by a pair of logi cal Y coordinates and the 58 // that will fit within or around a shape. The line is defined by a pair of logi cal Y coordinates and the
59 // computed segments are returned as pairs of logical X coordinates. The BasicSh ape itself is defined in 59 // computed segments are returned as pairs of logical X coordinates. The BasicSh ape itself is defined in
60 // physical coordinates. 60 // physical coordinates.
61 61
62 class Shape { 62 class Shape {
63 public: 63 public:
64 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo gicalBoxSize, WritingMode, Length margin); 64 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo gicalBoxSize, WritingMode, float margin);
65 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La youtRect& imageRect, const LayoutRect& marginRect, WritingMode, Length margin); 65 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La youtRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin);
66 static PassOwnPtr<Shape> createLayoutBoxShape(const RoundedRect&, WritingMod e, const Length& margin); 66 static PassOwnPtr<Shape> createLayoutBoxShape(const RoundedRect&, WritingMod e, float margin);
67 67
68 virtual ~Shape() { } 68 virtual ~Shape() { }
69 69
70 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0; 70 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0;
71 virtual bool isEmpty() const = 0; 71 virtual bool isEmpty() const = 0;
72 virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalH eight, SegmentList&) const = 0; 72 virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalH eight, SegmentList&) const = 0;
73 73
74 bool lineOverlapsShapeMarginBounds(LayoutUnit lineTop, LayoutUnit lineHeight ) const { return lineOverlapsBoundingBox(lineTop, lineHeight, shapeMarginLogical BoundingBox()); } 74 bool lineOverlapsShapeMarginBounds(LayoutUnit lineTop, LayoutUnit lineHeight ) const { return lineOverlapsBoundingBox(lineTop, lineHeight, shapeMarginLogical BoundingBox()); }
75 75
76 protected: 76 protected:
77 float shapeMargin() const { return m_margin; } 77 float shapeMargin() const { return m_margin; }
78 78
79 private: 79 private:
80 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons t LayoutRect& rect) const 80 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons t LayoutRect& rect) const
81 { 81 {
82 if (rect.isEmpty()) 82 if (rect.isEmpty())
83 return false; 83 return false;
84 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l ineHeight && lineTop == rect.y()); 84 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l ineHeight && lineTop == rect.y());
85 } 85 }
86 86
87 WritingMode m_writingMode; 87 WritingMode m_writingMode;
88 float m_margin; 88 float m_margin;
89 }; 89 };
90 90
91 } // namespace WebCore 91 } // namespace WebCore
92 92
93 #endif // Shape_h 93 #endif // Shape_h
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/BoxShapeTest.cpp ('k') | Source/core/rendering/shapes/Shape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698