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

Side by Side Diff: sky/engine/core/rendering/RenderTreeAsText.cpp

Issue 880263006: Remove LayerPaintPhase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 } 327 }
328 328
329 for (RenderObject* child = o.slowFirstChild(); child; child = child->nextSib ling()) { 329 for (RenderObject* child = o.slowFirstChild(); child; child = child->nextSib ling()) {
330 if (child->hasLayer()) 330 if (child->hasLayer())
331 continue; 331 continue;
332 write(ts, *child, indent + 1, behavior); 332 write(ts, *child, indent + 1, behavior);
333 } 333 }
334 } 334 }
335 335
336 enum LayerPaintPhase {
337 LayerPaintPhaseAll = 0,
338 LayerPaintPhaseBackground = -1,
339 LayerPaintPhaseForeground = 1
340 };
341
342 static void write(TextStream& ts, RenderLayer& l, 336 static void write(TextStream& ts, RenderLayer& l,
343 const LayoutRect& layerBounds, const LayoutRect& backgroundCli pRect, const LayoutRect& clipRect, 337 const LayoutRect& layerBounds, const LayoutRect& backgroundCli pRect, const LayoutRect& clipRect,
344 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal) 338 int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBe haviorNormal)
345 { 339 {
346 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); 340 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
347 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ; 341 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ;
348 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); 342 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
349 343
350 writeIndent(ts, indent); 344 writeIndent(ts, indent);
351 345
352 ts << "layer "; 346 ts << "layer ";
353 347
354 if (behavior & RenderAsTextShowAddresses) 348 if (behavior & RenderAsTextShowAddresses)
355 ts << static_cast<const void*>(&l) << " "; 349 ts << static_cast<const void*>(&l) << " ";
356 350
357 ts << adjustedLayoutBounds; 351 ts << adjustedLayoutBounds;
358 352
359 if (!adjustedLayoutBounds.isEmpty()) { 353 if (!adjustedLayoutBounds.isEmpty()) {
360 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) 354 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds))
361 ts << " backgroundClip " << adjustedBackgroundClipRect; 355 ts << " backgroundClip " << adjustedBackgroundClipRect;
362 if (!adjustedClipRect.contains(adjustedLayoutBounds)) 356 if (!adjustedClipRect.contains(adjustedLayoutBounds))
363 ts << " clip " << adjustedClipRect; 357 ts << " clip " << adjustedClipRect;
364 } 358 }
365 if (l.isTransparent()) 359 if (l.isTransparent())
366 ts << " transparent"; 360 ts << " transparent";
367 361
368 if (paintPhase == LayerPaintPhaseBackground)
369 ts << " layerType: background only";
370 else if (paintPhase == LayerPaintPhaseForeground)
371 ts << " layerType: foreground only";
372
373 ts << "\n"; 362 ts << "\n";
374 363 write(ts, *l.renderer(), indent + 1, behavior);
375 if (paintPhase != LayerPaintPhaseBackground)
376 write(ts, *l.renderer(), indent + 1, behavior);
377 } 364 }
378 365
379 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer, 366 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer,
380 const LayoutRect& paintRect, int indent, RenderAsTextBehavior behavior) 367 const LayoutRect& paintRect, int indent, RenderAsTextBehavior behavior)
381 { 368 {
382 // FIXME: Apply overflow to the root layer to not break every test. Complete hack. Sigh. 369 // FIXME: Apply overflow to the root layer to not break every test. Complete hack. Sigh.
383 LayoutRect paintDirtyRect(paintRect); 370 LayoutRect paintDirtyRect(paintRect);
384 if (rootLayer == layer) { 371 if (rootLayer == layer) {
385 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye r->renderBox()->layoutOverflowRect().maxX())); 372 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye r->renderBox()->layoutOverflowRect().maxX()));
386 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa yer->renderBox()->layoutOverflowRect().maxY())); 373 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa yer->renderBox()->layoutOverflowRect().maxY()));
387 } 374 }
388 375
389 // Calculate the clip rects we should use. 376 // Calculate the clip rects we should use.
390 LayoutRect layerBounds; 377 LayoutRect layerBounds;
391 ClipRect damageRect, clipRectToApply; 378 ClipRect damageRect, clipRectToApply;
392 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintDirtyRect, layerBounds, damageRect, clipRectToApply); 379 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintDirtyRect, layerBounds, damageRect, clipRectToApply);
393 380
394 // FIXME: Apply overflow to the root layer to not break every test. Complete hack. Sigh. 381 // FIXME: Apply overflow to the root layer to not break every test. Complete hack. Sigh.
395 if (rootLayer == layer) 382 if (rootLayer == layer)
396 layerBounds.setSize(layer->size().expandedTo(pixelSnappedIntSize(layer-> renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0)))); 383 layerBounds.setSize(layer->size().expandedTo(pixelSnappedIntSize(layer-> renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0))));
397 384
398 // Ensure our lists are up-to-date. 385 // Ensure our lists are up-to-date.
399 layer->stackingNode()->updateLayerListsIfNeeded(); 386 layer->stackingNode()->updateLayerListsIfNeeded();
400 387
401 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 388 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer);
402 389
403 if (shouldPaint) 390 if (shouldPaint)
404 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , LayerPaintPhaseAll, indent, behavior); 391 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , indent, behavior);
405 392
406 if (Vector<RenderLayerStackingNode*>* normalFlowList = layer->stackingNode() ->normalFlowList()) { 393 if (Vector<RenderLayerStackingNode*>* normalFlowList = layer->stackingNode() ->normalFlowList()) {
407 int currIndent = indent; 394 int currIndent = indent;
408 if (behavior & RenderAsTextShowLayerNesting) { 395 if (behavior & RenderAsTextShowLayerNesting) {
409 writeIndent(ts, indent); 396 writeIndent(ts, indent);
410 ts << " normal flow list(" << normalFlowList->size() << ")\n"; 397 ts << " normal flow list(" << normalFlowList->size() << ")\n";
411 ++currIndent; 398 ++currIndent;
412 } 399 }
413 for (unsigned i = 0; i != normalFlowList->size(); ++i) 400 for (unsigned i = 0; i != normalFlowList->size(); ++i)
414 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintDirt yRect, currIndent, behavior); 401 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintDirt yRect, currIndent, behavior);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 element->document().updateLayout(); 495 element->document().updateLayout();
509 496
510 RenderObject* renderer = element->renderer(); 497 RenderObject* renderer = element->renderer();
511 if (!renderer || !renderer->isBox()) 498 if (!renderer || !renderer->isBox())
512 return String(); 499 return String();
513 500
514 return externalRepresentation(toRenderBox(renderer), behavior | RenderAsText ShowAllLayers); 501 return externalRepresentation(toRenderBox(renderer), behavior | RenderAsText ShowAllLayers);
515 } 502 }
516 503
517 } // namespace blink 504 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698