mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
Merge pull request #484 from duanyao/workaround_spaces_webkit
Workaround spaces issues of blink/webkit
This commit is contained in:
commit
88e5fade10
@ -161,15 +161,21 @@
|
|||||||
/* Workaround for https://bugs.webkit.org/show_bug.cgi?id=35443 */
|
/* Workaround for https://bugs.webkit.org/show_bug.cgi?id=35443 */
|
||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
.@CSS_LINE_CN@:before {
|
||||||
|
/* Workaround Blink(up to 41)/Webkit bug of word-spacing with leading spaces (chromium #404444 and pdf2htmlEX #412) */
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
.@CSS_LINE_CN@ span { /* text blocks within a line */
|
.@CSS_LINE_CN@ span { /* text blocks within a line */
|
||||||
|
/* Blink(up to 41)/Webkit have bug with negative word-spacing and inline-block (pdf2htmlEX #416), so keep normal span inline. */
|
||||||
position:relative;
|
position:relative;
|
||||||
/* _<id> for spaces may need display:inline, which will override this */
|
|
||||||
display:inline-block;
|
|
||||||
unicode-bidi:bidi-override; /* For rtl languages, e.g. Hebrew, we don't want the default Unicode behaviour */
|
unicode-bidi:bidi-override; /* For rtl languages, e.g. Hebrew, we don't want the default Unicode behaviour */
|
||||||
}
|
}
|
||||||
.@CSS_WHITESPACE_CN@ { /* text shift */
|
.@CSS_WHITESPACE_CN@ { /* text shift */
|
||||||
color:transparent;
|
/* Blink(up to 41)/Webkit have bug with inline element, continuous spaces and word-spacing. Workaround by inline-block. */
|
||||||
z-index:-1;
|
display: inline-block;
|
||||||
|
color: transparent;
|
||||||
|
z-index: -1;
|
||||||
}
|
}
|
||||||
/* selection background should not be opaque, for fallback mode */
|
/* selection background should not be opaque, for fallback mode */
|
||||||
::selection{
|
::selection{
|
||||||
|
@ -247,11 +247,7 @@ void HTMLTextLine::dump_text(ostream & out)
|
|||||||
if(!(state_iter1->hash_umask & State::umask_by_id(State::WORD_SPACE_ID)))
|
if(!(state_iter1->hash_umask & State::umask_by_id(State::WORD_SPACE_ID)))
|
||||||
{
|
{
|
||||||
double space_off = state_iter1->single_space_offset();
|
double space_off = state_iter1->single_space_offset();
|
||||||
if((std::abs(target - space_off) <= param.h_eps)
|
if(std::abs(target - space_off) <= param.h_eps)
|
||||||
// Chrome/webkit don't apply CSS word-spacing to leading spaces, so we don't
|
|
||||||
// convert leading offsets to spaces. See also issue #412 and chromium issue #404444.
|
|
||||||
// TODO after browsers having this bug have vanished, just remove the line below.
|
|
||||||
&& ((state_iter1->word_space == 0) || (cur_offset_iter->start_idx != 0)))
|
|
||||||
{
|
{
|
||||||
Unicode u = ' ';
|
Unicode u = ' ';
|
||||||
writeUnicodes(out, &u, 1);
|
writeUnicodes(out, &u, 1);
|
||||||
|
@ -245,15 +245,15 @@ public:
|
|||||||
static const char * get_css_class_name (void) { return CSS::WHITESPACE_CN; }
|
static const char * get_css_class_name (void) { return CSS::WHITESPACE_CN; }
|
||||||
double default_value(void) { return 0; }
|
double default_value(void) { return 0; }
|
||||||
void dump_value(std::ostream & out, double value) {
|
void dump_value(std::ostream & out, double value) {
|
||||||
out << ((value > 0) ? "display:inline-block;width:"
|
out << ((value > 0) ? "width:"
|
||||||
: "display:inline;margin-left:")
|
: "margin-left:")
|
||||||
<< round(value) << "px;";
|
<< round(value) << "px;";
|
||||||
}
|
}
|
||||||
void dump_print_value(std::ostream & out, double value, double scale)
|
void dump_print_value(std::ostream & out, double value, double scale)
|
||||||
{
|
{
|
||||||
value *= scale;
|
value *= scale;
|
||||||
out << ((value > 0) ? "display:inline-block;width:"
|
out << ((value > 0) ? "width:"
|
||||||
: "display:inline;margin-left:")
|
: "margin-left:")
|
||||||
<< round(value) << "pt;";
|
<< round(value) << "pt;";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user