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

Side by Side Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 38943008: Explore the possibility of implementing the CSS Region interface. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Prototype v2 Created 7 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include "CSSPropertyNames.h" 28 #include "CSSPropertyNames.h"
29 #include "FetchInitiatorTypeNames.h" 29 #include "FetchInitiatorTypeNames.h"
30 #include "InspectorTypeBuilder.h" 30 #include "InspectorTypeBuilder.h"
31 #include "StylePropertyShorthand.h" 31 #include "StylePropertyShorthand.h"
32 #include "bindings/v8/ExceptionState.h" 32 #include "bindings/v8/ExceptionState.h"
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "core/css/CSSComputedStyleDeclaration.h" 34 #include "core/css/CSSComputedStyleDeclaration.h"
35 #include "core/css/CSSImportRule.h" 35 #include "core/css/CSSImportRule.h"
36 #include "core/css/CSSMediaRule.h" 36 #include "core/css/CSSMediaRule.h"
37 #include "core/css/CSSParser.h" 37 #include "core/css/CSSParser.h"
38 #include "core/css/CSSRegion.h"
38 #include "core/css/CSSRule.h" 39 #include "core/css/CSSRule.h"
39 #include "core/css/CSSRuleList.h" 40 #include "core/css/CSSRuleList.h"
40 #include "core/css/CSSStyleRule.h" 41 #include "core/css/CSSStyleRule.h"
41 #include "core/css/CSSStyleSheet.h" 42 #include "core/css/CSSStyleSheet.h"
42 #include "core/css/MediaList.h" 43 #include "core/css/MediaList.h"
43 #include "core/css/StylePropertySet.h" 44 #include "core/css/StylePropertySet.h"
44 #include "core/css/StyleRule.h" 45 #include "core/css/StyleRule.h"
45 #include "core/css/StyleSheet.h" 46 #include "core/css/StyleSheet.h"
46 #include "core/css/StyleSheetContents.h" 47 #include "core/css/StyleSheetContents.h"
47 #include "core/css/StyleSheetList.h" 48 #include "core/css/StyleSheetList.h"
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 if (!attributeStyle) 1768 if (!attributeStyle)
1768 return 0; 1769 return 0;
1769 1770
1770 ASSERT(attributeStyle->isMutable()); 1771 ASSERT(attributeStyle->isMutable());
1771 MutableStylePropertySet* mutableAttributeStyle = static_cast<MutableStylePro pertySet*>(attributeStyle); 1772 MutableStylePropertySet* mutableAttributeStyle = static_cast<MutableStylePro pertySet*>(attributeStyle);
1772 1773
1773 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI d(), mutableAttributeStyle->ensureCSSStyleDeclaration(), 0); 1774 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI d(), mutableAttributeStyle->ensureCSSStyleDeclaration(), 0);
1774 return inspectorStyle->buildObjectForStyle(); 1775 return inspectorStyle->buildObjectForStyle();
1775 } 1776 }
1776 1777
1777 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > InspectorCSSAgent::bui ldArrayForRegions(ErrorString* errorString, PassRefPtr<NodeList> regionList, int documentNodeId) 1778 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > InspectorCSSAgent::bui ldArrayForRegions(ErrorString* errorString, Vector<const RenderRegion*> regionLi st, int documentNodeId)
1778 { 1779 {
1779 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > regions = TypeBuilder: :Array<TypeBuilder::CSS::Region>::create(); 1780 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > regions = TypeBuilder: :Array<TypeBuilder::CSS::Region>::create();
1780 1781
1781 for (unsigned i = 0; i < regionList->length(); ++i) { 1782 for (unsigned i = 0; i < regionList.size(); ++i) {
1782 TypeBuilder::CSS::Region::RegionOverset::Enum regionOverset; 1783 TypeBuilder::CSS::Region::RegionOverset::Enum regionOverset;
1783 1784
1784 switch (toElement(regionList->item(i))->renderRegion()->regionOversetSta te()) { 1785 switch (regionList[i]->regionOversetState()) {
1785 case RegionFit: 1786 case RegionFit:
1786 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Fit; 1787 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Fit;
1787 break; 1788 break;
1788 case RegionEmpty: 1789 case RegionEmpty:
1789 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Empty; 1790 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Empty;
1790 break; 1791 break;
1791 case RegionOverset: 1792 case RegionOverset:
1792 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Overset; 1793 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Overset;
1793 break; 1794 break;
1794 case RegionUndefined: 1795 case RegionUndefined:
1795 continue; 1796 continue;
1796 default: 1797 default:
1797 ASSERT_NOT_REACHED(); 1798 ASSERT_NOT_REACHED();
1798 continue; 1799 continue;
1799 } 1800 }
1800 1801
1801 RefPtr<TypeBuilder::CSS::Region> region = TypeBuilder::CSS::Region::crea te() 1802 RefPtr<TypeBuilder::CSS::Region> region = TypeBuilder::CSS::Region::crea te()
1802 .setRegionOverset(regionOverset) 1803 .setRegionOverset(regionOverset)
1803 // documentNodeId was previously asserted 1804 // documentNodeId was previously asserted
1804 .setNodeId(m_domAgent->pushNodeToFrontend(errorString, documentNodeI d, regionList->item(i))); 1805 .setNodeId(m_domAgent->pushNodeToFrontend(errorString, documentNodeI d, regionList[i]->node()));
1805 1806
1806 regions->addItem(region); 1807 regions->addItem(region);
1807 } 1808 }
1808 1809
1809 return regions.release(); 1810 return regions.release();
1810 } 1811 }
1811 1812
1812 PassRefPtr<TypeBuilder::CSS::NamedFlow> InspectorCSSAgent::buildObjectForNamedFl ow(ErrorString* errorString, NamedFlow* webkitNamedFlow, int documentNodeId) 1813 PassRefPtr<TypeBuilder::CSS::NamedFlow> InspectorCSSAgent::buildObjectForNamedFl ow(ErrorString* errorString, NamedFlow* webkitNamedFlow, int documentNodeId)
1813 { 1814 {
1814 RefPtr<NodeList> contentList = webkitNamedFlow->getContent(); 1815 RefPtr<NodeList> contentList = webkitNamedFlow->getContent();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 documentsToChange.add(element->ownerDocument()); 1892 documentsToChange.add(element->ownerDocument());
1892 } 1893 }
1893 1894
1894 m_nodeIdToForcedPseudoState.clear(); 1895 m_nodeIdToForcedPseudoState.clear();
1895 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1896 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1896 (*it)->setNeedsStyleRecalc(); 1897 (*it)->setNeedsStyleRecalc();
1897 } 1898 }
1898 1899
1899 } // namespace WebCore 1900 } // namespace WebCore
1900 1901
OLDNEW
« Source/core/dom/PseudoElement.idl ('K') | « Source/core/inspector/InspectorCSSAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698