Fixed: make travis happy with DOM elements in CPTextView

This commit is contained in:
Alexandre Wilhelm committed 2015-05-04 14:03:33 -07:00
1 parent a884b94ac0
commit 4ebcf40619
2 files changed
+13 -5

No files matched your search

+3 -1
View File
@@ -285,10 +285,12 @@ _oncontextmenuhandler = function () { return false; };
// We erased all lines
if (!startIndex)
[self setExtraLineFragmentRect:CGRectMake(0, 0) usedRect:CGRectMake(0, 0) textContainer:nil];
// document.title=startIndex;
[_typesetter layoutGlyphsInLayoutManager:self startingAtGlyphIndex:startIndex maxNumberOfLineFragments:-1 nextGlyphIndex:nil];
#if PLATFORM(DOM)
[self _cleanUpDOM];
#endif
_isValidatingLayoutAndGlyphs = NO;
}
+10 -4
View File
@@ -345,8 +345,15 @@ var CPSystemTypesetterFactory;
lineRange.length++;
measuringRange.length++;
var currentChar = theString[glyphIndex], // use pure javascript methods for performance reasons
rangeWidth = _widthOfStringForFont(theString.substr(measuringRange.location, measuringRange.length), _currentFont).width + currentAnchor;
var currentChar = theString[glyphIndex];
#if PLATFORM(DOM)
// use pure javascript methods for performance reasons -> why don't we use sizeWithFont ?
var rangeWidth = _widthOfStringForFont(theString.substr(measuringRange.location, measuringRange.length), _currentFont).width + currentAnchor;
#else
var rangeWidth = [theString.substr(measuringRange.location, measuringRange.length) sizeWithFont:_currentFont].width + currentAnchor;
#endif
switch (currentChar) // faster than sending actionForControlCharacterAtIndex: called for each char.
{
@@ -365,11 +372,10 @@ var CPSystemTypesetterFactory;
wrapRange = CPMakeRangeCopy(lineRange);
wrapWidth = rangeWidth;
break;
default:
if (_isNewlineCharacter(currentChar))
{
isNewline = YES;
}
}
advancements.push(rangeWidth - prevRangeWidth);