This quote is from Chapter 20. The lines are spoken by Pearl, Hester's child. Pearl is speaking to her mother.
The meaning of the quote has to do with who she is talking about. When she says this, she is talking about Dimmesdale. She wonders why he acts so differently when he is with her and her mother than he does out in public. When they are alone, Dimmesdale acts lovingly towards her and talks to Hester, but when they are out in public he won't.
Of course, what's going on here is that Dimmesdale doesn't want to hang around with them in public because he doesn't want people to know he is Pearl's father.
Reverend Dimmsdale has gone to Hester and Pearl in the woods. He wants to get to know his daughter. Hester takes Pearl's hand and tells her that the Reverend wants to be a family with them. She asks Pearl if she will love him. Pearl is curious about the idea of having it be the three of them. She asks if Dimmsdale will go back with them at the present time. Hester explains that it will not happen yet. She tells her that he will teach Pearl many things and love her.
Pearl asks her mother:
"And will he always keep his hand over his heart"(181) Chapter; "The Child at Brookside."