Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/paint/ReplicaPainter.cpp

Issue 1391943005: Document reflection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the TODO. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/ReplicaPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ReplicaPainter.h" 6 #include "core/paint/ReplicaPainter.h"
7 7
8 #include "core/layout/LayoutReplica.h" 8 #include "core/layout/LayoutReplica.h"
9 #include "core/paint/LayoutObjectDrawingRecorder.h" 9 #include "core/paint/LayoutObjectDrawingRecorder.h"
10 #include "core/paint/PaintInfo.h" 10 #include "core/paint/PaintInfo.h"
11 #include "core/paint/PaintLayer.h" 11 #include "core/paint/PaintLayer.h"
12 #include "core/paint/PaintLayerPainter.h" 12 #include "core/paint/PaintLayerPainter.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 16 void ReplicaPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
17 { 17 {
18 // PaintLayerReflectionInfo should have set a transform on the LayoutReplica .
19 // Without it, we won't paint the reflection correctly.
20 ASSERT(m_layoutReplica.layer()->transform());
21
18 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Mask) 22 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Mask)
19 return; 23 return;
20 24
21 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplica.location(); 25 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplica.location();
22 26
23 if (paintInfo.phase == PaintPhaseForeground) { 27 if (paintInfo.phase == PaintPhaseForeground) {
24 // Turn around and paint the parent layer. Use temporary clipRects, so t hat the layer doesn't end up caching clip rects 28 // Turn around and paint the parent layer. Use temporary clipRects, so t hat the layer doesn't end up caching clip rects
25 // computing using the wrong rootLayer 29 // computing using the wrong rootLayer
26 PaintLayer* rootPaintingLayer = m_layoutReplica.layer()->transform() ? m _layoutReplica.layer()->parent() : m_layoutReplica.layer()->enclosingTransformed Ancestor(); 30 PaintLayer* rootPaintingLayer = m_layoutReplica.layer()->parent();
27 PaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintI nfo.rect), GlobalPaintNormalPhase, LayoutSize(), 0); 31 PaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintI nfo.rect), GlobalPaintNormalPhase, LayoutSize(), 0);
28 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection; 32 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr ansform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection;
29 PaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintIn fo.context, paintingInfo, flags); 33 PaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintIn fo.context, paintingInfo, flags);
30 } else if (paintInfo.phase == PaintPhaseMask) { 34 } else if (paintInfo.phase == PaintPhaseMask) {
31 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset); 35 m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset);
32 } 36 }
33 } 37 }
34 38
35 } // namespace blink 39 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ReplicaPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698