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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "core/inspector/ConsoleMessageStorage.h" 96 #include "core/inspector/ConsoleMessageStorage.h"
97 #include "core/inspector/InspectorClient.h" 97 #include "core/inspector/InspectorClient.h"
98 #include "core/inspector/InspectorConsoleAgent.h" 98 #include "core/inspector/InspectorConsoleAgent.h"
99 #include "core/inspector/InspectorController.h" 99 #include "core/inspector/InspectorController.h"
100 #include "core/inspector/InspectorCounters.h" 100 #include "core/inspector/InspectorCounters.h"
101 #include "core/inspector/InspectorFrontendChannel.h" 101 #include "core/inspector/InspectorFrontendChannel.h"
102 #include "core/inspector/InspectorInstrumentation.h" 102 #include "core/inspector/InspectorInstrumentation.h"
103 #include "core/inspector/InspectorOverlay.h" 103 #include "core/inspector/InspectorOverlay.h"
104 #include "core/inspector/InstrumentingAgents.h" 104 #include "core/inspector/InstrumentingAgents.h"
105 #include "core/layout/Layer.h" 105 #include "core/layout/Layer.h"
106 #include "core/layout/LayoutObject.h"
106 #include "core/layout/LayoutTreeAsText.h" 107 #include "core/layout/LayoutTreeAsText.h"
107 #include "core/layout/compositing/CompositedLayerMapping.h" 108 #include "core/layout/compositing/CompositedLayerMapping.h"
108 #include "core/layout/compositing/LayerCompositor.h" 109 #include "core/layout/compositing/LayerCompositor.h"
109 #include "core/loader/FrameLoader.h" 110 #include "core/loader/FrameLoader.h"
110 #include "core/loader/HistoryItem.h" 111 #include "core/loader/HistoryItem.h"
111 #include "core/page/Chrome.h" 112 #include "core/page/Chrome.h"
112 #include "core/page/ChromeClient.h" 113 #include "core/page/ChromeClient.h"
113 #include "core/page/EventHandler.h" 114 #include "core/page/EventHandler.h"
114 #include "core/page/FocusController.h" 115 #include "core/page/FocusController.h"
115 #include "core/page/NetworkStateNotifier.h" 116 #include "core/page/NetworkStateNotifier.h"
116 #include "core/page/Page.h" 117 #include "core/page/Page.h"
117 #include "core/page/PrintContext.h" 118 #include "core/page/PrintContext.h"
118 #include "core/plugins/testing/DictionaryPluginPlaceholder.h" 119 #include "core/plugins/testing/DictionaryPluginPlaceholder.h"
119 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h" 120 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h"
120 #include "core/rendering/RenderMenuList.h" 121 #include "core/rendering/RenderMenuList.h"
121 #include "core/rendering/RenderObject.h"
122 #include "core/rendering/RenderView.h" 122 #include "core/rendering/RenderView.h"
123 #include "core/testing/DictionaryTest.h" 123 #include "core/testing/DictionaryTest.h"
124 #include "core/testing/GCObservation.h" 124 #include "core/testing/GCObservation.h"
125 #include "core/testing/InternalSettings.h" 125 #include "core/testing/InternalSettings.h"
126 #include "core/testing/LayerRect.h" 126 #include "core/testing/LayerRect.h"
127 #include "core/testing/LayerRectList.h" 127 #include "core/testing/LayerRectList.h"
128 #include "core/testing/PluginPlaceholderOptions.h" 128 #include "core/testing/PluginPlaceholderOptions.h"
129 #include "core/testing/PrivateScriptTest.h" 129 #include "core/testing/PrivateScriptTest.h"
130 #include "core/testing/TypeConversions.h" 130 #include "core/testing/TypeConversions.h"
131 #include "core/testing/UnionTypesTest.h" 131 #include "core/testing/UnionTypesTest.h"
(...skipping 546 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 RenderObject* renderer = element->renderer(); 688 LayoutObject* renderer = element->renderer();
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 frameView->updateLayoutAndStyleForPainting(); 1515 frameView->updateLayoutAndStyleForPainting();
1516 1516
1517 return elementLayerTreeAsText(element, 0, exceptionState); 1517 return elementLayerTreeAsText(element, 0, exceptionState);
1518 } 1518 }
1519 1519
1520 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState) 1520 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState)
1521 { 1521 {
1522 ASSERT(element1 && element2); 1522 ASSERT(element1 && element2);
1523 element1->document().view()->updateLayoutAndStyleForPainting(); 1523 element1->document().view()->updateLayoutAndStyleForPainting();
1524 1524
1525 RenderObject* renderer1 = element1->renderer(); 1525 LayoutObject* renderer1 = element1->renderer();
1526 RenderObject* renderer2 = element2->renderer(); 1526 LayoutObject* renderer2 = element2->renderer();
1527 if (!renderer1 || !renderer1->isBox()) { 1527 if (!renderer1 || !renderer1->isBox()) {
1528 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi rst provided element's renderer is not a box." : "The first provided element has no renderer."); 1528 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi rst provided element's renderer is not a box." : "The first provided element has no renderer.");
1529 return 0; 1529 return 0;
1530 } 1530 }
1531 if (!renderer2 || !renderer2->isBox()) { 1531 if (!renderer2 || !renderer2->isBox()) {
1532 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se cond provided element's renderer is not a box." : "The second provided element h as no renderer."); 1532 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se cond provided element's renderer is not a box." : "The second provided element h as no renderer.");
1533 return 0; 1533 return 0;
1534 } 1534 }
1535 1535
1536 Layer* layer1 = toRenderBox(renderer1)->layer(); 1536 Layer* layer1 = toRenderBox(renderer1)->layer();
(...skipping 17 matching lines...) Expand all
1554 document->view()->updateLayoutAndStyleForPainting(); 1554 document->view()->updateLayoutAndStyleForPainting();
1555 1555
1556 return document->frame()->layerTreeAsText(flags); 1556 return document->frame()->layerTreeAsText(flags);
1557 } 1557 }
1558 1558
1559 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const 1559 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const
1560 { 1560 {
1561 ASSERT(element); 1561 ASSERT(element);
1562 element->document().updateLayout(); 1562 element->document().updateLayout();
1563 1563
1564 RenderObject* renderer = element->renderer(); 1564 LayoutObject* renderer = element->renderer();
1565 if (!renderer || !renderer->isBox()) { 1565 if (!renderer || !renderer->isBox()) {
1566 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. "); 1566 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. ");
1567 return String(); 1567 return String();
1568 } 1568 }
1569 1569
1570 Layer* layer = toRenderBox(renderer)->layer(); 1570 Layer* layer = toRenderBox(renderer)->layer();
1571 if (!layer 1571 if (!layer
1572 || !layer->hasCompositedLayerMapping() 1572 || !layer->hasCompositedLayerMapping()
1573 || !layer->compositedLayerMapping()->mainGraphicsLayer()) { 1573 || !layer->compositedLayerMapping()->mainGraphicsLayer()) {
1574 // Don't raise exception in these cases which may be normally used in te sts. 1574 // Don't raise exception in these cases which may be normally used in te sts.
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 } 2008 }
2009 2009
2010 bool Internals::isSelectPopupVisible(Node* node) 2010 bool Internals::isSelectPopupVisible(Node* node)
2011 { 2011 {
2012 ASSERT(node); 2012 ASSERT(node);
2013 if (!isHTMLSelectElement(*node)) 2013 if (!isHTMLSelectElement(*node))
2014 return false; 2014 return false;
2015 2015
2016 HTMLSelectElement& select = toHTMLSelectElement(*node); 2016 HTMLSelectElement& select = toHTMLSelectElement(*node);
2017 2017
2018 RenderObject* renderer = select.renderer(); 2018 LayoutObject* renderer = select.renderer();
2019 if (!renderer || !renderer->isMenuList()) 2019 if (!renderer || !renderer->isMenuList())
2020 return false; 2020 return false;
2021 2021
2022 RenderMenuList* menuList = toRenderMenuList(renderer); 2022 RenderMenuList* menuList = toRenderMenuList(renderer);
2023 return menuList->popupIsVisible(); 2023 return menuList->popupIsVisible();
2024 } 2024 }
2025 2025
2026 bool Internals::selectPopupItemStyleIsRtl(Node* node, int itemIndex) 2026 bool Internals::selectPopupItemStyleIsRtl(Node* node, int itemIndex)
2027 { 2027 {
2028 if (!node || !isHTMLSelectElement(*node)) 2028 if (!node || !isHTMLSelectElement(*node))
2029 return false; 2029 return false;
2030 2030
2031 HTMLSelectElement& select = toHTMLSelectElement(*node); 2031 HTMLSelectElement& select = toHTMLSelectElement(*node);
2032 2032
2033 RenderObject* renderer = select.renderer(); 2033 LayoutObject* renderer = select.renderer();
2034 if (!renderer || !renderer->isMenuList()) 2034 if (!renderer || !renderer->isMenuList())
2035 return false; 2035 return false;
2036 2036
2037 RenderMenuList& menuList = toRenderMenuList(*renderer); 2037 RenderMenuList& menuList = toRenderMenuList(*renderer);
2038 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); 2038 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex);
2039 return itemStyle.textDirection() == RTL; 2039 return itemStyle.textDirection() == RTL;
2040 } 2040 }
2041 2041
2042 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex) 2042 int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex)
2043 { 2043 {
2044 if (!node || !isHTMLSelectElement(*node)) 2044 if (!node || !isHTMLSelectElement(*node))
2045 return false; 2045 return false;
2046 2046
2047 HTMLSelectElement& select = toHTMLSelectElement(*node); 2047 HTMLSelectElement& select = toHTMLSelectElement(*node);
2048 2048
2049 RenderObject* renderer = select.renderer(); 2049 LayoutObject* renderer = select.renderer();
2050 if (!renderer || !renderer->isMenuList()) 2050 if (!renderer || !renderer->isMenuList())
2051 return false; 2051 return false;
2052 2052
2053 RenderMenuList& menuList = toRenderMenuList(*renderer); 2053 RenderMenuList& menuList = toRenderMenuList(*renderer);
2054 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex); 2054 PopupMenuStyle itemStyle = menuList.itemStyle(itemIndex);
2055 return itemStyle.font().fontMetrics().height(); 2055 return itemStyle.font().fontMetrics().height();
2056 } 2056 }
2057 2057
2058 bool Internals::loseSharedGraphicsContext3D() 2058 bool Internals::loseSharedGraphicsContext3D()
2059 { 2059 {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 { 2336 {
2337 ThreadState::current()->schedulePreciseGC(); 2337 ThreadState::current()->schedulePreciseGC();
2338 } 2338 }
2339 2339
2340 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&) 2340 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&)
2341 { 2341 {
2342 return new InternalsIterationSource(); 2342 return new InternalsIterationSource();
2343 } 2343 }
2344 2344
2345 } // namespace blink 2345 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/graphics/filters/SVGFilterBuilder.cpp ('k') | Source/devtools/front_end/console/CustomPreviewSection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698