OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 #include "web/SharedWorkerRepositoryClientImpl.h" | 189 #include "web/SharedWorkerRepositoryClientImpl.h" |
190 #include "web/TextFinder.h" | 190 #include "web/TextFinder.h" |
191 #include "web/WebDataSourceImpl.h" | 191 #include "web/WebDataSourceImpl.h" |
192 #include "web/WebDevToolsAgentPrivate.h" | 192 #include "web/WebDevToolsAgentPrivate.h" |
193 #include "web/WebPluginContainerImpl.h" | 193 #include "web/WebPluginContainerImpl.h" |
194 #include "web/WebViewImpl.h" | 194 #include "web/WebViewImpl.h" |
195 #include "wtf/CurrentTime.h" | 195 #include "wtf/CurrentTime.h" |
196 #include "wtf/HashMap.h" | 196 #include "wtf/HashMap.h" |
197 #include <algorithm> | 197 #include <algorithm> |
198 | 198 |
199 using namespace WebCore; | 199 using namespace blink; |
200 | 200 |
201 namespace blink { | 201 namespace blink { |
202 | 202 |
203 static int frameCount = 0; | 203 static int frameCount = 0; |
204 | 204 |
205 // Key for a StatsCounter tracking how many WebFrames are active. | 205 // Key for a StatsCounter tracking how many WebFrames are active. |
206 static const char webFrameActiveCount[] = "WebFrameActiveCount"; | 206 static const char webFrameActiveCount[] = "WebFrameActiveCount"; |
207 | 207 |
208 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu
ilder& output) | 208 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu
ilder& output) |
209 { | 209 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame*
frame) | 268 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame*
frame) |
269 { | 269 { |
270 if (!frame) | 270 if (!frame) |
271 return 0; | 271 return 0; |
272 if (!frame->document() || !frame->document()->isPluginDocument()) | 272 if (!frame->document() || !frame->document()->isPluginDocument()) |
273 return 0; | 273 return 0; |
274 PluginDocument* pluginDocument = toPluginDocument(frame->document()); | 274 PluginDocument* pluginDocument = toPluginDocument(frame->document()); |
275 return toWebPluginContainerImpl(pluginDocument->pluginWidget()); | 275 return toWebPluginContainerImpl(pluginDocument->pluginWidget()); |
276 } | 276 } |
277 | 277 |
278 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(WebCore::Loca
lFrame* frame, const WebNode& node) | 278 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(blink::LocalF
rame* frame, const WebNode& node) |
279 { | 279 { |
280 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame); | 280 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame); |
281 if (pluginContainer) | 281 if (pluginContainer) |
282 return pluginContainer; | 282 return pluginContainer; |
283 return toWebPluginContainerImpl(node.pluginContainer()); | 283 return toWebPluginContainerImpl(node.pluginContainer()); |
284 } | 284 } |
285 | 285 |
286 // Simple class to override some of PrintContext behavior. Some of the methods | 286 // Simple class to override some of PrintContext behavior. Some of the methods |
287 // made virtual so that they can be overridden by ChromePluginPrintContext. | 287 // made virtual so that they can be overridden by ChromePluginPrintContext. |
288 class ChromePrintContext : public PrintContext { | 288 class ChromePrintContext : public PrintContext { |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 876 |
877 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR
L, const WebURL& unreachableURL, bool replace) | 877 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR
L, const WebURL& unreachableURL, bool replace) |
878 { | 878 { |
879 ASSERT(frame()); | 879 ASSERT(frame()); |
880 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8"
), baseURL, unreachableURL, replace); | 880 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8"
), baseURL, unreachableURL, replace); |
881 } | 881 } |
882 | 882 |
883 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina
tionURL) | 883 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina
tionURL) |
884 { | 884 { |
885 ASSERT(frame()); | 885 ASSERT(frame()); |
886 const WebCore::Node* node = linkNode.constUnwrap<Node>(); | 886 const blink::Node* node = linkNode.constUnwrap<Node>(); |
887 if (isHTMLAnchorElement(node)) | 887 if (isHTMLAnchorElement(node)) |
888 toHTMLAnchorElement(node)->sendPings(destinationURL); | 888 toHTMLAnchorElement(node)->sendPings(destinationURL); |
889 } | 889 } |
890 | 890 |
891 bool WebLocalFrameImpl::isLoading() const | 891 bool WebLocalFrameImpl::isLoading() const |
892 { | 892 { |
893 if (!frame()) | 893 if (!frame()) |
894 return false; | 894 return false; |
895 return frame()->loader().isLoading(); | 895 return frame()->loader().isLoading(); |
896 } | 896 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1166 } |
1167 | 1167 |
1168 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent
) | 1168 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent
) |
1169 { | 1169 { |
1170 moveRangeSelection(base, extent); | 1170 moveRangeSelection(base, extent); |
1171 } | 1171 } |
1172 | 1172 |
1173 void WebLocalFrameImpl::selectRange(const WebRange& webRange) | 1173 void WebLocalFrameImpl::selectRange(const WebRange& webRange) |
1174 { | 1174 { |
1175 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran
ge> >(webRange)) | 1175 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran
ge> >(webRange)) |
1176 frame()->selection().setSelectedRange(range.get(), WebCore::VP_DEFAULT_A
FFINITY, FrameSelection::NonDirectional, NotUserTriggered); | 1176 frame()->selection().setSelectedRange(range.get(), blink::VP_DEFAULT_AFF
INITY, FrameSelection::NonDirectional, NotUserTriggered); |
1177 } | 1177 } |
1178 | 1178 |
1179 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint&
extent) | 1179 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint&
extent) |
1180 { | 1180 { |
1181 VisiblePosition basePosition = visiblePositionForWindowPoint(base); | 1181 VisiblePosition basePosition = visiblePositionForWindowPoint(base); |
1182 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); | 1182 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); |
1183 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio
n); | 1183 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio
n); |
1184 frame()->selection().setSelection(newSelection, CharacterGranularity); | 1184 frame()->selection().setSelection(newSelection, CharacterGranularity); |
1185 } | 1185 } |
1186 | 1186 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 behavior |= RenderAsTextShowCompositedLayers | RenderAsTextShowAddresses
| RenderAsTextShowIDAndClass | RenderAsTextShowLayerNesting; | 1464 behavior |= RenderAsTextShowCompositedLayers | RenderAsTextShowAddresses
| RenderAsTextShowIDAndClass | RenderAsTextShowLayerNesting; |
1465 | 1465 |
1466 if (toShow & RenderAsTextPrinting) | 1466 if (toShow & RenderAsTextPrinting) |
1467 behavior |= RenderAsTextPrintingMode; | 1467 behavior |= RenderAsTextPrintingMode; |
1468 | 1468 |
1469 return externalRepresentation(frame(), behavior); | 1469 return externalRepresentation(frame(), behavior); |
1470 } | 1470 } |
1471 | 1471 |
1472 WebString WebLocalFrameImpl::markerTextForListItem(const WebElement& webElement)
const | 1472 WebString WebLocalFrameImpl::markerTextForListItem(const WebElement& webElement)
const |
1473 { | 1473 { |
1474 return WebCore::markerTextForListItem(const_cast<Element*>(webElement.constU
nwrap<Element>())); | 1474 return blink::markerTextForListItem(const_cast<Element*>(webElement.constUnw
rap<Element>())); |
1475 } | 1475 } |
1476 | 1476 |
1477 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz
e& pageSizeInPixels) | 1477 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz
e& pageSizeInPixels) |
1478 { | 1478 { |
1479 ASSERT(m_printContext); | 1479 ASSERT(m_printContext); |
1480 | 1480 |
1481 GraphicsContext graphicsContext(canvas); | 1481 GraphicsContext graphicsContext(canvas); |
1482 graphicsContext.setPrinting(true); | 1482 graphicsContext.setPrinting(true); |
1483 | 1483 |
1484 m_printContext->spoolAllPagesWithBoundaries(graphicsContext, FloatSize(pageS
izeInPixels.width, pageSizeInPixels.height)); | 1484 m_printContext->spoolAllPagesWithBoundaries(graphicsContext, FloatSize(pageS
izeInPixels.width, pageSizeInPixels.height)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 } | 1529 } |
1530 | 1530 |
1531 WebLocalFrameImpl::~WebLocalFrameImpl() | 1531 WebLocalFrameImpl::~WebLocalFrameImpl() |
1532 { | 1532 { |
1533 blink::Platform::current()->decrementStatsCounter(webFrameActiveCount); | 1533 blink::Platform::current()->decrementStatsCounter(webFrameActiveCount); |
1534 frameCount--; | 1534 frameCount--; |
1535 | 1535 |
1536 cancelPendingScopingEffort(); | 1536 cancelPendingScopingEffort(); |
1537 } | 1537 } |
1538 | 1538 |
1539 void WebLocalFrameImpl::setWebCoreFrame(PassRefPtr<WebCore::LocalFrame> frame) | 1539 void WebLocalFrameImpl::setWebCoreFrame(PassRefPtr<blink::LocalFrame> frame) |
1540 { | 1540 { |
1541 m_frame = frame; | 1541 m_frame = frame; |
1542 | 1542 |
1543 // FIXME: we shouldn't add overhead to every frame by registering these obje
cts when they're not used. | 1543 // FIXME: we shouldn't add overhead to every frame by registering these obje
cts when they're not used. |
1544 if (m_frame) { | 1544 if (m_frame) { |
1545 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N
otificationPresenterImpl()); | 1545 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N
otificationPresenterImpl()); |
1546 if (m_client) | 1546 if (m_client) |
1547 notificationPresenter->initialize(m_client->notificationPresenter())
; | 1547 notificationPresenter->initialize(m_client->notificationPresenter())
; |
1548 | 1548 |
1549 provideNotification(*m_frame, notificationPresenter.release()); | 1549 provideNotification(*m_frame, notificationPresenter.release()); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 | 1825 |
1826 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const | 1826 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const |
1827 { | 1827 { |
1828 ASSERT(!parent()); | 1828 ASSERT(!parent()); |
1829 | 1829 |
1830 if (m_textFinder) | 1830 if (m_textFinder) |
1831 return m_textFinder->activeMatchFrame(); | 1831 return m_textFinder->activeMatchFrame(); |
1832 return 0; | 1832 return 0; |
1833 } | 1833 } |
1834 | 1834 |
1835 WebCore::Range* WebLocalFrameImpl::activeMatch() const | 1835 blink::Range* WebLocalFrameImpl::activeMatch() const |
1836 { | 1836 { |
1837 if (m_textFinder) | 1837 if (m_textFinder) |
1838 return m_textFinder->activeMatch(); | 1838 return m_textFinder->activeMatch(); |
1839 return 0; | 1839 return 0; |
1840 } | 1840 } |
1841 | 1841 |
1842 TextFinder& WebLocalFrameImpl::ensureTextFinder() | 1842 TextFinder& WebLocalFrameImpl::ensureTextFinder() |
1843 { | 1843 { |
1844 if (!m_textFinder) | 1844 if (!m_textFinder) |
1845 m_textFinder = TextFinder::create(*this); | 1845 m_textFinder = TextFinder::create(*this); |
(...skipping 13 matching lines...) Expand all Loading... |
1859 | 1859 |
1860 void WebLocalFrameImpl::invalidateAll() const | 1860 void WebLocalFrameImpl::invalidateAll() const |
1861 { | 1861 { |
1862 ASSERT(frame() && frame()->view()); | 1862 ASSERT(frame() && frame()->view()); |
1863 FrameView* view = frame()->view(); | 1863 FrameView* view = frame()->view(); |
1864 view->invalidateRect(view->frameRect()); | 1864 view->invalidateRect(view->frameRect()); |
1865 invalidateScrollbar(); | 1865 invalidateScrollbar(); |
1866 } | 1866 } |
1867 | 1867 |
1868 } // namespace blink | 1868 } // namespace blink |
OLD | NEW |