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

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 886
887 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds) 887 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds)
888 { 888 {
889 if (!m_scrollingLayer) 889 if (!m_scrollingLayer)
890 return; 890 return;
891 891
892 ASSERT(m_scrollingContentsLayer); 892 ASSERT(m_scrollingContentsLayer);
893 RenderBox* renderBox = toRenderBox(renderer()); 893 RenderBox* renderBox = toRenderBox(renderer());
894 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); 894 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
895 895
896 IntSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedScrol lOffset(); 896 IntSize adjustedScrollOffset = flooredIntSize(m_owningLayer.scrollableArea() ->adjustedScrollOffset());
Rick Byers 2014/10/02 21:44:06 Add FIXME?
Yufeng Shen (Slow to review) 2014/10/02 23:34:34 Done.
897 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()))); 897 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())));
898 m_scrollingLayer->setSize(clientBox.size()); 898 m_scrollingLayer->setSize(clientBox.size());
899 899
900 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); 900 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
901 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())); 901 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
902 902
903 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) { 903 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) {
904 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); 904 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
905 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); 905 m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
906 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca tion())); 906 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca tion()));
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 m_scrollingBlockSelectionLayer->setDrawsContent(false); 1143 m_scrollingBlockSelectionLayer->setDrawsContent(false);
1144 return; 1144 return;
1145 } 1145 }
1146 1146
1147 const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBou nds(); 1147 const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBou nds();
1148 const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty(); 1148 const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty();
1149 m_scrollingBlockSelectionLayer->setDrawsContent(!paintsIntoCompositedAncesto r() && shouldDrawContent); 1149 m_scrollingBlockSelectionLayer->setDrawsContent(!paintsIntoCompositedAncesto r() && shouldDrawContent);
1150 if (!shouldDrawContent) 1150 if (!shouldDrawContent)
1151 return; 1151 return;
1152 1152
1153 const IntPoint position = blockSelectionGapsBounds.location() + m_owningLaye r.scrollableArea()->adjustedScrollOffset(); 1153 const IntPoint position = blockSelectionGapsBounds.location() + flooredIntSi ze(m_owningLayer.scrollableArea()->adjustedScrollOffset());
Rick Byers 2014/10/02 21:44:06 add FIXME?
Yufeng Shen (Slow to review) 2014/10/02 23:34:35 Done.
1154 if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size( ) && m_scrollingBlockSelectionLayer->position() == position) 1154 if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size( ) && m_scrollingBlockSelectionLayer->position() == position)
1155 return; 1155 return;
1156 1156
1157 m_scrollingBlockSelectionLayer->setPosition(position); 1157 m_scrollingBlockSelectionLayer->setPosition(position);
1158 m_scrollingBlockSelectionLayer->setSize(blockSelectionGapsBounds.size()); 1158 m_scrollingBlockSelectionLayer->setSize(blockSelectionGapsBounds.size());
1159 m_scrollingBlockSelectionLayer->setOffsetFromRenderer(toIntSize(blockSelecti onGapsBounds.location()), GraphicsLayer::SetNeedsDisplay); 1159 m_scrollingBlockSelectionLayer->setOffsetFromRenderer(toIntSize(blockSelecti onGapsBounds.location()), GraphicsLayer::SetNeedsDisplay);
1160 } 1160 }
1161 1161
1162 void CompositedLayerMapping::updateDrawsContent() 1162 void CompositedLayerMapping::updateDrawsContent()
1163 { 1163 {
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2361 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2362 name = "Scrolling Block Selection Layer"; 2362 name = "Scrolling Block Selection Layer";
2363 } else { 2363 } else {
2364 ASSERT_NOT_REACHED(); 2364 ASSERT_NOT_REACHED();
2365 } 2365 }
2366 2366
2367 return name; 2367 return name;
2368 } 2368 }
2369 2369
2370 } // namespace blink 2370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698