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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 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
« no previous file with comments | « Source/platform/mac/ThemeMac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // instead. Returns the scale to be applied. 317 // instead. Returns the scale to be applied.
318 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit 318 // On Linux, we don't have the problem with NativeTheme, hence we let WebKit
319 // do the scaling and ignore the return value. 319 // do the scaling and ignore the return value.
320 virtual float spoolPage(GraphicsContext& context, int pageNumber) 320 virtual float spoolPage(GraphicsContext& context, int pageNumber)
321 { 321 {
322 IntRect pageRect = m_pageRects[pageNumber]; 322 IntRect pageRect = m_pageRects[pageNumber];
323 float scale = m_printedPageWidth / pageRect.width(); 323 float scale = m_printedPageWidth / pageRect.width();
324 324
325 context.save(); 325 context.save();
326 #if OS(POSIX) && !OS(MACOSX) 326 #if OS(POSIX) && !OS(MACOSX)
327 context.scale(WebCore::FloatSize(scale, scale)); 327 context.scale(scale, scale);
328 #endif 328 #endif
329 context.translate(static_cast<float>(-pageRect.x()), static_cast<float>( -pageRect.y())); 329 context.translate(static_cast<float>(-pageRect.x()), static_cast<float>( -pageRect.y()));
330 context.clip(pageRect); 330 context.clip(pageRect);
331 frame()->view()->paintContents(&context, pageRect); 331 frame()->view()->paintContents(&context, pageRect);
332 if (context.supportsURLFragments()) 332 if (context.supportsURLFragments())
333 outputLinkedDestinations(context, frame()->document(), pageRect); 333 outputLinkedDestinations(context, frame()->document(), pageRect);
334 context.restore(); 334 context.restore();
335 return scale; 335 return scale;
336 } 336 }
337 337
(...skipping 26 matching lines...) Expand all
364 graphicsContext.restore(); 364 graphicsContext.restore();
365 } 365 }
366 366
367 graphicsContext.save(); 367 graphicsContext.save();
368 368
369 graphicsContext.translate(0, currentHeight); 369 graphicsContext.translate(0, currentHeight);
370 #if OS(WIN) || OS(MACOSX) 370 #if OS(WIN) || OS(MACOSX)
371 // Account for the disabling of scaling in spoolPage. In the context 371 // Account for the disabling of scaling in spoolPage. In the context
372 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied . 372 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied .
373 float scale = getPageShrink(pageIndex); 373 float scale = getPageShrink(pageIndex);
374 graphicsContext.scale(WebCore::FloatSize(scale, scale)); 374 graphicsContext.scale(scale, scale);
375 #endif 375 #endif
376 spoolPage(graphicsContext, pageIndex); 376 spoolPage(graphicsContext, pageIndex);
377 graphicsContext.restore(); 377 graphicsContext.restore();
378 378
379 currentHeight += pageSizeInPixels.height() + 1; 379 currentHeight += pageSizeInPixels.height() + 1;
380 } 380 }
381 } 381 }
382 382
383 virtual void computePageRects(const FloatRect& printRect, float headerHeight , float footerHeight, float userScaleFactor, float& outPageHeight) 383 virtual void computePageRects(const FloatRect& printRect, float headerHeight , float footerHeight, float userScaleFactor, float& outPageHeight)
384 { 384 {
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 1922
1923 void WebLocalFrameImpl::invalidateAll() const 1923 void WebLocalFrameImpl::invalidateAll() const
1924 { 1924 {
1925 ASSERT(frame() && frame()->view()); 1925 ASSERT(frame() && frame()->view());
1926 FrameView* view = frame()->view(); 1926 FrameView* view = frame()->view();
1927 view->invalidateRect(view->frameRect()); 1927 view->invalidateRect(view->frameRect());
1928 invalidateScrollbar(); 1928 invalidateScrollbar();
1929 } 1929 }
1930 1930
1931 } // namespace blink 1931 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/mac/ThemeMac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698