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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (node->isDocumentNode()) { | 197 if (node->isDocumentNode()) { |
198 // This can be removed after root layer scrolling is enabled. | 198 // This can be removed after root layer scrolling is enabled. |
199 if (FrameView* frameView = toDocument(node)->view()) | 199 if (FrameView* frameView = toDocument(node)->view()) |
200 return frameView->layoutViewportScrollableArea(); | 200 return frameView->layoutViewportScrollableArea(); |
201 } | 201 } |
202 | 202 |
203 LayoutObject* layoutObject = node->layoutObject(); | 203 LayoutObject* layoutObject = node->layoutObject(); |
204 if (!layoutObject || !layoutObject->isBox()) | 204 if (!layoutObject || !layoutObject->isBox()) |
205 return nullptr; | 205 return nullptr; |
206 | 206 |
207 return toLayoutBox(layoutObject)->scrollableArea(); | 207 return toLayoutBox(layoutObject)->getScrollableArea(); |
208 } | 208 } |
209 | 209 |
210 const char* Internals::internalsId = "internals"; | 210 const char* Internals::internalsId = "internals"; |
211 | 211 |
212 Internals* Internals::create(ScriptState* scriptState) | 212 Internals* Internals::create(ScriptState* scriptState) |
213 { | 213 { |
214 return new Internals(scriptState); | 214 return new Internals(scriptState); |
215 } | 215 } |
216 | 216 |
217 Internals::~Internals() | 217 Internals::~Internals() |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } else { | 524 } else { |
525 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed is not a image element."); | 525 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed is not a image element."); |
526 return; | 526 return; |
527 } | 527 } |
528 | 528 |
529 if (!resource || !resource->hasImage()) { | 529 if (!resource || !resource->hasImage()) { |
530 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not available."); | 530 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not available."); |
531 return; | 531 return; |
532 } | 532 } |
533 | 533 |
534 Image* imageData = resource->image(); | 534 Image* imageData = resource->getImage(); |
535 if (!imageData->isBitmapImage()) { | 535 if (!imageData->isBitmapImage()) { |
536 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not a BitmapImage type."); | 536 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not a BitmapImage type."); |
537 return; | 537 return; |
538 } | 538 } |
539 | 539 |
540 imageData->advanceTime(deltaTimeInSeconds); | 540 imageData->advanceTime(deltaTimeInSeconds); |
541 } | 541 } |
542 | 542 |
543 void Internals::advanceImageAnimation(Element* image, ExceptionState& exceptionS
tate) | 543 void Internals::advanceImageAnimation(Element* image, ExceptionState& exceptionS
tate) |
544 { | 544 { |
545 ASSERT(image); | 545 ASSERT(image); |
546 | 546 |
547 ImageResource* resource = nullptr; | 547 ImageResource* resource = nullptr; |
548 if (isHTMLImageElement(*image)) { | 548 if (isHTMLImageElement(*image)) { |
549 resource = toHTMLImageElement(*image).cachedImage(); | 549 resource = toHTMLImageElement(*image).cachedImage(); |
550 } else if (isSVGImageElement(*image)) { | 550 } else if (isSVGImageElement(*image)) { |
551 resource = toSVGImageElement(*image).cachedImage(); | 551 resource = toSVGImageElement(*image).cachedImage(); |
552 } else { | 552 } else { |
553 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed is not a image element."); | 553 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed is not a image element."); |
554 return; | 554 return; |
555 } | 555 } |
556 | 556 |
557 if (!resource || !resource->hasImage()) { | 557 if (!resource || !resource->hasImage()) { |
558 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not available."); | 558 exceptionState.throwDOMException(InvalidAccessError, "The image resource
is not available."); |
559 return; | 559 return; |
560 } | 560 } |
561 | 561 |
562 Image* imageData = resource->image(); | 562 Image* imageData = resource->getImage(); |
563 imageData->advanceAnimationForTesting(); | 563 imageData->advanceAnimationForTesting(); |
564 } | 564 } |
565 | 565 |
566 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except
ionState) const | 566 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except
ionState) const |
567 { | 567 { |
568 ASSERT(root); | 568 ASSERT(root); |
569 if (!root->isShadowRoot()) { | 569 if (!root->isShadowRoot()) { |
570 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); | 570 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); |
571 return false; | 571 return false; |
572 } | 572 } |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 } | 1301 } |
1302 | 1302 |
1303 LayoutRect rect; | 1303 LayoutRect rect; |
1304 PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(),
rect); | 1304 PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(),
rect); |
1305 *layerOffset = IntSize(rect.x(), rect.y()); | 1305 *layerOffset = IntSize(rect.x(), rect.y()); |
1306 return searchRoot; | 1306 return searchRoot; |
1307 } | 1307 } |
1308 | 1308 |
1309 // If the |graphicsLayer| is a scroller's scrollingContent layer, | 1309 // If the |graphicsLayer| is a scroller's scrollingContent layer, |
1310 // consider this is a scrolling layer. | 1310 // consider this is a scrolling layer. |
1311 GraphicsLayer* layerForScrolling = searchRoot->scrollableArea() ? searchRoot
->scrollableArea()->layerForScrolling() : 0; | 1311 GraphicsLayer* layerForScrolling = searchRoot->getScrollableArea() ? searchR
oot->getScrollableArea()->layerForScrolling() : 0; |
1312 if (graphicsLayer == layerForScrolling) { | 1312 if (graphicsLayer == layerForScrolling) { |
1313 *layerType = "scrolling"; | 1313 *layerType = "scrolling"; |
1314 return searchRoot; | 1314 return searchRoot; |
1315 } | 1315 } |
1316 | 1316 |
1317 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { | 1317 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { |
1318 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL
ayer(); | 1318 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL
ayer(); |
1319 if (graphicsLayer == squashingLayer) { | 1319 if (graphicsLayer == squashingLayer) { |
1320 *layerType ="squashing"; | 1320 *layerType ="squashing"; |
1321 LayoutRect rect; | 1321 LayoutRect rect; |
1322 PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObjec
t(), rect); | 1322 PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObjec
t(), rect); |
1323 *layerOffset = IntSize(rect.x(), rect.y()); | 1323 *layerOffset = IntSize(rect.x(), rect.y()); |
1324 return searchRoot; | 1324 return searchRoot; |
1325 } | 1325 } |
1326 } | 1326 } |
1327 | 1327 |
1328 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->scrollableArea() ?
searchRoot->scrollableArea()->layerForHorizontalScrollbar() : 0; | 1328 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->getScrollableArea()
? searchRoot->getScrollableArea()->layerForHorizontalScrollbar() : 0; |
1329 if (graphicsLayer == layerForHorizontalScrollbar) { | 1329 if (graphicsLayer == layerForHorizontalScrollbar) { |
1330 *layerType = "horizontalScrollbar"; | 1330 *layerType = "horizontalScrollbar"; |
1331 return searchRoot; | 1331 return searchRoot; |
1332 } | 1332 } |
1333 | 1333 |
1334 GraphicsLayer* layerForVerticalScrollbar = searchRoot->scrollableArea() ? se
archRoot->scrollableArea()->layerForVerticalScrollbar() : 0; | 1334 GraphicsLayer* layerForVerticalScrollbar = searchRoot->getScrollableArea() ?
searchRoot->getScrollableArea()->layerForVerticalScrollbar() : 0; |
1335 if (graphicsLayer == layerForVerticalScrollbar) { | 1335 if (graphicsLayer == layerForVerticalScrollbar) { |
1336 *layerType = "verticalScrollbar"; | 1336 *layerType = "verticalScrollbar"; |
1337 return searchRoot; | 1337 return searchRoot; |
1338 } | 1338 } |
1339 | 1339 |
1340 GraphicsLayer* layerForScrollCorner = searchRoot->scrollableArea() ? searchR
oot->scrollableArea()->layerForScrollCorner() : 0; | 1340 GraphicsLayer* layerForScrollCorner = searchRoot->getScrollableArea() ? sear
chRoot->getScrollableArea()->layerForScrollCorner() : 0; |
1341 if (graphicsLayer == layerForScrollCorner) { | 1341 if (graphicsLayer == layerForScrollCorner) { |
1342 *layerType = "scrollCorner"; | 1342 *layerType = "scrollCorner"; |
1343 return searchRoot; | 1343 return searchRoot; |
1344 } | 1344 } |
1345 | 1345 |
1346 // Search right to left to increase the chances that we'll choose the top-mo
st layers in a | 1346 // Search right to left to increase the chances that we'll choose the top-mo
st layers in a |
1347 // grouped mapping for squashing. | 1347 // grouped mapping for squashing. |
1348 for (PaintLayer* child = searchRoot->lastChild(); child; child = child->prev
iousSibling()) { | 1348 for (PaintLayer* child = searchRoot->lastChild(); child; child = child->prev
iousSibling()) { |
1349 PaintLayer* foundLayer = findLayerForGraphicsLayer(child, graphicsLayer,
layerOffset, layerType); | 1349 PaintLayer* foundLayer = findLayerForGraphicsLayer(child, graphicsLayer,
layerOffset, layerType); |
1350 if (foundLayer) | 1350 if (foundLayer) |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 | 1988 |
1989 if (LayoutView *layoutView = document->layoutView()) | 1989 if (LayoutView *layoutView = document->layoutView()) |
1990 layoutView->invalidatePaintForViewAndCompositedLayers(); | 1990 layoutView->invalidatePaintForViewAndCompositedLayers(); |
1991 } | 1991 } |
1992 | 1992 |
1993 void Internals::startTrackingPaintInvalidationObjects() | 1993 void Internals::startTrackingPaintInvalidationObjects() |
1994 { | 1994 { |
1995 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 1995 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
1996 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); | 1996 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); |
1997 if (graphicsLayer->drawsContent()) | 1997 if (graphicsLayer->drawsContent()) |
1998 graphicsLayer->paintController().startTrackingPaintInvalidationObjects()
; | 1998 graphicsLayer->getPaintController().startTrackingPaintInvalidationObject
s(); |
1999 } | 1999 } |
2000 | 2000 |
2001 void Internals::stopTrackingPaintInvalidationObjects() | 2001 void Internals::stopTrackingPaintInvalidationObjects() |
2002 { | 2002 { |
2003 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2003 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2004 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); | 2004 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); |
2005 if (graphicsLayer->drawsContent()) | 2005 if (graphicsLayer->drawsContent()) |
2006 graphicsLayer->paintController().stopTrackingPaintInvalidationObjects(); | 2006 graphicsLayer->getPaintController().stopTrackingPaintInvalidationObjects
(); |
2007 } | 2007 } |
2008 | 2008 |
2009 Vector<String> Internals::trackedPaintInvalidationObjects() | 2009 Vector<String> Internals::trackedPaintInvalidationObjects() |
2010 { | 2010 { |
2011 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2011 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2012 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); | 2012 GraphicsLayer* graphicsLayer = toLocalFrame(frame()->page()->mainFrame())->v
iew()->layoutView()->layer()->graphicsLayerBacking(); |
2013 if (!graphicsLayer->drawsContent()) | 2013 if (!graphicsLayer->drawsContent()) |
2014 return Vector<String>(); | 2014 return Vector<String>(); |
2015 return graphicsLayer->paintController().trackedPaintInvalidationObjects(); | 2015 return graphicsLayer->getPaintController().trackedPaintInvalidationObjects()
; |
2016 } | 2016 } |
2017 | 2017 |
2018 ClientRectList* Internals::draggableRegions(Document* document, ExceptionState&
exceptionState) | 2018 ClientRectList* Internals::draggableRegions(Document* document, ExceptionState&
exceptionState) |
2019 { | 2019 { |
2020 return annotatedRegions(document, true, exceptionState); | 2020 return annotatedRegions(document, true, exceptionState); |
2021 } | 2021 } |
2022 | 2022 |
2023 ClientRectList* Internals::nonDraggableRegions(Document* document, ExceptionStat
e& exceptionState) | 2023 ClientRectList* Internals::nonDraggableRegions(Document* document, ExceptionStat
e& exceptionState) |
2024 { | 2024 { |
2025 return annotatedRegions(document, false, exceptionState); | 2025 return annotatedRegions(document, false, exceptionState); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 { | 2102 { |
2103 Cursor cursor = frame()->page()->chromeClient().lastSetCursorForTesting(); | 2103 Cursor cursor = frame()->page()->chromeClient().lastSetCursorForTesting(); |
2104 | 2104 |
2105 StringBuilder result; | 2105 StringBuilder result; |
2106 result.appendLiteral("type="); | 2106 result.appendLiteral("type="); |
2107 result.append(cursorTypeToString(cursor.getType())); | 2107 result.append(cursorTypeToString(cursor.getType())); |
2108 result.appendLiteral(" hotSpot="); | 2108 result.appendLiteral(" hotSpot="); |
2109 result.appendNumber(cursor.hotSpot().x()); | 2109 result.appendNumber(cursor.hotSpot().x()); |
2110 result.append(','); | 2110 result.append(','); |
2111 result.appendNumber(cursor.hotSpot().y()); | 2111 result.appendNumber(cursor.hotSpot().y()); |
2112 if (cursor.image()) { | 2112 if (cursor.getImage()) { |
2113 IntSize size = cursor.image()->size(); | 2113 IntSize size = cursor.getImage()->size(); |
2114 result.appendLiteral(" image="); | 2114 result.appendLiteral(" image="); |
2115 result.appendNumber(size.width()); | 2115 result.appendNumber(size.width()); |
2116 result.append('x'); | 2116 result.append('x'); |
2117 result.appendNumber(size.height()); | 2117 result.appendNumber(size.height()); |
2118 } | 2118 } |
2119 if (cursor.imageScaleFactor() != 1) { | 2119 if (cursor.imageScaleFactor() != 1) { |
2120 result.appendLiteral(" scale="); | 2120 result.appendLiteral(" scale="); |
2121 NumberToStringBuffer buffer; | 2121 NumberToStringBuffer buffer; |
2122 result.append(numberToFixedPrecisionString(cursor.imageScaleFactor(), 8,
buffer, true)); | 2122 result.append(numberToFixedPrecisionString(cursor.imageScaleFactor(), 8,
buffer, true)); |
2123 } | 2123 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 | 2205 |
2206 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex) | 2206 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex) |
2207 { | 2207 { |
2208 if (!node || !isHTMLSelectElement(*node)) | 2208 if (!node || !isHTMLSelectElement(*node)) |
2209 return false; | 2209 return false; |
2210 | 2210 |
2211 HTMLSelectElement& select = toHTMLSelectElement(*node); | 2211 HTMLSelectElement& select = toHTMLSelectElement(*node); |
2212 if (itemIndex < 0 || static_cast<size_t>(itemIndex) >= select.listItems().si
ze()) | 2212 if (itemIndex < 0 || static_cast<size_t>(itemIndex) >= select.listItems().si
ze()) |
2213 return false; | 2213 return false; |
2214 const ComputedStyle* itemStyle = select.itemComputedStyle(*select.listItems(
)[itemIndex]); | 2214 const ComputedStyle* itemStyle = select.itemComputedStyle(*select.listItems(
)[itemIndex]); |
2215 return itemStyle ? itemStyle->font().fontMetrics().height() : 0; | 2215 return itemStyle ? itemStyle->font().getFontMetrics().height() : 0; |
2216 } | 2216 } |
2217 | 2217 |
2218 void Internals::resetTypeAheadSession(HTMLSelectElement* select) | 2218 void Internals::resetTypeAheadSession(HTMLSelectElement* select) |
2219 { | 2219 { |
2220 ASSERT(select); | 2220 ASSERT(select); |
2221 select->resetTypeAheadSessionForTesting(); | 2221 select->resetTypeAheadSessionForTesting(); |
2222 } | 2222 } |
2223 | 2223 |
2224 bool Internals::loseSharedGraphicsContext3D() | 2224 bool Internals::loseSharedGraphicsContext3D() |
2225 { | 2225 { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2464 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size(
)).height(); | 2464 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size(
)).height(); |
2465 } | 2465 } |
2466 | 2466 |
2467 int Internals::visualViewportWidth() | 2467 int Internals::visualViewportWidth() |
2468 { | 2468 { |
2469 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size(
)).width(); | 2469 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size(
)).width(); |
2470 } | 2470 } |
2471 | 2471 |
2472 double Internals::visualViewportScrollX() | 2472 double Internals::visualViewportScrollX() |
2473 { | 2473 { |
2474 return frame()->view()->scrollableArea()->scrollPositionDouble().x(); | 2474 return frame()->view()->getScrollableArea()->scrollPositionDouble().x(); |
2475 } | 2475 } |
2476 | 2476 |
2477 double Internals::visualViewportScrollY() | 2477 double Internals::visualViewportScrollY() |
2478 { | 2478 { |
2479 return frame()->view()->scrollableArea()->scrollPositionDouble().y(); | 2479 return frame()->view()->getScrollableArea()->scrollPositionDouble().y(); |
2480 } | 2480 } |
2481 | 2481 |
2482 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) | 2482 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) |
2483 { | 2483 { |
2484 return new InternalsIterationSource(); | 2484 return new InternalsIterationSource(); |
2485 } | 2485 } |
2486 | 2486 |
2487 bool Internals::isUseCounted(Document* document, int useCounterId) | 2487 bool Internals::isUseCounted(Document* document, int useCounterId) |
2488 { | 2488 { |
2489 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures) | 2489 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 } | 2566 } |
2567 | 2567 |
2568 int Internals::getScrollAnimationState(Node* node) const | 2568 int Internals::getScrollAnimationState(Node* node) const |
2569 { | 2569 { |
2570 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) | 2570 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) |
2571 return static_cast<int>(scrollableArea->scrollAnimator().m_runState); | 2571 return static_cast<int>(scrollableArea->scrollAnimator().m_runState); |
2572 return -1; | 2572 return -1; |
2573 } | 2573 } |
2574 | 2574 |
2575 } // namespace blink | 2575 } // namespace blink |
OLD | NEW |