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

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

Issue 306483011: Combine background repaint conditions in RenderStyle and RenderObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/FillLayer.h ('k') | Source/core/rendering/style/RenderStyle.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 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 { 348 {
349 const FillLayer* curr; 349 const FillLayer* curr;
350 for (curr = this; curr; curr = curr->next()) { 350 for (curr = this; curr; curr = curr->next()) {
351 if (curr->m_image && !curr->m_image->isLoaded()) 351 if (curr->m_image && !curr->m_image->isLoaded())
352 return false; 352 return false;
353 } 353 }
354 354
355 return true; 355 return true;
356 } 356 }
357 357
358 bool FillLayer::needsFullRepaintOnContainerWidthChange() const
359 {
360 if (m_image) {
361 if (m_repeatX != RepeatFill && m_repeatX != NoRepeatFill)
362 return true;
363 if (m_xPosition.isPercent() && !m_xPosition.isZero())
364 return true;
365 if (m_backgroundXOrigin != LeftEdge)
366 return true;
367 if (m_sizeType != SizeLength && m_sizeType != SizeNone)
368 return true;
369 if (m_sizeType == SizeLength) {
370 if (m_sizeLength.width().isPercent() && !m_sizeLength.width().isZero ())
371 return true;
372 if (m_sizeLength.width().isAuto() && m_sizeLength.height().isPercent () && !m_sizeLength.height().isZero())
373 return true;
374 }
375 }
376
377 return m_next && m_next->needsFullRepaintOnContainerWidthChange();
378 }
379
380 bool FillLayer::needsFullRepaintOnContainerHeightChange() const
381 {
382 if (m_image) {
383 if (m_repeatY != RepeatFill && m_repeatY != NoRepeatFill)
384 return true;
385 if (m_yPosition.isPercent() && !m_yPosition.isZero())
386 return true;
387 if (m_backgroundYOrigin != TopEdge)
388 return true;
389 if (m_sizeType != SizeLength && m_sizeType != SizeNone)
390 return true;
391 if (m_sizeType == SizeLength) {
392 if (m_sizeLength.height().isPercent() && !m_sizeLength.height().isZe ro())
393 return true;
394 if (m_sizeLength.height().isAuto() && m_sizeLength.width().isPercent () && !m_sizeLength.width().isZero())
395 return true;
396 }
397 }
398
399 return m_next && m_next->needsFullRepaintOnContainerHeightChange();
400 }
401
402 bool FillLayer::hasOpaqueImage(const RenderObject* renderer) const 358 bool FillLayer::hasOpaqueImage(const RenderObject* renderer) const
403 { 359 {
404 if (!m_image) 360 if (!m_image)
405 return false; 361 return false;
406 362
407 if (m_composite == CompositeClear || m_composite == CompositeCopy) 363 if (m_composite == CompositeClear || m_composite == CompositeCopy)
408 return true; 364 return true;
409 365
410 if (m_blendMode != blink::WebBlendModeNormal) 366 if (m_blendMode != blink::WebBlendModeNormal)
411 return false; 367 return false;
412 368
413 if (m_composite == CompositeSourceOver) 369 if (m_composite == CompositeSourceOver)
414 return m_image->knownToBeOpaque(renderer); 370 return m_image->knownToBeOpaque(renderer);
415 371
416 return false; 372 return false;
417 } 373 }
418 374
419 bool FillLayer::hasRepeatXY() const 375 bool FillLayer::hasRepeatXY() const
420 { 376 {
421 return m_repeatX == RepeatFill && m_repeatY == RepeatFill; 377 return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
422 } 378 }
423 379
424 } // namespace WebCore 380 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/FillLayer.h ('k') | Source/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698