| OLD | NEW |
| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 sortAndMergeShapeIntervals(result); | 362 sortAndMergeShapeIntervals(result); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void PolygonShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logica
lHeight, SegmentList& result) const | 365 void PolygonShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logica
lHeight, SegmentList& result) const |
| 366 { | 366 { |
| 367 const FloatPolygon& polygon = shapeMarginBounds(); | 367 const FloatPolygon& polygon = shapeMarginBounds(); |
| 368 if (polygon.isEmpty()) | 368 if (polygon.isEmpty()) |
| 369 return; | 369 return; |
| 370 | 370 |
| 371 float y1 = logicalTop; | 371 float y1 = logicalTop.toFloat(); |
| 372 float y2 = logicalTop + logicalHeight; | 372 float y2 = (logicalTop + logicalHeight).toFloat(); |
| 373 | 373 |
| 374 FloatShapeIntervals y1XIntervals, y2XIntervals; | 374 FloatShapeIntervals y1XIntervals, y2XIntervals; |
| 375 computeXIntersections(polygon, y1, true, y1XIntervals); | 375 computeXIntersections(polygon, y1, true, y1XIntervals); |
| 376 computeXIntersections(polygon, y2, false, y2XIntervals); | 376 computeXIntersections(polygon, y2, false, y2XIntervals); |
| 377 | 377 |
| 378 FloatShapeIntervals mergedIntervals; | 378 FloatShapeIntervals mergedIntervals; |
| 379 FloatShapeInterval::uniteShapeIntervals(y1XIntervals, y2XIntervals, mergedIn
tervals); | 379 FloatShapeInterval::uniteShapeIntervals(y1XIntervals, y2XIntervals, mergedIn
tervals); |
| 380 | 380 |
| 381 FloatShapeIntervals edgeIntervals; | 381 FloatShapeIntervals edgeIntervals; |
| 382 computeOverlappingEdgeXProjections(polygon, y1, y2, edgeIntervals); | 382 computeOverlappingEdgeXProjections(polygon, y1, y2, edgeIntervals); |
| 383 | 383 |
| 384 FloatShapeIntervals excludedIntervals; | 384 FloatShapeIntervals excludedIntervals; |
| 385 FloatShapeInterval::uniteShapeIntervals(mergedIntervals, edgeIntervals, excl
udedIntervals); | 385 FloatShapeInterval::uniteShapeIntervals(mergedIntervals, edgeIntervals, excl
udedIntervals); |
| 386 | 386 |
| 387 for (unsigned i = 0; i < excludedIntervals.size(); ++i) { | 387 for (unsigned i = 0; i < excludedIntervals.size(); ++i) { |
| 388 const FloatShapeInterval& interval = excludedIntervals[i]; | 388 const FloatShapeInterval& interval = excludedIntervals[i]; |
| 389 result.append(LineSegment(interval.x1(), interval.x2())); | 389 result.append(LineSegment(interval.x1(), interval.x2())); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 void PolygonShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logica
lHeight, SegmentList& result) const | 393 void PolygonShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logica
lHeight, SegmentList& result) const |
| 394 { | 394 { |
| 395 const FloatPolygon& polygon = shapePaddingBounds(); | 395 const FloatPolygon& polygon = shapePaddingBounds(); |
| 396 if (polygon.isEmpty()) | 396 if (polygon.isEmpty()) |
| 397 return; | 397 return; |
| 398 | 398 |
| 399 float y1 = logicalTop; | 399 float y1 = logicalTop.toFloat(); |
| 400 float y2 = logicalTop + logicalHeight; | 400 float y2 = (logicalTop + logicalHeight).toFloat(); |
| 401 | 401 |
| 402 FloatShapeIntervals y1XIntervals, y2XIntervals; | 402 FloatShapeIntervals y1XIntervals, y2XIntervals; |
| 403 computeXIntersections(polygon, y1, true, y1XIntervals); | 403 computeXIntersections(polygon, y1, true, y1XIntervals); |
| 404 computeXIntersections(polygon, y2, false, y2XIntervals); | 404 computeXIntersections(polygon, y2, false, y2XIntervals); |
| 405 | 405 |
| 406 FloatShapeIntervals commonIntervals; | 406 FloatShapeIntervals commonIntervals; |
| 407 FloatShapeInterval::intersectShapeIntervals(y1XIntervals, y2XIntervals, comm
onIntervals); | 407 FloatShapeInterval::intersectShapeIntervals(y1XIntervals, y2XIntervals, comm
onIntervals); |
| 408 | 408 |
| 409 FloatShapeIntervals edgeIntervals; | 409 FloatShapeIntervals edgeIntervals; |
| 410 computeOverlappingEdgeXProjections(polygon, y1, y2, edgeIntervals); | 410 computeOverlappingEdgeXProjections(polygon, y1, y2, edgeIntervals); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 437 { | 437 { |
| 438 if (r1.y() < r2.y()) | 438 if (r1.y() < r2.y()) |
| 439 return true; | 439 return true; |
| 440 if (r1.y() == r2.y()) | 440 if (r1.y() == r2.y()) |
| 441 return r1.x() < r2.x(); | 441 return r1.x() < r2.x(); |
| 442 return false; | 442 return false; |
| 443 } | 443 } |
| 444 | 444 |
| 445 bool PolygonShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalInterval
Top, const FloatSize& minLogicalIntervalSize, LayoutUnit& result) const | 445 bool PolygonShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalInterval
Top, const FloatSize& minLogicalIntervalSize, LayoutUnit& result) const |
| 446 { | 446 { |
| 447 float minIntervalTop = minLogicalIntervalTop; | 447 float minIntervalTop = minLogicalIntervalTop.toFloat(); |
| 448 float minIntervalHeight = minLogicalIntervalSize.height(); | 448 float minIntervalHeight = minLogicalIntervalSize.height(); |
| 449 float minIntervalWidth = minLogicalIntervalSize.width(); | 449 float minIntervalWidth = minLogicalIntervalSize.width(); |
| 450 | 450 |
| 451 const FloatPolygon& polygon = shapePaddingBounds(); | 451 const FloatPolygon& polygon = shapePaddingBounds(); |
| 452 const FloatRect boundingBox = polygon.boundingBox(); | 452 const FloatRect boundingBox = polygon.boundingBox(); |
| 453 if (minIntervalWidth > boundingBox.width()) | 453 if (minIntervalWidth > boundingBox.width()) |
| 454 return false; | 454 return false; |
| 455 | 455 |
| 456 float minY = std::max(boundingBox.y(), minIntervalTop); | 456 float minY = std::max(boundingBox.y(), minIntervalTop); |
| 457 float maxY = minY + minIntervalHeight; | 457 float maxY = minY + minIntervalHeight; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 if (firstFitFound) | 525 if (firstFitFound) |
| 526 result = LayoutUnit::fromFloatCeil(firstFitRect.y()); | 526 result = LayoutUnit::fromFloatCeil(firstFitRect.y()); |
| 527 return firstFitFound; | 527 return firstFitFound; |
| 528 } | 528 } |
| 529 | 529 |
| 530 } // namespace WebCore | 530 } // namespace WebCore |
| OLD | NEW |