Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / shapes / Shape.cpp
index 81db5bd..4cfdbda 100644 (file)
@@ -94,7 +94,7 @@ static inline FloatSize physicalSizeToLogical(const FloatSize& size, WritingMode
     return size.transposedSize();
 }
 
-PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, Length margin, Length padding)
+PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin)
 {
     ASSERT(basicShape);
 
@@ -169,13 +169,12 @@ PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS
     }
 
     shape->m_writingMode = writingMode;
-    shape->m_margin = floatValueForLength(margin, 0);
-    shape->m_padding = floatValueForLength(padding, 0);
+    shape->m_margin = margin;
 
     return shape.release();
 }
 
-PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, Length margin, Length padding)
+PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin)
 {
     IntRect imageRect = pixelSnappedIntRect(imageR);
     IntRect marginRect = pixelSnappedIntRect(marginR);
@@ -203,7 +202,8 @@ PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const
                 if (startX == -1 && alphaAboveThreshold) {
                     startX = x;
                 } else if (startX != -1 && (!alphaAboveThreshold || x == imageRect.width() - 1)) {
-                    intervals->appendInterval(y + imageRect.y(), startX + imageRect.x(), x + imageRect.x());
+                    int endX = alphaAboveThreshold ? x + 1 : x;
+                    intervals->intervalAt(y + imageRect.y()).unite(IntShapeInterval(startX + imageRect.x(), endX + imageRect.x()));
                     startX = -1;
                 }
             }
@@ -212,19 +212,17 @@ PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const
 
     OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release(), marginRect.size()));
     rasterShape->m_writingMode = writingMode;
-    rasterShape->m_margin = floatValueForLength(margin, 0);
-    rasterShape->m_padding = floatValueForLength(padding, 0);
+    rasterShape->m_margin = margin;
     return rasterShape.release();
 }
 
-PassOwnPtr<Shape> Shape::createLayoutBoxShape(const RoundedRect& roundedRect, WritingMode writingMode, const Length& margin, const Length& padding)
+PassOwnPtr<Shape> Shape::createLayoutBoxShape(const RoundedRect& roundedRect, WritingMode writingMode, float margin)
 {
     FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
     FloatRoundedRect bounds(rect, roundedRect.radii());
     OwnPtr<Shape> shape = createInsetShape(bounds);
     shape->m_writingMode = writingMode;
-    shape->m_margin = floatValueForLength(margin, 0);
-    shape->m_padding = floatValueForLength(padding, 0);
+    shape->m_margin = margin;
 
     return shape.release();
 }