summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-08-01 10:35:18 -0700
committerJohn Reck <jreck@google.com>2012-08-01 11:20:47 -0700
commit887267ba11d80d5d04a9a45cda2f3d205ee08acd (patch)
treebdcb081914e9545fd353acc7ff071e7517b65cbd /Source/WebKit
parent74d16a7661fcde10787bc62b4c62e202c9cc2495 (diff)
downloadexternal_webkit-887267ba11d80d5d04a9a45cda2f3d205ee08acd.zip
external_webkit-887267ba11d80d5d04a9a45cda2f3d205ee08acd.tar.gz
external_webkit-887267ba11d80d5d04a9a45cda2f3d205ee08acd.tar.bz2
Fix PicturePile size adjust path
Change-Id: I372248211ce83a6c4b2a9369df9804388b7a98ef
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/jni/PicturePile.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/Source/WebKit/android/jni/PicturePile.cpp b/Source/WebKit/android/jni/PicturePile.cpp
index 0731977..91f3e74 100644
--- a/Source/WebKit/android/jni/PicturePile.cpp
+++ b/Source/WebKit/android/jni/PicturePile.cpp
@@ -153,14 +153,30 @@ void PicturePile::setSize(const IntSize& size)
{
if (m_size == size)
return;
+ IntSize oldSize = m_size;
m_size = size;
- // TODO: See above about just adding invals for new content
- m_pile.clear();
- m_webkitInvals.clear();
- if (!size.isEmpty()) {
- IntRect area(0, 0, size.width(), size.height());
- m_webkitInvals.append(area);
- m_pile.append(area);
+ if (size.width() <= oldSize.width() && size.height() <= oldSize.height()) {
+ // We are shrinking - huzzah, nothing to do!
+ // TODO: Loop through and throw out Pictures that are now clipped out
+ } else if (oldSize.width() == size.width()) {
+ // Only changing vertically
+ IntRect rect(0, std::min(oldSize.height(), size.height()),
+ size.width(), std::abs(oldSize.height() - size.height()));
+ invalidate(rect);
+ } else if (oldSize.height() == size.height()) {
+ // Only changing horizontally
+ IntRect rect(std::min(oldSize.width(), size.width()), 0,
+ std::abs(oldSize.width() - size.width()), size.height());
+ invalidate(rect);
+ } else {
+ // Both width & height changed, full inval :(
+ m_pile.clear();
+ m_webkitInvals.clear();
+ if (!size.isEmpty()) {
+ IntRect area(0, 0, size.width(), size.height());
+ m_webkitInvals.append(area);
+ m_pile.append(area);
+ }
}
}