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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2847873002: Don't pass subpixel offsets through non-translation transforms (Closed)
Patch Set: rebaseline-cl Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 visual_rect_flags)) 1193 visual_rect_flags))
1194 return false; 1194 return false;
1195 return true; 1195 return true;
1196 } 1196 }
1197 1197
1198 // Otherwise, apply the following: 1198 // Otherwise, apply the following:
1199 // 1. Transform. 1199 // 1. Transform.
1200 // 2. Container offset. 1200 // 2. Container offset.
1201 // 3. Container scroll offset. 1201 // 3. Container scroll offset.
1202 // 4. Perspective applied by container. 1202 // 4. Perspective applied by container.
1203 // 5. Transform flattening. 1203 // 5. Expansion for pixel snapping.
1204 // 6. Expansion for pixel snapping. 1204 // 6. Transform flattening.
chrishtr 2017/05/01 20:22:28 Not an issue you created, but could you make this
Xianzhu 2017/05/01 22:03:32 The steps 1 to 4 are actually generate the transfo
1205 // 7. Container clip. 1205 // 7. Container clip.
1206 1206
1207 // 1. Transform. 1207 // 1. Transform.
1208 TransformationMatrix transform; 1208 TransformationMatrix transform;
1209 if (Layer() && Layer()->Transform()) 1209 if (Layer() && Layer()->Transform())
1210 transform.Multiply(Layer()->CurrentTransform()); 1210 transform.Multiply(Layer()->CurrentTransform());
1211 1211
1212 // 2. Container offset. 1212 // 2. Container offset.
1213 transform.PostTranslate(container_offset.X().ToFloat(), 1213 transform.PostTranslate(container_offset.X().ToFloat(),
1214 container_offset.Y().ToFloat()); 1214 container_offset.Y().ToFloat());
(...skipping 15 matching lines...) Expand all
1230 1230
1231 TransformationMatrix perspective_matrix; 1231 TransformationMatrix perspective_matrix;
1232 perspective_matrix.ApplyPerspective( 1232 perspective_matrix.ApplyPerspective(
1233 container_object->Style()->Perspective()); 1233 container_object->Style()->Perspective());
1234 perspective_matrix.ApplyTransformOrigin(perspective_origin.X(), 1234 perspective_matrix.ApplyTransformOrigin(perspective_origin.X(),
1235 perspective_origin.Y(), 0); 1235 perspective_origin.Y(), 0);
1236 1236
1237 transform = perspective_matrix * transform; 1237 transform = perspective_matrix * transform;
1238 } 1238 }
1239 1239
1240 // 5. Transform flattening. 1240 // 5. Expansion for pixel snapping.
1241 transform_state.ApplyTransform(transform, accumulation); 1241 // Use EnclosingBoundingBox because we cannot properly compute pixel
chrishtr 2017/04/28 23:26:44 Why does this have to be first now? Don't see it y
Xianzhu 2017/05/01 18:13:42 This is to fix the MapToVisualRectInAncestorSpace(
chrishtr 2017/05/01 20:22:28 Oh I see. Yes I did make this change in 2727093002
1242
1243 // 6. Expansion for pixel snapping.
1244 // Use enclosingBoundingBox because we cannot properly compute pixel
1245 // snapping for painted elements within the transform since we don't know 1242 // snapping for painted elements within the transform since we don't know
1246 // the desired subpixel accumulation at this point, and the transform may 1243 // the desired subpixel accumulation at this point, and the transform may
1247 // include a scale. 1244 // include a scale.
chrishtr 2017/05/01 20:22:28 Please add a comment saying that pixel-snapping li
Xianzhu 2017/05/01 22:03:32 Done.
1248 if (!preserve3D) { 1245 if (!preserve3D) {
1249 transform_state.Flatten(); 1246 transform_state.Flatten();
chrishtr 2017/05/01 20:22:28 if (!preserve3D && !RuntimeEnabledFeatures::slimmi
Xianzhu 2017/05/01 22:03:32 Done.
1250 transform_state.SetQuad( 1247 transform_state.SetQuad(
1251 FloatQuad(transform_state.LastPlanarQuad().EnclosingBoundingBox())); 1248 FloatQuad(transform_state.LastPlanarQuad().EnclosingBoundingBox()));
1252 } 1249 }
1253 1250
1251 // 6. Transform flattening.
1252 transform_state.ApplyTransform(transform, accumulation);
1253 if (!preserve3D) {
1254 transform_state.Flatten();
1255 transform_state.SetQuad(FloatQuad(transform_state.LastPlanarQuad()));
1256 }
1257
1254 // 7. Container clip. 1258 // 7. Container clip.
1255 if (container_object->IsBox() && container_object != ancestor && 1259 if (container_object->IsBox() && container_object != ancestor &&
1256 container_object->HasClipRelatedProperty()) { 1260 container_object->HasClipRelatedProperty()) {
1257 return ToLayoutBox(container_object) 1261 return ToLayoutBox(container_object)
1258 ->ApplyBoxClips(transform_state, accumulation, visual_rect_flags); 1262 ->ApplyBoxClips(transform_state, accumulation, visual_rect_flags);
1259 } 1263 }
1260 1264
1261 return true; 1265 return true;
1262 } 1266 }
1263 1267
(...skipping 4635 matching lines...) Expand 10 before | Expand all | Expand 10 after
5899 void LayoutBox::MutableForPainting:: 5903 void LayoutBox::MutableForPainting::
5900 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5904 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5901 auto& rare_data = GetLayoutBox().EnsureRareData(); 5905 auto& rare_data = GetLayoutBox().EnsureRareData();
5902 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5906 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5903 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5907 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5904 rare_data.previous_layout_overflow_rect_ = 5908 rare_data.previous_layout_overflow_rect_ =
5905 GetLayoutBox().LayoutOverflowRect(); 5909 GetLayoutBox().LayoutOverflowRect();
5906 } 5910 }
5907 5911
5908 } // namespace blink 5912 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698