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

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

Issue 2842983002: [LayoutNG] Paint inlines from the fragment tree
Patch Set: Rebase w/HEAD Created 3 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/RoundedInnerRectClipper.h" 5 #include "core/paint/RoundedInnerRectClipper.h"
6 6
7 #include "core/layout/LayoutObject.h"
8 #include "core/paint/PaintInfo.h" 7 #include "core/paint/PaintInfo.h"
9 #include "platform/graphics/paint/ClipDisplayItem.h" 8 #include "platform/graphics/paint/ClipDisplayItem.h"
10 #include "platform/graphics/paint/PaintController.h" 9 #include "platform/graphics/paint/PaintController.h"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 RoundedInnerRectClipper::RoundedInnerRectClipper( 13 RoundedInnerRectClipper::RoundedInnerRectClipper(
15 const LayoutObject& layout_object, 14 const DisplayItemClient& display_item,
16 const PaintInfo& paint_info, 15 const PaintInfo& paint_info,
17 const LayoutRect& rect, 16 const LayoutRect& rect,
18 const FloatRoundedRect& clip_rect, 17 const FloatRoundedRect& clip_rect,
19 RoundedInnerRectClipperBehavior behavior) 18 RoundedInnerRectClipperBehavior behavior)
20 : layout_object_(layout_object), 19 : display_item_(display_item),
21 paint_info_(paint_info), 20 paint_info_(paint_info),
22 use_paint_controller_(behavior == kApplyToDisplayList), 21 use_paint_controller_(behavior == kApplyToDisplayList),
23 clip_type_(use_paint_controller_ 22 clip_type_(use_paint_controller_
24 ? paint_info_.DisplayItemTypeForClipping() 23 ? paint_info_.DisplayItemTypeForClipping()
25 : DisplayItem::kClipBoxPaintPhaseFirst) { 24 : DisplayItem::kClipBoxPaintPhaseFirst) {
26 Vector<FloatRoundedRect> rounded_rect_clips; 25 Vector<FloatRoundedRect> rounded_rect_clips;
27 if (clip_rect.IsRenderable()) { 26 if (clip_rect.IsRenderable()) {
28 rounded_rect_clips.push_back(clip_rect); 27 rounded_rect_clips.push_back(clip_rect);
29 } else { 28 } else {
30 // We create a rounded rect for each of the corners and clip it, while 29 // We create a rounded rect for each of the corners and clip it, while
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 clip_rect.Rect().MaxY() - rect.Y().ToFloat()); 62 clip_rect.Rect().MaxY() - rect.Y().ToFloat());
64 FloatRoundedRect::Radii bottom_corner_radii; 63 FloatRoundedRect::Radii bottom_corner_radii;
65 bottom_corner_radii.SetBottomLeft(clip_rect.GetRadii().BottomLeft()); 64 bottom_corner_radii.SetBottomLeft(clip_rect.GetRadii().BottomLeft());
66 rounded_rect_clips.push_back( 65 rounded_rect_clips.push_back(
67 FloatRoundedRect(bottom_corner, bottom_corner_radii)); 66 FloatRoundedRect(bottom_corner, bottom_corner_radii));
68 } 67 }
69 } 68 }
70 69
71 if (use_paint_controller_) { 70 if (use_paint_controller_) {
72 paint_info_.context.GetPaintController().CreateAndAppend<ClipDisplayItem>( 71 paint_info_.context.GetPaintController().CreateAndAppend<ClipDisplayItem>(
73 layout_object, clip_type_, LayoutRect::InfiniteIntRect(), 72 display_item, clip_type_, LayoutRect::InfiniteIntRect(),
74 rounded_rect_clips); 73 rounded_rect_clips);
75 } else { 74 } else {
76 ClipDisplayItem clip_display_item(layout_object, clip_type_, 75 ClipDisplayItem clip_display_item(display_item, clip_type_,
77 LayoutRect::InfiniteIntRect(), 76 LayoutRect::InfiniteIntRect(),
78 rounded_rect_clips); 77 rounded_rect_clips);
79 clip_display_item.Replay(paint_info.context); 78 clip_display_item.Replay(paint_info.context);
80 } 79 }
81 } 80 }
82 81
83 RoundedInnerRectClipper::~RoundedInnerRectClipper() { 82 RoundedInnerRectClipper::~RoundedInnerRectClipper() {
84 DisplayItem::Type end_type = DisplayItem::ClipTypeToEndClipType(clip_type_); 83 DisplayItem::Type end_type = DisplayItem::ClipTypeToEndClipType(clip_type_);
85 if (use_paint_controller_) { 84 if (use_paint_controller_) {
86 paint_info_.context.GetPaintController().EndItem<EndClipDisplayItem>( 85 paint_info_.context.GetPaintController().EndItem<EndClipDisplayItem>(
87 layout_object_, end_type); 86 display_item_, end_type);
88 } else { 87 } else {
89 EndClipDisplayItem end_clip_display_item(layout_object_, end_type); 88 EndClipDisplayItem end_clip_display_item(display_item_, end_type);
90 end_clip_display_item.Replay(paint_info_.context); 89 end_clip_display_item.Replay(paint_info_.context);
91 } 90 }
92 } 91 }
93 92
94 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/RoundedInnerRectClipper.h ('k') | third_party/WebKit/ng_paint.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698