-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Split DOM into two classes: Document and DOM #237
Conversation
private ArrayListAccumulator<Object> mCachedChildrenAccumulator; | ||
|
||
public Document(DOMProvider.Factory factory) { | ||
this.mFactory = factory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: drop this.
Document doc = new Document(new AndroidDOMProviderFactory((Application)context.getApplicationContext())); | ||
|
||
modules.add(new DOM(doc)); | ||
modules.add(new CSS(doc)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it so that the CSS module also requires the same minimum API level as DOM. @jasta should comment on this too.
@@ -226,18 +190,12 @@ public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject pa | |||
params, | |||
PerformSearchRequest.class); | |||
|
|||
final Pattern queryPattern = Pattern.compile(Pattern.quote(request.query), Pattern.CASE_INSENSITIVE); | |||
final ArrayListAccumulator<Integer> results = new ArrayListAccumulator<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's an opportunity to increase clarity here ... what do the integers inside of results
represent? Are they node IDs? If so, calling this nodeIdResults
might help to illuminate this fact.
Okay there's another round of feedback. This is shaping up well, despite how confusing it all is :) |
|
||
public class AndroidDOMProviderFactory implements DOMProvider.Factory { | ||
public final class AndroidDOMProviderFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename class to AndroidDocumentProviderFactory
Looks like we're almost done here. You have some conflicts to resolve, then need to squash, and then I think we can merge! |
DOM now handles only the communication between Chrome and Stetho, whereas Document is responsible for accessing, modifying, and maintaining information about elements on the Android side. The motivation for this change is that DOM is not the only class that needs access to information about elements - CSS also needs this information. By splitting these classes up it is possible for both DOM and CSS to be able to get and set element data.
Split DOM into two classes: Document and DOM
DOM now handles only the communication between Chrome and Stetho, whereas Document is responsible for accessing, modifying, and maintaining information about elements on the Android side. The motivation for this change is that DOM is not the only class that needs access to information about elements - CSS also needs this information. By splitting these classes up it is possible for both DOM and CSS to be able to get and set element data.