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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp

Issue 2740643002: DevTools: expose length of the stylesheet content in protocol (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/browser_protocol.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } 1416 }
1417 1417
1418 std::unique_ptr<protocol::CSS::CSSStyleSheetHeader> 1418 std::unique_ptr<protocol::CSS::CSSStyleSheetHeader>
1419 InspectorStyleSheet::buildObjectForStyleSheetInfo() { 1419 InspectorStyleSheet::buildObjectForStyleSheetInfo() {
1420 CSSStyleSheet* styleSheet = pageStyleSheet(); 1420 CSSStyleSheet* styleSheet = pageStyleSheet();
1421 if (!styleSheet) 1421 if (!styleSheet)
1422 return nullptr; 1422 return nullptr;
1423 1423
1424 Document* document = styleSheet->ownerDocument(); 1424 Document* document = styleSheet->ownerDocument();
1425 LocalFrame* frame = document ? document->frame() : nullptr; 1425 LocalFrame* frame = document ? document->frame() : nullptr;
1426 1426 String text;
1427 getText(&text);
1427 std::unique_ptr<protocol::CSS::CSSStyleSheetHeader> result = 1428 std::unique_ptr<protocol::CSS::CSSStyleSheetHeader> result =
1428 protocol::CSS::CSSStyleSheetHeader::create() 1429 protocol::CSS::CSSStyleSheetHeader::create()
1429 .setStyleSheetId(id()) 1430 .setStyleSheetId(id())
1430 .setOrigin(m_origin) 1431 .setOrigin(m_origin)
1431 .setDisabled(styleSheet->disabled()) 1432 .setDisabled(styleSheet->disabled())
1432 .setSourceURL(url()) 1433 .setSourceURL(url())
1433 .setTitle(styleSheet->title()) 1434 .setTitle(styleSheet->title())
1434 .setFrameId(frame ? IdentifiersFactory::frameId(frame) : "") 1435 .setFrameId(frame ? IdentifiersFactory::frameId(frame) : "")
1435 .setIsInline(styleSheet->isInline() && !startsAtZero()) 1436 .setIsInline(styleSheet->isInline() && !startsAtZero())
1436 .setStartLine( 1437 .setStartLine(
1437 styleSheet->startPositionInSource().m_line.zeroBasedInt()) 1438 styleSheet->startPositionInSource().m_line.zeroBasedInt())
1438 .setStartColumn( 1439 .setStartColumn(
1439 styleSheet->startPositionInSource().m_column.zeroBasedInt()) 1440 styleSheet->startPositionInSource().m_column.zeroBasedInt())
1441 .setLength(text.length())
1440 .build(); 1442 .build();
1441 1443
1442 if (hasSourceURL()) 1444 if (hasSourceURL())
1443 result->setHasSourceURL(true); 1445 result->setHasSourceURL(true);
1444 1446
1445 if (styleSheet->ownerNode()) 1447 if (styleSheet->ownerNode())
1446 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode())); 1448 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode()));
1447 1449
1448 String sourceMapURLValue = sourceMapURL(); 1450 String sourceMapURLValue = sourceMapURL();
1449 if (!sourceMapURLValue.isEmpty()) 1451 if (!sourceMapURLValue.isEmpty())
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 return m_element->getAttribute("style").getString(); 1935 return m_element->getAttribute("style").getString();
1934 } 1936 }
1935 1937
1936 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) { 1938 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) {
1937 visitor->trace(m_element); 1939 visitor->trace(m_element);
1938 visitor->trace(m_inspectorStyle); 1940 visitor->trace(m_inspectorStyle);
1939 InspectorStyleSheetBase::trace(visitor); 1941 InspectorStyleSheetBase::trace(visitor);
1940 } 1942 }
1941 1943
1942 } // namespace blink 1944 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/browser_protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698