| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 { | 201 { |
| 202 } | 202 } |
| 203 | 203 |
| 204 void Internals::resetToConsistentState(Page* page) | 204 void Internals::resetToConsistentState(Page* page) |
| 205 { | 205 { |
| 206 ASSERT(page); | 206 ASSERT(page); |
| 207 | 207 |
| 208 page->setDeviceScaleFactor(1); | 208 page->setDeviceScaleFactor(1); |
| 209 page->setIsCursorVisible(true); | 209 page->setIsCursorVisible(true); |
| 210 page->setPageScaleFactor(1, IntPoint(0, 0)); | 210 page->setPageScaleFactor(1, IntPoint(0, 0)); |
| 211 blink::overrideUserPreferredLanguages(Vector<AtomicString>()); | 211 overrideUserPreferredLanguages(Vector<AtomicString>()); |
| 212 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck
ingEnabled()) | 212 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck
ingEnabled()) |
| 213 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh
ecking(); | 213 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh
ecking(); |
| 214 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) | 214 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) |
| 215 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); | 215 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); |
| 216 | 216 |
| 217 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(
)) | 217 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(
)) |
| 218 scrollingCoordinator->reset(); | 218 scrollingCoordinator->reset(); |
| 219 | 219 |
| 220 page->deprecatedLocalMainFrame()->view()->clear(); | 220 page->deprecatedLocalMainFrame()->view()->clear(); |
| 221 } | 221 } |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 return blink::userPreferredLanguages(); | 1115 return blink::userPreferredLanguages(); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 // Optimally, the bindings generator would pass a Vector<AtomicString> here but | 1118 // Optimally, the bindings generator would pass a Vector<AtomicString> here but |
| 1119 // this is not supported yet. | 1119 // this is not supported yet. |
| 1120 void Internals::setUserPreferredLanguages(const Vector<String>& languages) | 1120 void Internals::setUserPreferredLanguages(const Vector<String>& languages) |
| 1121 { | 1121 { |
| 1122 Vector<AtomicString> atomicLanguages; | 1122 Vector<AtomicString> atomicLanguages; |
| 1123 for (size_t i = 0; i < languages.size(); ++i) | 1123 for (size_t i = 0; i < languages.size(); ++i) |
| 1124 atomicLanguages.append(AtomicString(languages[i])); | 1124 atomicLanguages.append(AtomicString(languages[i])); |
| 1125 blink::overrideUserPreferredLanguages(atomicLanguages); | 1125 overrideUserPreferredLanguages(atomicLanguages); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 unsigned Internals::activeDOMObjectCount(Document* document) | 1128 unsigned Internals::activeDOMObjectCount(Document* document) |
| 1129 { | 1129 { |
| 1130 ASSERT(document); | 1130 ASSERT(document); |
| 1131 return document->activeDOMObjectCount(); | 1131 return document->activeDOMObjectCount(); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even
tHandlerClass handlerClass) | 1134 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even
tHandlerClass handlerClass) |
| 1135 { | 1135 { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 return 0; | 1219 return 0; |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 // Given a vector of rects, merge those that are adjacent, leaving empty rects | 1222 // Given a vector of rects, merge those that are adjacent, leaving empty rects |
| 1223 // in the place of no longer used slots. This is intended to simplify the list | 1223 // in the place of no longer used slots. This is intended to simplify the list |
| 1224 // of rects returned by an SkRegion (which have been split apart for sorting | 1224 // of rects returned by an SkRegion (which have been split apart for sorting |
| 1225 // purposes). No attempt is made to do this efficiently (eg. by relying on the | 1225 // purposes). No attempt is made to do this efficiently (eg. by relying on the |
| 1226 // sort criteria of SkRegion). | 1226 // sort criteria of SkRegion). |
| 1227 static void mergeRects(blink::WebVector<blink::WebRect>& rects) | 1227 static void mergeRects(WebVector<blink::WebRect>& rects) |
| 1228 { | 1228 { |
| 1229 for (size_t i = 0; i < rects.size(); ++i) { | 1229 for (size_t i = 0; i < rects.size(); ++i) { |
| 1230 if (rects[i].isEmpty()) | 1230 if (rects[i].isEmpty()) |
| 1231 continue; | 1231 continue; |
| 1232 bool updated; | 1232 bool updated; |
| 1233 do { | 1233 do { |
| 1234 updated = false; | 1234 updated = false; |
| 1235 for (size_t j = i+1; j < rects.size(); ++j) { | 1235 for (size_t j = i+1; j < rects.size(); ++j) { |
| 1236 if (rects[j].isEmpty()) | 1236 if (rects[j].isEmpty()) |
| 1237 continue; | 1237 continue; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1259 updated = true; | 1259 updated = true; |
| 1260 } | 1260 } |
| 1261 } | 1261 } |
| 1262 } | 1262 } |
| 1263 } while (updated); | 1263 } while (updated); |
| 1264 } | 1264 } |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 static void accumulateLayerRectList(DeprecatedPaintLayerCompositor* compositor,
GraphicsLayer* graphicsLayer, LayerRectList* rects) | 1267 static void accumulateLayerRectList(DeprecatedPaintLayerCompositor* compositor,
GraphicsLayer* graphicsLayer, LayerRectList* rects) |
| 1268 { | 1268 { |
| 1269 blink::WebVector<blink::WebRect> layerRects = graphicsLayer->platformLayer()
->touchEventHandlerRegion(); | 1269 WebVector<blink::WebRect> layerRects = graphicsLayer->platformLayer()->touch
EventHandlerRegion(); |
| 1270 if (!layerRects.isEmpty()) { | 1270 if (!layerRects.isEmpty()) { |
| 1271 mergeRects(layerRects); | 1271 mergeRects(layerRects); |
| 1272 String layerType; | 1272 String layerType; |
| 1273 IntSize layerOffset; | 1273 IntSize layerOffset; |
| 1274 DeprecatedPaintLayer* renderLayer = findLayerForGraphicsLayer(compositor
->rootLayer(), graphicsLayer, &layerOffset, &layerType); | 1274 DeprecatedPaintLayer* renderLayer = findLayerForGraphicsLayer(compositor
->rootLayer(), graphicsLayer, &layerOffset, &layerType); |
| 1275 Node* node = renderLayer ? renderLayer->layoutObject()->node() : 0; | 1275 Node* node = renderLayer ? renderLayer->layoutObject()->node() : 0; |
| 1276 for (size_t i = 0; i < layerRects.size(); ++i) { | 1276 for (size_t i = 0; i < layerRects.size(); ++i) { |
| 1277 if (!layerRects[i].isEmpty()) { | 1277 if (!layerRects[i].isEmpty()) { |
| 1278 rects->append(node, layerType, layerOffset.width(), layerOffset.
height(), ClientRect::create(layerRects[i])); | 1278 rects->append(node, layerType, layerOffset.width(), layerOffset.
height(), ClientRect::create(layerRects[i])); |
| 1279 } | 1279 } |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 if (!renderer || !renderer->isMenuList()) | 2040 if (!renderer || !renderer->isMenuList()) |
| 2041 return false; | 2041 return false; |
| 2042 | 2042 |
| 2043 LayoutMenuList& menuList = toLayoutMenuList(*renderer); | 2043 LayoutMenuList& menuList = toLayoutMenuList(*renderer); |
| 2044 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); | 2044 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); |
| 2045 return itemStyle.font().fontMetrics().height(); | 2045 return itemStyle.font().fontMetrics().height(); |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 bool Internals::loseSharedGraphicsContext3D() | 2048 bool Internals::loseSharedGraphicsContext3D() |
| 2049 { | 2049 { |
| 2050 OwnPtr<blink::WebGraphicsContext3DProvider> sharedProvider = adoptPtr(blink:
:Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); | 2050 OwnPtr<WebGraphicsContext3DProvider> sharedProvider = adoptPtr(Platform::cur
rent()->createSharedOffscreenGraphicsContext3DProvider()); |
| 2051 if (!sharedProvider) | 2051 if (!sharedProvider) |
| 2052 return false; | 2052 return false; |
| 2053 blink::WebGraphicsContext3D* sharedContext = sharedProvider->context3d(); | 2053 WebGraphicsContext3D* sharedContext = sharedProvider->context3d(); |
| 2054 sharedContext->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_
CONTEXT_RESET_EXT); | 2054 sharedContext->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_
CONTEXT_RESET_EXT); |
| 2055 // To prevent tests that call loseSharedGraphicsContext3D from being | 2055 // To prevent tests that call loseSharedGraphicsContext3D from being |
| 2056 // flaky, we call finish so that the context is guaranteed to be lost | 2056 // flaky, we call finish so that the context is guaranteed to be lost |
| 2057 // synchronously (i.e. before returning). | 2057 // synchronously (i.e. before returning). |
| 2058 sharedContext->finish(); | 2058 sharedContext->finish(); |
| 2059 return true; | 2059 return true; |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 void Internals::forceCompositingUpdate(Document* document, ExceptionState& excep
tionState) | 2062 void Internals::forceCompositingUpdate(Document* document, ExceptionState& excep
tionState) |
| 2063 { | 2063 { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2366 | 2366 |
| 2367 ClientRectList* Internals::focusRingRects(Element* element) | 2367 ClientRectList* Internals::focusRingRects(Element* element) |
| 2368 { | 2368 { |
| 2369 Vector<LayoutRect> rects; | 2369 Vector<LayoutRect> rects; |
| 2370 if (element && element->layoutObject()) | 2370 if (element && element->layoutObject()) |
| 2371 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); | 2371 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); |
| 2372 return ClientRectList::create(rects); | 2372 return ClientRectList::create(rects); |
| 2373 } | 2373 } |
| 2374 | 2374 |
| 2375 } // namespace blink | 2375 } // namespace blink |
| OLD | NEW |