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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 265703012: Separate repaint and layout requirements of StyleDifference (Step 4) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/SVGRenderStyle.h » ('j') | 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const 369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const
370 { 370 {
371 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep 371 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep
372 // compare, which is duplicate work when we're going to compare each propert y inside 372 // compare, which is duplicate work when we're going to compare each propert y inside
373 // this function anyway. 373 // this function anyway.
374 374
375 StyleDifference diff; 375 StyleDifference diff;
376 if (m_svgStyle.get() != other.m_svgStyle.get()) 376 if (m_svgStyle.get() != other.m_svgStyle.get())
377 diff = m_svgStyle->diff(other.m_svgStyle.get()); 377 diff = m_svgStyle->diff(other.m_svgStyle.get());
378 378
379 if ((!diff.needsFullLayout() || !diff.needsRepaint()) && diffNeedsFullLayout AndRepaint(other)) {
380 diff.setNeedsFullLayout();
381 diff.setNeedsRepaintObject();
382 }
383
379 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) 384 if (!diff.needsFullLayout() && diffNeedsFullLayout(other))
380 diff.setNeedsFullLayout(); 385 diff.setNeedsFullLayout();
381 386
382 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off set != other.surround->offset) { 387 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off set != other.surround->offset) {
383 // Optimize for the case where a positioned layer is moving but not chan ging size. 388 // Optimize for the case where a positioned layer is moving but not chan ging size.
384 if ((position() == AbsolutePosition || position() == FixedPosition) 389 if ((position() == AbsolutePosition || position() == FixedPosition)
385 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) { 390 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) {
386 diff.setNeedsPositionedMovementLayout(); 391 diff.setNeedsPositionedMovementLayout();
387 } else { 392 } else {
388 // FIXME: We would like to use SimplifiedLayout for relative positio ning, but we can't quite do that yet. 393 // FIXME: We would like to use SimplifiedLayout for relative positio ning, but we can't quite do that yet.
(...skipping 15 matching lines...) Expand all
404 409
405 // Cursors are not checked, since they will be set appropriately in response to mouse events, 410 // Cursors are not checked, since they will be set appropriately in response to mouse events,
406 // so they don't need to cause any repaint or layout. 411 // so they don't need to cause any repaint or layout.
407 412
408 // Animations don't need to be checked either. We always set the new style o n the RenderObject, so we will get a chance to fire off 413 // Animations don't need to be checked either. We always set the new style o n the RenderObject, so we will get a chance to fire off
409 // the resulting transition properly. 414 // the resulting transition properly.
410 415
411 return diff; 416 return diff;
412 } 417 }
413 418
414 bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const 419 bool RenderStyle::diffNeedsFullLayoutAndRepaint(const RenderStyle& other) const
415 { 420 {
421 // FIXME: Not all cases in this method need both full layout and repaint.
422 // Should move cases into diffNeedsFullLayout() if
423 // - don't need repaint at all;
424 // - or the renderer knows how to exactly repaint caused by the layout chang e
425 // instead of forced full repaint.
426
416 if (m_box.get() != other.m_box.get()) { 427 if (m_box.get() != other.m_box.get()) {
417 if (m_box->width() != other.m_box->width() 428 if (m_box->width() != other.m_box->width()
418 || m_box->minWidth() != other.m_box->minWidth() 429 || m_box->minWidth() != other.m_box->minWidth()
419 || m_box->maxWidth() != other.m_box->maxWidth() 430 || m_box->maxWidth() != other.m_box->maxWidth()
420 || m_box->height() != other.m_box->height() 431 || m_box->height() != other.m_box->height()
421 || m_box->minHeight() != other.m_box->minHeight() 432 || m_box->minHeight() != other.m_box->minHeight()
422 || m_box->maxHeight() != other.m_box->maxHeight()) 433 || m_box->maxHeight() != other.m_box->maxHeight())
423 return true; 434 return true;
424 435
425 if (m_box->verticalAlign() != other.m_box->verticalAlign()) 436 if (m_box->verticalAlign() != other.m_box->verticalAlign())
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { 607 if (!m_background->outline().visuallyEqual(other.m_background->outline())) {
597 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it. 608 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it.
598 return true; 609 return true;
599 } 610 }
600 611
601 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff(). 612 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff().
602 613
603 return false; 614 return false;
604 } 615 }
605 616
617 bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const
618 {
619 return false;
620 }
621
606 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const 622 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const
607 { 623 {
608 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip)) 624 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip))
609 return true; 625 return true;
610 626
611 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 627 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
612 if (RuntimeEnabledFeatures::cssCompositingEnabled() 628 if (RuntimeEnabledFeatures::cssCompositingEnabled()
613 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode 629 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode
614 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation)) 630 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation))
615 return true; 631 return true;
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 // right 1706 // right
1691 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1707 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1692 if (radiiSum > rect.height()) 1708 if (radiiSum > rect.height())
1693 factor = std::min(rect.height() / radiiSum, factor); 1709 factor = std::min(rect.height() / radiiSum, factor);
1694 1710
1695 ASSERT(factor <= 1); 1711 ASSERT(factor <= 1);
1696 return factor; 1712 return factor;
1697 } 1713 }
1698 1714
1699 } // namespace WebCore 1715 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/SVGRenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698