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

Unified Diff: cc/ScrollbarLayerChromium.cpp

Issue 10909255: Support high DPI scrollbar on top level web frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/ScrollbarLayerChromium.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ScrollbarLayerChromium.cpp
diff --git a/cc/ScrollbarLayerChromium.cpp b/cc/ScrollbarLayerChromium.cpp
index 85801e6f2707449fb721e4e15d9ab60f83b64b35..703a398af5a180020b43cc7efea111bc4b0eb38f 100644
--- a/cc/ScrollbarLayerChromium.cpp
+++ b/cc/ScrollbarLayerChromium.cpp
@@ -122,6 +122,16 @@ private:
WebKit::WebScrollbar::ScrollbarPart m_trackPart;
};
+bool ScrollbarLayerChromium::needsContentsScale() const
+{
+ return true;
+}
+
+IntSize ScrollbarLayerChromium::contentBounds() const
+{
+ return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale()));
+}
+
class ScrollbarThumbPainter : public LayerPainterChromium {
WTF_MAKE_NONCOPYABLE(ScrollbarThumbPainter);
public:
@@ -204,8 +214,10 @@ void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextu
return;
// Paint and upload the entire part.
+ float widthScale = static_cast<float>(contentBounds().width()) / bounds().width();
+ float heightScale = static_cast<float>(contentBounds().height()) / bounds().height();
IntRect paintedOpaqueRect;
- painter->prepareToUpdate(rect, rect.size(), 1, 1, paintedOpaqueRect, stats);
+ painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, paintedOpaqueRect, stats);
texture->prepareRect(rect, stats);
IntSize destOffset(0, 0);
@@ -231,8 +243,8 @@ void ScrollbarLayerChromium::setTexturePriorities(const CCPriorityCalculator&)
m_foreTrack->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(drawsToRoot));
}
if (m_thumb) {
- WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
- m_thumb->texture()->setDimensions(IntSize(thumbRect.width, thumbRect.height), m_textureFormat);
+ IntSize thumbSize = layerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
+ m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
m_thumb->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(drawsToRoot));
}
}
@@ -245,14 +257,14 @@ void ScrollbarLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusi
createTextureUpdaterIfNeeded();
IntPoint scrollbarOrigin(m_scrollbar->location().x, m_scrollbar->location().y);
- IntRect contentRect(scrollbarOrigin, contentBounds());
+ IntRect contentRect = layerRectToContentRect(WebKit::WebRect(scrollbarOrigin.x(), scrollbarOrigin.y(), bounds().width(), bounds().height()));
updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats);
if (m_foreTrack && m_foreTrackUpdater)
updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, queue, stats);
// Consider the thumb to be at the origin when painting.
WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
- IntRect originThumbRect = IntRect(0, 0, thumbRect.width, thumbRect.height);
+ IntRect originThumbRect = layerRectToContentRect(WebKit::WebRect(0, 0, thumbRect.width, thumbRect.height));
if (!originThumbRect.isEmpty())
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
}
« no previous file with comments | « cc/ScrollbarLayerChromium.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698