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

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

Issue 2430313004: Paint collapsed borders of a table as one display item (Closed)
Patch Set: - Created 4 years, 1 month 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
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 "core/paint/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "core/layout/LayoutInline.h" 8 #include "core/layout/LayoutInline.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ClipPathClipper.h" 10 #include "core/paint/ClipPathClipper.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 static ShouldRespectOverflowClipType shouldRespectOverflowClip( 57 static ShouldRespectOverflowClipType shouldRespectOverflowClip(
58 PaintLayerFlags paintFlags, 58 PaintLayerFlags paintFlags,
59 const LayoutObject* layoutObject) { 59 const LayoutObject* layoutObject) {
60 return (paintFlags & PaintLayerPaintingOverflowContents || 60 return (paintFlags & PaintLayerPaintingOverflowContents ||
61 (paintFlags & PaintLayerPaintingChildClippingMaskPhase && 61 (paintFlags & PaintLayerPaintingChildClippingMaskPhase &&
62 layoutObject->hasClipPath())) 62 layoutObject->hasClipPath()))
63 ? IgnoreOverflowClip 63 ? IgnoreOverflowClip
64 : RespectOverflowClip; 64 : RespectOverflowClip;
65 } 65 }
66 66
67 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayer( 67 PaintResult PaintLayerPainter::paintLayer(
68 GraphicsContext& context, 68 GraphicsContext& context,
69 const PaintLayerPaintingInfo& paintingInfo, 69 const PaintLayerPaintingInfo& paintingInfo,
70 PaintLayerFlags paintFlags) { 70 PaintLayerFlags paintFlags) {
71 // https://code.google.com/p/chromium/issues/detail?id=343772 71 // https://code.google.com/p/chromium/issues/detail?id=343772
72 DisableCompositingQueryAsserts disabler; 72 DisableCompositingQueryAsserts disabler;
73 73
74 if (m_paintLayer.compositingState() != NotComposited) { 74 if (m_paintLayer.compositingState() != NotComposited) {
75 if (paintingInfo.getGlobalPaintFlags() & 75 if (paintingInfo.getGlobalPaintFlags() &
76 GlobalPaintFlattenCompositingLayers) { 76 GlobalPaintFlattenCompositingLayers) {
77 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's 77 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's
(...skipping 26 matching lines...) Expand all
104 paintFlags |= PaintLayerHaveTransparency; 104 paintFlags |= PaintLayerHaveTransparency;
105 105
106 if (m_paintLayer.paintsWithTransform(paintingInfo.getGlobalPaintFlags()) && 106 if (m_paintLayer.paintsWithTransform(paintingInfo.getGlobalPaintFlags()) &&
107 !(paintFlags & PaintLayerAppliedTransform)) 107 !(paintFlags & PaintLayerAppliedTransform))
108 return paintLayerWithTransform(context, paintingInfo, paintFlags); 108 return paintLayerWithTransform(context, paintingInfo, paintFlags);
109 109
110 return paintLayerContentsCompositingAllPhases(context, paintingInfo, 110 return paintLayerContentsCompositingAllPhases(context, paintingInfo,
111 paintFlags); 111 paintFlags);
112 } 112 }
113 113
114 PaintLayerPainter::PaintResult 114 PaintResult PaintLayerPainter::paintLayerContentsCompositingAllPhases(
115 PaintLayerPainter::paintLayerContentsCompositingAllPhases(
116 GraphicsContext& context, 115 GraphicsContext& context,
117 const PaintLayerPaintingInfo& paintingInfo, 116 const PaintLayerPaintingInfo& paintingInfo,
118 PaintLayerFlags paintFlags, 117 PaintLayerFlags paintFlags,
119 FragmentPolicy fragmentPolicy) { 118 FragmentPolicy fragmentPolicy) {
120 DCHECK(m_paintLayer.isSelfPaintingLayer() || 119 DCHECK(m_paintLayer.isSelfPaintingLayer() ||
121 m_paintLayer.hasSelfPaintingLayerDescendant()); 120 m_paintLayer.hasSelfPaintingLayerDescendant());
122 121
123 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform); 122 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform);
124 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; 123 localPaintFlags |= PaintLayerPaintingCompositingAllPhases;
125 return paintLayerContents(context, paintingInfo, localPaintFlags, 124 return paintLayerContents(context, paintingInfo, localPaintFlags,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (&clipRects != previousClipRects && 200 if (&clipRects != previousClipRects &&
202 (!previousClipRects || clipRects != *previousClipRects)) { 201 (!previousClipRects || clipRects != *previousClipRects)) {
203 needsRepaint = true; 202 needsRepaint = true;
204 shouldClearEmptyPaintPhaseFlags = true; 203 shouldClearEmptyPaintPhaseFlags = true;
205 } 204 }
206 paintLayer.setPreviousPaintingClipRects(clipRects); 205 paintLayer.setPreviousPaintingClipRects(clipRects);
207 } 206 }
208 207
209 // Repaint if previously the layer might be clipped by paintDirtyRect and 208 // Repaint if previously the layer might be clipped by paintDirtyRect and
210 // paintDirtyRect changes. 209 // paintDirtyRect changes.
211 if (paintLayer.previousPaintResult() == 210 if (paintLayer.previousPaintResult() == MayBeClippedByPaintDirtyRect &&
212 PaintLayerPainter::MayBeClippedByPaintDirtyRect &&
213 paintLayer.previousPaintDirtyRect() != paintingInfo.paintDirtyRect) { 211 paintLayer.previousPaintDirtyRect() != paintingInfo.paintDirtyRect) {
214 needsRepaint = true; 212 needsRepaint = true;
215 shouldClearEmptyPaintPhaseFlags = true; 213 shouldClearEmptyPaintPhaseFlags = true;
216 } 214 }
217 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect); 215 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect);
218 216
219 // Repaint if scroll offset accumulation changes. 217 // Repaint if scroll offset accumulation changes.
220 if (paintingInfo.scrollOffsetAccumulation != 218 if (paintingInfo.scrollOffsetAccumulation !=
221 paintLayer.previousScrollOffsetAccumulationForPainting()) { 219 paintLayer.previousScrollOffsetAccumulationForPainting()) {
222 needsRepaint = true; 220 needsRepaint = true;
223 shouldClearEmptyPaintPhaseFlags = true; 221 shouldClearEmptyPaintPhaseFlags = true;
224 } 222 }
225 paintLayer.setPreviousScrollOffsetAccumulationForPainting( 223 paintLayer.setPreviousScrollOffsetAccumulationForPainting(
226 paintingInfo.scrollOffsetAccumulation); 224 paintingInfo.scrollOffsetAccumulation);
227 225
228 return needsRepaint; 226 return needsRepaint;
229 } 227 }
230 228
231 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents( 229 PaintResult PaintLayerPainter::paintLayerContents(
232 GraphicsContext& context, 230 GraphicsContext& context,
233 const PaintLayerPaintingInfo& paintingInfoArg, 231 const PaintLayerPaintingInfo& paintingInfoArg,
234 PaintLayerFlags paintFlags, 232 PaintLayerFlags paintFlags,
235 FragmentPolicy fragmentPolicy) { 233 FragmentPolicy fragmentPolicy) {
236 DCHECK(m_paintLayer.isSelfPaintingLayer() || 234 DCHECK(m_paintLayer.isSelfPaintingLayer() ||
237 m_paintLayer.hasSelfPaintingLayerDescendant()); 235 m_paintLayer.hasSelfPaintingLayerDescendant());
238 DCHECK(!(paintFlags & PaintLayerAppliedTransform)); 236 DCHECK(!(paintFlags & PaintLayerAppliedTransform));
239 237
240 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); 238 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer();
241 bool isPaintingOverlayScrollbars = 239 bool isPaintingOverlayScrollbars =
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // fragment.layerBounds is set to the border box, not the bounding box, of 541 // fragment.layerBounds is set to the border box, not the bounding box, of
544 // the layer. 542 // the layer.
545 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, 543 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds,
546 fragment.backgroundRect.rect(), 544 fragment.backgroundRect.rect(),
547 newOffsetFromRoot)) 545 newOffsetFromRoot))
548 return true; 546 return true;
549 } 547 }
550 return false; 548 return false;
551 } 549 }
552 550
553 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform( 551 PaintResult PaintLayerPainter::paintLayerWithTransform(
554 GraphicsContext& context, 552 GraphicsContext& context,
555 const PaintLayerPaintingInfo& paintingInfo, 553 const PaintLayerPaintingInfo& paintingInfo,
556 PaintLayerFlags paintFlags) { 554 PaintLayerFlags paintFlags) {
557 TransformationMatrix layerTransform = 555 TransformationMatrix layerTransform =
558 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags()); 556 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags());
559 // If the transform can't be inverted, then don't paint anything. 557 // If the transform can't be inverted, then don't paint anything.
560 if (!layerTransform.isInvertible()) 558 if (!layerTransform.isInvertible())
561 return FullyPainted; 559 return FullyPainted;
562 560
563 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer 561 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 671 }
674 } 672 }
675 if (paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, 673 if (paintFragmentByApplyingTransform(context, paintingInfo, paintFlags,
676 fragment.paginationOffset) == 674 fragment.paginationOffset) ==
677 MayBeClippedByPaintDirtyRect) 675 MayBeClippedByPaintDirtyRect)
678 result = MayBeClippedByPaintDirtyRect; 676 result = MayBeClippedByPaintDirtyRect;
679 } 677 }
680 return result; 678 return result;
681 } 679 }
682 680
683 PaintLayerPainter::PaintResult 681 PaintResult PaintLayerPainter::paintFragmentByApplyingTransform(
684 PaintLayerPainter::paintFragmentByApplyingTransform(
685 GraphicsContext& context, 682 GraphicsContext& context,
686 const PaintLayerPaintingInfo& paintingInfo, 683 const PaintLayerPaintingInfo& paintingInfo,
687 PaintLayerFlags paintFlags, 684 PaintLayerFlags paintFlags,
688 const LayoutPoint& fragmentTranslation) { 685 const LayoutPoint& fragmentTranslation) {
689 // This involves subtracting out the position of the layer in our current 686 // This involves subtracting out the position of the layer in our current
690 // coordinate space, but preserving the accumulated error for sub-pixel 687 // coordinate space, but preserving the accumulated error for sub-pixel
691 // layout. 688 // layout.
692 LayoutPoint delta; 689 LayoutPoint delta;
693 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); 690 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
694 delta.moveBy(fragmentTranslation); 691 delta.moveBy(fragmentTranslation);
(...skipping 20 matching lines...) Expand all
715 paintingInfo.ancestorHasClipPathClipping; 712 paintingInfo.ancestorHasClipPathClipping;
716 713
717 // Remove skip root background flag when we're painting with a new root. 714 // Remove skip root background flag when we're painting with a new root.
718 if (&m_paintLayer != paintingInfo.rootLayer) 715 if (&m_paintLayer != paintingInfo.rootLayer)
719 paintFlags &= ~PaintLayerPaintingSkipRootBackground; 716 paintFlags &= ~PaintLayerPaintingSkipRootBackground;
720 717
721 return paintLayerContentsCompositingAllPhases( 718 return paintLayerContentsCompositingAllPhases(
722 context, transformedPaintingInfo, paintFlags, ForceSingleFragment); 719 context, transformedPaintingInfo, paintFlags, ForceSingleFragment);
723 } 720 }
724 721
725 PaintLayerPainter::PaintResult PaintLayerPainter::paintChildren( 722 PaintResult PaintLayerPainter::paintChildren(
726 unsigned childrenToVisit, 723 unsigned childrenToVisit,
727 GraphicsContext& context, 724 GraphicsContext& context,
728 const PaintLayerPaintingInfo& paintingInfo, 725 const PaintLayerPaintingInfo& paintingInfo,
729 PaintLayerFlags paintFlags) { 726 PaintLayerFlags paintFlags) {
730 PaintResult result = FullyPainted; 727 PaintResult result = FullyPainted;
731 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) 728 if (!m_paintLayer.hasSelfPaintingLayerDescendant())
732 return result; 729 return result;
733 730
734 #if ENABLE(ASSERT) 731 #if ENABLE(ASSERT)
735 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); 732 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1068
1072 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, 1069 PaintLayerPaintingInfo paintingInfo(&m_paintLayer,
1073 LayoutRect(enclosingIntRect(damageRect)), 1070 LayoutRect(enclosingIntRect(damageRect)),
1074 paintFlags, LayoutSize()); 1071 paintFlags, LayoutSize());
1075 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 1072 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
1076 1073
1077 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 1074 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
1078 } 1075 }
1079 1076
1080 } // namespace blink 1077 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698