summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--dw/style.hh4
-rw-r--r--dw/textblock.cc13
-rw-r--r--src/cssparser.cc2
-rw-r--r--src/html.cc3
5 files changed, 15 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d2a22ec..724ff1c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@ dillo-2.2.1 [not released yet]
- Use the suffix/subdomain field in cookies.txt.
- Follow most specific matching rule in cookiesrc.
- Fix segfault with form inputs and repush for stylesheets.
+ - Handle white-space: pre-wrap.
Patches: corvid
-----------------------------------------------------------------------------
diff --git a/dw/style.hh b/dw/style.hh
index 700c56d3..50a2045a 100644
--- a/dw/style.hh
+++ b/dw/style.hh
@@ -304,7 +304,9 @@ enum TextDecoration {
enum WhiteSpace {
WHITE_SPACE_NORMAL,
WHITE_SPACE_PRE,
- WHITE_SPACE_NOWRAP
+ WHITE_SPACE_NOWRAP,
+ WHITE_SPACE_PRE_WRAP,
+ WHITE_SPACE_PRE_LINE,
};
/**
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 43326c26..82b335ae 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -238,11 +238,12 @@ void Textblock::getExtremesImpl (core::Extremes *extremes)
for (lineIndex = wrapRef; lineIndex < lines->size (); lineIndex++) {
//DBG_MSGF (widget, "extremes", 0, "line %d", lineIndex);
//DBG_MSG_START (widget);
+ core::style::WhiteSpace ws;
line = lines->getRef (lineIndex);
- nowrap =
- words->getRef(line->firstWord)->style->whiteSpace
- != core::style::WHITE_SPACE_NORMAL;
+ ws = words->getRef(line->firstWord)->style->whiteSpace;
+ nowrap = ws == core::style::WHITE_SPACE_PRE ||
+ ws == core::style::WHITE_SPACE_NOWRAP;
//DEBUG_MSG (DEBUG_SIZE_LEVEL, " line %d (of %d), nowrap = %d\n",
// lineIndex, page->num_lines, nowrap);
@@ -900,7 +901,8 @@ void Textblock::wordWrap(int wordIndex)
/* previous word is a break */
newLine = true;
newPar = true;
- } else if (word->style->whiteSpace != core::style::WHITE_SPACE_NORMAL) {
+ } else if (word->style->whiteSpace == core::style::WHITE_SPACE_NOWRAP ||
+ word->style->whiteSpace == core::style::WHITE_SPACE_PRE) {
//DBG_MSGF (page, "wrap", 0, "no wrap (white_space = %d)",
// word->style->white_space);
newLine = false;
@@ -986,7 +988,8 @@ void Textblock::wordWrap(int wordIndex)
lastLineParMin += wordExtremes.maxWidth; /* Why maxWidth? */
lastLineParMax += wordExtremes.maxWidth;
- if (word->style->whiteSpace != core::style::WHITE_SPACE_NORMAL) {
+ if (word->style->whiteSpace == core::style::WHITE_SPACE_NOWRAP ||
+ word->style->whiteSpace == core::style::WHITE_SPACE_PRE) {
lastLine->parMin += wordExtremes.minWidth + lastSpace;
/* This may also increase the accumulated minimum word width. */
lastLine->maxWordMin =
diff --git a/src/cssparser.cc b/src/cssparser.cc
index f1d8faef..332a989a 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -111,7 +111,7 @@ static const char *const Css_vertical_align_vals[] = {
};
static const char *const Css_white_space_vals[] = {
- "normal", "pre", "nowrap", NULL
+ "normal", "pre", "nowrap", "pre-wrap", "pre-line", NULL
};
const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = {
diff --git a/src/html.cc b/src/html.cc
index 4a7b50f3..1a5d8caf 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -3497,7 +3497,8 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize)
break;
if (S_TOP(html)->parse_mode != DILLO_HTML_PARSE_MODE_PRE &&
- html->styleEngine->style ()->whiteSpace == WHITE_SPACE_PRE) {
+ (html->styleEngine->style ()->whiteSpace == WHITE_SPACE_PRE ||
+ html->styleEngine->style ()->whiteSpace == WHITE_SPACE_PRE_WRAP)) {
S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_PRE;
html->pre_column = 0;
html->PreFirstChar = true;