RESOLVED FIXED 110732
Web Inspector: Selector's raw start position in its line is considered to be 0 when computing UILocation
https://bugs.webkit.org/show_bug.cgi?id=110732
Summary Web Inspector: Selector's raw start position in its line is considered to be ...
Alexander Pavlov (apavlov)
Reported 2013-02-25 00:53:58 PST
Attachments
Patch (24.14 KB, patch)
2013-02-25 06:28 PST, Alexander Pavlov (apavlov)
no flags
Patch (62.05 KB, patch)
2013-02-25 23:04 PST, Alexander Pavlov (apavlov)
no flags
Patch (61.49 KB, patch)
2013-02-28 03:02 PST, Alexander Pavlov (apavlov)
no flags
Patch (61.50 KB, patch)
2013-02-28 07:57 PST, Alexander Pavlov (apavlov)
vsevik: review+
Alexander Pavlov (apavlov)
Comment 1 2013-02-25 06:28:37 PST
Pavel Feldman
Comment 2 2013-02-25 06:43:03 PST
Comment on attachment 190046 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190046&action=review > Source/WebCore/inspector/InspectorStyleSheet.cpp:149 > + ASSERT(m_hasText); Could you reuse the code in getRegularExpressionMatchesByLines? > Source/WebCore/inspector/InspectorStyleSheet.cpp:176 > +struct LineColumn { wtf/text/TextPosition.h > Source/WebCore/inspector/InspectorStyleSheet.cpp:191 > + const size_t vectorSize = lineEndings.size(); Move to ContentSearchUtil
Alexander Pavlov (apavlov)
Comment 3 2013-02-25 23:04:43 PST
Vsevolod Vlasov
Comment 4 2013-02-27 03:22:50 PST
Comment on attachment 190212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190212&action=review > Source/WebCore/inspector/ContentSearchUtils.cpp:74 > + if (!vectorSize) This check should not be needed, see my comment to lineEndings below. > Source/WebCore/inspector/ContentSearchUtils.cpp:79 > + size_t previousLineEndingOffset; const size_t* foundLineEnding = approximateBinarySearch<size_t, size_t>(lineEndings, vectorSize, offset, sizetExtractor); size_t lineIndex = foundLineEnding - &lineEndings.at(0); if (offset > *foundLineEnding) ++lineIndex; size_t previousLineEndingOffset = lineIndex >= 0 ? lineEndings.at(lineIndex-1) : 0; size_t column = offset - previousLineEndingOffset; return TextPosition(OrdinalNumber::fromZeroBasedInt(lineIndex), OrdinalNumber::fromZeroBasedInt(column)); Seems to be a shorter way to do the same. > Source/WebCore/inspector/ContentSearchUtils.cpp:128 > + while (start < text.length()) { I would do as follows instead to make sure we lways have at least one line (even for an empty file). That would be consistent with what we do in front-end (see utilities.js) while (start < text.length()) { size_t lineEnd = text.find('\n', start); if (lineEnd == notFound) break; result->append(lineEnd); start = lineEnd + 1; } result->append(text.length());
Vsevolod Vlasov
Comment 5 2013-02-28 01:44:21 PST
Comment on attachment 190212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190212&action=review > Source/WebCore/inspector/InspectorStyleSheet.cpp:527 > + OwnPtr<Vector<size_t> > lineEndings(m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : PassOwnPtr<Vector<size_t> >()); Could you please explain what is the expected value of SourceRange in case m_parentStyleSheet is null and hence lineEndings are not available? > Source/WebCore/inspector/front-end/CSSStyleModel.js:882 > + if (resource && resource.type === WebInspector.resourceTypes.Stylesheet) { Why is the resource type important here?
Vsevolod Vlasov
Comment 6 2013-02-28 01:45:16 PST
Comment on attachment 190212 [details] Patch r- per my comment about complexity of lineColumnFromOffset implementation.
Alexander Pavlov (apavlov)
Comment 7 2013-02-28 03:02:42 PST
Timothy Hatcher
Comment 8 2013-02-28 07:42:30 PST
Comment on attachment 190690 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190690&action=review > Source/WebCore/inspector/ContentSearchUtils.cpp:71 > +TextPosition lineColumnFromOffset(size_t offset, const Vector<size_t>& lineEndings) textPositionFromOffset?
Alexander Pavlov (apavlov)
Comment 9 2013-02-28 07:45:00 PST
Comment on attachment 190690 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190690&action=review >> Source/WebCore/inspector/ContentSearchUtils.cpp:71 >> +TextPosition lineColumnFromOffset(size_t offset, const Vector<size_t>& lineEndings) > > textPositionFromOffset? Makes sense, as long as it represents the line:column pair. Thanks.
Alexander Pavlov (apavlov)
Comment 10 2013-02-28 07:57:32 PST
Vsevolod Vlasov
Comment 11 2013-03-01 02:24:23 PST
Comment on attachment 190729 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190729&action=review > Source/WebCore/inspector/InspectorStyleSheet.cpp:64 > +#include <wtf/StdLibExtras.h> This include should go to ContentSearchUtils
Alexander Pavlov (apavlov)
Comment 12 2013-03-01 02:35:48 PST
Note You need to log in before you can comment on or make changes to this bug.