| 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/InlineFlowBoxPainter.h" | 5 #include "core/paint/InlineFlowBoxPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/api/LineLayoutAPIShim.h" | 7 #include "core/layout/api/LineLayoutAPIShim.h" |
| 8 #include "core/layout/line/RootInlineBox.h" | 8 #include "core/layout/line/RootInlineBox.h" |
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 m_inlineFlowBox.flipForWritingMode(localRect); | 343 m_inlineFlowBox.flipForWritingMode(localRect); |
| 344 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 344 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
| 345 | 345 |
| 346 const NinePieceImage& maskNinePieceImage = | 346 const NinePieceImage& maskNinePieceImage = |
| 347 m_inlineFlowBox.getLineLayoutItem().style()->maskBoxImage(); | 347 m_inlineFlowBox.getLineLayoutItem().style()->maskBoxImage(); |
| 348 StyleImage* maskBoxImage = | 348 StyleImage* maskBoxImage = |
| 349 m_inlineFlowBox.getLineLayoutItem().style()->maskBoxImage().image(); | 349 m_inlineFlowBox.getLineLayoutItem().style()->maskBoxImage().image(); |
| 350 | 350 |
| 351 // Figure out if we need to push a transparency layer to render our mask. | 351 // Figure out if we need to push a transparency layer to render our mask. |
| 352 bool pushTransparencyLayer = false; | 352 bool pushTransparencyLayer = false; |
| 353 bool compositedMask = | |
| 354 m_inlineFlowBox.getLineLayoutItem().hasLayer() && | |
| 355 m_inlineFlowBox.boxModelObject().layer()->hasCompositedMask(); | |
| 356 bool flattenCompositingLayers = | 353 bool flattenCompositingLayers = |
| 357 paintInfo.getGlobalPaintFlags() & GlobalPaintFlattenCompositingLayers; | 354 paintInfo.getGlobalPaintFlags() & GlobalPaintFlattenCompositingLayers; |
| 355 bool maskBlendingAppliedByCompositor = |
| 356 !flattenCompositingLayers && |
| 357 m_inlineFlowBox.getLineLayoutItem().hasLayer() && |
| 358 m_inlineFlowBox.boxModelObject() |
| 359 .layer() |
| 360 ->maskBlendingAppliedByCompositor(); |
| 358 SkBlendMode compositeOp = SkBlendMode::kSrcOver; | 361 SkBlendMode compositeOp = SkBlendMode::kSrcOver; |
| 359 if (!compositedMask || flattenCompositingLayers) { | 362 if (!maskBlendingAppliedByCompositor) { |
| 360 if ((maskBoxImage && | 363 if ((maskBoxImage && |
| 361 m_inlineFlowBox.getLineLayoutItem() | 364 m_inlineFlowBox.getLineLayoutItem() |
| 362 .style() | 365 .style() |
| 363 ->maskLayers() | 366 ->maskLayers() |
| 364 .hasImage()) || | 367 .hasImage()) || |
| 365 m_inlineFlowBox.getLineLayoutItem().style()->maskLayers().next()) { | 368 m_inlineFlowBox.getLineLayoutItem().style()->maskLayers().next()) { |
| 366 pushTransparencyLayer = true; | 369 pushTransparencyLayer = true; |
| 367 paintInfo.context.beginLayer(1.0f, SkBlendMode::kDstIn); | 370 paintInfo.context.beginLayer(1.0f, SkBlendMode::kDstIn); |
| 368 } else { | 371 } else { |
| 369 // TODO(fmalita): passing a dst-in xfer mode down to | 372 // TODO(fmalita): passing a dst-in xfer mode down to |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 rect.setHeight(logicalHeight); | 445 rect.setHeight(logicalHeight); |
| 443 } else { | 446 } else { |
| 444 rect.setX(logicalTop); | 447 rect.setX(logicalTop); |
| 445 rect.setWidth(logicalHeight); | 448 rect.setWidth(logicalHeight); |
| 446 } | 449 } |
| 447 } | 450 } |
| 448 return rect; | 451 return rect; |
| 449 } | 452 } |
| 450 | 453 |
| 451 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |