Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring - remove duplicated code in TextLayerBuilder #4618

Merged
merged 1 commit into from
Apr 14, 2014

Conversation

Schibum
Copy link
Contributor

@Schibum Schibum commented Apr 14, 2014

beginText() and appendText() in TextLayerBuilder.renderMatches() are identical except for adding an additional css class 'selected', which is superfluous anyway (callers that supply className already do that).

@yurydelendik
Copy link
Contributor

which is superfluous anyway (callers that supply className already do that)

Not sure what do you mean by that. As I can see span.className = className; is not equal to span.className = className + (isSelected ? ' selected' : '');. Let us check that:

/botio-windows preview

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/491931bb219929a/output.txt

@yurydelendik
Copy link
Contributor

return;
}
div.appendChild(node);
appendText({offset: 0, divIdx: divIdx}, begin, className);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, new object creation... could you switch offset and divIdx places to have the same shape, i.e. {divIdx: divIdx, offset: 0}?

@Schibum
Copy link
Contributor Author

Schibum commented Apr 14, 2014

What I meant is, that beginText() is only called in line 317 with a second argument, that already contains the selected class name, if needed.

I've removed the new object creation (a20896f) or swapped the properties (b4cdd4d). Let me know what you prefer ;)

@yurydelendik
Copy link
Contributor

No preference

@Schibum
Copy link
Contributor Author

Schibum commented Apr 14, 2014

squashed commits

@yurydelendik
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/6a72df6a44b1773/output.txt

@yurydelendik
Copy link
Contributor

Really good. Thanks

yurydelendik added a commit that referenced this pull request Apr 14, 2014
Refactoring - remove duplicated code in TextLayerBuilder
@yurydelendik yurydelendik merged commit 97b007e into mozilla:master Apr 14, 2014
@Schibum Schibum deleted the text_layer_cleanup branch April 14, 2014 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants