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

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: 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
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 repaint caused by layout change.
Julien - ping for review 2014/05/12 15:08:46 I don't understand this sentence: when do we *not*
Xianzhu 2014/05/12 21:31:51 I mean the renderer knows how to repaint optimally
425
416 if (m_box.get() != other.m_box.get()) { 426 if (m_box.get() != other.m_box.get()) {
417 if (m_box->width() != other.m_box->width() 427 if (m_box->width() != other.m_box->width()
418 || m_box->minWidth() != other.m_box->minWidth() 428 || m_box->minWidth() != other.m_box->minWidth()
419 || m_box->maxWidth() != other.m_box->maxWidth() 429 || m_box->maxWidth() != other.m_box->maxWidth()
420 || m_box->height() != other.m_box->height() 430 || m_box->height() != other.m_box->height()
421 || m_box->minHeight() != other.m_box->minHeight() 431 || m_box->minHeight() != other.m_box->minHeight()
422 || m_box->maxHeight() != other.m_box->maxHeight()) 432 || m_box->maxHeight() != other.m_box->maxHeight())
423 return true; 433 return true;
424 434
425 if (m_box->verticalAlign() != other.m_box->verticalAlign()) 435 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())) { 606 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. 607 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it.
598 return true; 608 return true;
599 } 609 }
600 610
601 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff(). 611 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff().
602 612
603 return false; 613 return false;
604 } 614 }
605 615
616 bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const
617 {
618 return false;
619 }
620
606 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const 621 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const
607 { 622 {
608 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip)) 623 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip))
609 return true; 624 return true;
610 625
611 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 626 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
612 if (RuntimeEnabledFeatures::cssCompositingEnabled() 627 if (RuntimeEnabledFeatures::cssCompositingEnabled()
613 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode 628 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode
614 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation)) 629 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation))
615 return true; 630 return true;
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 // right 1687 // right
1673 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1688 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1674 if (radiiSum > rect.height()) 1689 if (radiiSum > rect.height())
1675 factor = std::min(rect.height() / radiiSum, factor); 1690 factor = std::min(rect.height() / radiiSum, factor);
1676 1691
1677 ASSERT(factor <= 1); 1692 ASSERT(factor <= 1);
1678 return factor; 1693 return factor;
1679 } 1694 }
1680 1695
1681 } // namespace WebCore 1696 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698