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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1342503002: When style changes, set the LayoutObject as a client for all StyleImage loads. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | 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 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1827
1828 RefPtr<ComputedStyle> oldStyle = m_style.release(); 1828 RefPtr<ComputedStyle> oldStyle = m_style.release();
1829 setStyleInternal(style); 1829 setStyleInternal(style);
1830 1830
1831 updateFillImages(oldStyle ? &oldStyle->backgroundLayers() : 0, m_style->back groundLayers()); 1831 updateFillImages(oldStyle ? &oldStyle->backgroundLayers() : 0, m_style->back groundLayers());
1832 updateFillImages(oldStyle ? &oldStyle->maskLayers() : 0, m_style->maskLayers ()); 1832 updateFillImages(oldStyle ? &oldStyle->maskLayers() : 0, m_style->maskLayers ());
1833 1833
1834 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI mage().image()); 1834 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI mage().image());
1835 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo xImage().image()); 1835 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo xImage().image());
1836 1836
1837 const StyleImage* newContentImage = m_style->contentData() && m_style->conte ntData()->isImage() ?
1838 toImageContentData(m_style->contentData())->image() : nullptr;
1839 const StyleImage* oldContentImage = oldStyle && oldStyle->contentData() && o ldStyle->contentData()->isImage() ?
1840 toImageContentData(oldStyle->contentData())->image() : nullptr;
1841 updateImage(const_cast<StyleImage*>(oldContentImage), const_cast<StyleImage* >(newContentImage));
1842
1843 StyleImage* newBoxReflectMaskImage = m_style->boxReflect() ? m_style->boxRef lect()->mask().image() : nullptr;
1844 StyleImage* oldBoxReflectMaskImage = oldStyle && oldStyle->boxReflect() ? ol dStyle->boxReflect()->mask().image() : nullptr;
1845 updateImage(oldBoxReflectMaskImage, newBoxReflectMaskImage);
1846
1837 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts ide()); 1847 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts ide());
1838 1848
1839 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent; 1849 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent;
1840 1850
1841 styleDidChange(diff, oldStyle.get()); 1851 styleDidChange(diff, oldStyle.get());
1842 1852
1853 updateImage(oldStyle ? oldStyle->listStyleImage() : nullptr, m_style->listSt yleImage());
Nate Chapin 2015/09/11 21:35:50 It appears that this and only this needs to be aft
esprehn 2015/09/17 08:20:48 That needs a comment, also can we not move them al
Nate Chapin 2015/09/22 20:24:07 Moved this logic to LayoutListItem, since listStyl
1854
1843 // FIXME: |this| might be destroyed here. This can currently happen for a La youtTextFragment when 1855 // FIXME: |this| might be destroyed here. This can currently happen for a La youtTextFragment when
1844 // its first-letter block gets an update in LayoutTextFragment::styleDidChan ge. For LayoutTextFragment(s), 1856 // its first-letter block gets an update in LayoutTextFragment::styleDidChan ge. For LayoutTextFragment(s),
1845 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla g. We might want to broaden 1857 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla g. We might want to broaden
1846 // this condition in the future as we move layoutObject changes out of layou t and into style changes. 1858 // this condition in the future as we move layoutObject changes out of layou t and into style changes.
1847 if (doesNotNeedLayoutOrPaintInvalidation) 1859 if (doesNotNeedLayoutOrPaintInvalidation)
1848 return; 1860 return;
1849 1861
1850 // Now that the layer (if any) has been updated, we need to adjust the diff again, 1862 // Now that the layer (if any) has been updated, we need to adjust the diff again,
1851 // check whether we should layout now, and decide if we need to invalidate p aints. 1863 // check whether we should layout now, and decide if we need to invalidate p aints.
1852 StyleDifference updatedDiff = adjustStyleDifference(diff); 1864 StyleDifference updatedDiff = adjustStyleDifference(diff);
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 if (StyleImage* maskImage = maskLayer->image()) 2484 if (StyleImage* maskImage = maskLayer->image())
2473 maskImage->removeClient(this); 2485 maskImage->removeClient(this);
2474 } 2486 }
2475 2487
2476 if (StyleImage* borderImage = m_style->borderImage().image()) 2488 if (StyleImage* borderImage = m_style->borderImage().image())
2477 borderImage->removeClient(this); 2489 borderImage->removeClient(this);
2478 2490
2479 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) 2491 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
2480 maskBoxImage->removeClient(this); 2492 maskBoxImage->removeClient(this);
2481 2493
2494 if (m_style->contentData() && m_style->contentData()->isImage())
2495 const_cast<StyleImage*>(toImageContentData(m_style->contentData())-> image())->removeClient(this);
esprehn 2015/09/17 08:20:48 This const_cast seems sketchy, why is it okay to c
Nate Chapin 2015/09/22 20:24:07 I was scared to change it. :) Made ComputedStyle:
2496
2497 if (m_style->boxReflect() && m_style->boxReflect()->mask().image())
2498 m_style->boxReflect()->mask().image()->removeClient(this);
2499
2500 if (StyleImage* listStyleImage = m_style->listStyleImage())
2501 listStyleImage->removeClient(this);
2502
2482 removeShapeImageClient(m_style->shapeOutside()); 2503 removeShapeImageClient(m_style->shapeOutside());
2483 } 2504 }
2484 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this); 2505 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this);
2485 2506
2486 if (frameView()) 2507 if (frameView())
2487 setIsSlowRepaintObject(false); 2508 setIsSlowRepaintObject(false);
2488 } 2509 }
2489 2510
2490 void LayoutObject::insertedIntoTree() 2511 void LayoutObject::insertedIntoTree()
2491 { 2512 {
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 const blink::LayoutObject* root = object1; 3428 const blink::LayoutObject* root = object1;
3408 while (root->parent()) 3429 while (root->parent())
3409 root = root->parent(); 3430 root = root->parent();
3410 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3431 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3411 } else { 3432 } else {
3412 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3433 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3413 } 3434 }
3414 } 3435 }
3415 3436
3416 #endif 3437 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698