| Differences between
and this patch
- WebCore/ChangeLog +156 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-07-13  Roland Steiner  <rolandsteiner@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Reviewed by NOBODY (OOPS!).
6
       
7
        Implemented basic HTML5 ruby support. 
8
       (see http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-ruby-element)
9
       
10
       No CSS3 ruby properties or values are honored.
11
       The CSS3 box model is honored in a rudimentary way 
12
       (borders and padding surround the whole <ruby> element>.
13
       
14
       Ruby is rendered if a <ruby> HTML tag is encountered.
15
       CSS3 display values ('ruby', 'ruby-base', etc.) are not used. 
16
       The normal box model is as follows (with their display analogy in brackets):
17
       
18
       RenderRubyAsInline*) (inline)/RenderRubyAsBlock*) (block)
19
           1+ RenderRubyRun (inline-block)
20
               1 RenderRubyBase(block)
21
                   1+ text and/or inline objects
22
               0-2**) RenderRubyText(block)
23
                   1+ text and/or inline objects
24
                   
25
       Other objects are wrapped as necessary in order to preserve this tree structure.
26
27
       *) ruby is normally an inline objects, and thus will be represented by RenderRubyAsInline.
28
       However, when the ruby element itself is floated or positioned, RenderRubyAsBlock will be used.
29
30
       **)A 2nd <rt> for a given base currently is allowed and will render below the base.
31
       Note that this isn't tested for in the layout tests, as this feature may be controversial.
32
       
33
       The main logic is contained in RenderRubyRun and RubyInlineFlowBox.
34
       
35
       RenderRubyAsInline/RenderRubyAsBlock are rather simple sub-classes that mainly do special child handling.
36
       RenderRubyRun subclasses and re-uses the functionality of RenderBlock for layouting.
37
       RenderRubyBase and RenderRubyText are simple subclasses of RenderBlock that only do special child handling.     
38
       RubyInlineFlowBox is a subclass of InlineFLowBox and does the border and padding handling 
39
       for the whole <ruby> element and its contents.
40
       RoubyRootInlineBox is a similar subclass to RootInlineBox, but as its used only in block
41
       layouting, it only needs to override a single information method isRuby(). 
42
43
        To limit the size of the patch, tests are contained in a separate patch file.
44
        
45
        Tests: fast/ruby/ruby-length-border.html
46
               fast/ruby/ruby-length.html
47
               fast/ruby/ruby-run-break-border.html
48
               fast/ruby/ruby-run-break.html
49
               fast/ruby/ruby-runs.html
50
               fast/ruby/ruby-simple-rp.html
51
               fast/ruby/ruby-simple.html
52
53
        Configuration file changes (mainly add ENABLE_RUBY flag):
54
        * Configurations/FeatureDefines.xcconfig:
55
        * DerivedSources.make:
56
        * GNUmakefile.am:
57
        * WebCore.gypi:
58
        * WebCore.pro:
59
        * WebCore.xcodeproj/project.pbxproj:
60
        
61
        * css/CSSStyleSelector.cpp:
62
        (WebCore::CSSStyleSelector::styleForElement): loading of extra stylesheet for ruby
63
        
64
        * css/ruby.css: Added.  Default stylesheet for ruby elements
65
        
66
        * rendering/InlineBox.h:
67
        (WebCore::InlineBox::isRuby): query method
68
        (WebCore::InlineBox::baselinePosition): virtual when ENABLE_RUBY is set, overridden by ruby 
69
        (WebCore::InlineBox::lineHeight): virtual when ENABLE_RUBY is set, overridden by ruby 
70
        * rendering/InlineFlowBox.cpp: 
71
        (WebCore::InlineFlowBox::placeBoxesVertically): adapt box placement for ruby inline flow boxes.
72
        * rendering/RenderBlock.cpp: 
73
        (WebCore::RenderBlock::firstChildBoxInLayoutOrder): handle order in which block boxes are stacked, overridden by ruby 
74
        (WebCore::RenderBlock::nextChildBoxInLayoutOrder): handle order in which block boxes are stacked, overridden by ruby
75
        (WebCore::RenderBlock::layoutBlockChildren): make use of above methods
76
        * rendering/RenderBlock.h:
77
        * rendering/RenderObject.cpp:
78
        (WebCore::RenderObject::createObject): creation of ruby renderers
79
        * rendering/RenderObject.h:
80
        (WebCore::RenderObject::isRuby): information method added
81
        (WebCore::RenderObject::isRubyRun): information method added 
82
        (WebCore::RenderObject::isRubyBase): information method added
83
        (WebCore::RenderObject::isRubyText): information method added
84
        * rendering/RenderRuby.cpp: Added.
85
        (WebCore::RenderRubyAsInline::RenderRubyAsInline):
86
        (WebCore::RenderRubyAsInline::~RenderRubyAsInline):
87
        (WebCore::RenderRubyAsInline::isChildAllowed):
88
        (WebCore::RenderRubyAsInline::addChild):
89
        (WebCore::RenderRubyAsInline::createAnonymousRubyRun):
90
        (WebCore::RenderRubyAsInline::createInlineFlowBox):
91
        (WebCore::RenderRubyAsBlock::RenderRubyAsBlock):
92
        (WebCore::RenderRubyAsBlock::~RenderRubyAsBlock):
93
        (WebCore::RenderRubyAsBlock::isChildAllowed):
94
        (WebCore::RenderRubyAsBlock::addChild):
95
        (WebCore::RenderRubyAsBlock::createAnonymousRubyRun):
96
        (WebCore::RenderRubyAsBlock::createRootInlineBox):
97
        * rendering/RenderRuby.h: Added.
98
        (WebCore::RenderRubyAsInline::renderName):
99
        (WebCore::RenderRubyAsInline::isRuby):
100
        (WebCore::RenderRubyAsBlock::renderName):
101
        (WebCore::RenderRubyAsBlock::isRuby):
102
        (WebCore::RenderRubyAsBlock::shouldPaintSelectionGaps):
103
        * rendering/RenderRubyBase.cpp: Added.
104
        (WebCore::RenderRubyBase::RenderRubyBase):
105
        (WebCore::RenderRubyBase::~RenderRubyBase):
106
        (WebCore::RenderRubyBase::isChildAllowed):
107
        * rendering/RenderRubyBase.h: Added.
108
        (WebCore::RenderRubyBase::renderName):
109
        (WebCore::RenderRubyBase::isRubyBase):
110
        * rendering/RenderRubyRun.cpp: Added.
111
        (WebCore::RenderRubyRun::RenderRubyRun):
112
        (WebCore::RenderRubyRun::~RenderRubyRun):
113
        (WebCore::RenderRubyRun::hasRubyBase):
114
        (WebCore::RenderRubyRun::numberOfRubyTexts):
115
        (WebCore::RenderRubyRun::baselinePosition):
116
        (WebCore::RenderRubyRun::firstLineBlock):
117
        (WebCore::RenderRubyRun::updateFirstLetter):
118
        (WebCore::RenderRubyRun::isChildAllowed):
119
        (WebCore::RenderRubyRun::addChild):
120
        (WebCore::RenderRubyRun::firstChildBoxInLayoutOrder):
121
        (WebCore::RenderRubyRun::nextChildBoxInLayoutOrder):
122
        (WebCore::RenderRubyRun::effectiveRubyPosition):
123
        (WebCore::RenderRubyRun::getRubyBase):
124
        (WebCore::RenderRubyRun::getFirstRubyText):
125
        (WebCore::RenderRubyRun::getLastRubyText):
126
        (WebCore::RenderRubyRun::createAnonymousRubyBase):
127
        (WebCore::RenderRubyRun::createAnonymousRubyText):
128
        * rendering/RenderRubyRun.h: Added.
129
        (WebCore::RenderRubyRun::renderName):
130
        (WebCore::RenderRubyRun::isRubyRun):
131
        (WebCore::RenderRubyRun::isInlineBlockOrInlineTable):
132
        (WebCore::RenderRubyRun::shouldPaintSelectionGaps):
133
        * rendering/RenderRubyText.cpp: Added.
134
        (WebCore::RenderRubyText::RenderRubyText):
135
        (WebCore::RenderRubyText::~RenderRubyText):
136
        (WebCore::RenderRubyText::isChildAllowed):
137
        * rendering/RenderRubyText.h: Added.
138
        (WebCore::RenderRubyText::renderName):
139
        (WebCore::RenderRubyText::isRubyText):
140
        * rendering/RenderTheme.h:
141
        (WebCore::RenderTheme::extraRubyStyleSheet): extra stylesheet for ruby 
142
        * rendering/RubyInlineFlowBox.cpp: Added.
143
        (WebCore::RubyInlineFlowBox::RubyInlineFlowBox):
144
        (WebCore::RubyInlineFlowBox::virtualHeight):
145
        (WebCore::RubyInlineFlowBox::baselinePosition):
146
        (WebCore::RubyInlineFlowBox::computeHeightAndBaseline):
147
        * rendering/RubyInlineFlowBox.h: Added.
148
        (WebCore::RubyInlineFlowBox::isRuby):
149
        (WebCore::RubyInlineFlowBox::lineHeight):
150
        * rendering/RubyRootInlineBox.cpp: Added.
151
        (WebCore::RubyRootInlineBox::RubyRootInlineBox):
152
        * rendering/RubyRootInlineBox.h: Added.
153
        (WebCore::RubyRootInlineBox::isRuby):
154
        * rendering/style/RenderStyleConstants.h:
155
        (WebCore::):
156
1
2009-07-13  Drew Wilson  <atwilson@google.com>
157
2009-07-13  Drew Wilson  <atwilson@google.com>
2
158
3
        Reviewed by David Levin.
159
        Reviewed by David Levin.
- WebCore/DerivedSources.make +4 lines
Lines 523-528 XPathGrammar.cpp : xml/XPathGrammar.y $( WebCore/DerivedSources.make_sec1
523
523
524
USER_AGENT_STYLE_SHEETS = $(WebCore)/css/html.css $(WebCore)/css/quirks.css $(WebCore)/css/view-source.css $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css 
524
USER_AGENT_STYLE_SHEETS = $(WebCore)/css/html.css $(WebCore)/css/quirks.css $(WebCore)/css/view-source.css $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css 
525
525
526
ifeq ($(findstring ENABLE_RUBY,$(FEATURE_DEFINES)), ENABLE_RUBY)
527
    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/ruby.css 
528
endif
529
526
ifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG)
530
ifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG)
527
    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/svg.css 
531
    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/svg.css 
528
endif
532
endif
- WebCore/GNUmakefile.am +38 lines
Lines 2207-2212 webcore_libadd += \ WebCore/GNUmakefile.am_sec1
2207
endif # END ENABLE_VIDEO
2207
endif # END ENABLE_VIDEO
2208
2208
2209
# ----
2209
# ----
2210
# Ruby Support
2211
# ----
2212
if ENABLE_RUBY
2213
2214
HTML_FEATURES += ENABLE_RUBY=1
2215
webcore_cppflags += -DENABLE_RUBY=1
2216
2217
webcore_sources += \
2218
   WebCore/rendering/RenderRuby.cpp \
2219
   WebCore/rendering/RenderRuby.h \
2220
   WebCore/rendering/RenderRubyBase.cpp \
2221
   WebCore/rendering/RenderRubyBase.h \
2222
   WebCore/rendering/RenderRubyRun.cpp \
2223
   WebCore/rendering/RenderRubyRun.h \
2224
   WebCore/rendering/RenderRubyText.cpp \
2225
   WebCore/rendering/RenderRubyText.h \
2226
   WebCore/rendering/RubyInlineFlowBox.cpp \
2227
   WebCore/rendering/RubyInlineFlowBox.h \
2228
   WebCore/rendering/RubyRootInlineBox.cpp \
2229
   WebCore/rendering/RubyRootInlineBox.h
2230
2231
endif # END ENABLE_RUBY
2232
2233
# ----
2210
# XPath Support
2234
# XPath Support
2211
# ----
2235
# ----
2212
if ENABLE_XPATH
2236
if ENABLE_XPATH
Lines 3128-3133 USER_AGENT_STYLE_SHEETS = \ WebCore/GNUmakefile.am_sec2
3128
   $(WebCore)/css/wml.css \
3152
   $(WebCore)/css/wml.css \
3129
   $(WebCore)/css/mediaControls.css
3153
   $(WebCore)/css/mediaControls.css
3130
3154
3155
if ENABLE_RUBY
3156
# Note: ruby.css sets <rp> display:none, which we don't want if ruby isn't, in fact, enabled
3157
USER_AGENT_STYLE_SHEETS += \
3158
   $(WebCore)/css/ruby.css
3159
endif # END ENABLE_RUBY
3160
   
3161
3131
# new-style JavaScript bindings
3162
# new-style JavaScript bindings
3132
SCRIPTS_BINDINGS = \
3163
SCRIPTS_BINDINGS = \
3133
   $(WebCore)/bindings/scripts/CodeGenerator.pm \
3164
   $(WebCore)/bindings/scripts/CodeGenerator.pm \
Lines 3272-3277 webcore_dist += \ WebCore/GNUmakefile.am_sec3
3272
   WebCore/xml/xmlattrs.in \
3303
   WebCore/xml/xmlattrs.in \
3273
   WebCore/xml/XPathGrammar.y
3304
   WebCore/xml/XPathGrammar.y
3274
3305
3306
if ENABLE_RUBY
3307
# Note: ruby.css sets <rp> display:none, which we don't want if ruby isn't, in fact, enabled
3308
webcore_dist += \
3309
   WebCore/css/ruby.css
3310
endif # END ENABLE_RUBY
3311
   
3312
3275
# Installing web inspector files
3313
# Installing web inspector files
3276
webinspectordir = ${datadir}/webkit-1.0/webinspector
3314
webinspectordir = ${datadir}/webkit-1.0/webinspector
3277
dist_webinspector_DATA = \
3315
dist_webinspector_DATA = \
- WebCore/WebCore.gypi +12 lines
Lines 2747-2752 WebCore/WebCore.gypi_sec1
2747
            'rendering/RenderReplaced.h',
2747
            'rendering/RenderReplaced.h',
2748
            'rendering/RenderReplica.cpp',
2748
            'rendering/RenderReplica.cpp',
2749
            'rendering/RenderReplica.h',
2749
            'rendering/RenderReplica.h',
2750
            'rendering/RenderRuby.cpp',
2751
            'rendering/RenderRuby.h',
2752
            'rendering/RenderRubyBase.cpp',
2753
            'rendering/RenderRubyBase.h',
2754
            'rendering/RenderRubyRun.cpp',
2755
            'rendering/RenderRubyRun.h',
2756
            'rendering/RenderRubyText.cpp',
2757
            'rendering/RenderRubyText.h',
2750
            'rendering/RenderSVGBlock.cpp',
2758
            'rendering/RenderSVGBlock.cpp',
2751
            'rendering/RenderSVGBlock.h',
2759
            'rendering/RenderSVGBlock.h',
2752
            'rendering/RenderSVGContainer.cpp',
2760
            'rendering/RenderSVGContainer.cpp',
Lines 2832-2837 WebCore/WebCore.gypi_sec2
2832
            'rendering/RenderWordBreak.h',
2840
            'rendering/RenderWordBreak.h',
2833
            'rendering/RootInlineBox.cpp',
2841
            'rendering/RootInlineBox.cpp',
2834
            'rendering/RootInlineBox.h',
2842
            'rendering/RootInlineBox.h',
2843
            'rendering/RubyInlineFlowBox.cpp',
2844
            'rendering/RubyInlineFlowBox.h',
2845
            'rendering/RubyRootInlineBox.cpp',
2846
            'rendering/RubyRootInlineBox.h',
2835
            'rendering/ScrollBehavior.cpp',
2847
            'rendering/ScrollBehavior.cpp',
2836
            'rendering/ScrollBehavior.h',
2848
            'rendering/ScrollBehavior.h',
2837
            'rendering/SVGCharacterLayoutInfo.cpp',
2849
            'rendering/SVGCharacterLayoutInfo.cpp',
- WebCore/WebCore.pro +13 lines
Lines 1480-1485 contains(DEFINES, ENABLE_VIDEO=1) { WebCore/WebCore.pro_sec1
1480
1483
1481
}
1484
}
1482
1485
1486
contains(DEFINES, ENABLE_RUBY=1) {
1487
   STYLESHEETS_EMBED += \
1488
       $$PWD/css/ruby.css
1489
1490
    SOURCES += \
1491
        rendering/RenderRuby.cpp \
1492
        rendering/RenderRubyBase.cpp \
1493
        rendering/RenderRubyRun.cpp \
1494
        rendering/RenderRubyText.cpp \
1495
        rendering/RubyInlineFlowBox.cpp \
1496
        rendering/RubyRootInlineBox.cpp
1497
}
1498
1483
contains(DEFINES, ENABLE_XPATH=1) {
1499
contains(DEFINES, ENABLE_XPATH=1) {
1484
    FEATURE_DEFINES_JAVASCRIPT += ENABLE_XPATH=1
1500
    FEATURE_DEFINES_JAVASCRIPT += ENABLE_XPATH=1
1485
1501
- WebCore/WebCore.xcodeproj/project.pbxproj +52 lines
Lines 190-195 WebCore/WebCore.xcodeproj/project.pbxproj_sec1
190
       148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */; };
190
       148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */; };
191
       14993BE50B2F2B1C0050497F /* FocusController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14993BE30B2F2B1C0050497F /* FocusController.cpp */; };
191
       14993BE50B2F2B1C0050497F /* FocusController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14993BE30B2F2B1C0050497F /* FocusController.cpp */; };
192
       14993BE60B2F2B1C0050497F /* FocusController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14993BE40B2F2B1C0050497F /* FocusController.h */; settings = {ATTRIBUTES = (Private, ); }; };
192
       14993BE60B2F2B1C0050497F /* FocusController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14993BE40B2F2B1C0050497F /* FocusController.h */; settings = {ATTRIBUTES = (Private, ); }; };
193
       149C78F4100DE610003519BB /* RenderRuby.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78EC100DE610003519BB /* RenderRuby.cpp */; };
194
       149C78F5100DE610003519BB /* RenderRuby.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78ED100DE610003519BB /* RenderRuby.h */; };
195
       149C78F6100DE610003519BB /* RenderRubyBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78EE100DE610003519BB /* RenderRubyBase.cpp */; };
196
       149C78F7100DE610003519BB /* RenderRubyBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78EF100DE610003519BB /* RenderRubyBase.h */; };
197
       149C78F8100DE610003519BB /* RenderRubyRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78F0100DE610003519BB /* RenderRubyRun.cpp */; };
198
       149C78F9100DE610003519BB /* RenderRubyRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78F1100DE610003519BB /* RenderRubyRun.h */; };
199
       149C78FA100DE610003519BB /* RenderRubyText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78F2100DE610003519BB /* RenderRubyText.cpp */; };
200
       149C78FB100DE610003519BB /* RenderRubyText.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78F3100DE610003519BB /* RenderRubyText.h */; };
201
       149C7900100DE628003519BB /* RubyInlineFlowBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78FC100DE628003519BB /* RubyInlineFlowBox.cpp */; };
202
       149C7901100DE628003519BB /* RubyInlineFlowBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78FD100DE628003519BB /* RubyInlineFlowBox.h */; };
203
       149C7902100DE628003519BB /* RubyRootInlineBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149C78FE100DE628003519BB /* RubyRootInlineBox.cpp */; };
204
       149C7903100DE628003519BB /* RubyRootInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 149C78FF100DE628003519BB /* RubyRootInlineBox.h */; };
205
       149C7905100DE646003519BB /* ruby.css in Resources */ = {isa = PBXBuildFile; fileRef = 149C7904100DE646003519BB /* ruby.css */; };
193
       14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14C9A5E90B3D105F005A0232 /* Settings.cpp */; };
206
       14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14C9A5E90B3D105F005A0232 /* Settings.cpp */; };
194
       14CF78A409F58CBF00EB3665 /* JSCSSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */; };
207
       14CF78A409F58CBF00EB3665 /* JSCSSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */; };
195
       14CF78A609F58CD800EB3665 /* JSCSSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CF78A509F58CD800EB3665 /* JSCSSValue.h */; };
208
       14CF78A609F58CD800EB3665 /* JSCSSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CF78A509F58CD800EB3665 /* JSCSSValue.h */; };
Lines 5092-5097 WebCore/WebCore.xcodeproj/project.pbxproj_sec2
5092
       148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ExceptionHandlers.mm; sourceTree = "<group>"; };
5105
       148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ExceptionHandlers.mm; sourceTree = "<group>"; };
5093
       14993BE30B2F2B1C0050497F /* FocusController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FocusController.cpp; sourceTree = "<group>"; };
5106
       14993BE30B2F2B1C0050497F /* FocusController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FocusController.cpp; sourceTree = "<group>"; };
5094
       14993BE40B2F2B1C0050497F /* FocusController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FocusController.h; sourceTree = "<group>"; };
5107
       14993BE40B2F2B1C0050497F /* FocusController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FocusController.h; sourceTree = "<group>"; };
5108
       149C78EC100DE610003519BB /* RenderRuby.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRuby.cpp; sourceTree = "<group>"; };
5109
       149C78ED100DE610003519BB /* RenderRuby.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRuby.h; sourceTree = "<group>"; };
5110
       149C78EE100DE610003519BB /* RenderRubyBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRubyBase.cpp; sourceTree = "<group>"; };
5111
       149C78EF100DE610003519BB /* RenderRubyBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRubyBase.h; sourceTree = "<group>"; };
5112
       149C78F0100DE610003519BB /* RenderRubyRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRubyRun.cpp; sourceTree = "<group>"; };
5113
       149C78F1100DE610003519BB /* RenderRubyRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRubyRun.h; sourceTree = "<group>"; };
5114
       149C78F2100DE610003519BB /* RenderRubyText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRubyText.cpp; sourceTree = "<group>"; };
5115
       149C78F3100DE610003519BB /* RenderRubyText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRubyText.h; sourceTree = "<group>"; };
5116
       149C78FC100DE628003519BB /* RubyInlineFlowBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RubyInlineFlowBox.cpp; sourceTree = "<group>"; };
5117
       149C78FD100DE628003519BB /* RubyInlineFlowBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RubyInlineFlowBox.h; sourceTree = "<group>"; };
5118
       149C78FE100DE628003519BB /* RubyRootInlineBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RubyRootInlineBox.cpp; sourceTree = "<group>"; };
5119
       149C78FF100DE628003519BB /* RubyRootInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RubyRootInlineBox.h; sourceTree = "<group>"; };
5120
       149C7904100DE646003519BB /* ruby.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = ruby.css; sourceTree = "<group>"; };
5095
       14C9A5E90B3D105F005A0232 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
5121
       14C9A5E90B3D105F005A0232 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
5096
       14CF787109F587CA00EB3665 /* CSSValue.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValue.idl; sourceTree = "<group>"; };
5122
       14CF787109F587CA00EB3665 /* CSSValue.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValue.idl; sourceTree = "<group>"; };
5097
       14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSValue.cpp; sourceTree = "<group>"; };
5123
       14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSValue.cpp; sourceTree = "<group>"; };
Lines 14224-14229 WebCore/WebCore.xcodeproj/project.pbxproj_sec3
14224
               BC4368E70C226E32005EFB5F /* Rect.h */,
14250
               BC4368E70C226E32005EFB5F /* Rect.h */,
14225
               A80E79960A19BD21007FB8C5 /* Rect.idl */,
14251
               A80E79960A19BD21007FB8C5 /* Rect.idl */,
14226
               858C38EF0AA8FDD100B187A4 /* RGBColor.idl */,
14252
               858C38EF0AA8FDD100B187A4 /* RGBColor.idl */,
14253
               149C7904100DE646003519BB /* ruby.css */,
14227
               A80E6CCA0A1989CA007FB8C5 /* ShadowValue.cpp */,
14254
               A80E6CCA0A1989CA007FB8C5 /* ShadowValue.cpp */,
14228
               A80E6CBE0A1989CA007FB8C5 /* ShadowValue.h */,
14255
               A80E6CBE0A1989CA007FB8C5 /* ShadowValue.h */,
14229
               A80E734C0A199C77007FB8C5 /* StyleBase.cpp */,
14256
               A80E734C0A199C77007FB8C5 /* StyleBase.cpp */,
Lines 14368-14373 WebCore/WebCore.xcodeproj/project.pbxproj_sec4
14368
               A871DFDF0A15376B00B12A68 /* RenderReplaced.h */,
14395
               A871DFDF0A15376B00B12A68 /* RenderReplaced.h */,
14369
               BCA846D40DC67A350026C309 /* RenderReplica.cpp */,
14396
               BCA846D40DC67A350026C309 /* RenderReplica.cpp */,
14370
               BCA846D50DC67A350026C309 /* RenderReplica.h */,
14397
               BCA846D50DC67A350026C309 /* RenderReplica.h */,
14398
               149C78EC100DE610003519BB /* RenderRuby.cpp */,
14399
               149C78ED100DE610003519BB /* RenderRuby.h */,
14400
               149C78EE100DE610003519BB /* RenderRubyBase.cpp */,
14401
               149C78EF100DE610003519BB /* RenderRubyBase.h */,
14402
               149C78F0100DE610003519BB /* RenderRubyRun.cpp */,
14403
               149C78F1100DE610003519BB /* RenderRubyRun.h */,
14404
               149C78F2100DE610003519BB /* RenderRubyText.cpp */,
14405
               149C78F3100DE610003519BB /* RenderRubyText.h */,
14371
               BC3BE9900E9C1C7C00835588 /* RenderScrollbar.cpp */,
14406
               BC3BE9900E9C1C7C00835588 /* RenderScrollbar.cpp */,
14372
               BC3BE9910E9C1C7C00835588 /* RenderScrollbar.h */,
14407
               BC3BE9910E9C1C7C00835588 /* RenderScrollbar.h */,
14373
               BC3BE9AA0E9C242000835588 /* RenderScrollbarPart.cpp */,
14408
               BC3BE9AA0E9C242000835588 /* RenderScrollbarPart.cpp */,
Lines 14441-14446 WebCore/WebCore.xcodeproj/project.pbxproj_sec5
14441
               93799EF70BF2743600D0F230 /* RenderWordBreak.h */,
14476
               93799EF70BF2743600D0F230 /* RenderWordBreak.h */,
14442
               A8CFF5E00A155A05000A4234 /* RootInlineBox.cpp */,
14477
               A8CFF5E00A155A05000A4234 /* RootInlineBox.cpp */,
14443
               A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */,
14478
               A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */,
14479
               149C78FC100DE628003519BB /* RubyInlineFlowBox.cpp */,
14480
               149C78FD100DE628003519BB /* RubyInlineFlowBox.h */,
14481
               149C78FE100DE628003519BB /* RubyRootInlineBox.cpp */,
14482
               149C78FF100DE628003519BB /* RubyRootInlineBox.h */,
14444
               5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */,
14483
               5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */,
14445
               5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */,
14484
               5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */,
14446
               B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */,
14485
               B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */,
Lines 16965-16970 WebCore/WebCore.xcodeproj/project.pbxproj_sec6
16965
               93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
17004
               93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
16966
               E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
17005
               E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
16967
               97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
17006
               97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
17007
               149C78F5100DE610003519BB /* RenderRuby.h in Headers */,
17008
               149C78F7100DE610003519BB /* RenderRubyBase.h in Headers */,
17009
               149C78F9100DE610003519BB /* RenderRubyRun.h in Headers */,
17010
               149C78FB100DE610003519BB /* RenderRubyText.h in Headers */,
17011
               149C7901100DE628003519BB /* RubyInlineFlowBox.h in Headers */,
17012
               149C7903100DE628003519BB /* RubyRootInlineBox.h in Headers */,
16968
           );
17013
           );
16969
           runOnlyForDeploymentPostprocessing = 0;
17014
           runOnlyForDeploymentPostprocessing = 0;
16970
       };
17015
       };
Lines 17074-17079 WebCore/WebCore.xcodeproj/project.pbxproj_sec7
17074
               85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
17119
               85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
17075
               1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
17120
               1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
17076
               1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
17121
               1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
17122
               149C7905100DE646003519BB /* ruby.css in Resources */,
17077
           );
17123
           );
17078
           runOnlyForDeploymentPostprocessing = 0;
17124
           runOnlyForDeploymentPostprocessing = 0;
17079
       };
17125
       };
Lines 18987-18992 WebCore/WebCore.xcodeproj/project.pbxproj_sec8
18987
               93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */,
19033
               93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */,
18988
               E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
19034
               E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
18989
               97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
19035
               97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
19036
               149C78F4100DE610003519BB /* RenderRuby.cpp in Sources */,
19037
               149C78F6100DE610003519BB /* RenderRubyBase.cpp in Sources */,
19038
               149C78F8100DE610003519BB /* RenderRubyRun.cpp in Sources */,
19039
               149C78FA100DE610003519BB /* RenderRubyText.cpp in Sources */,
19040
               149C7900100DE628003519BB /* RubyInlineFlowBox.cpp in Sources */,
19041
               149C7902100DE628003519BB /* RubyRootInlineBox.cpp in Sources */,
18990
           );
19042
           );
18991
           runOnlyForDeploymentPostprocessing = 0;
19043
           runOnlyForDeploymentPostprocessing = 0;
18992
       };
19044
       };
- WebCore/css/CSSStyleSelector.cpp +12 lines
Lines 6-11 WebCore/css/CSSStyleSelector.cpp_sec1
6
 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6
 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7
 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
7
 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
8
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
9
 * Copyright (C) 2009 Google Inc. All rights reserved.
9
 *
10
 *
10
 * This library is free software; you can redistribute it and/or
11
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Library General Public
12
 * modify it under the terms of the GNU Library General Public
Lines 1145-1150 PassRefPtr<RenderStyle> CSSStyleSelector WebCore/css/CSSStyleSelector.cpp_sec2
1145
    }
1146
    }
1146
#endif
1147
#endif
1147
1148
1149
#if ENABLE(RUBY)
1150
    static bool loadedRubyStyleSheet;
1151
    if (!loadedRubyStyleSheet && (e->hasTagName(rubyTag) || e->hasTagName(rpTag) || e->hasTagName(rtTag))) {
1152
        loadedRubyStyleSheet = true;
1153
        String rubyRules = String(rubyUserAgentStyleSheet, sizeof(rubyUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraRubyStyleSheet();
1154
        CSSStyleSheet* rubySheet = parseUASheet(rubyRules);
1155
        defaultStyle->addRulesFromSheet(rubySheet, screenEval());
1156
        defaultPrintStyle->addRulesFromSheet(rubySheet, printEval());
1157
    }
1158
#endif
1159
1148
    int firstUARule = -1, lastUARule = -1;
1160
    int firstUARule = -1, lastUARule = -1;
1149
    int firstUserRule = -1, lastUserRule = -1;
1161
    int firstUserRule = -1, lastUserRule = -1;
1150
    int firstAuthorRule = -1, lastAuthorRule = -1;
1162
    int firstAuthorRule = -1, lastAuthorRule = -1;
- WebCore/css/ruby.css +45 lines
Line 0 WebCore/css/ruby.css_sec1
1
/*
2
 * Copyright (C) 2009 Apple Inc.  All rights reserved.
3
 * Copyright (C) 2009 Google Inc. All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
/* ruby HTML elements */
27
28
ruby {
29
    display: inline;
30
}
31
32
rt {
33
    display: inline-block;
34
}
35
36
ruby > rt {
37
    display: block;
38
    font-size: 60%;         /* make slightly larger than 50% for better readability */
39
    text-align: center;
40
}
41
42
ruby > rp {
43
    display: none;
44
}
45
- WebCore/rendering/InlineBox.h -2 / +11 lines
Lines 137-142 public: WebCore/rendering/InlineBox.h_sec1
137
    virtual bool isInlineFlowBox() const { return false; }
137
    virtual bool isInlineFlowBox() const { return false; }
138
    virtual bool isInlineTextBox() { return false; }
138
    virtual bool isInlineTextBox() { return false; }
139
    virtual bool isRootInlineBox() const { return false; }
139
    virtual bool isRootInlineBox() const { return false; }
140
#if ENABLE(RUBY)
141
   virtual bool isRuby() const { return false; }
142
#endif
140
#if ENABLE(SVG) 
143
#if ENABLE(SVG) 
141
    virtual bool isSVGRootInlineBox() { return false; }
144
    virtual bool isSVGRootInlineBox() { return false; }
142
145
Lines 205-212 public: WebCore/rendering/InlineBox.h_sec2
205
208
206
    int height() const;
209
    int height() const;
207
210
208
    inline int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); }
211
#if ENABLE(RUBY)
209
    inline int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); }
212
   // the bool parameter is only necessary for compatibility when ENABLE(RUBY) is false
213
   virtual int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); }
214
   virtual int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); }
215
#else
216
   inline int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); }
217
   inline int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); }
218
#endif
210
219
211
    virtual int topOverflow() const { return y(); }
220
    virtual int topOverflow() const { return y(); }
212
    virtual int bottomOverflow() const { return y() + height(); }
221
    virtual int bottomOverflow() const { return y() + height(); }
- WebCore/rendering/InlineFlowBox.cpp -6 / +11 lines
Lines 520-528 void InlineFlowBox::placeBoxesVertically WebCore/rendering/InlineFlowBox.cpp_sec1
520
        int overflowTop = 0;
520
        int overflowTop = 0;
521
        int overflowBottom = 0;
521
        int overflowBottom = 0;
522
        if (curr->isText() || curr->isInlineFlowBox()) {
522
        if (curr->isText() || curr->isInlineFlowBox()) {
523
            const Font& font = curr->renderer()->style(m_firstLine)->font();
523
#if ENABLE(RUBY)
524
            newY += curr->baselinePosition(false) - font.ascent();
524
            if (!curr->isRuby())
525
525
#endif
526
            {
527
                const Font& font = curr->renderer()->style(m_firstLine)->font();
528
                newY += curr->baselinePosition(false) - font.ascent();
529
530
                if (curr->isInlineFlowBox())
531
                    newY -= curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop();
532
            } 
533
            
526
            for (ShadowData* shadow = curr->renderer()->style()->textShadow(); shadow; shadow = shadow->next) {
534
            for (ShadowData* shadow = curr->renderer()->style()->textShadow(); shadow; shadow = shadow->next) {
527
                overflowTop = min(overflowTop, shadow->y - shadow->blur);
535
                overflowTop = min(overflowTop, shadow->y - shadow->blur);
528
                overflowBottom = max(overflowBottom, shadow->y + shadow->blur);
536
                overflowBottom = max(overflowBottom, shadow->y + shadow->blur);
Lines 543-551 void InlineFlowBox::placeBoxesVertically WebCore/rendering/InlineFlowBox.cpp_sec2
543
                overflowTop = min(overflowTop, box->reflectionBox().y());
551
                overflowTop = min(overflowTop, box->reflectionBox().y());
544
                overflowBottom = max(overflowBottom, box->reflectionBox().bottom());
552
                overflowBottom = max(overflowBottom, box->reflectionBox().bottom());
545
            }
553
            }
546
547
            if (curr->isInlineFlowBox())
548
                newY -= curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop();
549
        } else if (!curr->renderer()->isBR()) {
554
        } else if (!curr->renderer()->isBR()) {
550
            RenderBox* box = toRenderBox(curr->renderer());
555
            RenderBox* box = toRenderBox(curr->renderer());
551
            newY += box->marginTop();
556
            newY += box->marginTop();
- WebCore/rendering/RenderBlock.cpp -2 / +12 lines
Lines 1305-1310 void RenderBlock::handleBottomOfBlock(in WebCore/rendering/RenderBlock.cpp_sec1
1305
    setCollapsedBottomMargin(marginInfo);
1305
    setCollapsedBottomMargin(marginInfo);
1306
}
1306
}
1307
1307
1308
RenderBox* RenderBlock::firstChildBoxInLayoutOrder() const
1309
{
1310
    return firstChildBox();
1311
}
1312
1313
RenderBox* RenderBlock::nextChildBoxInLayoutOrder(RenderBox* child) const
1314
{
1315
    return child->nextSiblingBox();
1316
}
1317
1308
void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom)
1318
void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom)
1309
{
1319
{
1310
    if (gPercentHeightDescendantsMap) {
1320
    if (gPercentHeightDescendantsMap) {
Lines 1341-1351 void RenderBlock::layoutBlockChildren(bo WebCore/rendering/RenderBlock.cpp_sec2
1341
    int previousFloatBottom = 0;
1351
    int previousFloatBottom = 0;
1342
    maxFloatBottom = 0;
1352
    maxFloatBottom = 0;
1343
1353
1344
    RenderBox* next = firstChildBox();
1354
    RenderBox* next = firstChildBoxInLayoutOrder();
1345
1355
1346
    while (next) {
1356
    while (next) {
1347
        RenderBox* child = next;
1357
        RenderBox* child = next;
1348
        next = child->nextSiblingBox();
1358
        next = nextChildBoxInLayoutOrder(child);
1349
1359
1350
        if (legend == child)
1360
        if (legend == child)
1351
            continue; // Skip the legend, since it has already been positioned up in the fieldset's border.
1361
            continue; // Skip the legend, since it has already been positioned up in the fieldset's border.
- WebCore/rendering/RenderBlock.h +8 lines
Lines 352-357 protected: WebCore/rendering/RenderBlock.h_sec1
352
    virtual bool hasLineIfEmpty() const;
352
    virtual bool hasLineIfEmpty() const;
353
    bool layoutOnlyPositionedObjects();
353
    bool layoutOnlyPositionedObjects();
354
354
355
protected:
356
#if ENABLE(RUBY)
357
    virtual RenderBox* firstChildBoxInLayoutOrder() const; // overridden by ruby
358
    virtual RenderBox* nextChildBoxInLayoutOrder(RenderBox* childBox) const; // overridden by ruby
359
#else
360
    RenderBox* firstChildBoxInLayoutOrder() const;
361
    RenderBox* nextChildBoxInLayoutOrder(RenderBox* childBox) const;
362
#endif
355
    
363
    
356
private:
364
private:
357
    Position positionForBox(InlineBox*, bool start = true) const;
365
    Position positionForBox(InlineBox*, bool start = true) const;
- WebCore/rendering/RenderObject.cpp -28 / +30 lines
Lines 4-9 WebCore/rendering/RenderObject.cpp_sec1
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
5
 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
5
 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7
 * Copyright (C) 2009 Google Inc. All rights reserved.
7
 *
8
 *
8
 * This library is free software; you can redistribute it and/or
9
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Library General Public
10
 * modify it under the terms of the GNU Library General Public
Lines 51-56 WebCore/rendering/RenderObject.cpp_sec2
51
#include <wtf/RefCountedLeakCounter.h>
52
#include <wtf/RefCountedLeakCounter.h>
52
#include <wtf/UnusedParam.h>
53
#include <wtf/UnusedParam.h>
53
54
55
#if ENABLE(RUBY)
56
#include "RenderRuby.h"
57
#include "RenderRubyText.h"
58
#endif
59
54
#if USE(ACCELERATED_COMPOSITING)
60
#if USE(ACCELERATED_COMPOSITING)
55
#include "RenderLayerCompositor.h"
61
#include "RenderLayerCompositor.h"
56
#endif
62
#endif
Lines 101-156 RenderObject* RenderObject::createObject WebCore/rendering/RenderObject.cpp_sec3
101
        return image;
107
        return image;
102
    }
108
    }
103
109
104
    RenderObject* o = 0;
110
#if ENABLE(RUBY)
111
    if (node->hasTagName(rubyTag)) {
112
        if (style->display() == INLINE)
113
            return new (arena) RenderRubyAsInline(node);
114
        else
115
            return new (arena) RenderRubyAsBlock(node);
116
    }
117
    // treat <rt> as ruby text ONLY if it still has its default treatment of block
118
    if (node->hasTagName(rtTag) && style->display() == BLOCK)
119
        return new (arena) RenderRubyText(node); 
120
#endif
105
121
106
    switch (style->display()) {
122
    switch (style->display()) {
107
        case NONE:
123
        case NONE:
108
            break;
124
            return 0;
109
        case INLINE:
125
        case INLINE:
110
            o = new (arena) RenderInline(node);
126
            return new (arena) RenderInline(node);
111
            break;
112
        case BLOCK:
127
        case BLOCK:
113
            o = new (arena) RenderBlock(node);
114
            break;
115
        case INLINE_BLOCK:
128
        case INLINE_BLOCK:
116
            o = new (arena) RenderBlock(node);
117
            break;
118
        case LIST_ITEM:
119
            o = new (arena) RenderListItem(node);
120
            break;
121
        case RUN_IN:
129
        case RUN_IN:
122
        case COMPACT:
130
        case COMPACT:
123
            o = new (arena) RenderBlock(node);
131
            return new (arena) RenderBlock(node);
124
            break;
132
        case LIST_ITEM:
133
            return new (arena) RenderListItem(node);
125
        case TABLE:
134
        case TABLE:
126
        case INLINE_TABLE:
135
        case INLINE_TABLE:
127
            o = new (arena) RenderTable(node);
136
            return new (arena) RenderTable(node);
128
            break;
129
        case TABLE_ROW_GROUP:
137
        case TABLE_ROW_GROUP:
130
        case TABLE_HEADER_GROUP:
138
        case TABLE_HEADER_GROUP:
131
        case TABLE_FOOTER_GROUP:
139
        case TABLE_FOOTER_GROUP:
132
            o = new (arena) RenderTableSection(node);
140
            return new (arena) RenderTableSection(node);
133
            break;
134
        case TABLE_ROW:
141
        case TABLE_ROW:
135
            o = new (arena) RenderTableRow(node);
142
            return new (arena) RenderTableRow(node);
136
            break;
137
        case TABLE_COLUMN_GROUP:
143
        case TABLE_COLUMN_GROUP:
138
        case TABLE_COLUMN:
144
        case TABLE_COLUMN:
139
            o = new (arena) RenderTableCol(node);
145
            return new (arena) RenderTableCol(node);
140
            break;
141
        case TABLE_CELL:
146
        case TABLE_CELL:
142
            o = new (arena) RenderTableCell(node);
147
            return new (arena) RenderTableCell(node);
143
            break;
144
        case TABLE_CAPTION:
148
        case TABLE_CAPTION:
145
            o = new (arena) RenderBlock(node);
149
            return new (arena) RenderBlock(node);
146
            break;
147
        case BOX:
150
        case BOX:
148
        case INLINE_BOX:
151
        case INLINE_BOX:
149
            o = new (arena) RenderFlexibleBox(node);
152
            return new (arena) RenderFlexibleBox(node);
150
            break;
151
    }
153
    }
152
154
153
    return o;
155
    return 0;
154
}
156
}
155
157
156
#ifndef NDEBUG 
158
#ifndef NDEBUG 
- WebCore/rendering/RenderObject.h +8 lines
Lines 4-9 WebCore/rendering/RenderObject.h_sec1
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
5
 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
5
 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
6
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7
 * Copyright (C) 2009 Google Inc. All rights reserved.
7
 *
8
 *
8
 * This library is free software; you can redistribute it and/or
9
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Library General Public
10
 * modify it under the terms of the GNU Library General Public
Lines 292-297 public: WebCore/rendering/RenderObject.h_sec2
292
    bool cellWidthChanged() const { return m_cellWidthChanged; }
293
    bool cellWidthChanged() const { return m_cellWidthChanged; }
293
    void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
294
    void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
294
295
296
#if ENABLE(RUBY)
297
    virtual bool isRuby() const { return false; }
298
    virtual bool isRubyRun() const { return false; }
299
    virtual bool isRubyBase() const { return false; }
300
    virtual bool isRubyText() const { return false; }
301
#endif
302
295
#if ENABLE(SVG)
303
#if ENABLE(SVG)
296
    // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
304
    // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
297
    // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
305
    // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
- WebCore/rendering/RenderRuby.cpp +144 lines
Line 0 WebCore/rendering/RenderRuby.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RenderRuby.h"
22
23
#if ENABLE(RUBY)
24
25
#include "RenderRubyRun.h"
26
#include "RubyInlineFlowBox.h"
27
#include "RubyRootInlineBox.h"
28
29
namespace WebCore {
30
31
//=== ruby as inline object ===
32
33
RenderRubyAsInline::RenderRubyAsInline(Node* node)
34
    : RenderInline(node)
35
{
36
}
37
38
RenderRubyAsInline::~RenderRubyAsInline()
39
{
40
}
41
42
bool RenderRubyAsInline::isChildAllowed(RenderObject* child, RenderStyle*) const
43
{
44
    return child->isRubyRun()
45
        || child->isRubyBase()
46
        || child->isRubyText()
47
        || child->isInline();
48
}
49
50
void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild)
51
{
52
    // only RenderRubyRun objects can be directly added as a child, everything else must be wrapped.
53
    if (child->isRubyRun()) {
54
        RenderInline::addChild(child, beforeChild);
55
        return;
56
    }
57
    // if it's a ruby text, then check if we can add it to the previous run
58
    if (child->isRubyText()) {
59
        RenderObject* prev = beforeChild ? beforeChild->previousSibling() : lastChild();
60
        if (prev && prev->isRubyRun()) {
61
            prev->addChild(child);
62
            return;
63
        }
64
    }
65
    // can't add, or not a ruby text -> must create new run and add it there
66
    RenderObject* rr = createAnonymousRubyRun();
67
    addChild(rr, beforeChild);
68
    rr->addChild(child);
69
}
70
71
RenderRubyRun* RenderRubyAsInline::createAnonymousRubyRun()
72
{
73
    RenderRubyRun* rr = new (renderArena()) RenderRubyRun(document() /* anonymous */);
74
    RefPtr<RenderStyle> newStyle = RenderStyle::create();
75
    newStyle->inheritFrom(style());
76
    newStyle->setDisplay(INLINE_BLOCK); // FIXME: use INLINE_TABLE or a special WEBKIT_RUBY_RUN instead??
77
    rr->setStyle(newStyle.release());
78
    return rr;
79
}
80
81
InlineFlowBox* RenderRubyAsInline::createInlineFlowBox() 
82
{
83
    return new (renderArena()) RubyInlineFlowBox(this);
84
}
85
86
//=== ruby as block object ===
87
88
RenderRubyAsBlock::RenderRubyAsBlock(Node* node)
89
    : RenderBlock(node)
90
{
91
}
92
93
RenderRubyAsBlock::~RenderRubyAsBlock()
94
{
95
}
96
97
bool RenderRubyAsBlock::isChildAllowed(RenderObject* child, RenderStyle*) const
98
{
99
    return child->isRubyRun()
100
        || child->isRubyBase()
101
        || child->isRubyText()
102
        || child->isInline();
103
}
104
105
void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
106
{
107
    // only RenderRubyRun objects can be directly added as a child, everything else must be wrapped.
108
    if (child->isRubyRun()) {
109
        RenderBlock::addChild(child, beforeChild);
110
        return;
111
    }
112
    // if it's a ruby text, then check if we can add it to the previous run
113
    if (child->isRubyText()) {
114
        RenderObject* prev = beforeChild ? beforeChild->previousSibling() : lastChild();
115
        if (prev && prev->isRubyRun()) {
116
            prev->addChild(child);
117
            return;
118
        }
119
    }
120
    // can't add, or not a ruby text -> must create new run and add it there
121
    RenderObject* rr = createAnonymousRubyRun();
122
    addChild(rr, beforeChild);
123
    rr->addChild(child);
124
}
125
126
RenderRubyRun* RenderRubyAsBlock::createAnonymousRubyRun()
127
{
128
    RenderRubyRun* rr = new (renderArena()) RenderRubyRun(document() /* anonymous */);
129
    RefPtr<RenderStyle> newStyle = RenderStyle::create();
130
    newStyle->inheritFrom(style());
131
    newStyle->setDisplay(INLINE_BLOCK); // FIXME: use INLINE_TABLE or a special WEBKIT_RUBY_RUN instead??
132
    rr->setStyle(newStyle.release());
133
    return rr;
134
}
135
136
RootInlineBox* RenderRubyAsBlock::createRootInlineBox() 
137
{
138
    return new (renderArena()) RubyRootInlineBox(this);
139
}
140
141
} // namespace WebCore
142
143
#endif // ENABLE(RUBY)
144
- WebCore/rendering/RenderRuby.h +92 lines
Line 0 WebCore/rendering/RenderRuby.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RenderRuby_h
24
#define RenderRuby_h
25
26
#if ENABLE(RUBY)
27
28
#include "RenderInline.h"
29
#include "RenderBlock.h"
30
31
namespace WebCore {
32
33
class RenderRubyRun;
34
35
// Following the HTML 5 spec, the box object model for a <ruby> element looks as follows:
36
//
37
// 1 RenderRuby object, corresponding to the whole <ruby> HTML element 
38
//    1+ RenderRubyRun object(s), each one wrapping a ruby base with its corresponding ruby text(s)
39
//        1 RenderRubyBase object
40
//           n inline object(s)
41
//        0+ RenderRubyText object(s)
42
//           n inline object(s)
43
//
44
// Note: <rp> elements are defined as having 'display:none' and thus normally are not assigned a renderer.
45
//
46
// This structure allows both several runs of ruby bases with their respective ruby texts (see HTML5 spec).
47
48
// <ruby> when used as 'display:inline' 
49
class RenderRubyAsInline : public RenderInline {
50
public:
51
    RenderRubyAsInline(Node*);
52
    virtual ~RenderRubyAsInline();
53
54
    virtual const char* renderName() const { return "RenderRuby (inline)"; }
55
56
    virtual bool isRuby() const { return true; }
57
58
    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
59
    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
60
61
   InlineFlowBox* createInlineFlowBox();
62
63
private:
64
    RenderRubyRun* createAnonymousRubyRun();
65
};
66
67
// <ruby> when used as 'display:block' or 'display:inline-block'
68
class RenderRubyAsBlock : public RenderBlock {
69
public:
70
    RenderRubyAsBlock(Node*);
71
    virtual ~RenderRubyAsBlock();
72
73
    virtual const char* renderName() const { return "RenderRuby (block)"; }
74
75
    virtual bool isRuby() const { return true; }
76
77
    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
78
    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
79
80
    virtual bool shouldPaintSelectionGaps() const { return false; }
81
82
    virtual RootInlineBox* createRootInlineBox();
83
84
private:
85
    RenderRubyRun* createAnonymousRubyRun();
86
};
87
88
} // namespace WebCore
89
90
#endif // ENABLE(RUBY)
91
92
#endif // RenderRuby_h
- WebCore/rendering/RenderRubyBase.cpp +45 lines
Line 0 WebCore/rendering/RenderRubyBase.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RenderRubyBase.h"
22
23
#if ENABLE(RUBY)
24
25
namespace WebCore {
26
27
RenderRubyBase::RenderRubyBase(Node* node)
28
    : RenderBlock(node)
29
{
30
    setInline(false);
31
}
32
33
RenderRubyBase::~RenderRubyBase()
34
{
35
}
36
37
bool RenderRubyBase::isChildAllowed(RenderObject* child, RenderStyle*) const
38
{
39
    return child->isInline();
40
}
41
42
} // namespace WebCore
43
44
#endif // ENABLE(RUBY)
45
- WebCore/rendering/RenderRubyBase.h +48 lines
Line 0 WebCore/rendering/RenderRubyBase.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RenderRubyBase_h
24
#define RenderRubyBase_h
25
26
#if ENABLE(RUBY)
27
28
#include "RenderBlock.h"
29
30
namespace WebCore {
31
32
class RenderRubyBase : public RenderBlock {
33
public:
34
    RenderRubyBase(Node*);
35
    virtual ~RenderRubyBase();
36
37
    virtual const char* renderName() const { return isAnonymous() ? "RenderRubyBase (anonymous)" : "RenderRubyBase"; }
38
39
    virtual bool isRubyBase() const { return true; }
40
41
    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
42
};
43
44
} // namespace WebCore
45
46
#endif // ENABLE(RUBY)
47
48
#endif // RenderRubyBase_h
- WebCore/rendering/RenderRubyRun.cpp +241 lines
Line 0 WebCore/rendering/RenderRubyRun.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RenderRubyRun.h"
22
23
#if ENABLE(RUBY)
24
25
#include "RenderRubyBase.h"
26
#include "RenderRubyText.h"
27
#include "RenderView.h"
28
29
using namespace std;
30
31
namespace WebCore {
32
33
RenderRubyRun::RenderRubyRun(Node* node)
34
    : RenderBlock(node)
35
{
36
    setReplaced(true);
37
    setInline(true);
38
}
39
40
RenderRubyRun::~RenderRubyRun()
41
{
42
}
43
44
bool RenderRubyRun::hasRubyBase() const
45
{
46
    // normally, the base should be the first child (provided it has already been added)
47
    ASSERT(!firstChild() || firstChild()->isRubyBase());
48
    
49
    return getRubyBase();
50
}
51
52
int RenderRubyRun::numberOfRubyTexts() const
53
{
54
     // normally, the first child should be the base, not a text
55
    ASSERT(!firstChild() || firstChild()->isRubyBase());
56
57
    int n = 0;
58
    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
59
        if (child->isRubyText())
60
            ++n;
61
    }
62
    return n;
63
}
64
65
int RenderRubyRun::baselinePosition(bool firstLine, bool isRootLineBox) const
66
{
67
    RenderRubyBase* rb = getRubyBase();
68
    // FIXME: should we pass 'isRootLineBox' below, or just 'false'?
69
    return rb ? rb->y() + rb->baselinePosition(firstLine, isRootLineBox) : -1;
70
}
71
72
RenderBlock* RenderRubyRun::firstLineBlock() const
73
{
74
    return 0;
75
}
76
77
void RenderRubyRun::updateFirstLetter()
78
{
79
}
80
81
bool RenderRubyRun::isChildAllowed(RenderObject* child, RenderStyle*) const
82
{
83
    return child->isRubyBase()
84
        || child->isRubyText()
85
        || child->isInline();
86
}
87
88
void RenderRubyRun::addChild(RenderObject* child, RenderObject* beforeChild)
89
{
90
    if (!beforeChild && isAfterContent(lastChild()))
91
        beforeChild = lastChild();
92
    
93
    // RenderRubyText
94
    if (child->isRubyText()) {
95
        RenderBlock::addChild(child, beforeChild);
96
        return;
97
    }
98
    // RenderRubyBase
99
    if (child->isRubyBase()) {
100
        RenderBlock::addChild(child, beforeChild);
101
        return;
102
    }
103
    // plain text or other inline elements -> append to previous RenderRubyBase if existent, otherwise create anonymous RenderRubyBase
104
    RenderObject* prev = beforeChild ? beforeChild->previousSibling() : lastChild();
105
    if (prev && prev->isRubyBase()) {
106
        prev->addChild(child);
107
        return;
108
    }
109
    RenderObject* rb = createAnonymousRubyBase();
110
    addChild(rb, beforeChild);
111
    rb->addChild(child);
112
}
113
114
RenderBox* RenderRubyRun::firstChildBoxInLayoutOrder() const
115
{
116
    ASSERT(hasRubyBase());
117
118
    // first layout all 'BEFORE' texts, in reverse order
119
    for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) {
120
        if (child->isRubyText() && effectiveRubyPosition(child) == RP_BEFORE)
121
            return child;
122
    }
123
124
    // if there are no 'BEFORE' texts, start with the base 
125
    // (this shouldn't return NULL - if it does it just means that we also disregard all 'AFTER' texts)
126
    return getRubyBase();
127
}
128
129
RenderBox* RenderRubyRun::nextChildBoxInLayoutOrder(RenderBox* child) const
130
{
131
    ASSERT(hasRubyBase());
132
133
    // if the current child is a 'BEFORE' text, search for other BEFORE texts in reverse order
134
    // Note: there should only be 1 such text per se, but even in well-formed HTML/CSS, the designer could 
135
    // have explicitely set 'ruby-position: before' for all texts (once we support ruby-position)
136
    if (child->isRubyText() && effectiveRubyPosition(child) == RP_BEFORE) {
137
        for (child = child->previousSiblingBox(); child; child = child->previousSiblingBox()) {
138
            if (child->isRubyText() && effectiveRubyPosition(child) == RP_BEFORE)
139
                return child;
140
        }
141
142
        // no other 'BEFORE' texts found, continue with the base container
143
        // (this shouldn't return NULL - if it does it just means that we also disregard all 'AFTER' texts)
144
        return getRubyBase();
145
    }
146
147
    // if we just had a ruby base, then for defense-depth purposes, look for other bases just to be sure
148
    if (child->isRubyBase()) {
149
        for (child = child->nextSiblingBox(); child; child = child->nextSiblingBox()) {
150
            if (child->isRubyBase()) {
151
                ASSERT(false);  // this shouldn't happen, the 2nd base should have formed a new RenderRubyRun
152
                return child;
153
            }
154
        }
155
156
        // if there are no spurious additional bases, return the first AFTER text
157
        for (child = firstChildBox(); child; child = child->nextSiblingBox()) {
158
            if (child->isRubyText() && effectiveRubyPosition(child) == RP_AFTER)
159
                return child;
160
        }
161
162
        return NULL;
163
    }
164
165
    // otherwise continue with the next 'AFTER' text
166
    // Note: there should only be 1 such text per se, but even in well-formed HTML/CSS, the designer could 
167
    // have explicitely set 'ruby-position: after' for all texts (once we support ruby-position)
168
    ASSERT(child->isRubyText() && effectiveRubyPosition(child) == RP_AFTER);
169
    for (child = child->nextSiblingBox(); child; child = child->nextSiblingBox()) {
170
        if (child->isRubyText() && effectiveRubyPosition(child) == RP_AFTER)
171
            return child;
172
    }
173
174
    return NULL;
175
}
176
177
ERubyPosition RenderRubyRun::effectiveRubyPosition(RenderObject* child) const
178
{
179
    ASSERT(child->isRubyText());
180
    // ruby-position CSS property not implemented.
181
    // simply position the first <rt> in BEFORE position, the 2nd in AFTER position
182
    for (RenderObject* sibling = child->previousSibling(); sibling; sibling = sibling->previousSibling()) {
183
        if (sibling->isRubyText() && effectiveRubyPosition(sibling) == RP_BEFORE)
184
            return RP_AFTER;
185
    }
186
    return RP_BEFORE;
187
}
188
189
RenderRubyBase* RenderRubyRun::getRubyBase() const
190
{
191
    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
192
        if (child->isRubyBase())
193
            return static_cast<RenderRubyBase*>(child);
194
    }
195
    return NULL;
196
}
197
198
RenderRubyText* RenderRubyRun::getFirstRubyText() const
199
{
200
    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
201
        if (child->isRubyText())
202
            return static_cast<RenderRubyText*>(child);
203
    }
204
    return NULL;
205
}
206
207
RenderRubyText* RenderRubyRun::getLastRubyText() const
208
{
209
    for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
210
        if (child->isRubyText())
211
            return static_cast<RenderRubyText*>(child);
212
    }
213
    return NULL;
214
}
215
216
RenderRubyBase* RenderRubyRun::createAnonymousRubyBase()
217
{
218
    RenderRubyBase* rb = new (renderArena()) RenderRubyBase(document() /* anonymous */);
219
    RefPtr<RenderStyle> newStyle = RenderStyle::create();
220
    newStyle->inheritFrom(style());
221
    newStyle->setDisplay(BLOCK);
222
    newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER?
223
    rb->setStyle(newStyle.release());
224
    return rb;
225
}
226
227
RenderRubyText* RenderRubyRun::createAnonymousRubyText()
228
{
229
    RenderRubyText* rt = new (renderArena()) RenderRubyText(document() /* anonymous */);
230
    RefPtr<RenderStyle> newStyle = RenderStyle::create();
231
    newStyle->inheritFrom(style());
232
    newStyle->setDisplay(BLOCK);
233
    newStyle->setTextAlign(CENTER); // FIXME: temporary solution - need DISTRIBUTE_LETTERS/SPACES
234
    rt->setStyle(newStyle.release());
235
    return rt;
236
}
237
238
} // namespace WebCore
239
240
#endif // ENABLE(RUBY)
241
- WebCore/rendering/RenderRubyRun.h +80 lines
Line 0 WebCore/rendering/RenderRubyRun.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RenderRubyRun_h
24
#define RenderRubyRun_h
25
26
#if ENABLE(RUBY)
27
28
#include "RenderBlock.h"
29
30
namespace WebCore {
31
32
class RenderRubyBase;
33
class RenderRubyText;
34
35
// RenderRubyRun are 'inline-block/table' like objects,and wrap a single pairing of a ruby base with its ruby text(s).
36
// See RenderRuby.h for further comments on the structure
37
38
class RenderRubyRun : public RenderBlock {
39
public:
40
    RenderRubyRun(Node*);
41
    virtual ~RenderRubyRun();
42
43
    virtual const char* renderName() const { return "RenderRubyRun (anonymous)"; }
44
45
    virtual bool isRubyRun() const { return true; }
46
    virtual bool isInlineBlockOrInlineTable() const { return true; }
47
48
    bool hasRubyBase() const;
49
    int  numberOfRubyTexts() const;
50
51
    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
52
    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
53
54
    virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
55
56
    virtual RenderBlock* firstLineBlock() const;
57
    virtual void updateFirstLetter();
58
59
    virtual bool shouldPaintSelectionGaps() const { return false; }
60
61
    RenderRubyBase* getRubyBase() const;
62
    RenderRubyText* getFirstRubyText() const;
63
    RenderRubyText* getLastRubyText() const;
64
    
65
    ERubyPosition effectiveRubyPosition(RenderObject* child) const;
66
    
67
protected:
68
    virtual RenderBox* firstChildBoxInLayoutOrder() const;        
69
    virtual RenderBox* nextChildBoxInLayoutOrder(RenderBox* childBox) const; 
70
71
private:
72
    RenderRubyBase* createAnonymousRubyBase();
73
    RenderRubyText* createAnonymousRubyText();
74
};
75
76
} // namespace WebCore
77
78
#endif // ENABLE(RUBY)
79
80
#endif // RenderRubyRun_h
- WebCore/rendering/RenderRubyText.cpp +45 lines
Line 0 WebCore/rendering/RenderRubyText.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RenderRubyText.h"
22
23
#if ENABLE(RUBY)
24
25
namespace WebCore {
26
27
RenderRubyText::RenderRubyText(Node* node)
28
    : RenderBlock(node)
29
{
30
}
31
32
RenderRubyText::~RenderRubyText()
33
{
34
}
35
36
bool RenderRubyText::isChildAllowed(RenderObject* child, RenderStyle*) const
37
{
38
    return child->isInline();
39
}
40
41
} // namespace WebCore
42
43
#endif // ENABLE(RUBY)
44
45
- WebCore/rendering/RenderRubyText.h +48 lines
Line 0 WebCore/rendering/RenderRubyText.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RenderRubyText_h
24
#define RenderRubyText_h
25
26
#if ENABLE(RUBY)
27
28
#include "RenderBlock.h"
29
30
namespace WebCore {
31
32
class RenderRubyText : public RenderBlock {
33
public:
34
    RenderRubyText(Node*);
35
    virtual ~RenderRubyText();
36
37
    virtual const char* renderName() const { return "RenderRubyText"; }
38
39
    virtual bool isRubyText() const { return true; }
40
41
    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
42
};
43
44
} // namespace WebCore
45
46
#endif // ENABLE(RUBY)
47
48
#endif // RenderRubyText_h
- WebCore/rendering/RenderTheme.h -1 / +4 lines
Lines 78-89 public: WebCore/rendering/RenderTheme.h_sec1
78
    // RenderThemeMac.cpp for Mac OS X.
78
    // RenderThemeMac.cpp for Mac OS X.
79
79
80
    // These methods return the theme's extra style sheets rules, to let each platform
80
    // These methods return the theme's extra style sheets rules, to let each platform
81
    // adjust the default CSS rules in html.css, quirks.css, or mediaControls.css
81
    // adjust the default CSS rules in html.css, quirks.css, mediaControls.css, or ruby.css
82
    virtual String extraDefaultStyleSheet() { return String(); }
82
    virtual String extraDefaultStyleSheet() { return String(); }
83
    virtual String extraQuirksStyleSheet() { return String(); }
83
    virtual String extraQuirksStyleSheet() { return String(); }
84
#if ENABLE(VIDEO)
84
#if ENABLE(VIDEO)
85
    virtual String extraMediaControlsStyleSheet() { return String(); };
85
    virtual String extraMediaControlsStyleSheet() { return String(); };
86
#endif
86
#endif
87
#if ENABLE(RUBY)
88
    virtual String extraRubyStyleSheet() { return String(); };
89
#endif
87
90
88
    // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline
91
    // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline
89
    // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
92
    // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
- WebCore/rendering/RubyInlineFlowBox.cpp +77 lines
Line 0 WebCore/rendering/RubyInlineFlowBox.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RubyInlineFlowBox.h"
22
23
#if ENABLE(RUBY)
24
25
namespace WebCore {
26
27
using namespace std;
28
29
30
RubyInlineFlowBox::RubyInlineFlowBox(RenderObject* obj)
31
    : InlineFlowBox(obj)
32
    , m_cachedHeight(0)
33
    , m_cachedBaseline(0)
34
{
35
    setHasVirtualHeight();
36
}
37
38
int RubyInlineFlowBox::virtualHeight() const
39
{
40
    if (m_cachedHeight <= 0)
41
        computeHeightAndBaseline();
42
43
    return m_cachedHeight;
44
}
45
46
int RubyInlineFlowBox::baselinePosition(bool) const
47
{
48
    if (m_cachedBaseline <= 0)
49
        computeHeightAndBaseline();
50
51
    return m_cachedBaseline;
52
}
53
54
void RubyInlineFlowBox::computeHeightAndBaseline() const
55
{
56
    int maxAscent = 0;
57
    int maxDescent = 0;
58
59
    for (InlineBox* run = firstChild(); run; run = run->nextOnLine()) {
60
        int runHeight = run->height();
61
        int runBaseline = run->baselinePosition(false);
62
        int y = run->y();
63
        int ascent = y + runBaseline;
64
        int descent = runHeight - runBaseline;
65
        maxAscent = max(maxAscent, ascent);
66
        maxDescent = max(maxDescent, descent);
67
    }
68
    
69
    m_cachedBaseline = maxAscent + borderTop() + paddingTop();
70
    m_cachedHeight = m_cachedBaseline + maxDescent + borderBottom() + paddingBottom();
71
    ASSERT(m_cachedBaseline >= 0);
72
    ASSERT(m_cachedHeight >= 0);
73
}
74
75
} // namespace WebCore
76
77
#endif // ENABLE(RUBY)
- WebCore/rendering/RubyInlineFlowBox.h +54 lines
Line 0 WebCore/rendering/RubyInlineFlowBox.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RubyInlineFlowBox_h
24
#define RubyInlineFlowBox_h
25
26
#if ENABLE(RUBY)
27
28
#include "InlineFlowBox.h"
29
30
namespace WebCore {
31
32
class RubyInlineFlowBox : public InlineFlowBox {
33
public:
34
    RubyInlineFlowBox(RenderObject* obj);
35
36
    virtual bool isRuby() const { return true; }
37
38
    virtual int virtualHeight() const;
39
    virtual int baselinePosition(bool /*isRootLineBox*/) const;
40
    virtual int lineHeight(bool /*isRootLineBox*/) const { return height(); }
41
42
protected:
43
    void computeHeightAndBaseline() const; // operates on mutable members only
44
45
private:
46
    mutable int m_cachedHeight;
47
    mutable int m_cachedBaseline;
48
};
49
50
} // namespace WebCore
51
52
#endif // ENABLE(RUBY)
53
54
#endif // RubyInlineFlowBox_h
- WebCore/rendering/RubyRootInlineBox.cpp +34 lines
Line 0 WebCore/rendering/RubyRootInlineBox.cpp_sec1
1
/*
2
 * Copyright (C) 2009 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "RubyRootInlineBox.h"
22
23
#if ENABLE(RUBY)
24
25
namespace WebCore {
26
27
RubyRootInlineBox::RubyRootInlineBox(RenderObject* obj)
28
   : RootInlineBox(obj)
29
{
30
}
31
32
} // namespace WebCore
33
34
#endif // ENABLE(RUBY)
- WebCore/rendering/RubyRootInlineBox.h +43 lines
Line 0 WebCore/rendering/RubyRootInlineBox.h_sec1
1
/*
2
 * This file is part of the WebKit project.
3
 *
4
 * Copyright (C) 2009 Google Inc. All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 *
21
 */
22
23
#ifndef RubyRootInlineBox_h
24
#define RubyRootInlineBox_h
25
26
#if ENABLE(RUBY)
27
28
#include "RootInlineBox.h"
29
30
namespace WebCore {
31
32
class RubyRootInlineBox : public RootInlineBox {
33
public:
34
    RubyRootInlineBox(RenderObject* obj);
35
36
    virtual bool isRuby() const { return true; }
37
};
38
39
} // namespace WebCore
40
41
#endif // ENABLE(RUBY)
42
43
#endif // RubyRootInlineBox_h
- WebCore/rendering/style/RenderStyleConstants.h +9 lines
Lines 304-309 enum ETransformStyle3D { WebCore/rendering/style/RenderStyleConstants.h_sec1
304
enum EBackfaceVisibility {
304
enum EBackfaceVisibility {
305
    BackfaceVisibilityVisible, BackfaceVisibilityHidden
305
    BackfaceVisibilityVisible, BackfaceVisibilityHidden
306
};
306
};
307
    
308
#if ENABLE(RUBY)
309
enum ERubyPosition {
310
//  RP_AUTO, // <- see http://www.w3.org/Style/CSS/Tracker/issues/107
311
    RP_BEFORE,
312
    RP_AFTER,
313
//  RP_RIGHT
314
};
315
#endif
307
316
308
} // namespace WebCore
317
} // namespace WebCore
309
318

Return to Bug 3749