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

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
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const 370 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const
371 { 371 {
372 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep 372 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep
373 // compare, which is duplicate work when we're going to compare each propert y inside 373 // compare, which is duplicate work when we're going to compare each propert y inside
374 // this function anyway. 374 // this function anyway.
375 375
376 StyleDifference diff; 376 StyleDifference diff;
377 if (m_svgStyle.get() != other.m_svgStyle.get()) 377 if (m_svgStyle.get() != other.m_svgStyle.get())
378 diff = m_svgStyle->diff(other.m_svgStyle.get()); 378 diff = m_svgStyle->diff(other.m_svgStyle.get());
379 379
380 if ((!diff.needsFullLayout() || !diff.needsRepaint()) && diffNeedsFullLayout AndRepaint(other)) {
381 diff.setNeedsFullLayout();
382 diff.setNeedsRepaintObject();
383 }
384
380 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) 385 if (!diff.needsFullLayout() && diffNeedsFullLayout(other))
381 diff.setNeedsFullLayout(); 386 diff.setNeedsFullLayout();
382 387
383 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off set != other.surround->offset) { 388 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off set != other.surround->offset) {
384 // Optimize for the case where a positioned layer is moving but not chan ging size. 389 // Optimize for the case where a positioned layer is moving but not chan ging size.
385 if ((position() == AbsolutePosition || position() == FixedPosition) 390 if ((position() == AbsolutePosition || position() == FixedPosition)
386 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) { 391 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) {
387 diff.setNeedsPositionedMovementLayout(); 392 diff.setNeedsPositionedMovementLayout();
388 } else { 393 } else {
389 // FIXME: We would like to use SimplifiedLayout for relative positio ning, but we can't quite do that yet. 394 // 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
405 410
406 // Cursors are not checked, since they will be set appropriately in response to mouse events, 411 // Cursors are not checked, since they will be set appropriately in response to mouse events,
407 // so they don't need to cause any repaint or layout. 412 // so they don't need to cause any repaint or layout.
408 413
409 // 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 414 // 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
410 // the resulting transition properly. 415 // the resulting transition properly.
411 416
412 return diff; 417 return diff;
413 } 418 }
414 419
415 bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const 420 bool RenderStyle::diffNeedsFullLayoutAndRepaint(const RenderStyle& other) const
416 { 421 {
422 // FIXME: Not all cases in this method need both full layout and repaint.
423 // Should move cases into diffNeedsFullLayout() if
424 // - don't need repaint at all;
425 // - or the renderer knows how to exactly repaint caused by the layout chang e
426 // instead of forced full repaint.
427
417 if (m_box.get() != other.m_box.get()) { 428 if (m_box.get() != other.m_box.get()) {
418 if (m_box->width() != other.m_box->width() 429 if (m_box->width() != other.m_box->width()
419 || m_box->minWidth() != other.m_box->minWidth() 430 || m_box->minWidth() != other.m_box->minWidth()
420 || m_box->maxWidth() != other.m_box->maxWidth() 431 || m_box->maxWidth() != other.m_box->maxWidth()
421 || m_box->height() != other.m_box->height() 432 || m_box->height() != other.m_box->height()
422 || m_box->minHeight() != other.m_box->minHeight() 433 || m_box->minHeight() != other.m_box->minHeight()
423 || m_box->maxHeight() != other.m_box->maxHeight()) 434 || m_box->maxHeight() != other.m_box->maxHeight())
424 return true; 435 return true;
425 436
426 if (m_box->verticalAlign() != other.m_box->verticalAlign()) 437 if (m_box->verticalAlign() != other.m_box->verticalAlign())
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { 608 if (!m_background->outline().visuallyEqual(other.m_background->outline())) {
598 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it. 609 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it.
599 return true; 610 return true;
600 } 611 }
601 612
602 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff(). 613 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff().
603 614
604 return false; 615 return false;
605 } 616 }
606 617
618 bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const
619 {
620 return false;
621 }
622
607 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const 623 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const
608 { 624 {
609 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip)) 625 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip))
610 return true; 626 return true;
611 627
612 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 628 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
613 if (RuntimeEnabledFeatures::cssCompositingEnabled() 629 if (RuntimeEnabledFeatures::cssCompositingEnabled()
614 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode 630 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher itedData->m_effectiveBlendMode
615 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation)) 631 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa ta->m_isolation))
616 return true; 632 return true;
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 // right 1707 // right
1692 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1708 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1693 if (radiiSum > rect.height()) 1709 if (radiiSum > rect.height())
1694 factor = std::min(rect.height() / radiiSum, factor); 1710 factor = std::min(rect.height() / radiiSum, factor);
1695 1711
1696 ASSERT(factor <= 1); 1712 ASSERT(factor <= 1);
1697 return factor; 1713 return factor;
1698 } 1714 }
1699 1715
1700 } // namespace WebCore 1716 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698