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

Side by Side Diff: Source/core/rendering/RenderFlowThread.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 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) 2011 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 LayoutRect RenderFlowThread::computeRegionClippingRect(const LayoutPoint& offset , const LayoutRect& flowThreadPortionRect, const LayoutRect& flowThreadPortionOv erflowRect) const 260 LayoutRect RenderFlowThread::computeRegionClippingRect(const LayoutPoint& offset , const LayoutRect& flowThreadPortionRect, const LayoutRect& flowThreadPortionOv erflowRect) const
261 { 261 {
262 LayoutRect regionClippingRect(offset + (flowThreadPortionOverflowRect.locati on() - flowThreadPortionRect.location()), flowThreadPortionOverflowRect.size()); 262 LayoutRect regionClippingRect(offset + (flowThreadPortionOverflowRect.locati on() - flowThreadPortionRect.location()), flowThreadPortionOverflowRect.size());
263 if (style()->isFlippedBlocksWritingMode()) 263 if (style()->isFlippedBlocksWritingMode())
264 regionClippingRect.move(flowThreadPortionRect.size() - flowThreadPortion OverflowRect.size()); 264 regionClippingRect.move(flowThreadPortionRect.size() - flowThreadPortion OverflowRect.size());
265 return regionClippingRect; 265 return regionClippingRect;
266 } 266 }
267 267
268 void RenderFlowThread::paintFlowThreadPortionInRegion(PaintInfo& paintInfo, Rend erRegion* region, const LayoutRect& flowThreadPortionRect, const LayoutRect& flo wThreadPortionOverflowRect, const LayoutPoint& paintOffset) const 268 void RenderFlowThread::paintFlowThreadPortionInRegion(PaintInfo& paintInfo, Rend erRegion* region, const LayoutRect& flowThreadPortionRect, const LayoutRect& flo wThreadPortionOverflowRect, const LayoutPoint& paintOffset) const
269 { 269 {
270 GraphicsContext* context = paintInfo.context; 270 GraphicsContext* context = paintInfo.getContext();
271 if (!context) 271 if (!context)
272 return; 272 return;
273 273
274 // RenderFlowThread should start painting its content in a position that is offset 274 // RenderFlowThread should start painting its content in a position that is offset
275 // from the region rect's current position. The amount of offset is equal to the location of 275 // from the region rect's current position. The amount of offset is equal to the location of
276 // the flow thread portion in the flow thread's local coordinates. 276 // the flow thread portion in the flow thread's local coordinates.
277 // Note that we have to pixel snap the location at which we're going to pain t, since this is necessary 277 // Note that we have to pixel snap the location at which we're going to pain t, since this is necessary
278 // to minimize the amount of incorrect snapping that would otherwise occur. 278 // to minimize the amount of incorrect snapping that would otherwise occur.
279 // If we tried to paint by applying a non-integral translation, then all the 279 // If we tried to paint by applying a non-integral translation, then all the
280 // layout code that attempted to pixel snap would be incorrect. 280 // layout code that attempted to pixel snap would be incorrect.
281 IntPoint adjustedPaintOffset; 281 IntPoint adjustedPaintOffset;
282 LayoutPoint portionLocation; 282 LayoutPoint portionLocation;
283 if (style()->isFlippedBlocksWritingMode()) { 283 if (style()->isFlippedBlocksWritingMode()) {
284 LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect); 284 LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect);
285 flipForWritingMode(flippedFlowThreadPortionRect); 285 flipForWritingMode(flippedFlowThreadPortionRect);
286 portionLocation = flippedFlowThreadPortionRect.location(); 286 portionLocation = flippedFlowThreadPortionRect.location();
287 } else 287 } else
288 portionLocation = flowThreadPortionRect.location(); 288 portionLocation = flowThreadPortionRect.location();
289 adjustedPaintOffset = roundedIntPoint(paintOffset - portionLocation); 289 adjustedPaintOffset = roundedIntPoint(paintOffset - portionLocation);
290 290
291 // The clipping rect for the region is set up by assuming the flowThreadPort ionRect is going to paint offset from adjustedPaintOffset. 291 // The clipping rect for the region is set up by assuming the flowThreadPort ionRect is going to paint offset from adjustedPaintOffset.
292 // Remember that we pixel snapped and moved the paintOffset and stored the s napped result in adjustedPaintOffset. Now we add back in 292 // Remember that we pixel snapped and moved the paintOffset and stored the s napped result in adjustedPaintOffset. Now we add back in
293 // the flowThreadPortionRect's location to get the spot where we expect the portion to actually paint. This can be non-integral and 293 // the flowThreadPortionRect's location to get the spot where we expect the portion to actually paint. This can be non-integral and
294 // that's ok. We then pixel snap the resulting clipping rect to account for snapping that will occur when the flow thread paints. 294 // that's ok. We then pixel snap the resulting clipping rect to account for snapping that will occur when the flow thread paints.
295 IntRect regionClippingRect = pixelSnappedIntRect(computeRegionClippingRect(a djustedPaintOffset + portionLocation, flowThreadPortionRect, flowThreadPortionOv erflowRect)); 295 IntRect regionClippingRect = pixelSnappedIntRect(computeRegionClippingRect(a djustedPaintOffset + portionLocation, flowThreadPortionRect, flowThreadPortionOv erflowRect));
296 296
297 PaintInfo info(paintInfo); 297 PaintInfo info(paintInfo);
298 info.rect.intersect(regionClippingRect); 298 info.getRect().intersect(regionClippingRect);
299 299
300 if (!info.rect.isEmpty()) { 300 if (!info.getRect().isEmpty()) {
301 context->save(); 301 context->save();
302 302
303 context->clip(regionClippingRect); 303 context->clip(regionClippingRect);
304 304
305 context->translate(adjustedPaintOffset.x(), adjustedPaintOffset.y()); 305 context->translate(adjustedPaintOffset.x(), adjustedPaintOffset.y());
306 info.rect.moveBy(-adjustedPaintOffset); 306 info.getRect().moveBy(-adjustedPaintOffset);
307 307
308 layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayer TemporaryClipRects); 308 layer()->paint(context, info.getRect(), 0, 0, region, RenderLayer::Paint LayerTemporaryClipRects);
309 309
310 context->restore(); 310 context->restore();
311 } 311 }
312 } 312 }
313 313
314 bool RenderFlowThread::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumula tedOffset, HitTestAction hitTestAction) 314 bool RenderFlowThread::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumula tedOffset, HitTestAction hitTestAction)
315 { 315 {
316 if (hitTestAction == HitTestBlockBackground) 316 if (hitTestAction == HitTestBlockBackground)
317 return false; 317 return false;
318 return RenderBlock::nodeAtPoint(request, result, locationInContainer, accumu latedOffset, hitTestAction); 318 return RenderBlock::nodeAtPoint(request, result, locationInContainer, accumu latedOffset, hitTestAction);
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 { 1043 {
1044 if (!m_renderFlowThread) 1044 if (!m_renderFlowThread)
1045 return; 1045 return;
1046 RenderView* view = m_renderFlowThread->view(); 1046 RenderView* view = m_renderFlowThread->view();
1047 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl owThread); 1047 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl owThread);
1048 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo wThread); 1048 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo wThread);
1049 } 1049 }
1050 1050
1051 1051
1052 } // namespace WebCore 1052 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698