+2010-06-21 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added tests for the 'hyphens' and 'hyphenate-character' properties
+ https://bugs.webkit.org/show_bug.cgi?id=10228
+
+ * fast/text/hyphenate-character.html: Added.
+ * fast/text/hyphens.html: Added.
+ * platform/gtk/Skipped:
+ * platform/mac/fast/text/hyphenate-character-expected.checksum: Added.
+ * platform/mac/fast/text/hyphenate-character-expected.png: Added.
+ * platform/mac/fast/text/hyphenate-character-expected.txt: Added.
+ * platform/mac/fast/text/hyphens-expected.checksum: Added.
+ * platform/mac/fast/text/hyphens-expected.png: Added.
+ * platform/mac/fast/text/hyphens-expected.txt: Added.
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+
2010-06-21 Dumitru Daniliuc <dumi@chromium.org>
Unreviewed, fixing expectations.
--- /dev/null
+<style>
+ .text-box {
+ border: solid;
+ padding: 4px;
+ width: 330px;
+ font-size: 18px;
+ text-align: justify;
+ -webkit-hyphens: auto;
+ }
+
+ .float {
+ width: 75px;
+ height: 5em;
+ background-color: aliceblue;
+ float: right;
+ margin-left: 10px;
+ }
+
+ .hyphenate-character-auto {
+ -webkit-hyphenate-character: auto;
+ }
+
+ .hyphenate-character-bullet {
+ -webkit-hyphenate-character: "\2022";
+ }
+
+ .hyphenate-character-tilde-dot {
+ -webkit-hyphenate-character: "\B7~";
+ }
+
+ .test {
+ float: left;
+ margin: 0 4px;
+ }
+</style>
+<div class="test">
+ <p>The initial value (should be like <tt>auto</tt>)</p>
+ <div class="text-box">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p>The default (<tt>hyphenate-character: auto</tt>)</p>
+ <div class="text-box hyphenate-character-auto">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p>Bullet (<tt>hyphenate-character: "\2022"</tt>)</p>
+ <div class="text-box hyphenate-character-bullet">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p>Middle dot and tilde (<tt>hyphenate-character: "\B7~"</tt>)</p>
+ <div class="text-box hyphenate-character-tilde-dot">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
--- /dev/null
+<style>
+ .text-box {
+ border: solid;
+ padding: 4px;
+ width: 330px;
+ font-size: 18px;
+ text-align: justify;
+ }
+
+ .float {
+ width: 75px;
+ height: 5em;
+ background-color: aliceblue;
+ float: right;
+ margin-left: 10px;
+ }
+
+ .hyphens-auto {
+ -webkit-hyphens: auto;
+ }
+
+ .hyphens-none {
+ -webkit-hyphens: none;
+ }
+
+ .test {
+ float: left;
+ margin: 0 4px;
+ }
+</style>
+<div class="test">
+ <p><tt>hyphens: manual</tt> without soft hyphens</p>
+ <div class="text-box">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p><tt>hyphens: none</tt> with soft hyphens</p>
+ <div class="text-box hyphens-none">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in get­ting its body tucked away, com­fortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straight­ened
+ out, and was going to give the hedge­hog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p><tt>hyphens: manual</tt> with soft hyphens</p>
+ <div class="text-box">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in get­ting its body tucked away,
+ com­fortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straight­ened
+ out, and was going to give the hedge­hog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
+<div class="test">
+ <p><tt>hyphens: auto</tt> without soft hyphens</p>
+ <div class="text-box hyphens-auto">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened
+ out, and was going to give the hedgehog a blow with its head, it
+ would twist itself round and look up in her face…
+ </div>
+</div>
fast/text/firstline/001.html
fast/text/firstline/002.html
fast/text/firstline/003.html
+# Hyphenation is not implemented yet.
+fast/text/hyphenate-character.html
+fast/text/hyphens.html
+
fast/text/international/001.html
fast/text/international/002.html
fast/text/international/003.html
--- /dev/null
+1f42877e5a7db832962fe26284932bc5
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (floating) {DIV} at (4,0) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 203x18
+ text run at (0,0) width 203: "The initial value (should be like "
+ RenderInline {TT} at (0,0) size 32x15
+ RenderText {#text} at (203,2) size 32x15
+ text run at (203,2) width 32: "auto"
+ RenderText {#text} at (235,0) size 5x18
+ text run at (235,0) width 5: ")"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (215,73) width 37: "com"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight"
+ text run at (7,161) width 41: "ened "
+ text run at (48,161) width 289: "out, and was going to give the hedge"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (356,0) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 81x18
+ text run at (0,0) width 81: "The default ("
+ RenderInline {TT} at (0,0) size 200x15
+ RenderText {#text} at (81,2) size 200x15
+ text run at (81,2) width 200: "hyphenate-character: auto"
+ RenderText {#text} at (281,0) size 5x18
+ text run at (281,0) width 5: ")"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (215,73) width 37: "com"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight"
+ text run at (7,161) width 41: "ened "
+ text run at (48,161) width 289: "out, and was going to give the hedge"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (4,284) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 47x18
+ text run at (0,0) width 47: "Bullet ("
+ RenderInline {TT} at (0,0) size 224x15
+ RenderText {#text} at (47,2) size 224x15
+ text run at (47,2) width 224: "hyphenate-character: \"\\2022\""
+ RenderText {#text} at (271,0) size 5x18
+ text run at (271,0) width 5: ")"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (215,73) width 37: "com"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight"
+ text run at (7,161) width 41: "ened "
+ text run at (48,161) width 289: "out, and was going to give the hedge"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (356,284) size 357x284
+ RenderBlock {P} at (0,16) size 357x18
+ RenderText {#text} at (0,0) size 136x18
+ text run at (0,0) width 136: "Middle dot and tilde ("
+ RenderInline {TT} at (0,0) size 216x15
+ RenderText {#text} at (136,2) size 216x15
+ text run at (136,2) width 216: "hyphenate-character: \"\\B7~\""
+ RenderText {#text} at (352,0) size 5x18
+ text run at (352,0) width 5: ")"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get"
+ text run at (7,73) width 199: "ting its body tucked away, "
+ text run at (206,73) width 46: "com"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight"
+ text run at (7,161) width 40: "ened "
+ text run at (47,161) width 290: "out, and was going to give the hedge"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
--- /dev/null
+11c391edd6a7a515f6a962cc28f41d38
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (floating) {DIV} at (4,0) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderInline {TT} at (0,0) size 120x15
+ RenderText {#text} at (0,2) size 120x15
+ text run at (0,2) width 120: "hyphens: manual"
+ RenderText {#text} at (120,0) size 136x18
+ text run at (120,0) width 136: " without soft hyphens"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in"
+ text run at (7,73) width 245: "getting its body tucked away,"
+ text run at (7,95) width 245: "comfortably enough, under her"
+ text run at (7,117) width 307: "arm, with its legs hanging down, "
+ text run at (314,117) width 23: "but"
+ text run at (7,139) width 330: "generally, just as she had got its neck nicely"
+ text run at (7,161) width 95: "straightened "
+ text run at (102,161) width 235: "out, and was going to give the"
+ text run at (7,183) width 285: "hedgehog a blow with its head, it "
+ text run at (292,183) width 45: "would"
+ text run at (7,205) width 314: "twist itself round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (356,0) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderInline {TT} at (0,0) size 104x15
+ RenderText {#text} at (0,2) size 104x15
+ text run at (0,2) width 104: "hyphens: none"
+ RenderText {#text} at (104,0) size 116x18
+ text run at (104,0) width 116: " with soft hyphens"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in"
+ text run at (7,73) width 22: "get"
+ text run at (29,73) width 223: "ting its body tucked away,"
+ text run at (7,95) width 31: "com"
+ text run at (38,95) width 214: "fortably enough, under her"
+ text run at (7,117) width 307: "arm, with its legs hanging down, "
+ text run at (314,117) width 23: "but"
+ text run at (7,139) width 330: "generally, just as she had got its neck nicely"
+ text run at (7,161) width 54: "straight"
+ text run at (61,161) width 41: "ened "
+ text run at (102,161) width 235: "out, and was going to give the"
+ text run at (7,183) width 43: "hedge"
+ text run at (50,183) width 242: "hog a blow with its head, it "
+ text run at (292,183) width 45: "would"
+ text run at (7,205) width 314: "twist itself round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (4,284) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderInline {TT} at (0,0) size 120x15
+ RenderText {#text} at (0,2) size 120x15
+ text run at (0,2) width 120: "hyphens: manual"
+ RenderText {#text} at (120,0) size 116x18
+ text run at (120,0) width 116: " with soft hyphens"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get\x{AD}"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (215,73) width 37: "com\x{AD}"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight\x{AD}"
+ text run at (7,161) width 41: "ened "
+ text run at (48,161) width 289: "out, and was going to give the hedge\x{AD}"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
+ RenderBlock (floating) {DIV} at (356,284) size 344x284
+ RenderBlock {P} at (0,16) size 344x18
+ RenderInline {TT} at (0,0) size 104x15
+ RenderText {#text} at (0,2) size 104x15
+ text run at (0,2) width 104: "hyphens: auto"
+ RenderText {#text} at (104,0) size 136x18
+ text run at (104,0) width 136: " without soft hyphens"
+ RenderBlock {DIV} at (0,50) size 344x234 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x220
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (215,73) width 37: "com"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 226: "with its legs hanging down, "
+ text run at (233,117) width 104: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely straight"
+ text run at (7,161) width 41: "ened "
+ text run at (48,161) width 289: "out, and was going to give the hedge"
+ text run at (7,183) width 204: "hog a blow with its head, it "
+ text run at (211,183) width 126: "would twist itself"
+ text run at (7,205) width 233: "round and look up in her face\x{2026}"
fast/loader/subframe-navigate-during-main-frame-load.html
+# Hyphenation is not implemented yet.
+fast/text/hyphenate-character.html
+fast/text/hyphens.html
# =========================================================================== #
# Failing HTTP tests. #
# LayoutTestController::pageProperty is not implemented for WIN yet.
printing/page-rule-selection.html
+
+# Hyphenation is not implemented yet.
+fast/text/hyphenate-character.html
+fast/text/hyphens.html
\
platform/text/Base64.cpp \
platform/text/BidiContext.cpp \
+ platform/text/Hyphenation.cpp \
platform/text/RegularExpression.cpp \
platform/text/SegmentedString.cpp \
platform/text/String.cpp \
platform/text/Base64.cpp
platform/text/BidiContext.cpp
+ platform/text/Hyphenation.cpp
platform/text/RegularExpression.cpp
platform/text/SegmentedString.cpp
platform/text/String.cpp
+2010-06-21 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ CSS3: Implement the 'hyphens' and 'hyphenate-character' properties
+ https://bugs.webkit.org/show_bug.cgi?id=10228
+
+ Tests: fast/text/hyphenate-character.html
+ fast/text/hyphens.html
+
+ Added -webkit-hyphens and -webkit-hyphenate-character as specified in
+ <http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#hyphenation>.
+
+ * Android.mk: Added Hyphenation.cpp.
+ * CMakeLists.txt: Ditto.
+ * GNUmakefile.am: Added Hyphenation.{cpp,h}.
+ * WebCore.base.exp: Exported wkGetHyphenationLocationBeforeIndex().
+ * WebCore.gypi: Added Hyphenation.{cpp,h}.
+ * WebCore.pro: Added Hyphenation.{cpp,h}.
+ * WebCore.vcproj/WebCore.vcproj: Added Hyphenation.{cpp,h}.
+ * WebCore.xcodeproj/project.pbxproj: Added Hyphenation.{cpp,h}.
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added the -webkit-hyphenate-character
+ and -webkit-hyphens cases.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue): Validate values for the new properties.
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added. Maps from a Hyphens value to an identifier.
+ (WebCore::CSSPrimitiveValue::operator Hyphens): Added. Maps from an identifier to a Hyphens value.
+ * css/CSSPropertyNames.in: Added -webkit-hyphenate-character and -webkit-hyphens.
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty): Apply the new properties to the RenderStyle.
+ * css/CSSValueKeywords.in:
+ * platform/mac/WebCoreSystemInterface.h: Added wkGetHyphenationLocationBeforeIndex.
+ * platform/mac/WebCoreSystemInterface.mm: Ditto.
+ * platform/text/CharacterNames.h: Added the hyphen character.
+ * platform/text/Hyphenation.cpp: Added.
+ (WebCore::lastHyphenLocation): Added this default implementation for platforms that do not implement
+ hyphenation yet. It calls notImplemented() and returns 0.
+ * platform/text/Hyphenation.h: Added.
+ * platform/text/cf/HyphenationCF.cpp: Added.
+ (WebCore::lastHyphenLocation): Returns the last hyphenation location occurring in the given string before
+ the given index. Uses the current search locale (which is based on the top language preference of the user)
+ for hyphenation.
+ * platform/text/mac/HyphenationMac.mm: Added.
+ (WebCore::lastHyphenLocation): Returns the last hyphenation location occurring in the given string before
+ the given index. Returns 0 if the current search locale is not "en", because the platform only knows how to
+ hyphenate English.
+ * rendering/BidiRun.h:
+ (WebCore::BidiRun::BidiRun): Added a boolean member, m_hasHyphen, and initialized it to false in the constructor.
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::InlineBox): Renamed m_hasEllipsisBox to m_hasEllipsisBoxOrHyphen, because this bit is now
+ shared by two subclass: RootInlineBox uses it for hasEllipsisBox(), while InlineTextBox uses it for hasHyphen().
+ * rendering/InlineTextBox.cpp:
+ (WebCore::adjustCharactersAndLengthForHyphen): Added this helper function to get the hyphen string from the style
+ and return a UChar* and length for the concatenation of the given text with the hyphen string.
+ (WebCore::InlineTextBox::selectionRect): If the selected range touches the end and the box has a hyphen,
+ compute the width of the text with the hyphen string concatenated to it.
+ (WebCore::InlineTextBox::paint): If the box has a hyphen, draw the text with the hyphen string concatenated to it.
+ (WebCore::InlineTextBox::paintSelection): Similarly concatenate the hyphen string.
+ * rendering/InlineTextBox.h:
+ (WebCore::InlineTextBox::hasHyphen): Added this accessor.
+ (WebCore::InlineTextBox::setHasHyphen): Ditto.
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::constructLine): Copy the m_hasHyphen flag from the run to its text box.
+ (WebCore::RenderBlock::computeHorizontalPositionsForLine): Add the width of the hyphen string when computing the
+ width of a box that has a hyphen.
+ (WebCore::RenderBlock::layoutInlineChildren): If the line was hyphenated, set the m_hasHyphen flag on the
+ logically last run.
+ (WebCore::tryHyphenating): Added this helper function which checks if a piece of text that does not fit on the
+ line could be hyphenated such that the part before the hyphen, including the hyphen, would fit. Given the amount
+ of space remaining on the line, it finds the longest prefix that can fit in the remaining space (which leaving room for
+ the hyphen), and then checks for a hyphenation location within that prefix.
+ (WebCore::RenderBlock::findNextLineBreak): In the 'hyphens: none' case, prevent line breaks at soft hyphens.
+ In the 'hyphens: auto' case, try hyphenating when a word will not fit in the remaining space on the line.
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::detachEllipsisBox): Changed to use hasEllipsisBox() and setHasEllipsisBox().
+ (WebCore::RootInlineBox::clearTruncation): Ditto.
+ (WebCore::RootInlineBox::placeEllipsis): Ditto.
+ (WebCore::RootInlineBox::paintEllipsisBox): Ditto.
+ (WebCore::RootInlineBox::nodeAtPoint): Ditto.
+ (WebCore::RootInlineBox::ellipsisBox): Ditto.
+ * rendering/RootInlineBox.h:
+ (WebCore::RootInlineBox::hasEllipsisBox): Added this accessor.
+ (WebCore::RootInlineBox::setHasEllipsisBox): Ditto.
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::diff): Return a layout hint if the hyphens setting or hyphenate-character differs.
+ (WebCore::RenderStyle::hyphenString): Added. For hyphenate-character: auto, returns the hyphen character.
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::hyphens): Added this accessor.
+ (WebCore::InheritedFlags::hyphenateCharacter): Ditto.
+ (WebCore::InheritedFlags::setHyphens): Ditto.
+ (WebCore::InheritedFlags::setHyphenateCharacter): Ditto.
+ (WebCore::InheritedFlags::initialHyphens): Added. Returns HyphensManual.
+ (WebCore::InheritedFlags::initialHyphenateCharacter): Added. Returns the null string, corresponding to
+ a value of 'auto'.
+ * rendering/style/RenderStyleConstants.h:
+ Added a Hyphens enum.
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData): Initialize and copy the new members.
+ (WebCore::StyleRareInheritedData::operator==): Compare the new members.
+ * rendering/style/StyleRareInheritedData.h: Added two new members: hyphens and hyphenateCharacter.
+
2010-06-03 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Adler.
WebCore/platform/text/BidiContext.h \
WebCore/platform/text/BidiResolver.h \
WebCore/platform/text/CharacterNames.h \
+ WebCore/platform/text/Hyphenation.cpp \
+ WebCore/platform/text/Hyphenation.h \
WebCore/platform/text/ParserUtilities.h \
WebCore/platform/text/PlatformString.h \
WebCore/platform/text/RegularExpression.cpp \
_wkGetFontInLanguageForRange
_wkGetGlyphTransformedAdvances
_wkGetGlyphsForCharacters
+_wkGetHyphenationLocationBeforeIndex
_wkGetMIMETypeForExtension
_wkGetNSURLResponseCalculatedExpiration
_wkGetNSURLResponseLastModifiedDate
'platform/text/BidiContext.h',
'platform/text/BidiResolver.h',
'platform/text/CharacterNames.h',
+ 'platform/text/Hyphenation.cpp',
+ 'platform/text/Hyphenation.h',
'platform/text/ParserUtilities.h',
'platform/text/PlatformString.h',
'platform/text/RegularExpression.cpp',
platform/BlobItem.cpp \
platform/text/Base64.cpp \
platform/text/BidiContext.cpp \
+ platform/text/Hyphenation.cpp \
platform/ContentType.cpp \
platform/ContextMenu.cpp \
platform/CrossThreadCopier.cpp \
platform/text/AtomicString.h \
platform/text/Base64.h \
platform/text/BidiContext.h \
+ platform/text/Hyphenation.h \
platform/text/qt/TextCodecQt.h \
platform/text/RegularExpression.h \
platform/text/SegmentedString.h \
RelativePath="..\platform\text\CharacterNames.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\platform\text\Hyphentation.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\platform\text\Hyphenation.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\platform\text\ParserUtilities.h"\r
>\r
3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; };
33C0CCD4112C5E6200CE057D /* SecureTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */; };
33C0CCD5112C5E6200CE057D /* SecureTextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 33C0CCD3112C5E6200CE057D /* SecureTextInput.h */; };
+ 371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */; };
371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */; };
371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; };
371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */; };
37202199106213C600F25C4B /* FontSmoothingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37202198106213C600F25C4B /* FontSmoothingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */; };
+ 375CD232119D43C800A2A859 /* Hyphenation.h in Headers */ = {isa = PBXBuildFile; fileRef = 375CD231119D43C800A2A859 /* Hyphenation.h */; };
+ 375CD23B119D44EA00A2A859 /* HyphenationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375CD239119D44EA00A2A859 /* HyphenationMac.mm */; };
3774ABA50FA21EB400AD7DE9 /* OverlapTestRequestClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
377C4CDF1014E9F600B9AE42 /* PlaceholderDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 377C4CDD1014E9F600B9AE42 /* PlaceholderDocument.h */; };
377C4CE01014E9F600B9AE42 /* PlaceholderDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 377C4CDE1014E9F600B9AE42 /* PlaceholderDocument.cpp */; };
3390CA540FFC157B00921962 /* NotificationContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationContents.h; path = notifications/NotificationContents.h; sourceTree = "<group>"; };
33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecureTextInput.cpp; sourceTree = "<group>"; };
33C0CCD3112C5E6200CE057D /* SecureTextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecureTextInput.h; sourceTree = "<group>"; };
+ 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HyphenationCF.cpp; sourceTree = "<group>"; };
371F4F3E0D25B9AF00ECE0D5 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; };
371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; };
371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; };
371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnicodeRangeValue.cpp; sourceTree = "<group>"; };
37202198106213C600F25C4B /* FontSmoothingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingMode.h; sourceTree = "<group>"; };
3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGlyphMap.h; sourceTree = "<group>"; };
+ 375CD231119D43C800A2A859 /* Hyphenation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hyphenation.h; sourceTree = "<group>"; };
+ 375CD239119D44EA00A2A859 /* HyphenationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HyphenationMac.mm; sourceTree = "<group>"; };
3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlapTestRequestClient.h; sourceTree = "<group>"; };
377C4CDD1014E9F600B9AE42 /* PlaceholderDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaceholderDocument.h; sourceTree = "<group>"; };
377C4CDE1014E9F600B9AE42 /* PlaceholderDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlaceholderDocument.cpp; sourceTree = "<group>"; };
93EEC1EC09C2877700C515D1 /* html */,
1C81B94D0E9732D900266E07 /* inspector */,
BCB16BFB0979C38700467741 /* loader */,
- FABE72EC1059C1EB00D999DD /* mathml */,
333F703D0FB49C16008E12A6 /* notifications */,
65BF02180974806300C43196 /* page */,
BCF1A5BA097832090061A123 /* platform */,
B2B264590D00A77E000ACC1D /* cf */ = {
isa = PBXGroup;
children = (
+ 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */,
B2B2645A0D00A77E000ACC1D /* StringCF.cpp */,
B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */,
);
B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */,
B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */,
B2C3D9F50D006C1D00EF6F26 /* CharacterNames.h */,
+ 375CD231119D43C800A2A859 /* Hyphenation.h */,
BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */,
B2C3D9FB0D006C1D00EF6F26 /* PlatformString.h */,
B2C3D9FC0D006C1D00EF6F26 /* RegularExpression.cpp */,
children = (
B2AFFC850D00A5DF0030074D /* character-sets.txt */,
B2C3D9FA0D006C1D00EF6F26 /* CharsetData.h */,
+ 375CD239119D44EA00A2A859 /* HyphenationMac.mm */,
B2AFFC860D00A5DF0030074D /* mac-encodings.txt */,
B2AFFC870D00A5DF0030074D /* make-charset-table.pl */,
B2AFFC880D00A5DF0030074D /* ShapeArabic.c */,
BCB16BFB0979C38700467741 /* loader */ = {
isa = PBXGroup;
children = (
+ FABE72EC1059C1EB00D999DD /* mathml */,
1A8F6BB00DB55CDC001DB794 /* appcache */,
512DD8E80D91E691000F89EE /* archive */,
5126E6B60A2E3AEF005C29FA /* icon */,
FA7EFB031120D25400CF79C7 /* RenderMathMLUnderOver.cpp */,
FA7EFB041120D25400CF79C7 /* RenderMathMLUnderOver.h */,
);
- path = mathml;
+ name = mathml;
+ path = ../mathml;
sourceTree = "<group>";
};
/* End PBXGroup section */
BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */,
514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */,
514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */,
+ 375CD232119D43C800A2A859 /* Hyphenation.h in Headers */,
B275356E0B053814002CE64F /* Icon.h in Headers */,
5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */,
51E1ECBE0C91C90400DC255B /* IconDatabaseClient.h in Headers */,
BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */,
0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */,
514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */,
+ 371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */,
+ 375CD23B119D44EA00A2A859 /* HyphenationMac.mm in Sources */,
5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */,
445C8DB710015FC90031531A /* IconDatabaseNone.cpp in Sources */,
1A2D753E0DE47FAB00F0A648 /* IconFetcher.cpp in Sources */,
/*
* Copyright (C) 2004 Zack Rusin <zack@kde.org>
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
*
if (style->highlight() == nullAtom)
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
return CSSPrimitiveValue::create(style->highlight(), CSSPrimitiveValue::CSS_STRING);
+ case CSSPropertyWebkitHyphens:
+ return CSSPrimitiveValue::create(style->hyphens());
+ case CSSPropertyWebkitHyphenateCharacter:
+ if (style->hyphenateCharacter().isNull())
+ return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
+ return CSSPrimitiveValue::create(style->hyphenateCharacter(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitBorderFit:
if (style->borderFit() == BorderFitBorder)
return CSSPrimitiveValue::createIdentifier(CSSValueBorder);
/*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
validPrimitive = true;
break;
+ case CSSPropertyWebkitHyphens:
+ if (id == CSSValueNone || id == CSSValueManual || id == CSSValueAuto)
+ validPrimitive = true;
+ break;
+
+ case CSSPropertyWebkitHyphenateCharacter:
+ if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING)
+ validPrimitive = true;
+ break;
+
case CSSPropertyWebkitBorderFit:
if (id == CSSValueBorder || id == CSSValueLines)
validPrimitive = true;
/*
* Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
}
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
+ : m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
+{
+ switch (hyphens) {
+ case HyphensNone:
+ m_value.ident = CSSValueNone;
+ break;
+ case HyphensManual:
+ m_value.ident = CSSValueManual;
+ break;
+ case HyphensAuto:
+ m_value.ident = CSSValueAuto;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator Hyphens() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return HyphensNone;
+ case CSSValueManual:
+ return HyphensManual;
+ case CSSValueAuto:
+ return HyphensAuto;
+ default:
+ ASSERT_NOT_REACHED();
+ return HyphensAuto;
+ }
+}
+
#if ENABLE(SVG)
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
-webkit-font-size-delta
-webkit-font-smoothing
-webkit-highlight
+-webkit-hyphenate-character
+-webkit-hyphens
-webkit-line-break
-webkit-line-clamp
-webkit-margin-bottom-collapse
m_style->setHighlight(primitiveValue->getStringValue());
return;
}
+ case CSSPropertyWebkitHyphens: {
+ HANDLE_INHERIT_AND_INITIAL(hyphens, Hyphens);
+ m_style->setHyphens(*primitiveValue);
+ return;
+ }
+ case CSSPropertyWebkitHyphenateCharacter: {
+ HANDLE_INHERIT_AND_INITIAL(hyphenateCharacter, HyphenateCharacter);
+ if (primitiveValue->getIdent() == CSSValueAuto)
+ m_style->setHyphenateCharacter(nullAtom);
+ else
+ m_style->setHyphenateCharacter(primitiveValue->getStringValue());
+ return;
+ }
case CSSPropertyWebkitBorderFit: {
HANDLE_INHERIT_AND_INITIAL(borderFit, BorderFit);
if (primitiveValue->getIdent() == CSSValueBorder)
maximized
minimized
windowed
+
+# -webkit-hyphens
+# none
+manual
+# auto
/*
- * Copyright 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
extern NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *);
+extern void* wkGetHyphenationLocationBeforeIndex;
#else
extern void* wkNoteOpenPanelFiles;
+extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
#endif
}
/*
- * Copyright 2006, 2007, 2008, 2010 Apple Computer, Inc. All rights reserved.
+ * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *);
+void* wkGetHyphenationLocationBeforeIndex;
#else
void* wkNoteOpenPanelFiles;
+CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
#endif
const UChar hebrewPunctuationGeresh = 0x05F3;
const UChar hebrewPunctuationGershayim = 0x05F4;
const UChar horizontalEllipsis = 0x2026;
+const UChar hyphen = 0x2010;
const UChar hyphenMinus = 0x002D;
const UChar ideographicComma = 0x3001;
const UChar ideographicFullStop = 0x3002;
--- /dev/null
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Hyphenation.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+size_t lastHyphenLocation(const UChar* /* characters */, size_t /* length */, size_t /* beforeIndex */)
+{
+ notImplemented();
+ return 0;
+}
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Hyphenation_h
+#define Hyphenation_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+size_t lastHyphenLocation(const UChar*, size_t length, size_t beforeIndex);
+
+} // namespace WebCore
+
+#endif // Hyphenation_h
--- /dev/null
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Hyphenation.h"
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+
+#include "TextBreakIteratorInternalICU.h"
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+static CFLocaleRef createCurrentSearchLocale()
+{
+ RetainPtr<CFStringRef> localeIdentifier(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, (const UInt8*)currentSearchLocaleID(), strlen(currentSearchLocaleID()), kCFStringEncodingASCII, false, kCFAllocatorNull));
+ return CFLocaleCreate(kCFAllocatorDefault, localeIdentifier.get());
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+{
+ RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
+
+ static CFLocaleRef locale = createCurrentSearchLocale();
+
+ CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale, 0);
+ return result == kCFNotFound ? 0 : result;
+}
+
+} // namespace WebCore
+
+#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
--- /dev/null
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "Hyphenation.h"
+
+#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+
+#import "TextBreakIteratorInternalICU.h"
+#import "WebCoreSystemInterface.h"
+#import <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+{
+ static bool localeIsEnglish = !strcmp("en", currentSearchLocaleID());
+ if (!localeIsEnglish)
+ return 0;
+
+ RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
+ return wkGetHyphenationLocationBeforeIndex(string.get(), beforeIndex);
+}
+
+} // namespace WebCore
+
+#endif // defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
: BidiCharacterRun(start, stop, context, dir)
, m_object(object)
, m_box(0)
+ , m_hasHyphen(false)
{
}
public:
RenderObject* m_object;
InlineBox* m_box;
+ bool m_hasHyphen;
};
}
#endif
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
- , m_hasEllipsisBox(false)
+ , m_hasEllipsisBoxOrHyphen(false)
, m_dirOverride(false)
, m_isText(false)
, m_determinedIfNextOnLineExists(false)
#endif
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
- , m_hasEllipsisBox(false)
+ , m_hasEllipsisBoxOrHyphen(false)
, m_dirOverride(false)
, m_isText(false)
, m_determinedIfNextOnLineExists(false)
// for RootInlineBox
bool m_endsWithBreak : 1; // Whether the line ends with a <br>.
bool m_hasSelectedChildren : 1; // Whether we have any children selected (this bit will also be set if the <br> that terminates our line is selected).
- bool m_hasEllipsisBox : 1;
+ bool m_hasEllipsisBoxOrHyphen : 1;
// for InlineTextBox
public:
/*
* (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
return state;
}
+typedef Vector<UChar, 256> BufferForAppendingHyphen;
+
+static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, RenderStyle* style, const UChar*& characters, int& length)
+{
+ const AtomicString& hyphenString = style->hyphenString();
+ charactersWithHyphen.reserveCapacity(length + hyphenString.length());
+ charactersWithHyphen.append(characters, length);
+ charactersWithHyphen.append(hyphenString.characters(), hyphenString.length());
+ characters = charactersWithHyphen.data();
+ length += hyphenString.length();
+}
+
IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos)
{
int sPos = max(startPos - m_start, 0);
RenderText* textObj = textRenderer();
int selTop = selectionTop();
int selHeight = selectionHeight();
- const Font& f = textObj->style(m_firstLine)->font();
+ RenderStyle* styleToUse = textObj->style(m_firstLine);
+ const Font& f = styleToUse->font();
+
+ const UChar* characters = textObj->text()->characters() + m_start;
+ int len = m_len;
+ BufferForAppendingHyphen charactersWithHyphen;
+ if (ePos == len && hasHyphen()) {
+ adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, len);
+ ePos = len;
+ }
- IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(textObj->text()->characters() + m_start, m_len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride),
+ IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride),
IntPoint(tx + m_x, ty + selTop), selHeight, sPos, ePos));
if (r.x() > tx + m_x + m_width)
r.setWidth(0);
}
}
+ const UChar* characters = textRenderer()->text()->characters() + m_start;
+ int length = m_len;
+ BufferForAppendingHyphen charactersWithHyphen;
+ if (hasHyphen())
+ adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length);
+
int baseline = renderer()->style(m_firstLine)->font().ascent();
IntPoint textOrigin(m_x + tx, m_y + ty + baseline);
- TextRun textRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || styleToUse->visuallyOrdered());
+ TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || styleToUse->visuallyOrdered());
int sPos = 0;
int ePos = 0;
if (paintSelectedTextOnly || paintSelectedTextSeparately)
selectionStartEnd(sPos, ePos);
- int length = m_len;
if (m_truncation != cNoTruncation) {
sPos = min<int>(sPos, m_truncation);
ePos = min<int>(ePos, m_truncation);
// If the text is truncated, let the thing being painted in the truncation
// draw its own highlight.
int length = m_truncation != cNoTruncation ? m_truncation : m_len;
+ const UChar* characters = textRenderer()->text()->characters() + m_start;
+
+ BufferForAppendingHyphen charactersWithHyphen;
+ if (ePos == length && hasHyphen()) {
+ adjustCharactersAndLengthForHyphen(charactersWithHyphen, style, characters, length);
+ ePos = length;
+ }
+
context->clip(IntRect(m_x + tx, y + ty, m_width, h));
- context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
+ context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
direction() == RTL, m_dirOverride || style->visuallyOrdered()),
IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);
context->restore();
unsigned short truncation() { return m_truncation; }
+ bool hasHyphen() const { return m_hasEllipsisBoxOrHyphen; }
+ void setHasHyphen(bool hasHyphen) { m_hasEllipsisBoxOrHyphen = hasHyphen; }
+
private:
virtual int selectionTop();
virtual int selectionHeight();
void skipTrailingWhitespace(InlineIterator&, bool isLineEmpty, bool previousLineBrokeCleanly);
int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly);
void fitBelowFloats(int widthToFit, bool firstLine, int& availableWidth);
- InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, EClear* clear = 0);
+ InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, bool& hyphenated, EClear* = 0);
RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject);
InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine);
void computeHorizontalPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&);
#include "BidiResolver.h"
#include "CharacterNames.h"
+#include "Hyphenation.h"
#include "InlineIterator.h"
#include "InlineTextBox.h"
#include "Logging.h"
text->setStart(r->m_start);
text->setLen(r->m_stop - r->m_start);
text->m_dirOverride = r->dirOverride(visuallyOrdered);
+ if (r->m_hasHyphen)
+ text->setHasHyphen(true);
}
}
HashSet<const SimpleFontData*> fallbackFonts;
GlyphOverflow glyphOverflow;
r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow));
+ int hyphenWidth = 0;
+ if (static_cast<InlineTextBox*>(r->m_box)->hasHyphen()) {
+ const AtomicString& hyphenString = rt->style()->hyphenString();
+ hyphenWidth = rt->style(firstLine)->font().width(TextRun(hyphenString.characters(), hyphenString.length()));
+ }
+ r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth);
if (!fallbackFonts.isEmpty()) {
ASSERT(r->m_box->isText());
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(static_cast<InlineTextBox*>(r->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).first;
isLineEmpty = true;
EClear clear = CNONE;
- end = findNextLineBreak(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly, &clear);
+ bool hyphenated;
+ end = findNextLineBreak(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly, hyphenated, &clear);
if (resolver.position().atEnd()) {
resolver.deleteRuns();
checkForFloatsFromLastLine = true;
RootInlineBox* lineBox = 0;
if (resolver.runCount()) {
+ if (hyphenated)
+ resolver.logicallyLastRun()->m_hasHyphen = true;
lineBox = constructLine(resolver.runCount(), resolver.firstRun(), resolver.lastRun(), firstLine, !end.obj, end.obj && !end.pos ? end.obj : 0);
if (lineBox) {
lineBox->setEndsWithBreak(previousLineBrokeCleanly);
return font.width(TextRun(text->characters() + from, len, !collapseWhiteSpace, xPos));
}
+static void tryHyphenating(RenderText* text, const Font& font, int lastSpace, int pos, int xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
+{
+ const AtomicString& hyphenString = text->style()->hyphenString();
+ int hyphenWidth = font.width(TextRun(hyphenString.characters(), hyphenString.length()));
+
+ unsigned prefixLength = font.offsetForPosition(TextRun(text->characters() + lastSpace, pos - lastSpace, !collapseWhiteSpace, xPos + lastSpaceWordSpacing), availableWidth - xPos - hyphenWidth - lastSpaceWordSpacing, false);
+ if (!prefixLength)
+ return;
+
+ prefixLength = 1 + lastHyphenLocation(text->characters() + lastSpace + 1, pos - lastSpace - 1, prefixLength - 1);
+ if (prefixLength <= 1)
+ return;
+
+#if !ASSERT_DISABLED
+ int prefixWidth = hyphenWidth + textWidth(text, lastSpace, prefixLength, font, xPos, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
+ ASSERT(xPos + prefixWidth <= availableWidth);
+#endif
+
+ lineBreak.obj = text;
+ lineBreak.pos = lastSpace + prefixLength;
+ lineBreak.nextBreakablePosition = nextBreakable;
+ hyphenated = true;
+}
+
InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly,
- EClear* clear)
+ bool& hyphenated, EClear* clear)
{
ASSERT(resolver.position().block == this);
bool prevLineBrokeCleanly = previousLineBrokeCleanly;
previousLineBrokeCleanly = false;
+ hyphenated = false;
+
bool autoWrapWasEverTrueOnLine = false;
bool floatsFitOnLine = true;
int len = strlen - pos;
const UChar* str = t->characters();
- const Font& f = t->style(firstLine)->font();
+ RenderStyle* style = t->style(firstLine);
+ const Font& f = style->font();
bool isFixedPitch = f.isFixedPitch();
+ bool canHyphenate = style->hyphens() == HyphensAuto;
int lastSpace = pos;
int wordSpacing = o->style()->wordSpacing();
len--;
lastSpaceWordSpacing = 0;
lastSpace = pos; // Cheesy hack to prevent adding in widths of the run twice.
+ if (style->hyphens() == HyphensNone) {
+ // Prevent a line break at the soft hyphen by ensuring that betweenWords is false
+ // in the next iteration.
+ atStart = true;
+ }
continue;
}
skipTrailingWhitespace(lBreak, isLineEmpty, previousLineBrokeCleanly);
}
}
+ if (canHyphenate && w + tmpW > width) {
+ tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
+ if (hyphenated)
+ goto end;
+ }
if (lineWasTooWide || w + tmpW > width) {
if (lBreak.obj && shouldPreserveNewline(lBreak.obj) && lBreak.obj->isText() && toRenderText(lBreak.obj)->textLength() && !toRenderText(lBreak.obj)->isWordBreak() && toRenderText(lBreak.obj)->characters()[lBreak.pos] == '\n') {
if (!stoppedIgnoringSpaces && pos > 0) {
}
// IMPORTANT: pos is > length here!
- if (!ignoringSpaces)
- tmpW += textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
+ int additionalTmpW = ignoringSpaces ? 0 : textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
+ tmpW += additionalTmpW;
tmpW += inlineWidth(o, !appliedStartWidth, true);
+
+ if (canHyphenate && w + tmpW > width) {
+ tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
+ if (hyphenated)
+ goto end;
+ }
} else
ASSERT_NOT_REACHED();
void RootInlineBox::detachEllipsisBox(RenderArena* arena)
{
- if (m_hasEllipsisBox) {
+ if (hasEllipsisBox()) {
EllipsisBox* box = gEllipsisBoxMap->take(this);
box->setParent(0);
box->destroy(arena);
- m_hasEllipsisBox = false;
+ setHasEllipsisBox(false);
}
}
void RootInlineBox::clearTruncation()
{
- if (m_hasEllipsisBox) {
+ if (hasEllipsisBox()) {
detachEllipsisBox(renderer()->renderArena());
InlineFlowBox::clearTruncation();
}
if (!gEllipsisBoxMap)
gEllipsisBoxMap = new EllipsisBoxMap();
gEllipsisBoxMap->add(this, ellipsisBox);
- m_hasEllipsisBox = true;
+ setHasEllipsisBox(true);
// FIXME: Do we need an RTL version of this?
if (ltr && (x() + width() + ellipsisWidth) <= blockRightEdge) {
void RootInlineBox::paintEllipsisBox(RenderObject::PaintInfo& paintInfo, int tx, int ty) const
{
- if (m_hasEllipsisBox && renderer()->shouldPaintWithinRoot(paintInfo) && renderer()->style()->visibility() == VISIBLE &&
- paintInfo.phase == PaintPhaseForeground)
+ if (hasEllipsisBox() && renderer()->shouldPaintWithinRoot(paintInfo) && renderer()->style()->visibility() == VISIBLE
+ && paintInfo.phase == PaintPhaseForeground)
ellipsisBox()->paint(paintInfo, tx, ty);
}
bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty)
{
- if (m_hasEllipsisBox && visibleToHitTesting()) {
+ if (hasEllipsisBox() && visibleToHitTesting()) {
if (ellipsisBox()->nodeAtPoint(request, result, x, y, tx, ty)) {
renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty));
return true;
EllipsisBox* RootInlineBox::ellipsisBox() const
{
- if (!m_hasEllipsisBox)
+ if (!hasEllipsisBox())
return 0;
return gEllipsisBoxMap->get(this);
}
virtual void attachLineBoxToRenderObject();
virtual void removeLineBoxFromRenderObject();
-protected:
+private:
+ bool hasEllipsisBox() const { return m_hasEllipsisBoxOrHyphen; }
+ void setHasEllipsisBox(bool hasEllipsisBox) { m_hasEllipsisBoxOrHyphen = hasEllipsisBox; }
+
// Where this line ended. The exact object and the position within that object are stored so that
// we can create an InlineIterator beginning just after the end of this line.
RenderObject* m_lineBreakObj;
/*
* Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
rareInheritedData->wordWrap != other->rareInheritedData->wordWrap ||
rareInheritedData->nbspMode != other->rareInheritedData->nbspMode ||
rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak ||
- rareInheritedData->textSecurity != other->rareInheritedData->textSecurity)
+ rareInheritedData->textSecurity != other->rareInheritedData->textSecurity ||
+ rareInheritedData->hyphens != other->rareInheritedData->hyphens ||
+ rareInheritedData->hyphenateCharacter != other->rareInheritedData->hyphenateCharacter)
return StyleDifferenceLayout;
if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
return *map.get();
}
+const AtomicString& RenderStyle::hyphenString() const
+{
+ ASSERT(hyphens() == HyphensAuto);
+
+ const AtomicString& hyphenateCharacter = rareInheritedData.get()->hyphenateCharacter;
+ if (!hyphenateCharacter.isNull())
+ return hyphenateCharacter;
+
+ // FIXME: This should depend on locale.
+ DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphen, 1));
+ return hyphenMinusString;
+}
+
#if ENABLE(DASHBOARD_SUPPORT)
const Vector<StyleDashboardRegion>& RenderStyle::initialDashboardRegions()
{
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
const AtomicString& highlight() const { return rareInheritedData->highlight; }
+ Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
+ const AtomicString& hyphenateCharacter() const { return rareInheritedData->hyphenateCharacter; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
+ void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
+ void setHyphenateCharacter(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenateCharacter, h); }
void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
const CounterDirectiveMap* counterDirectives() const;
CounterDirectiveMap& accessCounterDirectives();
+ const AtomicString& hyphenString() const;
+
bool inheritedNotEqual(const RenderStyle*) const;
StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
static const AtomicString& initialHighlight() { return nullAtom; }
+ static Hyphens initialHyphens() { return HyphensManual; }
+ static const AtomicString& initialHyphenateCharacter() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
static EResize initialResize() { return RESIZE_NONE; }
static ControlPart initialAppearance() { return NoControlPart; }
enum ELineClampType { LineClampLineCount, LineClampPercentage };
+enum Hyphens { HyphensNone, HyphensManual, HyphensAuto };
+
} // namespace WebCore
#endif // RenderStyleConstants_h
/*
* Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
, resize(RenderStyle::initialResize())
, userSelect(RenderStyle::initialUserSelect())
, colorSpace(DeviceColorSpace)
+ , hyphens(HyphensManual)
{
}
, resize(o.resize)
, userSelect(o.userSelect)
, colorSpace(o.colorSpace)
+ , hyphens(o.hyphens)
+ , hyphenateCharacter(o.hyphenateCharacter)
{
}
&& textSizeAdjust == o.textSizeAdjust
&& resize == o.resize
&& userSelect == o.userSelect
- && colorSpace == o.colorSpace;
+ && colorSpace == o.colorSpace
+ && hyphens == o.hyphens
+ && hyphenateCharacter == o.hyphenateCharacter;
}
bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
unsigned resize : 2; // EResize
unsigned userSelect : 1; // EUserSelect
unsigned colorSpace : 1; // ColorSpace
-
+ unsigned hyphens : 2; // Hyphens
+
+ AtomicString hyphenateCharacter;
+
private:
StyleRareInheritedData();
StyleRareInheritedData(const StyleRareInheritedData&);
+2010-06-21 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WebKit part of implementing the 'hyphens' and 'hyphenate-character' properties
+ https://bugs.webkit.org/show_bug.cgi?id=10228
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface): Initialize wkGetHyphenationLocationBeforeIndex.
+
2010-06-21 Satish Sampath <satish@chromium.org>
Reviewed by Steve Block.
/*
- * Copyright 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
INIT(NoteOpenPanelFiles);
#endif
+ INIT(GetHyphenationLocationBeforeIndex);
+
didInit = true;
}
+2010-06-21 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WebKitSystemInterface part of CSS3: Implement the 'hyphens' and 'hyphenate-character' properties
+ https://bugs.webkit.org/show_bug.cgi?id=10228
+
+ * WebKitSystemInterface.h: Added WKGetHyphenationLocationBeforeIndex().
+ * libWebKitSystemInterfaceLeopard.a:
+ * libWebKitSystemInterfaceSnowLeopard.a:
+ * libWebKitSystemInterfaceTiger.a:
+
2010-06-21 Satish Sampath <satish@chromium.org>
Reviewed by Steve Block.
void WKSyncSurfaceToView(NSView *view);
#endif
+CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
+
#ifdef __cplusplus
}
#endif