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

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

Issue 2905733003: Remove WTFLogAlways() usages from core/layout/
Patch Set: 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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/layout/LayoutGeometryMap.h" 26 #include "core/layout/LayoutGeometryMap.h"
27 27
28 #include "core/frame/LocalFrame.h" 28 #include "core/frame/LocalFrame.h"
29 #include "core/paint/PaintLayer.h" 29 #include "core/paint/PaintLayer.h"
30 #include "platform/geometry/TransformState.h" 30 #include "platform/geometry/TransformState.h"
31 #include "platform/wtf/AutoReset.h" 31 #include "platform/wtf/AutoReset.h"
32 32
33 #define LAYOUT_GEOMETRY_MAP_LOGGING 0
fs 2017/06/14 20:14:19 "...as the code is unmaintainable." I'm not sure
mrunal 2017/06/19 22:10:57 The unmaintainable bit is below where LAYOUT_GEOME
fs 2017/06/20 08:24:35 Yes, sure, but that is pretty much the burden of h
34
35 #if LAYOUT_GEOMETRY_MAP_LOGGING
36 #define LAYOUT_GEOMETRY_MAP_LOG(...) WTFLogAlways(__VA_ARGS__)
tkent 2017/06/14 23:41:39 Such conditional log macros is usually replaced wi
37 #else
38 #define LAYOUT_GEOMETRY_MAP_LOG(...) ((void)0)
39 #endif
40
41 namespace blink { 33 namespace blink {
42 34
43 LayoutGeometryMap::LayoutGeometryMap(MapCoordinatesFlags flags) 35 LayoutGeometryMap::LayoutGeometryMap(MapCoordinatesFlags flags)
44 : insertion_position_(kNotFound), 36 : insertion_position_(kNotFound),
45 non_uniform_steps_count_(0), 37 non_uniform_steps_count_(0),
46 transformed_steps_count_(0), 38 transformed_steps_count_(0),
47 fixed_steps_count_(0), 39 fixed_steps_count_(0),
48 map_coordinates_flags_(flags) {} 40 map_coordinates_flags_(flags) {}
49 41
50 LayoutGeometryMap::~LayoutGeometryMap() {} 42 LayoutGeometryMap::~LayoutGeometryMap() {}
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 map_coordinates_flags_ & kTraverseDocumentBoundaries); 224 map_coordinates_flags_ & kTraverseDocumentBoundaries);
233 225
234 // We have to visit all the layoutObjects to detect flipped blocks. This might 226 // We have to visit all the layoutObjects to detect flipped blocks. This might
235 // defeat the gains from mapping via layers. 227 // defeat the gains from mapping via layers.
236 bool can_convert_in_layer_tree = 228 bool can_convert_in_layer_tree =
237 (ancestor_layer && !cross_document) 229 (ancestor_layer && !cross_document)
238 ? CanMapBetweenLayoutObjects(layout_object, 230 ? CanMapBetweenLayoutObjects(layout_object,
239 ancestor_layer->GetLayoutObject()) 231 ancestor_layer->GetLayoutObject())
240 : false; 232 : false;
241 233
242 LAYOUT_GEOMETRY_MAP_LOG(
243 "LayoutGeometryMap::pushMappingsToAncestor from layer %p to layer %p, "
244 "canConvertInLayerTree=%d\n",
245 layer, ancestorLayer, canConvertInLayerTree);
246
247 if (can_convert_in_layer_tree) { 234 if (can_convert_in_layer_tree) {
248 LayoutPoint layer_offset; 235 LayoutPoint layer_offset;
249 layer->ConvertToLayerCoords(ancestor_layer, layer_offset); 236 layer->ConvertToLayerCoords(ancestor_layer, layer_offset);
250 237
251 // The LayoutView must be pushed first. 238 // The LayoutView must be pushed first.
252 if (!mapping_.size()) { 239 if (!mapping_.size()) {
253 DCHECK(ancestor_layer->GetLayoutObject().IsLayoutView()); 240 DCHECK(ancestor_layer->GetLayoutObject().IsLayoutView());
254 PushMappingsToAncestor(&ancestor_layer->GetLayoutObject(), 0); 241 PushMappingsToAncestor(&ancestor_layer->GetLayoutObject(), 0);
255 } 242 }
256 243
257 AutoReset<size_t> position_change(&insertion_position_, mapping_.size()); 244 AutoReset<size_t> position_change(&insertion_position_, mapping_.size());
258 bool accumulating_transform = 245 bool accumulating_transform =
259 layout_object.Style()->Preserves3D() || 246 layout_object.Style()->Preserves3D() ||
260 ancestor_layer->GetLayoutObject().Style()->Preserves3D(); 247 ancestor_layer->GetLayoutObject().Style()->Preserves3D();
261 Push(&layout_object, ToLayoutSize(layer_offset), 248 Push(&layout_object, ToLayoutSize(layer_offset),
262 accumulating_transform ? kAccumulatingTransform : 0); 249 accumulating_transform ? kAccumulatingTransform : 0);
263 return; 250 return;
264 } 251 }
265 const LayoutBoxModelObject* ancestor_layout_object = 252 const LayoutBoxModelObject* ancestor_layout_object =
266 ancestor_layer ? &ancestor_layer->GetLayoutObject() : 0; 253 ancestor_layer ? &ancestor_layer->GetLayoutObject() : 0;
267 PushMappingsToAncestor(&layout_object, ancestor_layout_object); 254 PushMappingsToAncestor(&layout_object, ancestor_layout_object);
268 } 255 }
269 256
270 void LayoutGeometryMap::Push(const LayoutObject* layout_object, 257 void LayoutGeometryMap::Push(const LayoutObject* layout_object,
271 const LayoutSize& offset_from_container, 258 const LayoutSize& offset_from_container,
272 GeometryInfoFlags flags, 259 GeometryInfoFlags flags,
273 LayoutSize offset_for_fixed_position) { 260 LayoutSize offset_for_fixed_position) {
274 LAYOUT_GEOMETRY_MAP_LOG("LayoutGeometryMap::push %p %d,%d isNonUniform=%d\n",
275 layoutObject, offsetFromContainer.width().toInt(),
mrunal 2017/06/19 22:10:57 @fs, For example there is no definition for offset
276 offsetFromContainer.height().toInt(), isNonUniform);
277
278 DCHECK_NE(insertion_position_, kNotFound); 261 DCHECK_NE(insertion_position_, kNotFound);
279 DCHECK(!layout_object->IsLayoutView() || !insertion_position_ || 262 DCHECK(!layout_object->IsLayoutView() || !insertion_position_ ||
280 map_coordinates_flags_ & kTraverseDocumentBoundaries); 263 map_coordinates_flags_ & kTraverseDocumentBoundaries);
281 DCHECK(offset_for_fixed_position.IsZero() || layout_object->IsLayoutView()); 264 DCHECK(offset_for_fixed_position.IsZero() || layout_object->IsLayoutView());
282 265
283 mapping_.insert(insertion_position_, 266 mapping_.insert(insertion_position_,
284 LayoutGeometryMapStep(layout_object, flags)); 267 LayoutGeometryMapStep(layout_object, flags));
285 268
286 LayoutGeometryMapStep& step = mapping_[insertion_position_]; 269 LayoutGeometryMapStep& step = mapping_[insertion_position_];
287 step.offset_ = offset_from_container; 270 step.offset_ = offset_from_container;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // If we're not working with multiple LayoutViews, then any view is considered 365 // If we're not working with multiple LayoutViews, then any view is considered
383 // "topmost" (to preserve original behavior). 366 // "topmost" (to preserve original behavior).
384 if (!(map_coordinates_flags_ & kTraverseDocumentBoundaries)) 367 if (!(map_coordinates_flags_ & kTraverseDocumentBoundaries))
385 return true; 368 return true;
386 369
387 return layout_object->GetFrame()->IsMainFrame(); 370 return layout_object->GetFrame()->IsMainFrame();
388 } 371 }
389 #endif 372 #endif
390 373
391 } // namespace blink 374 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698