Bug 1398581: Ensure a first-letter doesn't incorrectly inherit from a first-line. r=heycam
This approach kinda sucks, because we woefully throw away the style context computed in the case it inherited from a first-line, but it's the easiest thing I could think of without either making it more inefficient, or threading a parent style ignoring first-line through ResolvePseudoElementStyle and related functions. MozReview-Commit-ID: 3uGuU7dHEnE
This commit is contained in:
@@ -11861,10 +11861,11 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
|
||||
|
||||
// Get style context for the first-letter-frame. Keep this in sync with
|
||||
// nsBlockFrame::UpdatePseudoElementStyles.
|
||||
nsStyleContext* parentStyleContext =
|
||||
nsIFrame* parentFrame =
|
||||
nsFrame::CorrectStyleParentFrame(aParentFrame,
|
||||
nsCSSPseudoElements::firstLetter)->
|
||||
StyleContext();
|
||||
nsCSSPseudoElements::firstLetter);
|
||||
|
||||
nsStyleContext* parentStyleContext = parentFrame->StyleContext();
|
||||
|
||||
// Use content from containing block so that we can actually
|
||||
// find a matching style rule.
|
||||
@@ -11873,7 +11874,20 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
|
||||
// Create first-letter style rule
|
||||
RefPtr<nsStyleContext> sc =
|
||||
GetFirstLetterStyle(blockContent, parentStyleContext);
|
||||
|
||||
if (sc) {
|
||||
if (sc->IsServo() && parentFrame->IsLineFrame()) {
|
||||
ServoStyleContext* parentStyleIgnoringFirstLine =
|
||||
aBlockFrame->StyleContext()->AsServo();
|
||||
sc =
|
||||
mPresShell->StyleSet()->AsServo()->ReparentStyleContext(
|
||||
sc->AsServo(),
|
||||
parentStyleContext->AsServo(),
|
||||
parentStyleIgnoringFirstLine,
|
||||
parentStyleIgnoringFirstLine,
|
||||
blockContent->AsElement());
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> textSC = mPresShell->StyleSet()->
|
||||
ResolveStyleForText(aTextContent, sc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user