Skip to content

Commit

Permalink
servo: Merge #5868 - Implement Body.bgColor and Document.bgColor (fro…
Browse files Browse the repository at this point in the history
…m nox:document-legacy); r=jdm

Source-Repo: https://github.com/servo/servo
Source-Revision: 9ec2ce0decff852f24280a59c779220f243bcff6

UltraBlame original commit: 4f0f92d870fd6259feb58cf81a782298f2d14f48
  • Loading branch information
marco-c committed Oct 1, 2019
1 parent 685dc02 commit 027dcbd
Show file tree
Hide file tree
Showing 4 changed files with 670 additions and 34 deletions.
203 changes: 202 additions & 1 deletion servo/components/script/dom/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ InheritTypes
{
DocumentDerived
EventCast
HTMLElementCast
HTMLBodyElementCast
}
;
use
Expand All @@ -240,6 +240,7 @@ InheritTypes
:
:
{
HTMLElementCast
HTMLHeadElementCast
ElementCast
}
Expand Down Expand Up @@ -2110,6 +2111,32 @@ Node
>
>
;
fn
get_body_attribute
(
self
local_name
:
&
Atom
)
-
>
DOMString
;
fn
set_body_attribute
(
self
local_name
:
&
Atom
value
:
DOMString
)
;
/
/
/
Expand Down Expand Up @@ -6493,6 +6520,133 @@ r
}
}
fn
get_body_attribute
(
self
local_name
:
&
Atom
)
-
>
DOMString
{
match
self
.
GetBody
(
)
.
and_then
(
HTMLBodyElementCast
:
:
to_temporary
)
.
root
(
)
{
Some
(
ref
body
)
=
>
{
ElementCast
:
:
from_ref
(
body
.
r
(
)
)
.
get_string_attribute
(
local_name
)
}
None
=
>
"
"
.
to_owned
(
)
}
}
fn
set_body_attribute
(
self
local_name
:
&
Atom
value
:
DOMString
)
{
if
let
Some
(
ref
body
)
=
self
.
GetBody
(
)
.
and_then
(
HTMLBodyElementCast
:
:
to_temporary
)
.
root
(
)
{
ElementCast
:
:
from_ref
(
body
.
r
(
)
)
.
set_string_attribute
(
local_name
value
)
;
}
}
fn
set_current_script
(
self
Expand Down Expand Up @@ -13188,6 +13342,53 @@ Ok
)
)
}
fn
BgColor
(
self
)
-
>
DOMString
{
self
.
get_body_attribute
(
&
atom
!
(
"
bgcolor
"
)
)
}
fn
SetBgColor
(
self
value
:
DOMString
)
{
self
.
set_body_attribute
(
&
atom
!
(
"
bgcolor
"
)
value
)
}
global_event_handlers
!
(
Expand Down
44 changes: 44 additions & 0 deletions servo/components/script/dom/htmlbodyelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ cssparser
RGBA
;
use
string_cache
:
:
Atom
;
use
util
:
:
Expand Down Expand Up @@ -493,6 +499,44 @@ a
HTMLBodyElement
>
{
/
/
https
:
/
/
html
.
spec
.
whatwg
.
org
/
#
dom
-
body
-
bgcolor
make_getter
!
(
BgColor
"
bgcolor
"
)
;
make_setter
!
(
SetBgColor
"
bgcolor
"
)
;
fn
GetOnunload
(
Expand Down
Loading

0 comments on commit 027dcbd

Please sign in to comment.