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

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: Code refactoring in RenderView 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::invalidateTreeAfterLayout(paintInvalidationState); 456 RenderBlock::invalidateTreeAfterLayout(paintInvalidationState);
457 } 457 }
458 458
459 LayoutRect RenderView::rectForPaintInvalidation(const LayoutRect* repaintRectPtr ) const
460 {
461 if (document().printing() || !m_frameView)
462 return LayoutRect();
463 LayoutRect repaintRect = repaintRectPtr ? *repaintRectPtr : viewRect();
chrishtr 2014/07/16 20:00:25 You need to put line 463 at the top of the functio
464 Element* owner = document().ownerElement();
465 if (layer()->compositingState() == PaintsIntoOwnBacking || !owner)
466 return repaintRect;
467 if (RenderBox* obj = owner->renderBox()) {
468 LayoutRect viewRectangle = viewRect();
469 LayoutRect rectToRepaint = intersection(repaintRect, viewRectangle);
470
471 // Subtract out the contentsX and contentsY offsets to get our coords wi thin the viewing
472 // rectangle.
473 rectToRepaint.moveBy(-viewRectangle.location());
474
475 // FIXME: Hardcoded offsets here are not good.
476 rectToRepaint.moveBy(obj->contentBoxRect().location());
477 return rectToRepaint;
478 }
479 return LayoutRect();
chrishtr 2014/07/16 20:00:25 return repaintRect;
480 }
481
459 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const 482 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const
460 { 483 {
461 ASSERT(!repaintRect.isEmpty()); 484 ASSERT(!repaintRect.isEmpty());
462 485
463 if (document().printing() || !m_frameView) 486 if (document().printing() || !m_frameView)
464 return; 487 return;
465 488
466 // We always just invalidate the root view, since we could be an iframe that is clipped out 489 // We always just invalidate the root view, since we could be an iframe that is clipped out
467 // or even invisible. 490 // or even invisible.
468 Element* owner = document().ownerElement(); 491 Element* owner = document().ownerElement();
469 if (layer()->compositingState() == PaintsIntoOwnBacking) { 492 if (layer()->compositingState() == PaintsIntoOwnBacking) {
470 layer()->repainter().setBackingNeedsRepaintInRect(repaintRect); 493 layer()->repainter().setBackingNeedsRepaintInRect(repaintRect);
471 } else if (!owner) { 494 } else if (!owner) {
472 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(re paintRect)); 495 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(re paintRect));
473 } else if (RenderBox* obj = owner->renderBox()) { 496 } else if (RenderBox* obj = owner->renderBox()) {
474 LayoutRect viewRectangle = viewRect(); 497 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 } 498 }
485 } 499 }
486 500
487 void RenderView::repaintViewAndCompositedLayers() 501 void RenderView::repaintViewAndCompositedLayers()
488 { 502 {
489 paintInvalidationForWholeRenderer(); 503 paintInvalidationForWholeRenderer();
490 504
491 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. 505 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen.
492 DisableCompositingQueryAsserts disabler; 506 DisableCompositingQueryAsserts disabler;
493 507
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 return viewWidth(IncludeScrollbars) / scale; 1007 return viewWidth(IncludeScrollbars) / scale;
994 } 1008 }
995 1009
996 double RenderView::layoutViewportHeight() const 1010 double RenderView::layoutViewportHeight() const
997 { 1011 {
998 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 1012 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
999 return viewHeight(IncludeScrollbars) / scale; 1013 return viewHeight(IncludeScrollbars) / scale;
1000 } 1014 }
1001 1015
1002 } // namespace WebCore 1016 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698