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

Side by Side Diff: third_party/WebKit/Source/core/style/FillLayer.cpp

Issue 1787733003: Consolidate background fill layer opaqueness into one method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/style/FillLayer.h ('k') | 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 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 { 363 {
364 const FillLayer* curr; 364 const FillLayer* curr;
365 for (curr = this; curr; curr = curr->next()) { 365 for (curr = this; curr; curr = curr->next()) {
366 if (curr->m_image && !curr->m_image->isLoaded()) 366 if (curr->m_image && !curr->m_image->isLoaded())
367 return false; 367 return false;
368 } 368 }
369 369
370 return true; 370 return true;
371 } 371 }
372 372
373 bool FillLayer::hasOpaqueImage(const LayoutObject* layoutObject) const 373 bool FillLayer::backgroundImageIsOpaque(const LayoutObject& imageClient, const f loat effectiveZoom) const
trchen 2016/03/11 22:13:33 I think the complexity of this function is getting
Stephen Chennney 2016/03/14 14:59:35 I'm wary of exposing multiple methods that a calle
374 { 374 {
375 if (!m_image) 375 if (!m_image || !m_image->canRender())
376 return false; 376 return false;
377 377
378 // TODO(trchen): Should check blend mode before composite mode. 378 if ((m_repeatX != RepeatFill && m_repeatX != RoundFill)
379 if (m_composite == CompositeClear || m_composite == CompositeCopy) 379 || (m_repeatY != RepeatFill && m_repeatY != RoundFill))
380 return true; 380 return false;
381 381
382 if (m_blendMode != WebBlendModeNormal) 382 if (m_blendMode != WebBlendModeNormal)
383 return false; 383 return false;
384 384
385 if (m_composite == CompositeClear || m_composite == CompositeCopy)
386 return true;
387
388 if (m_image->imageSize(&imageClient, effectiveZoom, LayoutSize()).isEmpty())
389 return false;
390
385 if (m_composite == CompositeSourceOver) 391 if (m_composite == CompositeSourceOver)
386 return m_image->knownToBeOpaque(layoutObject); 392 return m_image->knownToBeOpaque(&imageClient);
387 393
388 return false; 394 return false;
389 } 395 }
390 396
391 bool FillLayer::hasRepeatXY() const
392 {
393 return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
394 }
395
396 static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer & layer2) 397 static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer & layer2)
397 { 398 {
398 // We just care about pointer equivalency. 399 // We just care about pointer equivalency.
399 return layer1.image() == layer2.image(); 400 return layer1.image() == layer2.image();
400 } 401 }
401 402
402 bool FillLayer::imagesIdentical(const FillLayer* layer1, const FillLayer* layer2 ) 403 bool FillLayer::imagesIdentical(const FillLayer* layer1, const FillLayer* layer2 )
403 { 404 {
404 for (; layer1 && layer2; layer1 = layer1->next(), layer2 = layer2->next()) { 405 for (; layer1 && layer2; layer1 = layer1->next(), layer2 = layer2->next()) {
405 if (!layerImagesIdentical(*layer1, *layer2)) 406 if (!layerImagesIdentical(*layer1, *layer2))
406 return false; 407 return false;
407 } 408 }
408 409
409 return !layer1 && !layer2; 410 return !layer1 && !layer2;
410 } 411 }
411 412
412 } // namespace blink 413 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/FillLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698