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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/LayerPainter.h" | 6 #include "core/paint/LayerPainter.h" |
7 | 7 |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/layout/ClipPathOperation.h" | 9 #include "core/layout/ClipPathOperation.h" |
10 #include "core/layout/FilterEffectRenderer.h" | 10 #include "core/layout/FilterEffectRenderer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 35 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
36 // will do a full paintInvalidationForWholeRenderer(). | 36 // will do a full paintInvalidationForWholeRenderer(). |
37 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) | 37 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) |
38 return true; | 38 return true; |
39 | 39 |
40 return false; | 40 return false; |
41 } | 41 } |
42 | 42 |
43 void LayerPainter::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, LayoutObject* paintingRoot, PaintLayerFlags paintF
lags) | 43 void LayerPainter::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, LayoutObject* paintingRoot, PaintLayerFlags paintF
lags) |
44 { | 44 { |
45 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 45 LayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enclosingIntRect(d
amageRect)), paintBehavior, LayoutSize(), paintingRoot); |
46 if (shouldPaintLayerInSoftwareMode(paintingInfo, paintFlags)) | 46 if (shouldPaintLayerInSoftwareMode(paintingInfo, paintFlags)) |
47 paintLayer(context, paintingInfo, paintFlags); | 47 paintLayer(context, paintingInfo, paintFlags); |
48 } | 48 } |
49 | 49 |
50 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* renderer) | 50 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const LayoutObject* renderer) |
51 { | 51 { |
52 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf
lowClip : RespectOverflowClip; | 52 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf
lowClip : RespectOverflowClip; |
53 } | 53 } |
54 | 54 |
55 void LayerPainter::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 55 void LayerPainter::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); | 390 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); |
391 delta.moveBy(fragmentTranslation); | 391 delta.moveBy(fragmentTranslation); |
392 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf
o.paintBehavior)); | 392 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf
o.paintBehavior)); |
393 IntPoint roundedDelta = roundedIntPoint(delta); | 393 IntPoint roundedDelta = roundedIntPoint(delta); |
394 transform.translateRight(roundedDelta.x(), roundedDelta.y()); | 394 transform.translateRight(roundedDelta.x(), roundedDelta.y()); |
395 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); | 395 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); |
396 | 396 |
397 Transform3DRecorder transform3DRecorder(*context, m_renderLayer.renderer()->
displayItemClient(), transform); | 397 Transform3DRecorder transform3DRecorder(*context, m_renderLayer.renderer()->
displayItemClient(), transform); |
398 | 398 |
399 // Now do a paint with the root layer shifted to be us. | 399 // Now do a paint with the root layer shifted to be us. |
400 LayerPaintingInfo transformedPaintingInfo(&m_renderLayer, enclosingIntRect(t
ransform.inverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBeha
vior, | 400 LayerPaintingInfo transformedPaintingInfo(&m_renderLayer, LayoutRect(enclosi
ngIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), paintingIn
fo.paintBehavior, |
401 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); | 401 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); |
402 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
, ForceSingleFragment); | 402 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
, ForceSingleFragment); |
403 } | 403 } |
404 | 404 |
405 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont
ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 405 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont
ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
406 { | 406 { |
407 if (!m_renderLayer.hasSelfPaintingLayerDescendant()) | 407 if (!m_renderLayer.hasSelfPaintingLayerDescendant()) |
408 return; | 408 return; |
409 | 409 |
410 #if ENABLE(ASSERT) | 410 #if ENABLE(ASSERT) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } | 549 } |
550 | 550 |
551 colRect.moveBy(layerOffset); | 551 colRect.moveBy(layerOffset); |
552 | 552 |
553 LayoutRect localDirtyRect(paintingInfo.paintDirtyRect); | 553 LayoutRect localDirtyRect(paintingInfo.paintDirtyRect); |
554 localDirtyRect.intersect(colRect); | 554 localDirtyRect.intersect(colRect); |
555 | 555 |
556 if (!localDirtyRect.isEmpty()) { | 556 if (!localDirtyRect.isEmpty()) { |
557 // Each strip pushes a clip, since column boxes are specified as bei
ng | 557 // Each strip pushes a clip, since column boxes are specified as bei
ng |
558 // like overflow:hidden. | 558 // like overflow:hidden. |
559 ClipRecorder clipRecorder(m_renderLayer.renderer()->displayItemClien
t(), context, DisplayItem::ClipLayerColumnBounds, enclosingIntRect(colRect)); | 559 ClipRecorder clipRecorder(m_renderLayer.renderer()->displayItemClien
t(), context, DisplayItem::ClipLayerColumnBounds, LayoutRect(enclosingIntRect(co
lRect))); |
560 | 560 |
561 if (!colIndex) { | 561 if (!colIndex) { |
562 // Apply a translation transform to change where the layer paint
s. | 562 // Apply a translation transform to change where the layer paint
s. |
563 TransformationMatrix oldTransform; | 563 TransformationMatrix oldTransform; |
564 bool oldHasTransform = m_renderLayer.transform(); | 564 bool oldHasTransform = m_renderLayer.transform(); |
565 if (oldHasTransform) | 565 if (oldHasTransform) |
566 oldTransform = *m_renderLayer.transform(); | 566 oldTransform = *m_renderLayer.transform(); |
567 TransformationMatrix newTransform(oldTransform); | 567 TransformationMatrix newTransform(oldTransform); |
568 newTransform.translateRight(roundToInt(offset.width()), roundToI
nt(offset.height())); | 568 newTransform.translateRight(roundToInt(offset.width()), roundToI
nt(offset.height())); |
569 | 569 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); | 701 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); |
702 paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragme
nt.foregroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForRender
er, paintFlags, HasNotClipped); | 702 paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragme
nt.foregroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForRender
er, paintFlags, HasNotClipped); |
703 } | 703 } |
704 } | 704 } |
705 | 705 |
706 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout
Rect& damageRect, PaintBehavior paintBehavior, LayoutObject* paintingRoot) | 706 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout
Rect& damageRect, PaintBehavior paintBehavior, LayoutObject* paintingRoot) |
707 { | 707 { |
708 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 708 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
709 return; | 709 return; |
710 | 710 |
711 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 711 LayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enclosingIntRect(d
amageRect)), paintBehavior, LayoutSize(), paintingRoot); |
712 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 712 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
713 | 713 |
714 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 714 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
715 } | 715 } |
716 | 716 |
717 } // namespace blink | 717 } // namespace blink |
OLD | NEW |