| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 WTF_MAKE_FAST_ALLOCATED; | 64 WTF_MAKE_FAST_ALLOCATED; |
| 65 | 65 |
| 66 public: | 66 public: |
| 67 explicit PagePopupChromeClient(WebPagePopupImpl* popup) | 67 explicit PagePopupChromeClient(WebPagePopupImpl* popup) |
| 68 : m_popup(popup) | 68 : m_popup(popup) |
| 69 { | 69 { |
| 70 ASSERT(m_popup->widgetClient()); | 70 ASSERT(m_popup->widgetClient()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 virtual void closeWindowSoon() OVERRIDE | 74 virtual void closeWindowSoon() override |
| 75 { | 75 { |
| 76 m_popup->closePopup(); | 76 m_popup->closePopup(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual FloatRect windowRect() OVERRIDE | 79 virtual FloatRect windowRect() override |
| 80 { | 80 { |
| 81 return FloatRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectI
nScreen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.he
ight); | 81 return FloatRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectI
nScreen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.he
ight); |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual void setWindowRect(const FloatRect& rect) OVERRIDE | 84 virtual void setWindowRect(const FloatRect& rect) override |
| 85 { | 85 { |
| 86 m_popup->m_windowRectInScreen = IntRect(rect); | 86 m_popup->m_windowRectInScreen = IntRect(rect); |
| 87 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen); | 87 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen); |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual IntRect rootViewToScreen(const IntRect& rect) const OVERRIDE | 90 virtual IntRect rootViewToScreen(const IntRect& rect) const override |
| 91 { | 91 { |
| 92 IntRect rectInScreen(rect); | 92 IntRect rectInScreen(rect); |
| 93 rectInScreen.move(m_popup->m_windowRectInScreen.x, m_popup->m_windowRect
InScreen.y); | 93 rectInScreen.move(m_popup->m_windowRectInScreen.x, m_popup->m_windowRect
InScreen.y); |
| 94 return rectInScreen; | 94 return rectInScreen; |
| 95 } | 95 } |
| 96 | 96 |
| 97 virtual void addMessageToConsole(LocalFrame*, MessageSource, MessageLevel, c
onst String& message, unsigned lineNumber, const String&, const String&) OVERRID
E | 97 virtual void addMessageToConsole(LocalFrame*, MessageSource, MessageLevel, c
onst String& message, unsigned lineNumber, const String&, const String&) overrid
e |
| 98 { | 98 { |
| 99 #ifndef NDEBUG | 99 #ifndef NDEBUG |
| 100 fprintf(stderr, "CONSOLE MESSSAGE:%u: %s\n", lineNumber, message.utf8().
data()); | 100 fprintf(stderr, "CONSOLE MESSSAGE:%u: %s\n", lineNumber, message.utf8().
data()); |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void invalidateContentsAndRootView(const IntRect& paintRect) OVERRID
E | 104 virtual void invalidateContentsAndRootView(const IntRect& paintRect) overrid
e |
| 105 { | 105 { |
| 106 if (paintRect.isEmpty()) | 106 if (paintRect.isEmpty()) |
| 107 return; | 107 return; |
| 108 m_popup->widgetClient()->didInvalidateRect(paintRect); | 108 m_popup->widgetClient()->didInvalidateRect(paintRect); |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual void invalidateContentsForSlowScroll(const IntRect& updateRect) OVER
RIDE | 111 virtual void invalidateContentsForSlowScroll(const IntRect& updateRect) over
ride |
| 112 { | 112 { |
| 113 invalidateContentsAndRootView(updateRect); | 113 invalidateContentsAndRootView(updateRect); |
| 114 } | 114 } |
| 115 | 115 |
| 116 virtual void scheduleAnimation() OVERRIDE | 116 virtual void scheduleAnimation() override |
| 117 { | 117 { |
| 118 // Calling scheduleAnimation on m_webView so WebTestProxy will call begi
nFrame. | 118 // Calling scheduleAnimation on m_webView so WebTestProxy will call begi
nFrame. |
| 119 if (LayoutTestSupport::isRunningLayoutTest()) | 119 if (LayoutTestSupport::isRunningLayoutTest()) |
| 120 m_popup->m_webView->scheduleAnimation(); | 120 m_popup->m_webView->scheduleAnimation(); |
| 121 | 121 |
| 122 if (m_popup->isAcceleratedCompositingActive()) { | 122 if (m_popup->isAcceleratedCompositingActive()) { |
| 123 ASSERT(m_popup->m_layerTreeView); | 123 ASSERT(m_popup->m_layerTreeView); |
| 124 m_popup->m_layerTreeView->setNeedsAnimate(); | 124 m_popup->m_layerTreeView->setNeedsAnimate(); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 m_popup->m_widgetClient->scheduleAnimation(); | 127 m_popup->m_widgetClient->scheduleAnimation(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 virtual WebScreenInfo screenInfo() const OVERRIDE | 130 virtual WebScreenInfo screenInfo() const override |
| 131 { | 131 { |
| 132 return m_popup->m_webView->client() ? m_popup->m_webView->client()->scre
enInfo() : WebScreenInfo(); | 132 return m_popup->m_webView->client() ? m_popup->m_webView->client()->scre
enInfo() : WebScreenInfo(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual void* webView() const OVERRIDE | 135 virtual void* webView() const override |
| 136 { | 136 { |
| 137 return m_popup->m_webView; | 137 return m_popup->m_webView; |
| 138 } | 138 } |
| 139 | 139 |
| 140 virtual FloatSize minimumWindowSize() const OVERRIDE | 140 virtual FloatSize minimumWindowSize() const override |
| 141 { | 141 { |
| 142 return FloatSize(0, 0); | 142 return FloatSize(0, 0); |
| 143 } | 143 } |
| 144 | 144 |
| 145 virtual void setCursor(const Cursor& cursor) OVERRIDE | 145 virtual void setCursor(const Cursor& cursor) override |
| 146 { | 146 { |
| 147 if (m_popup->m_webView->client()) | 147 if (m_popup->m_webView->client()) |
| 148 m_popup->m_webView->client()->didChangeCursor(WebCursorInfo(cursor))
; | 148 m_popup->m_webView->client()->didChangeCursor(WebCursorInfo(cursor))
; |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual void needTouchEvents(bool needsTouchEvents) OVERRIDE | 151 virtual void needTouchEvents(bool needsTouchEvents) override |
| 152 { | 152 { |
| 153 m_popup->widgetClient()->hasTouchEventHandlers(needsTouchEvents); | 153 m_popup->widgetClient()->hasTouchEventHandlers(needsTouchEvents); |
| 154 } | 154 } |
| 155 | 155 |
| 156 virtual GraphicsLayerFactory* graphicsLayerFactory() const OVERRIDE | 156 virtual GraphicsLayerFactory* graphicsLayerFactory() const override |
| 157 { | 157 { |
| 158 return m_popup->m_webView->graphicsLayerFactory(); | 158 return m_popup->m_webView->graphicsLayerFactory(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 virtual void attachRootGraphicsLayer(GraphicsLayer* graphicsLayer) OVERRIDE | 161 virtual void attachRootGraphicsLayer(GraphicsLayer* graphicsLayer) override |
| 162 { | 162 { |
| 163 m_popup->setRootGraphicsLayer(graphicsLayer); | 163 m_popup->setRootGraphicsLayer(graphicsLayer); |
| 164 } | 164 } |
| 165 | 165 |
| 166 virtual void postAccessibilityNotification(AXObject* obj, AXObjectCache::AXN
otification notification) OVERRIDE | 166 virtual void postAccessibilityNotification(AXObject* obj, AXObjectCache::AXN
otification notification) override |
| 167 { | 167 { |
| 168 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup
Client->ownerElement().document().frame()); | 168 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_popup->m_popup
Client->ownerElement().document().frame()); |
| 169 if (obj && frame && frame->client()) | 169 if (obj && frame && frame->client()) |
| 170 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas
t<WebAXEvent>(notification)); | 170 frame->client()->postAccessibilityEvent(WebAXObject(obj), static_cas
t<WebAXEvent>(notification)); |
| 171 | 171 |
| 172 // FIXME: Delete these lines once Chromium only uses the frame client in
terface, above. | 172 // FIXME: Delete these lines once Chromium only uses the frame client in
terface, above. |
| 173 if (obj && m_popup->m_webView->client()) | 173 if (obj && m_popup->m_webView->client()) |
| 174 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj
), static_cast<WebAXEvent>(notification)); | 174 m_popup->m_webView->client()->postAccessibilityEvent(WebAXObject(obj
), static_cast<WebAXEvent>(notification)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 WebPagePopupImpl* m_popup; | 177 WebPagePopupImpl* m_popup; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 class PagePopupFeaturesClient : public ContextFeaturesClient { | 180 class PagePopupFeaturesClient : public ContextFeaturesClient { |
| 181 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) OVERRI
DE; | 181 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) overri
de; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType
type, bool defaultValue) | 184 bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType
type, bool defaultValue) |
| 185 { | 185 { |
| 186 if (type == ContextFeatures::PagePopup) | 186 if (type == ContextFeatures::PagePopup) |
| 187 return true; | 187 return true; |
| 188 return defaultValue; | 188 return defaultValue; |
| 189 } | 189 } |
| 190 | 190 |
| 191 // WebPagePopupImpl ------------------------------------------------------------
---- | 191 // WebPagePopupImpl ------------------------------------------------------------
---- |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // A WebPagePopupImpl instance usually has two references. | 461 // A WebPagePopupImpl instance usually has two references. |
| 462 // - One owned by the instance itself. It represents the visible widget. | 462 // - One owned by the instance itself. It represents the visible widget. |
| 463 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 463 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 464 // WebPagePopupImpl to close. | 464 // WebPagePopupImpl to close. |
| 465 // We need them because the closing operation is asynchronous and the widget | 465 // We need them because the closing operation is asynchronous and the widget |
| 466 // can be closed while the WebViewImpl is unaware of it. | 466 // can be closed while the WebViewImpl is unaware of it. |
| 467 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 467 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 } // namespace blink | 470 } // namespace blink |
| OLD | NEW |