| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 FrameView* view = frame_->view(); | 1406 FrameView* view = frame_->view(); |
| 1407 if (view) | 1407 if (view) |
| 1408 view->layout(); | 1408 view->layout(); |
| 1409 | 1409 |
| 1410 // recursively layout child frames | 1410 // recursively layout child frames |
| 1411 Frame* child = frame_->tree()->firstChild(); | 1411 Frame* child = frame_->tree()->firstChild(); |
| 1412 for (; child; child = child->tree()->nextSibling()) | 1412 for (; child; child = child->tree()->nextSibling()) |
| 1413 FromFrame(child)->Layout(); | 1413 FromFrame(child)->Layout(); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 void WebFrameImpl::Paint(gfx::PlatformCanvas* canvas, const gfx::Rect& rect) { | 1416 void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { |
| 1417 static StatsRate rendering("WebFramePaintTime"); | 1417 static StatsRate rendering("WebFramePaintTime"); |
| 1418 StatsScope<StatsRate> rendering_scope(rendering); | 1418 StatsScope<StatsRate> rendering_scope(rendering); |
| 1419 | 1419 |
| 1420 if (!rect.IsEmpty()) { | 1420 if (!rect.IsEmpty()) { |
| 1421 IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); | 1421 IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); |
| 1422 #if defined(OS_MACOSX) | 1422 #if defined(OS_MACOSX) |
| 1423 CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); | 1423 CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); |
| 1424 GraphicsContext gc(context); | 1424 GraphicsContext gc(context); |
| 1425 #else | 1425 #else |
| 1426 PlatformContextSkia context(canvas); | 1426 PlatformContextSkia context(canvas); |
| 1427 | 1427 |
| 1428 // PlatformGraphicsContext is actually a pointer to PlatformContextSkia | 1428 // PlatformGraphicsContext is actually a pointer to PlatformContextSkia |
| 1429 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); | 1429 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); |
| 1430 #endif | 1430 #endif |
| 1431 if (frame_->document() && frameview()) { | 1431 if (frame_->document() && frameview()) { |
| 1432 frameview()->paint(&gc, dirty_rect); | 1432 frameview()->paint(&gc, dirty_rect); |
| 1433 } else { | 1433 } else { |
| 1434 gc.fillRect(dirty_rect, Color::white); | 1434 gc.fillRect(dirty_rect, Color::white); |
| 1435 } | 1435 } |
| 1436 } | 1436 } |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 bool WebFrameImpl::CaptureImage(scoped_ptr<gfx::BitmapPlatformDevice>* image, | 1439 bool WebFrameImpl::CaptureImage(scoped_ptr<skia::BitmapPlatformDevice>* image, |
| 1440 bool scroll_to_zero) { | 1440 bool scroll_to_zero) { |
| 1441 if (!image) { | 1441 if (!image) { |
| 1442 NOTREACHED(); | 1442 NOTREACHED(); |
| 1443 return false; | 1443 return false; |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 // Must layout before painting. | 1446 // Must layout before painting. |
| 1447 Layout(); | 1447 Layout(); |
| 1448 | 1448 |
| 1449 gfx::PlatformCanvas canvas; | 1449 skia::PlatformCanvas canvas; |
| 1450 if (!canvas.initialize(frameview()->width(), frameview()->height(), true)) | 1450 if (!canvas.initialize(frameview()->width(), frameview()->height(), true)) |
| 1451 return false; | 1451 return false; |
| 1452 | 1452 |
| 1453 #if defined(OS_WIN) || defined(OS_LINUX) | 1453 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1454 PlatformContextSkia context(&canvas); | 1454 PlatformContextSkia context(&canvas); |
| 1455 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); | 1455 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); |
| 1456 #elif defined(OS_MACOSX) | 1456 #elif defined(OS_MACOSX) |
| 1457 CGContextRef context = canvas.beginPlatformPaint(); | 1457 CGContextRef context = canvas.beginPlatformPaint(); |
| 1458 GraphicsContext gc(context); | 1458 GraphicsContext gc(context); |
| 1459 #endif | 1459 #endif |
| 1460 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(), | 1460 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(), |
| 1461 frameview()->height())); | 1461 frameview()->height())); |
| 1462 #if defined(OS_MACOSX) | 1462 #if defined(OS_MACOSX) |
| 1463 canvas.endPlatformPaint(); | 1463 canvas.endPlatformPaint(); |
| 1464 #endif | 1464 #endif |
| 1465 | 1465 |
| 1466 gfx::BitmapPlatformDevice& device = | 1466 skia::BitmapPlatformDevice& device = |
| 1467 static_cast<gfx::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); | 1467 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); |
| 1468 | 1468 |
| 1469 #if defined(OS_WIN) | 1469 #if defined(OS_WIN) |
| 1470 device.fixupAlphaBeforeCompositing(); | 1470 device.fixupAlphaBeforeCompositing(); |
| 1471 #endif | 1471 #endif |
| 1472 | 1472 |
| 1473 image->reset(new gfx::BitmapPlatformDevice(device)); | 1473 image->reset(new skia::BitmapPlatformDevice(device)); |
| 1474 return true; | 1474 return true; |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 bool WebFrameImpl::IsLoading() { | 1477 bool WebFrameImpl::IsLoading() { |
| 1478 // I'm assuming this does what we want. | 1478 // I'm assuming this does what we want. |
| 1479 return frame_->loader()->isLoading(); | 1479 return frame_->loader()->isLoading(); |
| 1480 } | 1480 } |
| 1481 | 1481 |
| 1482 void WebFrameImpl::Closing() { | 1482 void WebFrameImpl::Closing() { |
| 1483 alt_error_page_fetcher_.reset(); | 1483 alt_error_page_fetcher_.reset(); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 } | 1766 } |
| 1767 | 1767 |
| 1768 void WebFrameImpl::GetPageRect(int page, gfx::Rect* page_size) const { | 1768 void WebFrameImpl::GetPageRect(int page, gfx::Rect* page_size) const { |
| 1769 if (page < 0 || page >= static_cast<int>(pages_.size())) { | 1769 if (page < 0 || page >= static_cast<int>(pages_.size())) { |
| 1770 NOTREACHED(); | 1770 NOTREACHED(); |
| 1771 return; | 1771 return; |
| 1772 } | 1772 } |
| 1773 *page_size = webkit_glue::FromIntRect(pages_[page]); | 1773 *page_size = webkit_glue::FromIntRect(pages_[page]); |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 bool WebFrameImpl::SpoolPage(int page, gfx::PlatformCanvas* canvas) { | 1776 bool WebFrameImpl::SpoolPage(int page, skia::PlatformCanvas* canvas) { |
| 1777 // Ensure correct state. | 1777 // Ensure correct state. |
| 1778 if (!printing_ || | 1778 if (!printing_ || |
| 1779 page < 0 || | 1779 page < 0 || |
| 1780 page >= static_cast<int>(pages_.size())) { | 1780 page >= static_cast<int>(pages_.size())) { |
| 1781 NOTREACHED(); | 1781 NOTREACHED(); |
| 1782 return false; | 1782 return false; |
| 1783 } | 1783 } |
| 1784 | 1784 |
| 1785 if (!frame() || !frame()->document()) { | 1785 if (!frame() || !frame()->document()) { |
| 1786 NOTREACHED(); | 1786 NOTREACHED(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 return password_listeners_.get(input_element); | 1829 return password_listeners_.get(input_element); |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 void WebFrameImpl::ClearPasswordListeners() { | 1832 void WebFrameImpl::ClearPasswordListeners() { |
| 1833 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); | 1833 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); |
| 1834 iter != password_listeners_.end(); ++iter) { | 1834 iter != password_listeners_.end(); ++iter) { |
| 1835 delete iter->second; | 1835 delete iter->second; |
| 1836 } | 1836 } |
| 1837 password_listeners_.clear(); | 1837 password_listeners_.clear(); |
| 1838 } | 1838 } |
| OLD | NEW |