From edc11e5ad3a4a237877a1086a9d71b420ebe6816 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Thu, 11 Oct 2001 00:15:09 +0000 Subject: [PATCH] Fix 'text-decoration: blink' and the blink element. Patch from Chase Tingley . r=dbaron sr=hyatt b=89065 --- layout/base/public/nsHTMLReflowState.h | 3 +++ layout/generic/nsHTMLReflowState.cpp | 8 ++++++++ layout/generic/nsHTMLReflowState.h | 3 +++ layout/generic/nsTextFrame.cpp | 2 +- layout/html/base/src/nsHTMLReflowState.cpp | 8 ++++++++ layout/html/base/src/nsTextFrame.cpp | 2 +- 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/layout/base/public/nsHTMLReflowState.h b/layout/base/public/nsHTMLReflowState.h index 59848c9c6834..023c06a5830d 100644 --- a/layout/base/public/nsHTMLReflowState.h +++ b/layout/base/public/nsHTMLReflowState.h @@ -226,6 +226,9 @@ struct nsHTMLReflowState { // set it. if false, the reflow sets alignCharOffset PRPackedBool mUseAlignCharOffset; + // Keep track of text-decoration: blink + PRPackedBool mBlinks; + // Cached pointers to the various style structs used during intialization const nsStyleDisplay* mStyleDisplay; const nsStyleVisibility* mStyleVisibility; diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 1eb7e57741be..8c48f217d946 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -1831,6 +1831,14 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, aContainingBlockHeight); } } + /* Check for blinking text. */ + mBlinks = (parentReflowState && parentReflowState->mBlinks); + if (!mBlinks) { + const nsStyleTextReset* st; + frame->GetStyleData(eStyleStruct_TextReset, + (const nsStyleStruct*&)st); + mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); + } } // Compute the box data for block and block-replaced elements in the diff --git a/layout/generic/nsHTMLReflowState.h b/layout/generic/nsHTMLReflowState.h index 59848c9c6834..023c06a5830d 100644 --- a/layout/generic/nsHTMLReflowState.h +++ b/layout/generic/nsHTMLReflowState.h @@ -226,6 +226,9 @@ struct nsHTMLReflowState { // set it. if false, the reflow sets alignCharOffset PRPackedBool mUseAlignCharOffset; + // Keep track of text-decoration: blink + PRPackedBool mBlinks; + // Cached pointers to the various style structs used during intialization const nsStyleDisplay* mStyleDisplay; const nsStyleVisibility* mStyleVisibility; diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index f17b5680df5d..8fd568a3e9cc 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -5011,7 +5011,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // the TEXT_BLINK_ON bit). PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS); mState &= ~TEXT_REFLOW_FLAGS; - if (ts.mFont->mFont.decorations & NS_STYLE_TEXT_DECORATION_BLINK) { + if (aReflowState.mBlinks) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; nsBlinkTimer::AddBlinkFrame(aPresContext, this); diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp index 1eb7e57741be..8c48f217d946 100644 --- a/layout/html/base/src/nsHTMLReflowState.cpp +++ b/layout/html/base/src/nsHTMLReflowState.cpp @@ -1831,6 +1831,14 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, aContainingBlockHeight); } } + /* Check for blinking text. */ + mBlinks = (parentReflowState && parentReflowState->mBlinks); + if (!mBlinks) { + const nsStyleTextReset* st; + frame->GetStyleData(eStyleStruct_TextReset, + (const nsStyleStruct*&)st); + mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK); + } } // Compute the box data for block and block-replaced elements in the diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index f17b5680df5d..8fd568a3e9cc 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -5011,7 +5011,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // the TEXT_BLINK_ON bit). PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS); mState &= ~TEXT_REFLOW_FLAGS; - if (ts.mFont->mFont.decorations & NS_STYLE_TEXT_DECORATION_BLINK) { + if (aReflowState.mBlinks) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; nsBlinkTimer::AddBlinkFrame(aPresContext, this);