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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 7319: get webframe_impl.cc to compile on linux (Closed)
Patch Set: merge fixes from icefox Created 12 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
« no previous file with comments | « webkit/glue/webframe_impl.h ('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) 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #include "webkit/glue/alt_error_page_resource_fetcher.h" 140 #include "webkit/glue/alt_error_page_resource_fetcher.h"
141 #include "webkit/glue/webdocumentloader_impl.h" 141 #include "webkit/glue/webdocumentloader_impl.h"
142 #include "webkit/glue/weberror_impl.h" 142 #include "webkit/glue/weberror_impl.h"
143 #include "webkit/glue/webframe_impl.h" 143 #include "webkit/glue/webframe_impl.h"
144 #include "webkit/glue/webhistoryitem_impl.h" 144 #include "webkit/glue/webhistoryitem_impl.h"
145 #include "webkit/glue/webtextinput_impl.h" 145 #include "webkit/glue/webtextinput_impl.h"
146 #include "webkit/glue/webview_impl.h" 146 #include "webkit/glue/webview_impl.h"
147 #include "webkit/port/page/ChromeClientWin.h" 147 #include "webkit/port/page/ChromeClientWin.h"
148 #include "webkit/port/platform/WidgetClientWin.h" 148 #include "webkit/port/platform/WidgetClientWin.h"
149 149
150 #if defined(OS_LINUX)
151 #include <gdk/gdk.h>
152 #endif
153
150 using WebCore::ChromeClientWin; 154 using WebCore::ChromeClientWin;
151 using WebCore::Color; 155 using WebCore::Color;
152 using WebCore::Document; 156 using WebCore::Document;
153 using WebCore::DocumentFragment; 157 using WebCore::DocumentFragment;
154 using WebCore::DocumentLoader; 158 using WebCore::DocumentLoader;
155 using WebCore::ExceptionCode; 159 using WebCore::ExceptionCode;
156 using WebCore::GraphicsContext; 160 using WebCore::GraphicsContext;
157 using WebCore::HTMLFrameOwnerElement; 161 using WebCore::HTMLFrameOwnerElement;
158 using WebCore::Frame; 162 using WebCore::Frame;
159 using WebCore::FrameLoader; 163 using WebCore::FrameLoader;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 int to_append = std::min(it.length(), 241 int to_append = std::min(it.length(),
238 max_chars - static_cast<int>(output->size())); 242 max_chars - static_cast<int>(output->size()));
239 output->append(chars, to_append); 243 output->append(chars, to_append);
240 if (output->size() >= static_cast<size_t>(max_chars)) 244 if (output->size() >= static_cast<size_t>(max_chars))
241 return; // Filled up the buffer. 245 return; // Filled up the buffer.
242 } 246 }
243 } 247 }
244 248
245 // Recursively walk the children. 249 // Recursively walk the children.
246 FrameTree* frame_tree = frame->tree(); 250 FrameTree* frame_tree = frame->tree();
247 Frame* cur_child = frame_tree->firstChild();
248 for (Frame* cur_child = frame_tree->firstChild(); cur_child; 251 for (Frame* cur_child = frame_tree->firstChild(); cur_child;
249 cur_child = cur_child->tree()->nextSibling()) { 252 cur_child = cur_child->tree()->nextSibling()) {
250 // Make sure the frame separator won't fill up the buffer, and give up if 253 // Make sure the frame separator won't fill up the buffer, and give up if
251 // it will. The danger is if the separator will make the buffer longer than 254 // it will. The danger is if the separator will make the buffer longer than
252 // max_chars. This will cause the computation above: 255 // max_chars. This will cause the computation above:
253 // max_chars - output->size() 256 // max_chars - output->size()
254 // to be a negative number which will crash when the subframe is added. 257 // to be a negative number which will crash when the subframe is added.
255 if (static_cast<int>(output->size()) >= max_chars - kFrameSeparatorLen) 258 if (static_cast<int>(output->size()) >= max_chars - kFrameSeparatorLen)
256 return; 259 return;
257 260
(...skipping 12 matching lines...) Expand all
270 // Don't complain about using "this" in initializer list. 273 // Don't complain about using "this" in initializer list.
271 MSVC_PUSH_DISABLE_WARNING(4355) 274 MSVC_PUSH_DISABLE_WARNING(4355)
272 : frame_loader_client_(this), 275 : frame_loader_client_(this),
273 scope_matches_factory_(this), 276 scope_matches_factory_(this),
274 MSVC_POP_WARNING() 277 MSVC_POP_WARNING()
275 currently_loading_request_(NULL), 278 currently_loading_request_(NULL),
276 plugin_delegate_(NULL), 279 plugin_delegate_(NULL),
277 allows_scrolling_(true), 280 allows_scrolling_(true),
278 margin_width_(-1), 281 margin_width_(-1),
279 margin_height_(-1), 282 margin_height_(-1),
280 last_match_count_(-1),
281 total_matchcount_(-1),
282 inspected_node_(NULL), 283 inspected_node_(NULL),
283 active_tickmark_frame_(NULL), 284 active_tickmark_frame_(NULL),
284 active_tickmark_(WidgetClientWin::kNoTickmark), 285 active_tickmark_(WidgetClientWin::kNoTickmark),
285 locating_active_rect_(false), 286 locating_active_rect_(false),
286 last_active_range_(NULL), 287 last_active_range_(NULL),
288 last_match_count_(-1),
289 total_matchcount_(-1),
287 frames_scoping_count_(-1), 290 frames_scoping_count_(-1),
288 scoping_complete_(false), 291 scoping_complete_(false),
289 next_invalidate_after_(0), 292 next_invalidate_after_(0),
290 printing_(false) { 293 printing_(false) {
291 StatsCounter(kWebFrameActiveCount).Increment(); 294 StatsCounter(kWebFrameActiveCount).Increment();
292 live_object_count_++; 295 live_object_count_++;
293 } 296 }
294 297
295 WebFrameImpl::~WebFrameImpl() { 298 WebFrameImpl::~WebFrameImpl() {
296 StatsCounter(kWebFrameActiveCount).Decrement(); 299 StatsCounter(kWebFrameActiveCount).Decrement();
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 std::wstring* text) const { 719 std::wstring* text) const {
717 text->clear(); 720 text->clear();
718 if (!frame_) 721 if (!frame_)
719 return; 722 return;
720 723
721 FrameContentAsPlainText(max_chars, frame_.get(), text); 724 FrameContentAsPlainText(max_chars, frame_.get(), text);
722 } 725 }
723 726
724 void WebFrameImpl::InvalidateArea(AreaToInvalidate area) { 727 void WebFrameImpl::InvalidateArea(AreaToInvalidate area) {
725 ASSERT(frame() && frame()->view()); 728 ASSERT(frame() && frame()->view());
729 #if defined(OS_WIN)
730 // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView
726 FrameView* view = frame()->view(); 731 FrameView* view = frame()->view();
727 732
728 #if defined(OS_WIN)
729 // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView
730 if ((area & INVALIDATE_ALL) == INVALIDATE_ALL) { 733 if ((area & INVALIDATE_ALL) == INVALIDATE_ALL) {
731 view->addToDirtyRegion(view->frameGeometry()); 734 view->addToDirtyRegion(view->frameGeometry());
732 } else { 735 } else {
733 if ((area & INVALIDATE_CONTENT_AREA) == INVALIDATE_CONTENT_AREA) { 736 if ((area & INVALIDATE_CONTENT_AREA) == INVALIDATE_CONTENT_AREA) {
734 IntRect content_area(view->x(), 737 IntRect content_area(view->x(),
735 view->y(), 738 view->y(),
736 view->visibleWidth(), 739 view->visibleWidth(),
737 view->visibleHeight()); 740 view->visibleHeight());
738 view->addToDirtyRegion(content_area); 741 view->addToDirtyRegion(content_area);
739 } 742 }
740 743
741 if ((area & INVALIDATE_SCROLLBAR) == INVALIDATE_SCROLLBAR) { 744 if ((area & INVALIDATE_SCROLLBAR) == INVALIDATE_SCROLLBAR) {
742 // Invalidate the vertical scroll bar region for the view. 745 // Invalidate the vertical scroll bar region for the view.
743 IntRect scroll_bar_vert(view->x() + view->visibleWidth(), 746 IntRect scroll_bar_vert(view->x() + view->visibleWidth(),
744 view->y(), 747 view->y(),
745 PlatformScrollbar::verticalScrollbarWidth(), 748 PlatformScrollbar::verticalScrollbarWidth(),
746 view->visibleHeight()); 749 view->visibleHeight());
747 view->addToDirtyRegion(scroll_bar_vert); 750 view->addToDirtyRegion(scroll_bar_vert);
748 } 751 }
749 } 752 }
750 #endif 753 #endif
751 } 754 }
752 755
753 void WebFrameImpl::InvalidateTickmark(RefPtr<WebCore::Range> tickmark) { 756 void WebFrameImpl::InvalidateTickmark(RefPtr<WebCore::Range> tickmark) {
754 ASSERT(frame() && frame()->view()); 757 ASSERT(frame() && frame()->view());
758 #if defined(OS_WIN)
759 // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView
755 FrameView* view = frame()->view(); 760 FrameView* view = frame()->view();
756 761
757 #if defined(OS_WIN)
758 // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView
759 IntRect pos = tickmark->boundingBox(); 762 IntRect pos = tickmark->boundingBox();
760 pos.move(-view->contentsX(), -view->contentsY()); 763 pos.move(-view->contentsX(), -view->contentsY());
761 view->addToDirtyRegion(pos); 764 view->addToDirtyRegion(pos);
762 #endif 765 #endif
763 } 766 }
764 767
765 void WebFrameImpl::IncreaseMatchCount(int count, int request_id) { 768 void WebFrameImpl::IncreaseMatchCount(int count, int request_id) {
766 total_matchcount_ += count; 769 total_matchcount_ += count;
767 770
768 // Update the UI with the latest findings. 771 // Update the UI with the latest findings.
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); 1487 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
1485 #endif 1488 #endif
1486 if (frame_->document() && frameview()) { 1489 if (frame_->document() && frameview()) {
1487 frameview()->paint(&gc, dirty_rect); 1490 frameview()->paint(&gc, dirty_rect);
1488 } else { 1491 } else {
1489 gc.fillRect(dirty_rect, Color::white); 1492 gc.fillRect(dirty_rect, Color::white);
1490 } 1493 }
1491 } 1494 }
1492 } 1495 }
1493 1496
1497 // TODO(tc): Merge these as they are almost identical across platforms.
1494 #if defined(OS_WIN) 1498 #if defined(OS_WIN)
1495 gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) { 1499 gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) {
1496 // Must layout before painting. 1500 // Must layout before painting.
1497 Layout(); 1501 Layout();
1498 1502
1499 gfx::PlatformCanvasWin canvas(frameview()->width(), frameview()->height(), tru e); 1503 gfx::PlatformCanvasWin canvas(frameview()->width(), frameview()->height(), tru e);
1500 PlatformContextSkia context(&canvas); 1504 PlatformContextSkia context(&canvas);
1501 1505
1502 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); 1506 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
1503 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(), 1507 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(),
(...skipping 16 matching lines...) Expand all
1520 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(), 1524 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(),
1521 frameview()->height())); 1525 frameview()->height()));
1522 canvas.endPlatformPaint(); 1526 canvas.endPlatformPaint();
1523 1527
1524 gfx::BitmapPlatformDevice& device = 1528 gfx::BitmapPlatformDevice& device =
1525 static_cast<gfx::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); 1529 static_cast<gfx::BitmapPlatformDevice&>(canvas.getTopPlatformDevice());
1526 return device; 1530 return device;
1527 } 1531 }
1528 #else 1532 #else
1529 gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) { 1533 gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) {
1530 NOTIMPLEMENTED(); 1534 // Must layout before painting.
1535 Layout();
1536
1537 gfx::PlatformCanvasLinux canvas(frameview()->width(), frameview()->height(),
1538 true);
1539 PlatformContextSkia context(&canvas);
1540
1541 GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
1542 frameview()->paint(&gc, IntRect(0, 0, frameview()->width(),
1543 frameview()->height()));
1544
1545 gfx::BitmapPlatformDevice& device =
1546 static_cast<gfx::BitmapPlatformDevice&>(canvas.getTopPlatformDevice());
1547 return device;
1531 } 1548 }
1532 #endif 1549 #endif
1533 1550
1534 bool WebFrameImpl::IsLoading() { 1551 bool WebFrameImpl::IsLoading() {
1535 // I'm assuming this does what we want. 1552 // I'm assuming this does what we want.
1536 return frame_->loader()->isLoading(); 1553 return frame_->loader()->isLoading();
1537 } 1554 }
1538 1555
1539 void WebFrameImpl::Closing() { 1556 void WebFrameImpl::Closing() {
1540 // let go of our references, this breaks reference cycles and will 1557 // let go of our references, this breaks reference cycles and will
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 if (loader) { 1896 if (loader) {
1880 return WebCore::FrameLoadTypeReloadAllowingStaleData == 1897 return WebCore::FrameLoadTypeReloadAllowingStaleData ==
1881 loader->policyLoadType(); 1898 loader->policyLoadType();
1882 } 1899 }
1883 return false; 1900 return false;
1884 } 1901 }
1885 1902
1886 int WebFrameImpl::PendingFrameUnloadEventCount() const { 1903 int WebFrameImpl::PendingFrameUnloadEventCount() const {
1887 return frame()->eventHandler()->pendingFrameUnloadEventCount(); 1904 return frame()->eventHandler()->pendingFrameUnloadEventCount();
1888 } 1905 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698