| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/ObjectPainter.h" | 5 #include "core/paint/ObjectPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
| 10 #include "core/layout/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 m_layoutObject.document().baseURL())) { | 331 m_layoutObject.document().baseURL())) { |
| 332 String fragmentName = url.fragmentIdentifier(); | 332 String fragmentName = url.fragmentIdentifier(); |
| 333 if (m_layoutObject.document().findAnchor(fragmentName)) | 333 if (m_layoutObject.document().findAnchor(fragmentName)) |
| 334 paintInfo.context.setURLFragmentForRect(fragmentName, rect); | 334 paintInfo.context.setURLFragmentForRect(fragmentName, rect); |
| 335 return; | 335 return; |
| 336 } | 336 } |
| 337 paintInfo.context.setURLForRect(url, rect); | 337 paintInfo.context.setURLForRect(url, rect); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void ObjectPainter::drawLineForBoxSide(GraphicsContext& graphicsContext, | 340 void ObjectPainter::drawLineForBoxSide(GraphicsContext& graphicsContext, |
| 341 int x1, | 341 float x1, |
| 342 int y1, | 342 float y1, |
| 343 int x2, | 343 float x2, |
| 344 int y2, | 344 float y2, |
| 345 BoxSide side, | 345 BoxSide side, |
| 346 Color color, | 346 Color color, |
| 347 EBorderStyle style, | 347 EBorderStyle style, |
| 348 int adjacentWidth1, | 348 int adjacentWidth1, |
| 349 int adjacentWidth2, | 349 int adjacentWidth2, |
| 350 bool antialias) { | 350 bool antialias) { |
| 351 int thickness; | 351 float thickness; |
| 352 int length; | 352 float length; |
| 353 if (side == BSTop || side == BSBottom) { | 353 if (side == BSTop || side == BSBottom) { |
| 354 thickness = y2 - y1; | 354 thickness = y2 - y1; |
| 355 length = x2 - x1; | 355 length = x2 - x1; |
| 356 } else { | 356 } else { |
| 357 thickness = x2 - x1; | 357 thickness = x2 - x1; |
| 358 length = y2 - y1; | 358 length = y2 - y1; |
| 359 } | 359 } |
| 360 | 360 |
| 361 // We would like this check to be an ASSERT as we don't want to draw empty | 361 // We would like this check to be an ASSERT as we don't want to draw empty |
| 362 // borders. However nothing guarantees that the following recursive calls to | 362 // borders. However nothing guarantees that the following recursive calls to |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 442 } |
| 443 | 443 |
| 444 void ObjectPainter::drawDoubleBoxSide(GraphicsContext& graphicsContext, | 444 void ObjectPainter::drawDoubleBoxSide(GraphicsContext& graphicsContext, |
| 445 int x1, | 445 int x1, |
| 446 int y1, | 446 int y1, |
| 447 int x2, | 447 int x2, |
| 448 int y2, | 448 int y2, |
| 449 int length, | 449 int length, |
| 450 BoxSide side, | 450 BoxSide side, |
| 451 Color color, | 451 Color color, |
| 452 int thickness, | 452 float thickness, |
| 453 int adjacentWidth1, | 453 int adjacentWidth1, |
| 454 int adjacentWidth2, | 454 int adjacentWidth2, |
| 455 bool antialias) { | 455 bool antialias) { |
| 456 int thirdOfThickness = (thickness + 1) / 3; | 456 int thirdOfThickness = (thickness + 1) / 3; |
| 457 DCHECK_GT(thirdOfThickness, 0); | 457 DCHECK_GT(thirdOfThickness, 0); |
| 458 | 458 |
| 459 if (!adjacentWidth1 && !adjacentWidth2) { | 459 if (!adjacentWidth1 && !adjacentWidth2) { |
| 460 StrokeStyle oldStrokeStyle = graphicsContext.getStrokeStyle(); | 460 StrokeStyle oldStrokeStyle = graphicsContext.getStrokeStyle(); |
| 461 graphicsContext.setStrokeStyle(NoStroke); | 461 graphicsContext.setStrokeStyle(NoStroke); |
| 462 graphicsContext.setFillColor(color); | 462 graphicsContext.setFillColor(color); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 adjustedPaintOffset += toLayoutBox(m_layoutObject).location(); | 709 adjustedPaintOffset += toLayoutBox(m_layoutObject).location(); |
| 710 DCHECK(m_layoutObject.paintOffset() == adjustedPaintOffset) | 710 DCHECK(m_layoutObject.paintOffset() == adjustedPaintOffset) |
| 711 << " Paint offset mismatch: " << m_layoutObject.debugName() | 711 << " Paint offset mismatch: " << m_layoutObject.debugName() |
| 712 << " from PaintPropertyTreeBuilder: " | 712 << " from PaintPropertyTreeBuilder: " |
| 713 << m_layoutObject.paintOffset().toString() | 713 << m_layoutObject.paintOffset().toString() |
| 714 << " from painter: " << adjustedPaintOffset.toString(); | 714 << " from painter: " << adjustedPaintOffset.toString(); |
| 715 } | 715 } |
| 716 #endif | 716 #endif |
| 717 | 717 |
| 718 } // namespace blink | 718 } // namespace blink |
| OLD | NEW |