Fix for 5.0 SF1in bug #300809: Composer adds and deletes tags; bad image

display; HTML does not validate
There are actually 3 different bugs reported in 300809. This checkin fixes
the problem where the spacing and the image are too close: <P></P><BR><IMG>

edtbuf.cpp:
    - Modified CEditBuffer::ParseOpenTag() so we don't discard a <BR> that
      comes after a </P>.
    - Commented out code that adds a blank container before a table that
      follows a </P>.

edtele.cpp:
    - Modified CEditContainerElement::AdjustContainers() to add a blank
      container after a paragraph that ends with a </P> tag.
This commit is contained in:
kin%netscape.com 1998-07-16 21:56:54 +00:00
Родитель 15d22d92ca
Коммит 0b6a300c6b
2 изменённых файлов: 54 добавлений и 5 удалений

Просмотреть файл

@ -1166,7 +1166,7 @@ intn CEditBuffer::ParseOpenTag(pa_DocData *pData, PA_Tag* pTag, intn status){
case P_LINEBREAK:
{
// Ignore <BR> after </LI>.
if ( m_bLastTagIsEnd && BitSet( edt_setIgnoreBreakAfterClose, m_iLastTagType ) ) {
if ( m_bLastTagIsEnd && BitSet( edt_setIgnoreBreakAfterClose, m_iLastTagType ) && m_iLastTagType != P_PARAGRAPH) {
}
else {
pElement = new CEditBreakElement(m_pCreationCursor, pTag);
@ -1231,6 +1231,12 @@ intn CEditBuffer::ParseOpenTag(pa_DocData *pData, PA_Tag* pTag, intn status){
}
/* Don't add extra breaks here. We now add extra breaks after a </P> in
* CEditContainerElement::AdjustContainers().
*
* - kin
*/
#if 0
// A table following a </P> should have an extra break before the table. Add a NSDT.
CEditElement *pPrev = m_pCreationCursor->GetLastChild();
if (pPrev && pPrev->IsContainer()) {
@ -1243,6 +1249,7 @@ intn CEditBuffer::ParseOpenTag(pa_DocData *pData, PA_Tag* pTag, intn status){
(void) new CEditTextElement(pNew, 0);
}
}
#endif
m_pCreationCursor = pElement = new CEditTableElement( m_pCreationCursor, pTag, GetRAMCharSetID(), GetCurrentAlignment() );

Просмотреть файл

@ -6558,6 +6558,10 @@ void CEditContainerElement::AdjustContainers( CEditBuffer *pBuffer ){
|| (pBuffer->IsComposeWindow()
&& GetType() == P_PREFORMAT
&& m_hackPreformat ) ){
XP_Bool bInsertNewContainer = FALSE;
XP_Bool bIsParagraph = GetType() == P_PARAGRAPH;
//
// Convert to internal paragraph type
//
@ -6570,9 +6574,47 @@ void CEditContainerElement::AdjustContainers( CEditBuffer *pBuffer ){
//
if ( pPreviousSibling && pPreviousSibling->IsContainer() )
pPrev = (CEditContainerElement*) pPreviousSibling;
if ( pNext && !pNext->IsContainer() ) pNext = 0;
if ( !pNext || !CompareAlignments(GetAlignment(), pNext->GetAlignment())){
if (!pNext)
bInsertNewContainer = TRUE;
else if (pNext->IsContainer())
{
//
// If the alignments of this container and the next one
// don't match, add a blank container after this container.
//
// - Or -
//
// If this paragraph has an end tag, and the next container
// is an NSDT, add a blank container after this paragraph.
//
// This will allow us to handle cases like:
//
// <P></P><BR>
// <P></P>text
// <P></P><IMG>
//
if (!CompareAlignments(GetAlignment(), pNext->GetAlignment()) ||
(bIsParagraph && m_bHasEndTag && pNext->GetType() == P_NSDT))
bInsertNewContainer = TRUE;
}
else if (bIsParagraph &&
((!IsListContainer(pNext->GetType()) && !pNext->IsTable()) ||
(m_bHasEndTag && pNext->IsTable())))
{
//
// Dont' add a blank container between a paragraph and
// a list ... layout does that for us for free.
//
// If the paragraph is followed by a table, add a blank
// container only if the paragraph has a </P> tag.
//
bInsertNewContainer = TRUE;
}
if ( bInsertNewContainer ){
CEditContainerElement *pNew;
pNew = CEditContainerElement::NewDefaultContainer( 0,
GetAlignment() );
@ -6581,7 +6623,7 @@ void CEditContainerElement::AdjustContainers( CEditBuffer *pBuffer ){
(void) new CEditBreakElement(pNew, 0);
pNew->InsertAfter( this );
}
//
// If there is a previous container, append an empty single spaced
// paragraph before this one. also append an empty single spaced paragraph if it was a table.