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

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 390193003: [not for review] Add Draw entries to window Performance Timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Git pull Created 6 years, 5 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ASSERT(!needsLayout()); 449 ASSERT(!needsLayout());
450 450
451 // We specifically need to repaint the viewRect since other renderers 451 // We specifically need to repaint the viewRect since other renderers
452 // short-circuit on full-repaint. 452 // short-circuit on full-repaint.
453 if (doingFullRepaint() && !viewRect().isEmpty()) 453 if (doingFullRepaint() && !viewRect().isEmpty())
454 repaintViewRectangle(viewRect()); 454 repaintViewRectangle(viewRect());
455 455
456 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); 456 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState);
457 } 457 }
458 458
459 LayoutRect RenderView::rectForPaintInvalidation(const LayoutRect* repaintRectPtr ) const
460 {
461 LayoutRect repaintRect = repaintRectPtr ? *repaintRectPtr : viewRect();
462 Element* owner = document().ownerElement();
463 if (document().printing() || !m_frameView
464 || layer()->compositingState() == PaintsIntoOwnBacking || !owner)
465 return repaintRect;
466 if (RenderBox* obj = owner->renderBox()) {
467 LayoutRect viewRectangle = viewRect();
468 LayoutRect rectToRepaint = intersection(repaintRect, viewRectangle);
469
470 // Subtract out the contentsX and contentsY offsets to get our coords wi thin the viewing
471 // rectangle.
472 rectToRepaint.moveBy(-viewRectangle.location());
473
474 // FIXME: Hardcoded offsets here are not good.
475 rectToRepaint.moveBy(obj->contentBoxRect().location());
476 return rectToRepaint;
477 }
478 return repaintRect;
479 }
480
459 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const 481 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const
460 { 482 {
461 ASSERT(!repaintRect.isEmpty()); 483 ASSERT(!repaintRect.isEmpty());
462 484
463 if (document().printing() || !m_frameView) 485 if (document().printing() || !m_frameView)
464 return; 486 return;
465 487
466 // We always just invalidate the root view, since we could be an iframe that is clipped out 488 // We always just invalidate the root view, since we could be an iframe that is clipped out
467 // or even invisible. 489 // or even invisible.
468 Element* owner = document().ownerElement(); 490 Element* owner = document().ownerElement();
469 if (layer()->compositingState() == PaintsIntoOwnBacking) { 491 if (layer()->compositingState() == PaintsIntoOwnBacking) {
470 layer()->repainter().setBackingNeedsRepaintInRect(repaintRect); 492 layer()->repainter().setBackingNeedsRepaintInRect(repaintRect);
471 } else if (!owner) { 493 } else if (!owner) {
472 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(re paintRect)); 494 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(re paintRect));
473 } else if (RenderBox* obj = owner->renderBox()) { 495 } else if (RenderBox* obj = owner->renderBox()) {
474 LayoutRect viewRectangle = viewRect(); 496 obj->invalidatePaintRectangle(rectForPaintInvalidation(&repaintRect));
475 LayoutRect rectToRepaint = intersection(repaintRect, viewRectangle);
476
477 // Subtract out the contentsX and contentsY offsets to get our coords wi thin the viewing
478 // rectangle.
479 rectToRepaint.moveBy(-viewRectangle.location());
480
481 // FIXME: Hardcoded offsets here are not good.
482 rectToRepaint.moveBy(obj->contentBoxRect().location());
483 obj->invalidatePaintRectangle(rectToRepaint);
484 } 497 }
485 } 498 }
486 499
487 void RenderView::repaintViewAndCompositedLayers() 500 void RenderView::repaintViewAndCompositedLayers()
488 { 501 {
489 paintInvalidationForWholeRenderer(); 502 paintInvalidationForWholeRenderer();
490 503
491 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. 504 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen.
492 DisableCompositingQueryAsserts disabler; 505 DisableCompositingQueryAsserts disabler;
493 506
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 return viewWidth(IncludeScrollbars) / scale; 1006 return viewWidth(IncludeScrollbars) / scale;
994 } 1007 }
995 1008
996 double RenderView::layoutViewportHeight() const 1009 double RenderView::layoutViewportHeight() const
997 { 1010 {
998 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 1011 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
999 return viewHeight(IncludeScrollbars) / scale; 1012 return viewHeight(IncludeScrollbars) / scale;
1000 } 1013 }
1001 1014
1002 } // namespace blink 1015 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698