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

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

Issue 275543003: Don't always fully repaint on viewport resize (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 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 == RoundFill || m_repeatX == SpaceFill)
362 return true;
363 if (m_xPosition.isPercent() && !m_xPosition.isZero())
esprehn 2014/05/08 20:42:03 ditto
364 return true;
365 if (m_backgroundXOrigin != LeftEdge)
366 return true;
367 if (m_sizeType == SizeLength && m_sizeLength.width().isPercent())
esprehn 2014/05/08 20:42:03 Why don't you check 0% here?
368 return true;
369 if (m_sizeType == Contain || m_sizeType == Cover)
370 return true;
371 }
372
373 return m_next && m_next->needsFullRepaintOnContainerWidthChange();
374 }
375
376 bool FillLayer::needsFullRepaintOnContainerHeightChange() const
377 {
378 if (m_image) {
379 if (m_repeatY == RoundFill || m_repeatY == SpaceFill)
380 return true;
381 if (m_yPosition.isPercent() && !m_yPosition.isZero())
esprehn 2014/05/08 20:42:03 Why do we ever represent 0 as a percent? It seems
Xianzhu 2014/05/08 22:31:08 For visual effect, 0% and 0px are the same, but fo
382 return true;
383 if (m_backgroundYOrigin != TopEdge)
384 return true;
385 if (m_sizeType == SizeLength && m_sizeLength.height().isPercent())
esprehn 2014/05/08 20:42:03 why not check 0%?
Xianzhu 2014/05/08 22:31:08 Omitted this because it's not a common usage and I
386 return true;
387 if (m_sizeType == Contain || m_sizeType == Cover)
388 return true;
esprehn 2014/05/08 20:42:03 Lists like this make me really nervous, this is ho
Xianzhu 2014/05/08 22:31:08 In the new patch set I changed the 'A||B' lists to
389 }
390
391 return m_next && m_next->needsFullRepaintOnContainerWidthChange();
392 }
393
358 bool FillLayer::hasOpaqueImage(const RenderObject* renderer) const 394 bool FillLayer::hasOpaqueImage(const RenderObject* renderer) const
359 { 395 {
360 if (!m_image) 396 if (!m_image)
361 return false; 397 return false;
362 398
363 if (m_composite == CompositeClear || m_composite == CompositeCopy) 399 if (m_composite == CompositeClear || m_composite == CompositeCopy)
364 return true; 400 return true;
365 401
366 if (m_blendMode != blink::WebBlendModeNormal) 402 if (m_blendMode != blink::WebBlendModeNormal)
367 return false; 403 return false;
368 404
369 if (m_composite == CompositeSourceOver) 405 if (m_composite == CompositeSourceOver)
370 return m_image->knownToBeOpaque(renderer); 406 return m_image->knownToBeOpaque(renderer);
371 407
372 return false; 408 return false;
373 } 409 }
374 410
375 bool FillLayer::hasRepeatXY() const 411 bool FillLayer::hasRepeatXY() const
376 { 412 {
377 return m_repeatX == RepeatFill && m_repeatY == RepeatFill; 413 return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
378 } 414 }
379 415
380 } // namespace WebCore 416 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698