Skip to content

Commit

Permalink
Make odf.Formatting's buildStyleChain() not ignore root containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Friedrich W. H. Kossebau committed Apr 2, 2015
1 parent e9b41aa commit be0969b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Fix breaking all empty annotations on merging the paragraph they are contained in with the one before ([#877](https://github.com/kogmbh/WebODF/pull/877)))
* Fix error message popup on deleting an annotation starting at the end of a paragraph or styled range ([#880](https://github.com/kogmbh/WebODF/pull/880)))
* Fix wrong style information for text in annotations ([#881](https://github.com/kogmbh/WebODF/pull/881)))

### Improvements

Expand Down
3 changes: 2 additions & 1 deletion webodf/lib/odf/Formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ odf.Formatting = function Formatting() {
/**@type{string}*/
chainKey = '',
foundContainer = false;
while (parent) {

while (parent && (!odfUtils.isInlineRoot(parent)) && (parent.parentNode !== odfContainer.rootElement)) {
if (!foundContainer && odfUtils.isGroupingElement(parent)) {
foundContainer = true;
}
Expand Down
19 changes: 19 additions & 0 deletions webodf/tests/gui/DirectFormattingControllerTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ gui.DirectFormattingControllerTests = function DirectFormattingControllerTests(r
r.shouldBe(t, "t.isBold", "false");
}

function getSelectionInfo_ReportedStyleSummaryStaysInAnnotationScope() {
createOdtDocument(
"<style:style style:name='simple' style:family='paragraph'>" +
"<style:text-properties fo:font-weight='bold'/>" +
"</style:style>",
"<text:p text:style-name='simple'><office:annotation office:name=\"alice_1\">" +
"<text:list><text:list-item><text:p>[]</text:p></text:list-item></text:list>" +
"</office:annotation></text:p>");

t.isBold = t.formattingController.isBold();
r.shouldBe(t, "t.isBold", "false");

t.formattingController.setBold(true);
t.isBold = t.formattingController.isBold();

r.shouldBe(t, "t.isBold", "true");
}

function createCursorStyleOp_UseCachedStyle_ReturnsSetOpForCachedStyle() {
createOdtDocument(
"<style:style style:name='simple' style:family='paragraph'>" +
Expand Down Expand Up @@ -282,6 +300,7 @@ gui.DirectFormattingControllerTests = function DirectFormattingControllerTests(r
this.tests = function () {
return r.name([
getSelectionInfo_ReportedStyleSummaryIncludesCursorStyling,
getSelectionInfo_ReportedStyleSummaryStaysInAnnotationScope,
createCursorStyleOp_UseCachedStyle_ReturnsSetOpForCachedStyle,
createParagraphStyleOp_OnLastStepInParagraph_CreatesParagraphStyleForNewParagraph,
createParagraphStyleOp_NoSelectedText_ReturnsEmptyArray,
Expand Down
1 change: 0 additions & 1 deletion webodf/tests/odf/FormattingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ odf.FormattingTests = function FormattingTests(runner) {
"dr3d:scene",
"text:note-body",
"text:ruby-text",
"office:annotation",
"office:binary-data",
"office:event-listeners",
"editinfo"
Expand Down

0 comments on commit be0969b

Please sign in to comment.