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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
OLDNEW
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 678 }
679 679
680 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ()); 680 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ());
681 } 681 }
682 682
683 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundingBox(Element* element) 683 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundingBox(Element* element)
684 { 684 {
685 ASSERT(element); 685 ASSERT(element);
686 686
687 element->document().updateLayoutIgnorePendingStylesheets(); 687 element->document().updateLayoutIgnorePendingStylesheets();
688 LayoutObject* renderer = element->renderer(); 688 LayoutObject* renderer = element->layoutObject();
689 if (!renderer) 689 if (!renderer)
690 return ClientRect::create(); 690 return ClientRect::create();
691 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s()); 691 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s());
692 } 692 }
693 693
694 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& exceptionState) 694 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& exceptionState)
695 { 695 {
696 ASSERT(node); 696 ASSERT(node);
697 DocumentMarker::MarkerTypes markerTypes = 0; 697 DocumentMarker::MarkerTypes markerTypes = 0;
698 if (!markerTypesFrom(markerType, markerTypes)) { 698 if (!markerTypesFrom(markerType, markerTypes)) {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 { 1163 {
1164 ASSERT(document); 1164 ASSERT(document);
1165 return eventHandlerCount(*document, EventHandlerRegistry::TouchEvent); 1165 return eventHandlerCount(*document, EventHandlerRegistry::TouchEvent);
1166 } 1166 }
1167 1167
1168 static Layer* findLayerForGraphicsLayer(Layer* searchRoot, GraphicsLayer* graphi csLayer, IntSize* layerOffset, String* layerType) 1168 static Layer* findLayerForGraphicsLayer(Layer* searchRoot, GraphicsLayer* graphi csLayer, IntSize* layerOffset, String* layerType)
1169 { 1169 {
1170 *layerOffset = IntSize(); 1170 *layerOffset = IntSize();
1171 if (searchRoot->hasCompositedLayerMapping() && graphicsLayer == searchRoot-> compositedLayerMapping()->mainGraphicsLayer()) { 1171 if (searchRoot->hasCompositedLayerMapping() && graphicsLayer == searchRoot-> compositedLayerMapping()->mainGraphicsLayer()) {
1172 LayoutRect rect; 1172 LayoutRect rect;
1173 Layer::mapRectToPaintBackingCoordinates(searchRoot->renderer(), rect); 1173 Layer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect );
1174 *layerOffset = IntSize(rect.x(), rect.y()); 1174 *layerOffset = IntSize(rect.x(), rect.y());
1175 return searchRoot; 1175 return searchRoot;
1176 } 1176 }
1177 1177
1178 GraphicsLayer* layerForScrolling = searchRoot->scrollableArea() ? searchRoot ->scrollableArea()->layerForScrolling() : 0; 1178 GraphicsLayer* layerForScrolling = searchRoot->scrollableArea() ? searchRoot ->scrollableArea()->layerForScrolling() : 0;
1179 if (graphicsLayer == layerForScrolling) { 1179 if (graphicsLayer == layerForScrolling) {
1180 *layerType = "scrolling"; 1180 *layerType = "scrolling";
1181 return searchRoot; 1181 return searchRoot;
1182 } 1182 }
1183 1183
1184 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { 1184 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) {
1185 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL ayer(); 1185 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL ayer();
1186 if (graphicsLayer == squashingLayer) { 1186 if (graphicsLayer == squashingLayer) {
1187 *layerType ="squashing"; 1187 *layerType ="squashing";
1188 LayoutRect rect; 1188 LayoutRect rect;
1189 Layer::mapRectToPaintBackingCoordinates(searchRoot->renderer(), rect ); 1189 Layer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
1190 *layerOffset = IntSize(rect.x(), rect.y()); 1190 *layerOffset = IntSize(rect.x(), rect.y());
1191 return searchRoot; 1191 return searchRoot;
1192 } 1192 }
1193 } 1193 }
1194 1194
1195 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForHorizontalScrollbar() : 0; 1195 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForHorizontalScrollbar() : 0;
1196 if (graphicsLayer == layerForHorizontalScrollbar) { 1196 if (graphicsLayer == layerForHorizontalScrollbar) {
1197 *layerType = "horizontalScrollbar"; 1197 *layerType = "horizontalScrollbar";
1198 return searchRoot; 1198 return searchRoot;
1199 } 1199 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 } 1267 }
1268 1268
1269 static void accumulateLayerRectList(LayerCompositor* compositor, GraphicsLayer* graphicsLayer, LayerRectList* rects) 1269 static void accumulateLayerRectList(LayerCompositor* compositor, GraphicsLayer* graphicsLayer, LayerRectList* rects)
1270 { 1270 {
1271 blink::WebVector<blink::WebRect> layerRects = graphicsLayer->platformLayer() ->touchEventHandlerRegion(); 1271 blink::WebVector<blink::WebRect> layerRects = graphicsLayer->platformLayer() ->touchEventHandlerRegion();
1272 if (!layerRects.isEmpty()) { 1272 if (!layerRects.isEmpty()) {
1273 mergeRects(layerRects); 1273 mergeRects(layerRects);
1274 String layerType; 1274 String layerType;
1275 IntSize layerOffset; 1275 IntSize layerOffset;
1276 Layer* renderLayer = findLayerForGraphicsLayer(compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType); 1276 Layer* renderLayer = findLayerForGraphicsLayer(compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType);
1277 Node* node = renderLayer ? renderLayer->renderer()->node() : 0; 1277 Node* node = renderLayer ? renderLayer->layoutObject()->node() : 0;
1278 for (size_t i = 0; i < layerRects.size(); ++i) { 1278 for (size_t i = 0; i < layerRects.size(); ++i) {
1279 if (!layerRects[i].isEmpty()) { 1279 if (!layerRects[i].isEmpty()) {
1280 rects->append(node, layerType, layerOffset.width(), layerOffset. height(), ClientRect::create(layerRects[i])); 1280 rects->append(node, layerType, layerOffset.width(), layerOffset. height(), ClientRect::create(layerRects[i]));
1281 } 1281 }
1282 } 1282 }
1283 } 1283 }
1284 1284
1285 size_t numChildren = graphicsLayer->children().size(); 1285 size_t numChildren = graphicsLayer->children().size();
1286 for (size_t i = 0; i < numChildren; ++i) 1286 for (size_t i = 0; i < numChildren; ++i)
1287 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ; 1287 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 frameView->updateLayoutAndStyleForPainting(); 1501 frameView->updateLayoutAndStyleForPainting();
1502 1502
1503 return elementLayerTreeAsText(element, 0, exceptionState); 1503 return elementLayerTreeAsText(element, 0, exceptionState);
1504 } 1504 }
1505 1505
1506 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState) 1506 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState)
1507 { 1507 {
1508 ASSERT(element1 && element2); 1508 ASSERT(element1 && element2);
1509 element1->document().view()->updateLayoutAndStyleForPainting(); 1509 element1->document().view()->updateLayoutAndStyleForPainting();
1510 1510
1511 LayoutObject* renderer1 = element1->renderer(); 1511 LayoutObject* renderer1 = element1->layoutObject();
1512 LayoutObject* renderer2 = element2->renderer(); 1512 LayoutObject* renderer2 = element2->layoutObject();
1513 if (!renderer1 || !renderer1->isBox()) { 1513 if (!renderer1 || !renderer1->isBox()) {
1514 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi rst provided element's renderer is not a box." : "The first provided element has no renderer."); 1514 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi rst provided element's renderer is not a box." : "The first provided element has no renderer.");
1515 return false; 1515 return false;
1516 } 1516 }
1517 if (!renderer2 || !renderer2->isBox()) { 1517 if (!renderer2 || !renderer2->isBox()) {
1518 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se cond provided element's renderer is not a box." : "The second provided element h as no renderer."); 1518 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se cond provided element's renderer is not a box." : "The second provided element h as no renderer.");
1519 return false; 1519 return false;
1520 } 1520 }
1521 1521
1522 Layer* layer1 = toLayoutBox(renderer1)->layer(); 1522 Layer* layer1 = toLayoutBox(renderer1)->layer();
(...skipping 17 matching lines...) Expand all
1540 document->view()->updateLayoutAndStyleForPainting(); 1540 document->view()->updateLayoutAndStyleForPainting();
1541 1541
1542 return document->frame()->layerTreeAsText(flags); 1542 return document->frame()->layerTreeAsText(flags);
1543 } 1543 }
1544 1544
1545 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const 1545 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const
1546 { 1546 {
1547 ASSERT(element); 1547 ASSERT(element);
1548 element->document().updateLayout(); 1548 element->document().updateLayout();
1549 1549
1550 LayoutObject* renderer = element->renderer(); 1550 LayoutObject* renderer = element->layoutObject();
1551 if (!renderer || !renderer->isBox()) { 1551 if (!renderer || !renderer->isBox()) {
1552 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. "); 1552 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. ");
1553 return String(); 1553 return String();
1554 } 1554 }
1555 1555
1556 Layer* layer = toLayoutBox(renderer)->layer(); 1556 Layer* layer = toLayoutBox(renderer)->layer();
1557 if (!layer 1557 if (!layer
1558 || !layer->hasCompositedLayerMapping() 1558 || !layer->hasCompositedLayerMapping()
1559 || !layer->compositedLayerMapping()->mainGraphicsLayer()) { 1559 || !layer->compositedLayerMapping()->mainGraphicsLayer()) {
1560 // Don't raise exception in these cases which may be normally used in te sts. 1560 // Don't raise exception in these cases which may be normally used in te sts.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 } 1989 }
1990 1990
1991 bool Internals::isSelectPopupVisible(Node* node) 1991 bool Internals::isSelectPopupVisible(Node* node)
1992 { 1992 {
1993 ASSERT(node); 1993 ASSERT(node);
1994 if (!isHTMLSelectElement(*node)) 1994 if (!isHTMLSelectElement(*node))
1995 return false; 1995 return false;
1996 1996
1997 HTMLSelectElement& select = toHTMLSelectElement(*node); 1997 HTMLSelectElement& select = toHTMLSelectElement(*node);
1998 1998
1999 LayoutObject* renderer = select.renderer(); 1999 LayoutObject* renderer = select.layoutObject();
2000 if (!renderer || !renderer->isMenuList()) 2000 if (!renderer || !renderer->isMenuList())
2001 return false; 2001 return false;
2002 2002
2003 LayoutMenuList* menuList = toLayoutMenuList(renderer); 2003 LayoutMenuList* menuList = toLayoutMenuList(renderer);
2004 return menuList->popupIsVisible(); 2004 return menuList->popupIsVisible();
2005 } 2005 }
2006 2006
2007 bool Internals::selectPopupItemStyleIsRtl(Node* node, int itemIndex) 2007 bool Internals::selectPopupItemStyleIsRtl(Node* node, int itemIndex)
2008 { 2008 {
2009 if (!node || !isHTMLSelectElement(*node)) 2009 if (!node || !isHTMLSelectElement(*node))
2010 return false; 2010 return false;
2011 2011
2012 HTMLSelectElement& select = toHTMLSelectElement(*node); 2012 HTMLSelectElement& select = toHTMLSelectElement(*node);
2013 2013
2014 LayoutObject* renderer = select.renderer(); 2014 LayoutObject* renderer = select.layoutObject();
2015 if (!renderer || !renderer->isMenuList()) 2015 if (!renderer || !renderer->isMenuList())
2016 return false; 2016 return false;
2017 2017
2018 LayoutMenuList& menuList = toLayoutMenuList(*renderer); 2018 LayoutMenuList& menuList = toLayoutMenuList(*renderer);
2019 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); 2019 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex);
2020 return itemStyle.textDirection() == RTL; 2020 return itemStyle.textDirection() == RTL;
2021 } 2021 }
2022 2022
2023 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex) 2023 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex)
2024 { 2024 {
2025 if (!node || !isHTMLSelectElement(*node)) 2025 if (!node || !isHTMLSelectElement(*node))
2026 return false; 2026 return false;
2027 2027
2028 HTMLSelectElement& select = toHTMLSelectElement(*node); 2028 HTMLSelectElement& select = toHTMLSelectElement(*node);
2029 2029
2030 LayoutObject* renderer = select.renderer(); 2030 LayoutObject* renderer = select.layoutObject();
2031 if (!renderer || !renderer->isMenuList()) 2031 if (!renderer || !renderer->isMenuList())
2032 return false; 2032 return false;
2033 2033
2034 LayoutMenuList& menuList = toLayoutMenuList(*renderer); 2034 LayoutMenuList& menuList = toLayoutMenuList(*renderer);
2035 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); 2035 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex);
2036 return itemStyle.font().fontMetrics().height(); 2036 return itemStyle.font().fontMetrics().height();
2037 } 2037 }
2038 2038
2039 bool Internals::loseSharedGraphicsContext3D() 2039 bool Internals::loseSharedGraphicsContext3D()
2040 { 2040 {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 void Internals::setValueForUser(Element* element, const String& value) 2167 void Internals::setValueForUser(Element* element, const String& value)
2168 { 2168 {
2169 toHTMLInputElement(element)->setValueForUser(value); 2169 toHTMLInputElement(element)->setValueForUser(value);
2170 } 2170 }
2171 2171
2172 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2172 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2173 { 2173 {
2174 if (!node) 2174 if (!node)
2175 return String(); 2175 return String();
2176 blink::WebPoint point(x, y); 2176 blink::WebPoint point(x, y);
2177 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent( ), maxLength); 2177 SurroundingText surroundingText(VisiblePosition(node->layoutObject()->positi onForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquival ent(), maxLength);
2178 return surroundingText.content(); 2178 return surroundingText.content();
2179 } 2179 }
2180 2180
2181 void Internals::setFocused(bool focused) 2181 void Internals::setFocused(bool focused)
2182 { 2182 {
2183 frame()->page()->focusController().setFocused(focused); 2183 frame()->page()->focusController().setFocused(focused);
2184 } 2184 }
2185 2185
2186 bool Internals::ignoreLayoutWithPendingStylesheets(Document* document) 2186 bool Internals::ignoreLayoutWithPendingStylesheets(Document* document)
2187 { 2187 {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 { 2317 {
2318 ThreadState::current()->setGCState(ThreadState::GCScheduledForTesting); 2318 ThreadState::current()->setGCState(ThreadState::GCScheduledForTesting);
2319 } 2319 }
2320 2320
2321 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&) 2321 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&)
2322 { 2322 {
2323 return new InternalsIterationSource(); 2323 return new InternalsIterationSource();
2324 } 2324 }
2325 2325
2326 } // namespace blink 2326 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/graphics/filters/SVGFEImage.cpp ('k') | Source/modules/accessibility/AXImageMapLink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698