[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: several fixes for DefaultStyledDocument
From: |
Anthony Balkissoon |
Subject: |
[cp-patches] Patch: several fixes for DefaultStyledDocument |
Date: |
Mon, 19 Dec 2005 17:54:30 -0500 |
This is the first part of the work I'm doing on DefaultStyledDocument.
This fixes a couple issues associated with PR 24744 but the bug is not
completely fixed yet, so the testcase for that PR still crashes. I will
continue to work on this but these changes are ready to go in and may
help get some text/html test apps up and running so I'm committing this
now.
2005-12-19 Anthony Balkissoon <address@hidden>
* javax/swing/text/DefaultStyledDocument.java:
(endOffset): New field.
(ElementBuffer.insert): If length is 0 return early. Set the endOffset
variable here.
(ElementBuffer.insertContentTag): Added special case for when insertion
covers entire range of the current Element. Replaced (offset + length)
with endOffset everywhere. Added checks to see if the insertion has
the same attributes as the surrounding Element(s), in which case we
don't split them, we join them.
(SectionElement.getName): Return the field SectionElementName instead
of hardcoding a return value.
(getLogicalStyle): As the specs require, if the attributes from the
resolve parent aren't of type Style, return null.
(setCharacterAttributes): Exit early if length is 0. Obtain a
write lock for the body of this method. Changed the way we iterate
through the paragraphs to be more efficient and more intuitive. Added
AttributeUndoableEdits to the DocumentEvent and fired the
UndoableEditUpdate.
(setLogicalStyle): Return early if the Element is null. Obtain a write
lock for the body of this method. Fire the appropriate DocumentEvent.
(setParagraphAttributes): Changed the way we iterated through the
paragraphs because it was incorrect and unintuitive. Obtained a write
lock within a try/finally block. Added AttributeUndoableEdits to the
DocumentEvent and fired the event.
(insertUpdate): Changed the way we iterate because we cannot assume
the Segment holds the characters starting from index 0. Give the
startTag the same attributes as the paragraph. Removed the useless
offset += len line because len is 0.
(printElements): New temporary debugging method.
(attributeSetsAreSame): New method.
--Tony
DefaultStyledDocumentFixes1.diff
Description: Text Data
- [cp-patches] Patch: several fixes for DefaultStyledDocument,
Anthony Balkissoon <=