mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Organize all the source files into compiler/, components/, and platform/.
This commit is contained in:
parent
5e406fab7e
commit
7caa209039
267 changed files with 349 additions and 244 deletions
116
.gitmodules
vendored
116
.gitmodules
vendored
|
@ -1,87 +1,87 @@
|
|||
[submodule "src/rust-azure"]
|
||||
path = src/rust-azure
|
||||
[submodule "src/support/azure/rust-azure"]
|
||||
path = src/support/azure/rust-azure
|
||||
url = https://github.com/mozilla-servo/rust-azure.git
|
||||
[submodule "src/rust-cocoa"]
|
||||
path = src/rust-cocoa
|
||||
[submodule "src/platform/macos/rust-cocoa"]
|
||||
path = src/platform/macos/rust-cocoa
|
||||
url = https://github.com/mozilla-servo/rust-cocoa.git
|
||||
[submodule "src/mozjs"]
|
||||
path = src/mozjs
|
||||
[submodule "src/support/spidermonkey/mozjs"]
|
||||
path = src/support/spidermonkey/mozjs
|
||||
url = https://github.com/mozilla-servo/mozjs.git
|
||||
[submodule "src/rust-mozjs"]
|
||||
path = src/rust-mozjs
|
||||
[submodule "src/support/spidermonkey/rust-mozjs"]
|
||||
path = src/support/spidermonkey/rust-mozjs
|
||||
url = https://github.com/mozilla-servo/rust-mozjs.git
|
||||
[submodule "src/rust-harfbuzz"]
|
||||
path = src/rust-harfbuzz
|
||||
[submodule "src/support/harfbuzz/rust-harfbuzz"]
|
||||
path = src/support/harfbuzz/rust-harfbuzz
|
||||
url = https://github.com/mozilla-servo/rust-harfbuzz.git
|
||||
[submodule "src/rust-stb-image"]
|
||||
path = src/rust-stb-image
|
||||
[submodule "src/support/stb-image/rust-stb-image"]
|
||||
path = src/support/stb-image/rust-stb-image
|
||||
url = https://github.com/mozilla-servo/rust-stb-image.git
|
||||
[submodule "src/rust-geom"]
|
||||
path = src/rust-geom
|
||||
[submodule "src/support/geom/rust-geom"]
|
||||
path = src/support/geom/rust-geom
|
||||
url = https://github.com/mozilla-servo/rust-geom.git
|
||||
[submodule "src/rust-opengles"]
|
||||
path = src/rust-opengles
|
||||
[submodule "src/support/opengles/rust-opengles"]
|
||||
path = src/support/opengles/rust-opengles
|
||||
url = https://github.com/mozilla-servo/rust-opengles.git
|
||||
[submodule "src/rust-glut"]
|
||||
path = src/rust-glut
|
||||
[submodule "src/support/glut/rust-glut"]
|
||||
path = src/support/glut/rust-glut
|
||||
url = https://github.com/mozilla-servo/rust-glut.git
|
||||
[submodule "src/rust-layers"]
|
||||
path = src/rust-layers
|
||||
[submodule "src/support/layers/rust-layers"]
|
||||
path = src/support/layers/rust-layers
|
||||
url = https://github.com/mozilla-servo/rust-layers.git
|
||||
[submodule "src/rust-http-client"]
|
||||
path = src/rust-http-client
|
||||
[submodule "src/support/http-client/rust-http-client"]
|
||||
path = src/support/http-client/rust-http-client
|
||||
url = https://github.com/mozilla-servo/rust-http-client.git
|
||||
[submodule "src/libhubbub"]
|
||||
path = src/libhubbub
|
||||
[submodule "src/support/hubbub/libhubbub"]
|
||||
path = src/support/hubbub/libhubbub
|
||||
url = https://github.com/mozilla-servo/libhubbub.git
|
||||
[submodule "src/libparserutils"]
|
||||
path = src/libparserutils
|
||||
[submodule "src/support/libparserutils/libparserutils"]
|
||||
path = src/support/libparserutils/libparserutils
|
||||
url = https://github.com/mozilla-servo/libparserutils.git
|
||||
[submodule "src/rust-hubbub"]
|
||||
path = src/rust-hubbub
|
||||
[submodule "src/support/hubbub/rust-hubbub"]
|
||||
path = src/support/hubbub/rust-hubbub
|
||||
url = https://github.com/mozilla-servo/rust-hubbub.git
|
||||
[submodule "src/rust-core-foundation"]
|
||||
path = src/rust-core-foundation
|
||||
[submodule "src/platform/macos/rust-core-foundation"]
|
||||
path = src/platform/macos/rust-core-foundation
|
||||
url = https://github.com/mozilla-servo/rust-core-foundation.git
|
||||
[submodule "src/rust-io-surface"]
|
||||
path = src/rust-io-surface
|
||||
[submodule "src/platform/macos/rust-io-surface"]
|
||||
path = src/platform/macos/rust-io-surface
|
||||
url = https://github.com/mozilla-servo/rust-io-surface.git
|
||||
[submodule "src/sharegl"]
|
||||
path = src/sharegl
|
||||
[submodule "src/support/sharegl/sharegl"]
|
||||
path = src/support/sharegl/sharegl
|
||||
url = https://github.com/mozilla-servo/sharegl.git
|
||||
[submodule "src/libwapcaplet"]
|
||||
path = src/libwapcaplet
|
||||
[submodule "src/support/wapcaplet/libwapcaplet"]
|
||||
path = src/support/wapcaplet/libwapcaplet
|
||||
url = https://github.com/mozilla-servo/libwapcaplet.git
|
||||
[submodule "src/libcss"]
|
||||
path = src/libcss
|
||||
[submodule "src/support/css/libcss"]
|
||||
path = src/support/css/libcss
|
||||
url = https://github.com/mozilla-servo/libcss.git
|
||||
[submodule "src/rust-netsurfcss"]
|
||||
path = src/rust-netsurfcss
|
||||
[submodule "src/support/netsurfcss/rust-netsurfcss"]
|
||||
path = src/support/netsurfcss/rust-netsurfcss
|
||||
url = https://github.com/mozilla-servo/rust-netsurfcss.git
|
||||
[submodule "src/rust-wapcaplet"]
|
||||
path = src/rust-wapcaplet
|
||||
[submodule "src/support/wapcaplet/rust-wapcaplet"]
|
||||
path = src/support/wapcaplet/rust-wapcaplet
|
||||
url = https://github.com/mozilla-servo/rust-wapcaplet.git
|
||||
[submodule "src/rust-core-graphics"]
|
||||
path = src/rust-core-graphics
|
||||
[submodule "src/platform/macos/rust-core-graphics"]
|
||||
path = src/platform/macos/rust-core-graphics
|
||||
url = https://github.com/mozilla-servo/rust-core-graphics.git
|
||||
[submodule "src/rust-core-text"]
|
||||
path = src/rust-core-text
|
||||
[submodule "src/platform/macos/rust-core-text"]
|
||||
path = src/platform/macos/rust-core-text
|
||||
url = https://github.com/mozilla-servo/rust-core-text.git
|
||||
[submodule "src/rust-freetype"]
|
||||
path = src/rust-freetype
|
||||
[submodule "src/platform/linux/rust-freetype"]
|
||||
path = src/platform/linux/rust-freetype
|
||||
url = https://github.com/mozilla-servo/rust-freetype.git
|
||||
[submodule "src/rust-fontconfig"]
|
||||
path = src/rust-fontconfig
|
||||
[submodule "src/platform/linux/rust-fontconfig"]
|
||||
path = src/platform/linux/rust-fontconfig
|
||||
url = https://github.com/mozilla-servo/rust-fontconfig.git
|
||||
[submodule "src/rust-xlib"]
|
||||
path = src/rust-xlib
|
||||
[submodule "src/platform/linux/rust-xlib"]
|
||||
path = src/platform/linux/rust-xlib
|
||||
url = https://github.com/mozilla-servo/rust-xlib.git
|
||||
[submodule "src/rust-css"]
|
||||
path = src/rust-css
|
||||
[submodule "src/support/css/rust-css"]
|
||||
path = src/support/css/rust-css
|
||||
url = https://github.com/mozilla-servo/rust-css.git
|
||||
[submodule "src/skia"]
|
||||
path = src/skia
|
||||
[submodule "src/support/skia/skia"]
|
||||
path = src/support/skia/skia
|
||||
url = https://github.com/mozilla-servo/skia.git
|
||||
[submodule "src/rust"]
|
||||
path = src/rust
|
||||
[submodule "src/compiler/rust"]
|
||||
path = src/compiler/rust
|
||||
url = https://github.com/mozilla/rust.git
|
||||
|
|
76
Makefile.in
76
Makefile.in
|
@ -78,10 +78,10 @@ $(S)config.stamp : $(S)configure $(S)Makefile.in
|
|||
# Build the compiler
|
||||
ifneq ($(CFG_LOCAL_RUSTC),1)
|
||||
$(CFG_RUSTC):
|
||||
$(MAKE) -C "$(CFG_BUILD_DIR)src/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS=""
|
||||
$(MAKE) -C "$(CFG_BUILD_DIR)src/compiler/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS=""
|
||||
|
||||
clean-rust:
|
||||
$(MAKE) -C "$(CFG_BUILD_DIR)src/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS="" clean
|
||||
$(MAKE) -C "$(CFG_BUILD_DIR)src/compiler/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS="" clean
|
||||
else
|
||||
$(CFG_RUSTC):
|
||||
|
||||
|
@ -91,6 +91,13 @@ endif
|
|||
|
||||
rust: $(CFG_RUSTC)
|
||||
|
||||
# Strip off submodule paths to determine "raw" submodule names.
|
||||
SUBMODULES=$(shell echo $(CFG_SUBMODULES) | perl -p -e 's![A-Za-z0-9_-]+/!!g')
|
||||
|
||||
# Define e.g. PATH_rust-io-surface = platform/macos/rust-io-surface
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval PATH_$(shell echo $(submodule) | perl -p -e 's![A-Za-z0-9_-]+/!!g') = $(submodule)))
|
||||
|
||||
define DEF_SUBMODULE_VARS
|
||||
|
||||
#defaults
|
||||
|
@ -106,29 +113,34 @@ endif
|
|||
#
|
||||
# We can't auto-compute this, because some modules have lib* prefix in
|
||||
# their name already, while others don't.
|
||||
DONE_$(1) = $$(B)src/$(1)/lib*.dummy
|
||||
DEPS_SUBMODULES += $(1)
|
||||
DONE_$(1) = $$(B)src/$$(PATH_$(1))/lib*.dummy
|
||||
DEPS_SUBMODULES += $$(PATH_$(1))
|
||||
endef
|
||||
|
||||
# these will get populated.
|
||||
DEPS_SUBMODULES =
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_VARS,$(submodule))))
|
||||
|
||||
$(info $(DEPS_SUBMODULES))
|
||||
|
||||
# include submodule dependencies configuration
|
||||
include $(S)mk/sub.mk
|
||||
|
||||
# Define how to make submodule targets
|
||||
define DEF_SUBMODULE_RULES
|
||||
|
||||
ENV_RLDFLAGS_$(1) = $$(foreach dep,$$(DEPS_$(1)),-L $$(B)src/$$(PATH_$$(dep)))
|
||||
|
||||
# variables that depend on dependency definitions from sub.mk!
|
||||
ENV_CFLAGS_$(1) = CFLAGS="$$(CFLAGS_$(1))"
|
||||
ENV_RFLAGS_$(1) = RUSTFLAGS="$$(strip $$(CFG_RUSTC_FLAGS)) $$(addprefix -L $$(B)src/,$$(DEPS_$(1)))"
|
||||
ENV_RFLAGS_$(1) = RUSTFLAGS="$$(strip $$(CFG_RUSTC_FLAGS)) $$(ENV_RLDFLAGS_$(1))"
|
||||
|
||||
# use a rough approximation of submodule dependencies to trigger calling submodule make
|
||||
# whenever a submodule changes
|
||||
# TODO: this may be a bit brutish, but is there a better way?
|
||||
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$(1),*h *c *cpp *rs *rc)
|
||||
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$$(PATH_$(1)),*h *c *cpp *rs *rc)
|
||||
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
|
||||
# the main target for a submodule
|
||||
# --
|
||||
|
@ -148,7 +160,7 @@ $$(DONE_$(1)) : $$(DONE_DEPS_$(1)) $$(ROUGH_DEPS_$(1)) $$(RUSTC_DEP_$(1))
|
|||
$$(Q) \
|
||||
$$(ENV_CFLAGS_$(1)) \
|
||||
$$(ENV_RFLAGS_$(1)) \
|
||||
$$(MAKE) -C $$(B)src/$(1) && touch $$(DONE_$(1))
|
||||
$$(MAKE) -C $$(B)src/$$(PATH_$(1)) && touch $$(DONE_$(1))
|
||||
|
||||
# main submodule target
|
||||
$(1) : $$(DONE_$(1))
|
||||
|
@ -156,38 +168,38 @@ $(1) : $$(DONE_$(1))
|
|||
.NOTPARALLEL : $(1)
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_RULES,$(submodule))))
|
||||
|
||||
DONE_SUBMODULES = $(foreach dep,$(DEPS_SUBMODULES),$(DONE_$(dep)))
|
||||
DONE_SUBMODULES = $(foreach submodule,$(SUBMODULES),$(DONE_$(submodule)))
|
||||
|
||||
RFLAGS_servo_util = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
|
||||
SRC_servo_util = $(call rwildcard,$(S)src/servo-util/,*.rs)
|
||||
CRATE_servo_util = $(S)src/servo-util/servo_util.rc
|
||||
DONE_servo_util = $(B)src/servo-util/libservoutil.dummy
|
||||
SRC_servo_util = $(call rwildcard,$(S)src/components/servo-util/,*.rs)
|
||||
CRATE_servo_util = $(S)src/components/servo-util/servo_util.rc
|
||||
DONE_servo_util = $(B)src/components/servo-util/libservoutil.dummy
|
||||
|
||||
DEPS_servo_util = $(CRATE_servo_util) $(SRC_servo_util) $(DONE_SUBMODULES)
|
||||
|
||||
RFLAGS_servo_net = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/servo-util
|
||||
SRC_servo_net = $(call rwildcard,$(S)src/servo-net/,*.rs)
|
||||
CRATE_servo_net = $(S)src/servo-net/servo_net.rc
|
||||
DONE_servo_net = $(B)src/servo-net/libservonet.dummy
|
||||
RFLAGS_servo_net = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/servo-util
|
||||
SRC_servo_net = $(call rwildcard,$(S)src/components/servo-net/,*.rs)
|
||||
CRATE_servo_net = $(S)src/components/servo-net/servo_net.rc
|
||||
DONE_servo_net = $(B)src/components/servo-net/libservonet.dummy
|
||||
|
||||
DEPS_servo_net = $(CRATE_servo_net) $(SRC_servo_net) $(DONE_SUBMODULES) $(DONE_servo_util)
|
||||
|
||||
RFLAGS_servo_gfx = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/servo-util -L $(B)src/servo-net
|
||||
SRC_servo_gfx = $(call rwildcard,$(S)src/servo-gfx/,*.rs)
|
||||
CRATE_servo_gfx = $(S)src/servo-gfx/servo_gfx.rc
|
||||
DONE_servo_gfx = $(B)src/servo-gfx/libservogfx.dummy
|
||||
RFLAGS_servo_gfx = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/servo-util -L $(B)src/components/servo-net
|
||||
SRC_servo_gfx = $(call rwildcard,$(S)src/components/servo-gfx/,*.rs)
|
||||
CRATE_servo_gfx = $(S)src/components/servo-gfx/servo_gfx.rc
|
||||
DONE_servo_gfx = $(B)src/components/servo-gfx/libservogfx.dummy
|
||||
|
||||
DEPS_servo_gfx = $(CRATE_servo_gfx) $(SRC_servo_gfx) $(DONE_SUBMODULES) $(DONE_servo_util) $(DONE_servo_net)
|
||||
|
||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/servo-gfx -L $(B)src/servo-util -L $(B)src/servo-net
|
||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/servo-gfx -L $(B)src/components/servo-util -L $(B)src/components/servo-net
|
||||
|
||||
WEBIDL_servo = $(call rwildcard,$(S)src/servo/,*.webidl)
|
||||
WEBIDL_servo = $(call rwildcard,$(S)src/components/servo/,*.webidl)
|
||||
AUTOGEN_SRC_servo = $(patsubst %.webidl, %Binding.rs, $(WEBIDL_servo))
|
||||
SRC_servo = $(call rwildcard,$(S)src/servo/,*.rs) $(AUTOGEN_SRC_servo)
|
||||
CRATE_servo = $(S)src/servo/servo.rc
|
||||
SRC_servo = $(call rwildcard,$(S)src/components/servo/,*.rs) $(AUTOGEN_SRC_servo)
|
||||
CRATE_servo = $(S)src/components/servo/servo.rc
|
||||
|
||||
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_servo_util) $(DONE_servo_gfx) $(DONE_servo_net)
|
||||
|
||||
|
@ -210,7 +222,7 @@ $(DONE_servo_net): $(DEPS_servo_net)
|
|||
$(DONE_servo_gfx): $(DEPS_servo_gfx)
|
||||
$(RUSTC) $(RFLAGS_servo_gfx) -o $@ $< && touch $@
|
||||
|
||||
BINDINGS_SRC = $(S)/src/servo/dom/bindings/codegen
|
||||
BINDINGS_SRC = $(S)/src/components/servo/dom/bindings/codegen
|
||||
|
||||
CACHE_DIR = $(BINDINGS_SRC)/_cache
|
||||
|
||||
|
@ -249,12 +261,12 @@ servo: $(DEPS_servo)
|
|||
ifeq ($(OSTYPE),apple-darwin)
|
||||
|
||||
package: servo
|
||||
mkdir -p Servo.app/Contents/MacOS/src/rust-cocoa
|
||||
mkdir -p Servo.app/Contents/MacOS/src/rust-azure
|
||||
mkdir -p Servo.app/Contents/MacOS/src/platform/macos/rust-cocoa
|
||||
mkdir -p Servo.app/Contents/MacOS/src/platform/macos/rust-azure
|
||||
cp $(S)/Info.plist Servo.app/Contents/
|
||||
cp servo Servo.app/Contents/MacOS/
|
||||
cp src/rust-cocoa/lib*.dylib Servo.app/Contents/MacOS/src/rust-cocoa/
|
||||
cp src/rust-azure/lib*.dylib Servo.app/Contents/MacOS/src/rust-azure/
|
||||
cp src/platform/macos/rust-cocoa/lib*.dylib Servo.app/Contents/MacOS/src/platform/macos/rust-cocoa/
|
||||
cp src/platform/macos/rust-azure/lib*.dylib Servo.app/Contents/MacOS/src/platform/macos/rust-azure/
|
||||
|
||||
else
|
||||
|
||||
|
@ -272,8 +284,8 @@ endif
|
|||
|
||||
.PHONY: backup-rust restore-rust
|
||||
backup-rust:
|
||||
mv src/rust ..
|
||||
mv src/compiler/rust ..
|
||||
|
||||
restore-rust:
|
||||
rm -rf src/rust
|
||||
rm -rf src/compiler/rust
|
||||
mv ../rust src/
|
||||
|
|
65
configure
vendored
65
configure
vendored
|
@ -320,7 +320,7 @@ then
|
|||
else
|
||||
step_msg "using in-tree rust compiler"
|
||||
# The Rust compiler we're going to build
|
||||
CFG_RUSTC="${CFG_BUILD_DIR}src/rust/${DEFAULT_HOST_TRIPLE}/stage2/bin/rustc"
|
||||
CFG_RUSTC="${CFG_BUILD_DIR}src/compiler/rust/${DEFAULT_HOST_TRIPLE}/stage2/bin/rustc"
|
||||
fi
|
||||
|
||||
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
|
||||
|
@ -371,7 +371,7 @@ msg "configuring src/mozjs"
|
|||
|
||||
AUTOCONF213_M4_MACROS="$(dirname ${CFG_AUTOCONF213})/../share/$(basename ${CFG_AUTOCONF213})/"
|
||||
# Run the SpiderMonkey autoconf using autoconf 2.13
|
||||
(cd ${CFG_SRC_DIR}src/mozjs/js/src && "${CFG_AUTOCONF213}" -l "${AUTOCONF213_M4_MACROS}") || exit $?
|
||||
(cd ${CFG_SRC_DIR}src/support/spidermonkey/mozjs/js/src && "${CFG_AUTOCONF213}" -l "${AUTOCONF213_M4_MACROS}") || exit $?
|
||||
|
||||
# Pixman and cairo require some care to autoconf correctly for our in-tree build.
|
||||
# The normal autogen.sh files mostly just run autoreconfig but we need more fine control
|
||||
|
@ -397,16 +397,46 @@ fi
|
|||
AUTOCMD="${LIBTOOLIZE} && autoconf && autoheader && automake --add-missing --copy --force"
|
||||
# Copied from cairo's autogen.sh. Build fails without
|
||||
|
||||
CFG_SUBMODULES="libwapcaplet rust-wapcaplet rust-harfbuzz rust-opengles skia rust-azure rust-stb-image rust-geom rust-glut rust-layers rust-http-client libparserutils libhubbub libcss rust-netsurfcss rust-css rust-hubbub sharegl rust-mozjs mozjs"
|
||||
CFG_SUBMODULES="\
|
||||
support/azure/rust-azure \
|
||||
support/css/rust-css \
|
||||
support/geom/rust-geom \
|
||||
support/glut/rust-glut \
|
||||
support/harfbuzz/rust-harfbuzz \
|
||||
support/http-client/rust-http-client \
|
||||
support/hubbub/libhubbub \
|
||||
support/hubbub/rust-hubbub \
|
||||
support/layers/rust-layers \
|
||||
support/libparserutils/libparserutils \
|
||||
support/netsurfcss/libcss \
|
||||
support/netsurfcss/rust-netsurfcss \
|
||||
support/opengles/rust-opengles \
|
||||
support/sharegl/sharegl \
|
||||
support/skia/skia \
|
||||
support/spidermonkey/mozjs \
|
||||
support/spidermonkey/rust-mozjs \
|
||||
support/stb-image/rust-stb-image \
|
||||
support/wapcaplet/libwapcaplet \
|
||||
support/wapcaplet/rust-wapcaplet"
|
||||
|
||||
if [ $CFG_OSTYPE = "apple-darwin" ]
|
||||
then
|
||||
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
||||
CFG_SUBMODULES="\
|
||||
platform/macos/rust-cocoa \
|
||||
platform/macos/rust-core-foundation \
|
||||
platform/macos/rust-core-graphics \
|
||||
platform/macos/rust-core-text \
|
||||
platform/macos/rust-io-surface \
|
||||
${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
if [ $CFG_OSTYPE = "unknown-linux-gnu" ]
|
||||
then
|
||||
CFG_SUBMODULES="rust-freetype rust-fontconfig rust-xlib ${CFG_SUBMODULES}"
|
||||
CFG_SUBMODULES="\
|
||||
platform/linux/rust-fontconfig \
|
||||
platform/linux/rust-freetype \
|
||||
platform/linux/rust-xlib \
|
||||
${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
step_msg "making build directories"
|
||||
|
@ -418,11 +448,11 @@ do
|
|||
make_dir ${CFG_BUILD_DIR}src/${i}
|
||||
done
|
||||
|
||||
make_dir ${CFG_BUILD_DIR}src/servo-util
|
||||
make_dir ${CFG_BUILD_DIR}src/servo-net
|
||||
make_dir ${CFG_BUILD_DIR}src/servo-gfx
|
||||
make_dir ${CFG_BUILD_DIR}src/components/servo-util
|
||||
make_dir ${CFG_BUILD_DIR}src/components/servo-net
|
||||
make_dir ${CFG_BUILD_DIR}src/components/servo-gfx
|
||||
make_dir src/test/ref
|
||||
make_dir src/rust
|
||||
make_dir src/compiler/rust
|
||||
|
||||
# TODO: don't run configure on submodules unless necessary. For an example,
|
||||
# see how Rust's configure script optionally reconfigures the LLVM module.
|
||||
|
@ -430,11 +460,11 @@ step_msg "running submodule configure scripts"
|
|||
|
||||
# Only reconfigure Rust when it changes
|
||||
do_reconfigure=1
|
||||
index1="${CFG_SRC_DIR}.git/modules/src/rust/index"
|
||||
index2="${CFG_SRC_DIR}src/rust/.git/index"
|
||||
index1="${CFG_SRC_DIR}.git/modules/src/compiler/rust/index"
|
||||
index2="${CFG_SRC_DIR}src/compiler/rust/.git/index"
|
||||
for index in ${index1} ${index2}
|
||||
do
|
||||
config_stamp="${CFG_BUILD_DIR}src/rust/config.stamp"
|
||||
config_stamp="${CFG_BUILD_DIR}src/compiler/rust/config.stamp"
|
||||
if test -e ${index} -a -e ${config_stamp} -a ${config_stamp} -nt ${index}
|
||||
then
|
||||
msg "not reconfiguring Rust, config.stamp is fresh"
|
||||
|
@ -444,16 +474,11 @@ done
|
|||
|
||||
if [ ${do_reconfigure} -ne 0 ]
|
||||
then
|
||||
cd ${CFG_BUILD_DIR}src/rust
|
||||
${CFG_SRC_DIR}src/rust/configure
|
||||
cd ${CFG_BUILD_DIR}src/compiler/rust
|
||||
${CFG_SRC_DIR}src/compiler/rust/configure
|
||||
cd ${CFG_BUILD_DIR}
|
||||
fi
|
||||
|
||||
# Cairo expects to use an installed pixman, but we want to override that
|
||||
# behavior to use our version
|
||||
export pixman_CFLAGS="-I${CFG_SRC_DIR}src/pixman/pixman -I${CFG_BUILD_DIR}src/pixman/pixman"
|
||||
export pixman_LDFLAGS="-I${CFG_BUILD_DIR}src/pixman/pixman/.libs"
|
||||
|
||||
# PIC all the things
|
||||
export CFLAGS="${CFLAGS} -fPIC"
|
||||
export LDFLAGS="${CFLAGS} -fPIC"
|
||||
|
@ -466,7 +491,7 @@ do
|
|||
fi
|
||||
CONFIGURE_SCRIPT="${CFG_SRC_DIR}src/${i}/configure"
|
||||
# needed because Spidermonkey configure is in non-standard location
|
||||
if [ $i = mozjs ]; then
|
||||
if [ $i = "support/spidermonkey/mozjs" ]; then
|
||||
CONFIGURE_SCRIPT="${CFG_SRC_DIR}src/${i}/js/src/configure"
|
||||
fi
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ check-$(1) : $$(DONE_$(1))
|
|||
$$(Q) \
|
||||
$$(ENV_CFLAGS_$(1)) \
|
||||
$$(ENV_RFLAGS_$(1)) \
|
||||
$$(MAKE) -C $$(B)src/$(1) check
|
||||
$$(MAKE) -C $$(B)src/$$(PATH_$(1)) check
|
||||
|
||||
DEPS_CHECK_ALL += $(1)
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_TEST_RULES,$(submodule))))
|
||||
|
||||
|
||||
|
|
16
mk/clean.mk
16
mk/clean.mk
|
@ -3,13 +3,13 @@ define DEF_SUBMODULE_CLEAN_RULES
|
|||
clean-$(1) :
|
||||
@$$(call E, make clean: $(1))
|
||||
$$(Q)rm -f $$(DONE_$(1))
|
||||
$$(Q)$$(MAKE) -C $$(B)src/$(1) clean
|
||||
$$(Q)$$(MAKE) -C $$(B)src/$$(PATH_$(1)) clean
|
||||
|
||||
# add these targets to meta-targets
|
||||
DEPS_CLEAN_ALL += $(1)
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(foreach submodule,$(SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_CLEAN_RULES,$(submodule))))
|
||||
|
||||
DEPS_CLEAN_TARGETS_ALL = $(addprefix clean-,$(DEPS_CLEAN_ALL))
|
||||
|
@ -25,14 +25,14 @@ clean-fast: $(DEPS_CLEAN_TARGETS_FAST) clean-servo
|
|||
$(Q)echo "Cleaning targets:"
|
||||
$(Q)echo "$(filter-out $(SLOW_BUILDS),$(DEPS_CLEAN_ALL))"
|
||||
|
||||
clean-servo-gfx:
|
||||
cd $(B)/src/servo-gfx/ && rm -rf libservo_gfx*.dylib $(DONE_servo_gfx)
|
||||
clean-servo-util:
|
||||
cd $(B)/src/components/servo-util/ && rm -rf libservo_util*.dylib $(DONE_servo_util)
|
||||
|
||||
clean-servo-net:
|
||||
cd $(B)/src/servo-net/ && rm -rf libservo_net*.dylib $(DONE_servo_net)
|
||||
cd $(B)/src/components/servo-net/ && rm -rf libservo_net*.dylib $(DONE_servo_net)
|
||||
|
||||
clean-servo-util:
|
||||
cd $(B)/src/servo-util/ && rm -rf libservo_util*.dylib $(DONE_servo_util)
|
||||
clean-servo-gfx:
|
||||
cd $(B)/src/components/servo-gfx/ && rm -rf libservo_gfx*.dylib $(DONE_servo_gfx)
|
||||
|
||||
clean-servo: clean-servo-gfx clean-servo-net clean-servo-util
|
||||
clean-servo: clean-servo-gfx clean-servo-util clean-servo-net
|
||||
rm -f servo servo-test
|
||||
|
|
|
@ -140,3 +140,4 @@ DEPS_rust-layers += \
|
|||
rust-xlib \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
|
100
src/README.md
100
src/README.md
|
@ -1,54 +1,68 @@
|
|||
Descriptions of the Servo source directories. For the most part these represent a single
|
||||
crate or library.
|
||||
|
||||
## Servo and Rust projects
|
||||
## Servo components
|
||||
|
||||
These are the main servo projects, as well as projects that are pure Rust (not bindings).
|
||||
* `components/contenttest`: JavaScript test runner.
|
||||
* `components/reftest`: Reference (layout) test runner.
|
||||
* `components/servo`: The top-level Servo crate. Contains compositing, DOM, layout, and script.
|
||||
* `components/servo-gfx`: Graphics rendering, fonts, and text shaping.
|
||||
* `components/servo-net`: Networking, caching, image decoding.
|
||||
* `components/servo-util`: Various utility functions used by other Servo components.
|
||||
|
||||
* _rust-css_ - A CSS parsing and selector matching library, based on libcss and currently
|
||||
using libcss for the implementation, but not exposing any libcss internals
|
||||
* _rust-geom_ - Generic linear algebra library
|
||||
* _rust-http-client_ - An HTTP library in Rust, using libuv via the Rust standard library
|
||||
* _rust-layers_ - A simple GPU-accelerated 2D scene graph library
|
||||
* _servo_ - The Servo web browser engine
|
||||
* _servo-gfx_ - Servo's graphics subsystem
|
||||
* _sharegl_ - A library for sharing 3D textures between processes
|
||||
## The Rust compiler
|
||||
|
||||
## Third-party projects
|
||||
* `compiler/rust`: The Rust compiler.
|
||||
|
||||
* _libcss_ - The CSS library from the NetSurf web browser. We are using this for parsing
|
||||
and selector matching until we have a Rust solution
|
||||
* _libhubbub_ - The HTML parser from the NetSurf web browser. We are using this for parsing
|
||||
until we have a Rust solution
|
||||
* _libparserutils_ - A parsing library used by libcss and libhubbub
|
||||
* _libwapcaplet_ - A string internment library used by libcss and libhubbub
|
||||
* _mozjs_ - The SpiderMonkey JavaScript engine, forked from mozilla-central
|
||||
* _rust-azure_ - mozilla-central's 2D vector graphics abstraction layer and bindings
|
||||
* _rust-harfbuzz_ - The harfbuzz text shaping library and bindings
|
||||
* _rust-stb-image_ - The stb_image library and bindings. We are using this for image decoding
|
||||
until we have a higher-performance and/or Rust solution
|
||||
* _skia_ - The Skia drawing library, a backend for Azure
|
||||
## Supporting libraries
|
||||
|
||||
## Library bindings
|
||||
These libraries are used in all Servo ports. In keeping with Servo's philosophy of modularity,
|
||||
they are designed to be useful in other Rust projects.
|
||||
|
||||
* _rust-cocoa_ - Bindings to OS X's Cocoa framework
|
||||
* _rust-core-foundation_ - Bindings to OS X's Core Foundation framework
|
||||
* _rust-core-graphics_ - Bindings to OS X's Core Graphics framework, a backend for Azure
|
||||
* _rust-core-text_ - Bindings to OS X's Core Text framework
|
||||
* _rust-fontconfig_ - Bindings to fontconfig
|
||||
* _rust-freetype_ - Bindings to FreeType
|
||||
* _rust-glut_ - Bindings to GLUT
|
||||
* _rust-hubbub_ - Bindings to libhubbub
|
||||
* _rust-io-surface_ - OS X implementation of cross-process surface sharing. Used by sharegl
|
||||
* _rust-mozjs_ - Bindings to SpiderMonkey
|
||||
* _rust-netsurfcss_ - Bindings to libcss
|
||||
* _rust-opengles_ - Bindings to OpenGL ES
|
||||
* _rust-wapcaplet_ - Bindings to libwapcaplet
|
||||
* _rust-xlib_ - Bindings to xlib
|
||||
* `support/azure`: A cross-platform 2D drawing library from the Mozilla project. Azure can render
|
||||
with Direct2D, Core Graphics (Quartz), Skia, and Cairo.
|
||||
* `support/css`: A general CSS parsing and selector matching library. This abstraction layer
|
||||
exists to prevent `libcss` internals from leaking into Servo.
|
||||
* `support/geom`: A simple Euclidean geometry and linear algebra library.
|
||||
* `support/glut`: Bindings to the GLUT windowing framework. This bare-bones windowing framework is
|
||||
useful for testing the engine without browser chrome.
|
||||
* `support/harfbuzz`: A mature Unicode- and OpenType-aware text shaping library, used by many
|
||||
rendering engines and toolkits.
|
||||
* `support/http-client`: An HTTP client library for Rust.
|
||||
* `support/hubbub`: The HTML parser from the NetSurf project. This is a temporary solution for HTML
|
||||
parsing until a pure-Rust solution is available.
|
||||
* `support/layers`: A simple GPU-accelerated 2D scene graph library, somewhat similar to libraries
|
||||
like Clutter.
|
||||
* `support/libparserutils`: A parsing library used by `hubbub` and `netsurfcss`.
|
||||
* `support/netsurfcss`: The CSS library from the NetSurf project. This is a temporary stopgap for
|
||||
CSS parsing until a pure-Rust solution is available.
|
||||
* `support/opengles`: Bindings to OpenGL ES 2.0.
|
||||
* `support/sharegl`: A library for sharing OpenGL or Direct3D textures between processes.
|
||||
* `support/skia`: Google's accelerated 2D rendering library.
|
||||
* `support/spidermonkey`: Mozilla's JavaScript engine.
|
||||
* `support/stb-image`: A minimalist image decoding library. This is a temporary stopgap for image
|
||||
decoding until a higher-performance solution is available.
|
||||
* `support/wapcaplet`: A string storage library used by `hubbub` and `netsurfcss`.
|
||||
|
||||
## Other
|
||||
## Platform-specfic bindings
|
||||
|
||||
### Linux
|
||||
|
||||
* `platform/linux/rust-fontconfig`: Bindings to the freedesktop.org `fontconfig` library.
|
||||
* `platform/linux/rust-freetype`: Bindings to the FreeType library.
|
||||
* `platform/linux/rust-xlib`: Bindings to the X Window System libraries.
|
||||
|
||||
### Mac
|
||||
|
||||
* `platform/macos/rust-cocoa`: General Cocoa bindings.
|
||||
* `platform/macos/rust-core-foundation`: Bindings to Core Foundation.
|
||||
* `platform/macos/rust-core-graphics`: Bindings to Core Graphics/Quartz.
|
||||
* `platform/macos/rust-core-text`: Bindings to Core Text.
|
||||
* `platform/macos/rust-io-surface`: Bindings to the `IOSurface` library.
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
* `etc`: Various scripts and files that don't belong anywhere else.
|
||||
* `etc/patches`: Patches for upstream libraries.
|
||||
* `test`: Test cases.
|
||||
|
||||
* _contenttest_ - Test harness for JavaScript bindings
|
||||
* _etc_ - Miscellaneous
|
||||
* _reftest_ - Test harness for comparing Servo output to Firefox
|
||||
* _test_ - Test cases
|
||||
|
|
1
src/compiler/rust
Submodule
1
src/compiler/rust
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 1b883365bc0813f5775c8207e414b7973e947a76
|
|
@ -71,7 +71,7 @@ pub impl FontList {
|
|||
|
||||
priv fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> {
|
||||
// look up canonical name
|
||||
let family = self.family_map.find(&str::from_slice(family_name));
|
||||
let family = self.family_map.find_equiv(&family_name);
|
||||
|
||||
let decision = if family.is_some() { "Found" } else { "Couldn't find" };
|
||||
debug!("FontList: %s font family with name=%s", decision, family_name);
|
||||
|
@ -90,15 +90,17 @@ pub struct FontFamily {
|
|||
impl FontFamily {
|
||||
pub fn new(family_name: &str) -> FontFamily {
|
||||
FontFamily {
|
||||
family_name: str::from_slice(family_name),
|
||||
family_name: family_name.to_str(),
|
||||
entries: ~[],
|
||||
}
|
||||
}
|
||||
|
||||
fn load_family_variations(@mut self, list: &FontListHandle) {
|
||||
if self.entries.len() > 0 { return; }
|
||||
if self.entries.len() > 0 {
|
||||
return
|
||||
}
|
||||
list.load_variations_for_family(self);
|
||||
assert!(self.entries.len() > 0);
|
||||
assert!(self.entries.len() > 0)
|
||||
}
|
||||
|
||||
pub fn find_font_for_style(@mut self, list: &FontListHandle, style: &SpecifiedFontStyle)
|
|
@ -52,7 +52,7 @@ pub impl FontListHandle {
|
|||
|
||||
debug!("Creating new FontEntry for face: %s", handle.face_name());
|
||||
let entry = @FontEntry::new(family, handle);
|
||||
family.entries.push(entry);
|
||||
family.entries.push(entry)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -588,7 +588,7 @@ pub impl<'self> GlyphStore {
|
|||
fn iter_glyphs_for_char_index(&'self self,
|
||||
i: uint,
|
||||
cb: &fn(uint, &GlyphInfo<'self>) -> bool)
|
||||
-> bool {
|
||||
-> bool {
|
||||
assert!(i < self.entry_buffer.len());
|
||||
|
||||
let entry = &self.entry_buffer[i];
|
||||
|
@ -609,30 +609,36 @@ pub impl<'self> GlyphStore {
|
|||
true
|
||||
}
|
||||
|
||||
fn iter_glyphs_for_char_range(&'self self, range: &Range,
|
||||
cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
fn iter_glyphs_for_char_range(&'self self,
|
||||
range: &Range,
|
||||
callback: &fn(uint, &GlyphInfo<'self>) -> bool)
|
||||
-> bool {
|
||||
if range.begin() >= self.entry_buffer.len() {
|
||||
error!("iter_glyphs_for_range: range.begin beyond length!");
|
||||
return;
|
||||
return false
|
||||
}
|
||||
if range.end() > self.entry_buffer.len() {
|
||||
error!("iter_glyphs_for_range: range.end beyond length!");
|
||||
return;
|
||||
return false
|
||||
}
|
||||
|
||||
for range.eachi |i| {
|
||||
if !self.iter_glyphs_for_char_index(i, cb) {
|
||||
break;
|
||||
if !self.iter_glyphs_for_char_index(i, callback) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn iter_all_glyphs(&'self self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
|
||||
fn iter_all_glyphs(&'self self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) -> bool {
|
||||
for uint::range(0, self.entry_buffer.len()) |i| {
|
||||
if !self.iter_glyphs_for_char_index(i, cb) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
// getter methods
|
|
@ -357,19 +357,26 @@ impl Shaper {
|
|||
probably doesn't work.");
|
||||
|
||||
let mut all_glyphs_are_within_cluster: bool = true;
|
||||
do glyph_span.eachi |j| {
|
||||
for glyph_span.eachi |j| {
|
||||
let loc = glyph_data.byte_offset_of_glyph(j);
|
||||
if !char_byte_span.contains(loc) {
|
||||
all_glyphs_are_within_cluster = false;
|
||||
break
|
||||
}
|
||||
|
||||
// If true, keep checking. Else, stop.
|
||||
if !all_glyphs_are_within_cluster {
|
||||
break
|
||||
}
|
||||
all_glyphs_are_within_cluster // if true, keep checking. else, stop.
|
||||
}
|
||||
|
||||
debug!("All glyphs within char_byte_span cluster?: %?",
|
||||
all_glyphs_are_within_cluster);
|
||||
|
||||
// found a valid range; stop extending char_span.
|
||||
if all_glyphs_are_within_cluster { break; }
|
||||
if all_glyphs_are_within_cluster {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// character/glyph clump must contain characters.
|
|
@ -128,7 +128,7 @@ pub impl<'self> TextRun {
|
|||
return max_piece_width;
|
||||
}
|
||||
|
||||
fn iter_natural_lines_for_range(&self, range: &Range, f: &fn(&Range) -> bool) {
|
||||
fn iter_natural_lines_for_range(&self, range: &Range, f: &fn(&Range) -> bool) -> bool {
|
||||
let mut clump = Range::new(range.begin(), 0);
|
||||
let mut in_clump = false;
|
||||
|
||||
|
@ -151,9 +151,11 @@ pub impl<'self> TextRun {
|
|||
clump.extend_to(range.end());
|
||||
f(&clump);
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn iter_indivisible_pieces_for_range(&self, range: &Range, f: &fn(&Range) -> bool) {
|
||||
fn iter_indivisible_pieces_for_range(&self, range: &Range, f: &fn(&Range) -> bool) -> bool {
|
||||
let mut clump = Range::new(range.begin(), 0);
|
||||
|
||||
loop {
|
||||
|
@ -165,11 +167,15 @@ pub impl<'self> TextRun {
|
|||
}
|
||||
|
||||
// now clump.end() is break-before or range.end()
|
||||
if !f(&clump) || clump.end() == range.end() { break; }
|
||||
if !f(&clump) || clump.end() == range.end() {
|
||||
break
|
||||
}
|
||||
|
||||
// now clump includes one break-before character, or starts from range.end()
|
||||
let end = clump.end(); // FIXME: borrow checker workaround
|
||||
clump.reset(end, 1);
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
|
@ -127,7 +127,7 @@ pub fn true_type_tag(a: char, b: char, c: char, d: char) -> u32 {
|
|||
|
||||
#[test]
|
||||
fn test_true_type_tag() {
|
||||
fail_unless!(true_type_tag('c', 'm', 'a', 'p') == 0x_63_6D_61_70_u32);
|
||||
assert!(true_type_tag('c', 'm', 'a', 'p') == 0x_63_6D_61_70_u32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -143,7 +143,7 @@ fn test_transform_compress_none() {
|
|||
let mode = CompressNone;
|
||||
|
||||
for uint::range(0, test_strs.len()) |i| {
|
||||
fail_unless!(transform_text(test_strs[i], mode) == test_strs[i]);
|
||||
assert!(transform_text(test_strs[i], mode) == test_strs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,11 +166,11 @@ fn test_transform_discard_newline() {
|
|||
~"foo bar baz",
|
||||
~"foobarbaz"];
|
||||
|
||||
fail_unless!(test_strs.len() == oracle_strs.len());
|
||||
assert!(test_strs.len() == oracle_strs.len());
|
||||
let mode = DiscardNewline;
|
||||
|
||||
for uint::range(0, test_strs.len()) |i| {
|
||||
fail_unless!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
assert!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,11 +192,11 @@ fn test_transform_compress_whitespace() {
|
|||
~"foo bar baz",
|
||||
~"foobarbaz\n\n"];
|
||||
|
||||
fail_unless!(test_strs.len() == oracle_strs.len());
|
||||
assert!(test_strs.len() == oracle_strs.len());
|
||||
let mode = CompressWhitespace;
|
||||
|
||||
for uint::range(0, test_strs.len()) |i| {
|
||||
fail_unless!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
assert!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,10 +218,10 @@ fn test_transform_compress_whitespace_newline() {
|
|||
~"foo bar baz",
|
||||
~"foobarbaz "];
|
||||
|
||||
fail_unless!(test_strs.len() == oracle_strs.len());
|
||||
assert!(test_strs.len() == oracle_strs.len());
|
||||
let mode = CompressWhitespaceNewline;
|
||||
|
||||
for uint::range(0, test_strs.len()) |i| {
|
||||
fail_unless!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
assert!(transform_text(test_strs[i], mode) == oracle_strs[i]);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
@ -12,7 +12,7 @@ use core::cell::Cell;
|
|||
use core::comm::{Chan, Port, SharedChan, stream};
|
||||
use core::task::spawn;
|
||||
use core::to_str::ToStr;
|
||||
use core::util::replace;
|
||||
use core::util::{replace, swap};
|
||||
use std::arc::ARC;
|
||||
use std::net::url::Url;
|
||||
|
||||
|
@ -383,7 +383,6 @@ impl ImageCache {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
priv fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
|
||||
match self.get_state(copy url) {
|
||||
Init => fail!(~"request for image before prefetch"),
|
|
@ -31,8 +31,14 @@ pub impl Range {
|
|||
fn begin(&self) -> uint { self.off }
|
||||
fn length(&self) -> uint { self.len }
|
||||
fn end(&self) -> uint { self.off + self.len }
|
||||
fn eachi(&self, cb: &fn(uint) -> bool) {
|
||||
do uint::range(self.off, self.off + self.len) |i| { cb(i) }
|
||||
|
||||
fn eachi(&self, callback: &fn(uint) -> bool) -> bool {
|
||||
for uint::range(self.off, self.off + self.len) |i| {
|
||||
if !callback(i) {
|
||||
break
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn contains(&self, i: uint) -> bool {
|
|
@ -62,7 +62,7 @@ pub trait TreeUtils {
|
|||
fn remove_child(&self, child: Self);
|
||||
|
||||
/// Iterates over all children of this node.
|
||||
fn each_child(&self, callback: &fn(Self) -> bool);
|
||||
fn each_child(&self, callback: &fn(Self) -> bool) -> bool;
|
||||
|
||||
/// Iterates over this node and all its descendants, in preorder.
|
||||
fn traverse_preorder(&self, callback: &fn(Self) -> bool) -> bool;
|
||||
|
@ -132,7 +132,7 @@ impl<NR:TreeNodeRef<N>,N:TreeNode<NR>> TreeUtils for NR {
|
|||
}
|
||||
}
|
||||
|
||||
fn each_child(&self, callback: &fn(NR) -> bool) {
|
||||
fn each_child(&self, callback: &fn(NR) -> bool) -> bool {
|
||||
let mut maybe_current = self.with_base(|n| n.first_child());
|
||||
while !maybe_current.is_none() {
|
||||
let current = maybe_current.get_ref().clone();
|
||||
|
@ -142,6 +142,8 @@ impl<NR:TreeNodeRef<N>,N:TreeNode<NR>> TreeUtils for NR {
|
|||
|
||||
maybe_current = current.with_base(|n| n.next_sibling());
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn traverse_preorder(&self, callback: &fn(NR) -> bool) -> bool {
|
|
@ -59,8 +59,8 @@ mod make_url_tests {
|
|||
let file = ~"local.html";
|
||||
let url = make_url(file, None);
|
||||
debug!("url: %?", url);
|
||||
fail_unless!(url.scheme == ~"file");
|
||||
fail_unless!(url.path.contains(os::getcwd().to_str()));
|
||||
assert!(url.scheme == ~"file");
|
||||
assert!(url.path.contains(os::getcwd().to_str()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -69,9 +69,9 @@ mod make_url_tests {
|
|||
let old_url = make_url(old_str, None);
|
||||
let new_str = ~"index.html";
|
||||
let new_url = make_url(new_str, Some(old_url));
|
||||
fail_unless!(new_url.scheme == ~"http");
|
||||
fail_unless!(new_url.host == ~"example.com");
|
||||
fail_unless!(new_url.path == ~"/index.html");
|
||||
assert!(new_url.scheme == ~"http");
|
||||
assert!(new_url.host == ~"example.com");
|
||||
assert!(new_url.path == ~"/index.html");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -80,9 +80,9 @@ mod make_url_tests {
|
|||
let old_url = make_url(old_str, None);
|
||||
let new_str = ~"index.html";
|
||||
let new_url = make_url(new_str, Some(old_url));
|
||||
fail_unless!(new_url.scheme == ~"http");
|
||||
fail_unless!(new_url.host == ~"example.com");
|
||||
fail_unless!(new_url.path == ~"/index.html");
|
||||
assert!(new_url.scheme == ~"http");
|
||||
assert!(new_url.host == ~"example.com");
|
||||
assert!(new_url.path == ~"/index.html");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -91,9 +91,9 @@ mod make_url_tests {
|
|||
let old_url = make_url(old_str, None);
|
||||
let new_str = ~"crumpet.html";
|
||||
let new_url = make_url(new_str, Some(old_url));
|
||||
fail_unless!(new_url.scheme == ~"http");
|
||||
fail_unless!(new_url.host == ~"example.com");
|
||||
fail_unless!(new_url.path == ~"/crumpet.html");
|
||||
assert!(new_url.scheme == ~"http");
|
||||
assert!(new_url.host == ~"example.com");
|
||||
assert!(new_url.path == ~"/crumpet.html");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -102,9 +102,9 @@ mod make_url_tests {
|
|||
let old_url = make_url(old_str, None);
|
||||
let new_str = ~"crumpet.html";
|
||||
let new_url = make_url(new_str, Some(old_url));
|
||||
fail_unless!(new_url.scheme == ~"http");
|
||||
fail_unless!(new_url.host == ~"example.com");
|
||||
fail_unless!(new_url.path == ~"/snarf/crumpet.html");
|
||||
assert!(new_url.scheme == ~"http");
|
||||
assert!(new_url.host == ~"example.com");
|
||||
assert!(new_url.path == ~"/snarf/crumpet.html");
|
||||
}
|
||||
|
||||
}
|
|
@ -244,7 +244,7 @@ fn lend_surface(surfaces: &mut SurfaceSet, receiver: Chan<LayerBufferSet>) {
|
|||
// Now we don't have it
|
||||
surfaces.front.have = false;
|
||||
// But we (hopefully) have another!
|
||||
surfaces.front <-> surfaces.back;
|
||||
util::swap(&mut surfaces.front, &mut surfaces.back);
|
||||
// Let's look
|
||||
assert!(surfaces.front.have);
|
||||
}
|
|
@ -21,6 +21,7 @@ use core::io::read_whole_file;
|
|||
use core::pipes::select2i;
|
||||
use core::ptr::null;
|
||||
use core::task::{SingleThreaded, task};
|
||||
use core::local_data;
|
||||
use core::util::replace;
|
||||
use dom;
|
||||
use geom::size::Size2D;
|
||||
|
@ -153,7 +154,9 @@ pub fn Content(layout_task: LayoutTask,
|
|||
};
|
||||
|
||||
cx.set_cx_private(ptr::to_unsafe_ptr(&*content) as *());
|
||||
unsafe { local_data::local_data_set(global_content_key, cast::transmute(content)); }
|
||||
unsafe {
|
||||
local_data::local_data_set(global_content_key, cast::transmute(content));
|
||||
}
|
||||
|
||||
content
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue