OLD | NEW |
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 } | 334 } |
335 | 335 |
336 enum LayerPaintPhase { | 336 enum LayerPaintPhase { |
337 LayerPaintPhaseAll = 0, | 337 LayerPaintPhaseAll = 0, |
338 LayerPaintPhaseBackground = -1, | 338 LayerPaintPhaseBackground = -1, |
339 LayerPaintPhaseForeground = 1 | 339 LayerPaintPhaseForeground = 1 |
340 }; | 340 }; |
341 | 341 |
342 static void write(TextStream& ts, RenderLayer& l, | 342 static void write(TextStream& ts, RenderLayer& l, |
343 const LayoutRect& layerBounds, const LayoutRect& backgroundCli
pRect, const LayoutRect& clipRect, const LayoutRect& outlineClipRect, | 343 const LayoutRect& layerBounds, const LayoutRect& backgroundCli
pRect, const LayoutRect& clipRect, |
344 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent =
0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal) | 344 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent =
0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal) |
345 { | 345 { |
346 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); | 346 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); |
347 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect)
; | 347 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect)
; |
348 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); | 348 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); |
349 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect); | |
350 | 349 |
351 writeIndent(ts, indent); | 350 writeIndent(ts, indent); |
352 | 351 |
353 ts << "layer "; | 352 ts << "layer "; |
354 | 353 |
355 if (behavior & RenderAsTextShowAddresses) | 354 if (behavior & RenderAsTextShowAddresses) |
356 ts << static_cast<const void*>(&l) << " "; | 355 ts << static_cast<const void*>(&l) << " "; |
357 | 356 |
358 ts << adjustedLayoutBounds; | 357 ts << adjustedLayoutBounds; |
359 | 358 |
360 if (!adjustedLayoutBounds.isEmpty()) { | 359 if (!adjustedLayoutBounds.isEmpty()) { |
361 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) | 360 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) |
362 ts << " backgroundClip " << adjustedBackgroundClipRect; | 361 ts << " backgroundClip " << adjustedBackgroundClipRect; |
363 if (!adjustedClipRect.contains(adjustedLayoutBounds)) | 362 if (!adjustedClipRect.contains(adjustedLayoutBounds)) |
364 ts << " clip " << adjustedClipRect; | 363 ts << " clip " << adjustedClipRect; |
365 if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds)) | |
366 ts << " outlineClip " << adjustedOutlineClipRect; | |
367 } | 364 } |
368 if (l.isTransparent()) | 365 if (l.isTransparent()) |
369 ts << " transparent"; | 366 ts << " transparent"; |
370 | 367 |
371 if (l.renderer()->hasOverflowClip()) { | 368 if (l.renderer()->hasOverflowClip()) { |
372 if (l.scrollableArea()->scrollXOffset()) | 369 if (l.scrollableArea()->scrollXOffset()) |
373 ts << " scrollX " << l.scrollableArea()->scrollXOffset(); | 370 ts << " scrollX " << l.scrollableArea()->scrollXOffset(); |
374 if (l.scrollableArea()->scrollYOffset()) | 371 if (l.scrollableArea()->scrollYOffset()) |
375 ts << " scrollY " << l.scrollableArea()->scrollYOffset(); | 372 ts << " scrollY " << l.scrollableArea()->scrollYOffset(); |
376 if (l.renderBox() && l.renderBox()->pixelSnappedClientWidth() != l.rende
rBox()->pixelSnappedScrollWidth()) | 373 if (l.renderBox() && l.renderBox()->pixelSnappedClientWidth() != l.rende
rBox()->pixelSnappedScrollWidth()) |
(...skipping 18 matching lines...) Expand all Loading... |
395 { | 392 { |
396 // FIXME: Apply overflow to the root layer to not break every test. Complete
hack. Sigh. | 393 // FIXME: Apply overflow to the root layer to not break every test. Complete
hack. Sigh. |
397 LayoutRect paintDirtyRect(paintRect); | 394 LayoutRect paintDirtyRect(paintRect); |
398 if (rootLayer == layer) { | 395 if (rootLayer == layer) { |
399 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye
r->renderBox()->layoutOverflowRect().maxX())); | 396 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye
r->renderBox()->layoutOverflowRect().maxX())); |
400 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa
yer->renderBox()->layoutOverflowRect().maxY())); | 397 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa
yer->renderBox()->layoutOverflowRect().maxY())); |
401 } | 398 } |
402 | 399 |
403 // Calculate the clip rects we should use. | 400 // Calculate the clip rects we should use. |
404 LayoutRect layerBounds; | 401 LayoutRect layerBounds; |
405 ClipRect damageRect, clipRectToApply, outlineRect; | 402 ClipRect damageRect, clipRectToApply; |
406 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect
s), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); | 403 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect
s), paintDirtyRect, layerBounds, damageRect, clipRectToApply); |
407 | 404 |
408 // FIXME: Apply overflow to the root layer to not break every test. Complete
hack. Sigh. | 405 // FIXME: Apply overflow to the root layer to not break every test. Complete
hack. Sigh. |
409 if (rootLayer == layer) | 406 if (rootLayer == layer) |
410 layerBounds.setSize(layer->size().expandedTo(pixelSnappedIntSize(layer->
renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0)))); | 407 layerBounds.setSize(layer->size().expandedTo(pixelSnappedIntSize(layer->
renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0)))); |
411 | 408 |
412 // Ensure our lists are up-to-date. | 409 // Ensure our lists are up-to-date. |
413 layer->stackingNode()->updateLayerListsIfNeeded(); | 410 layer->stackingNode()->updateLayerListsIfNeeded(); |
414 | 411 |
415 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); | 412 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); |
416 | 413 |
417 if (shouldPaint) | 414 if (shouldPaint) |
418 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, outlineRect.rect(), LayerPaintPhaseAll, indent, behavior); | 415 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, LayerPaintPhaseAll, indent, behavior); |
419 | 416 |
420 if (Vector<RenderLayerStackingNode*>* normalFlowList = layer->stackingNode()
->normalFlowList()) { | 417 if (Vector<RenderLayerStackingNode*>* normalFlowList = layer->stackingNode()
->normalFlowList()) { |
421 int currIndent = indent; | 418 int currIndent = indent; |
422 if (behavior & RenderAsTextShowLayerNesting) { | 419 if (behavior & RenderAsTextShowLayerNesting) { |
423 writeIndent(ts, indent); | 420 writeIndent(ts, indent); |
424 ts << " normal flow list(" << normalFlowList->size() << ")\n"; | 421 ts << " normal flow list(" << normalFlowList->size() << ")\n"; |
425 ++currIndent; | 422 ++currIndent; |
426 } | 423 } |
427 for (unsigned i = 0; i != normalFlowList->size(); ++i) | 424 for (unsigned i = 0; i != normalFlowList->size(); ++i) |
428 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintDirt
yRect, currIndent, behavior); | 425 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintDirt
yRect, currIndent, behavior); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 element->document().updateLayout(); | 519 element->document().updateLayout(); |
523 | 520 |
524 RenderObject* renderer = element->renderer(); | 521 RenderObject* renderer = element->renderer(); |
525 if (!renderer || !renderer->isBox()) | 522 if (!renderer || !renderer->isBox()) |
526 return String(); | 523 return String(); |
527 | 524 |
528 return externalRepresentation(toRenderBox(renderer), behavior | RenderAsText
ShowAllLayers); | 525 return externalRepresentation(toRenderBox(renderer), behavior | RenderAsText
ShowAllLayers); |
529 } | 526 } |
530 | 527 |
531 } // namespace blink | 528 } // namespace blink |
OLD | NEW |