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

Unified Diff: Source/core/inspector/InspectorStyleSheet.cpp

Issue 172593003: DevTools: [CSS] Add CSS.editRangeInStyleSheetText() to the protocol (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorStyleSheet.cpp
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index 14911cfc3fb87695a7a01c144ddae10411eff95d..0b76b5be7c8f57a7dce00026a8271a66c0db44f3 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -1557,6 +1557,16 @@ InspectorCSSId InspectorStyleSheet::ruleId(CSSStyleRule* rule) const
return ruleOrStyleId(rule->style());
}
+bool InspectorStyleSheet::lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber, unsigned* offset) const
+{
+ OwnPtr<Vector<unsigned> > endings = lineEndings();
+ if (lineNumber >= endings->size())
+ return false;
+ TextPosition position(OrdinalNumber::fromZeroBasedInt(lineNumber), OrdinalNumber::fromZeroBasedInt(columnNumber));
+ *offset = position.toOffsetPosition(*endings).zeroBasedInt();
apavlov 2014/02/21 14:37:55 This should check for columnNumber-is-beyond-last-
lushnikov 2014/02/23 16:07:07 Added check that columnNumber is beyond the amount
+ return true;
+}
+
void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle)
{
if (m_isRevalidating)

Powered by Google App Engine
This is Rietveld 408576698