From 5eae13db9c8ac12711dd5d7cb168295b46f9548b Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sat, 10 Apr 1999 04:21:33 +0000 Subject: [PATCH] Fix for bug #4833. Changed CreateGeneratedContentFrame() to make sure that 'position' is set to 'static' --- layout/base/nsCSSFrameConstructor.cpp | 16 ++++++++++++++-- layout/html/style/src/nsCSSFrameConstructor.cpp | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index c8b2d600524d..f3ed31b7ac7b 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -376,8 +376,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresContext* aPresContext if (NS_STYLE_DISPLAY_NONE != display->mDisplay) { // See if there was any content specified - const nsStyleContent* styleContent; - styleContent = (const nsStyleContent*)pseudoStyleContext->GetStyleData(eStyleStruct_Content); + const nsStyleContent* styleContent = + (const nsStyleContent*)pseudoStyleContext->GetStyleData(eStyleStruct_Content); PRUint32 contentCount = styleContent->ContentCount(); if (contentCount > 0) { @@ -411,6 +411,18 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresContext* aPresContext mutableDisplay->mDisplay = displayValue; } + // Also make sure the 'position' property is 'static'. :before and :after + // pseudo-elements can not be floated or positioned + const nsStylePosition * stylePosition = + (const nsStylePosition*)pseudoStyleContext->GetStyleData(eStyleStruct_Position); + if (NS_STYLE_POSITION_NORMAL != stylePosition->mPosition) { + // Reset the value + nsStylePosition* mutablePosition = (nsStylePosition*) + pseudoStyleContext->GetMutableStyleData(eStyleStruct_Position); + + mutablePosition->mPosition = NS_STYLE_POSITION_NORMAL; + } + // Create a block box or an inline box depending on the value of // the 'display' property nsIFrame* containerFrame; diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index c8b2d600524d..f3ed31b7ac7b 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -376,8 +376,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresContext* aPresContext if (NS_STYLE_DISPLAY_NONE != display->mDisplay) { // See if there was any content specified - const nsStyleContent* styleContent; - styleContent = (const nsStyleContent*)pseudoStyleContext->GetStyleData(eStyleStruct_Content); + const nsStyleContent* styleContent = + (const nsStyleContent*)pseudoStyleContext->GetStyleData(eStyleStruct_Content); PRUint32 contentCount = styleContent->ContentCount(); if (contentCount > 0) { @@ -411,6 +411,18 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresContext* aPresContext mutableDisplay->mDisplay = displayValue; } + // Also make sure the 'position' property is 'static'. :before and :after + // pseudo-elements can not be floated or positioned + const nsStylePosition * stylePosition = + (const nsStylePosition*)pseudoStyleContext->GetStyleData(eStyleStruct_Position); + if (NS_STYLE_POSITION_NORMAL != stylePosition->mPosition) { + // Reset the value + nsStylePosition* mutablePosition = (nsStylePosition*) + pseudoStyleContext->GetMutableStyleData(eStyleStruct_Position); + + mutablePosition->mPosition = NS_STYLE_POSITION_NORMAL; + } + // Create a block box or an inline box depending on the value of // the 'display' property nsIFrame* containerFrame;