diff options
1021 files changed, 29014 insertions, 7797 deletions
@@ -1,3 +1,114 @@ +2012-05-31 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Enable CSS_IMAGE_SET flag + https://bugs.webkit.org/show_bug.cgi?id=87727 + + Reviewed by Adam Roben. + + Add CSS_IMAGE_SET flag to CMake and enable it by default on EFL port. + + * Source/cmake/OptionsEfl.cmake: + * Source/cmake/WebKitFeatures.cmake: + * Source/cmakeconfig.h.cmake: + +2012-05-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Add needed file back to the wx build. + + * wscript: + +2012-05-30 Mariusz Grzegorczyk <mariusz.g@samsung.com>, Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Fix WebKit2-EFL build + https://bugs.webkit.org/show_bug.cgi?id=83693 + + Reviewed by Carlos Garcia Campos. + + * Source/cmake/OptionsEfl.cmake: Define BUILDING_SOUP__ to build WebKit2/Efl. + +2012-05-29 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Loading media data with http authentication + https://bugs.webkit.org/show_bug.cgi?id=84214 + + Reviewed by George Staikos. + + Added a manual test case which needs user to provide a HTTP server + with HTTP authentication support when loading the specified media + resource. The test case will test if the media resource is successfully + loaded. + + * ManualTests/blackberry/video-load-with-authentication.html: Added. + +2012-05-29 Simon Fraser <simon.fraser@apple.com> + + Incomplete repaint on twitter.com when replying to a tweet + https://bugs.webkit.org/show_bug.cgi?id=87553 + + Reviewed by Dean Jackson. + + Manual test that adds a transform to a layer, forcing that + layer to gain backing store. + + * ManualTests/compositing/requires-backing-change.html: Added. + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Source/cmake/WebKitFeatures.cmake: + * Source/cmakeconfig.h.cmake: + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * Source/autotools/symbols.filter: Added needed symbols for GTK build. + +2012-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move allowRoundingHacks to Internals interface + https://bugs.webkit.org/show_bug.cgi?id=87328 + + Reviewed by Hajime Morita. + + * Source/autotools/symbols.filter: Add allowRoundingHacks symbol filter. + +2012-05-27 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] Enable blob support for the EFL port + https://bugs.webkit.org/show_bug.cgi?id=85363 + + Reviewed by Hajime Morita. + + Enable Blob support by default for the EFL port. + + * Source/cmake/OptionsEfl.cmake: + +2012-05-27 Raphael Kubo da Costa <rakuco@webkit.org> + + [CMake] Make WEBKIT_SET_EXTRA_COMPILER_FLAGS work with clang. + https://bugs.webkit.org/show_bug.cgi?id=87597 + + Reviewed by Daniel Bates. + + Building with clang requires at least the -fPIC option being + passed correctly, just like it is needed with gcc. clang is also + compatible with most of gcc's compiler options, so we only need to + check for clang besides g++ in the macro definition. + + * Source/cmake/WebKitHelpers.cmake: Check for "Clang" and use + CMAKE_COMPILER_IS_GNUCXX for the previous check, as it is shorter + and achieves the same effect. + 2012-05-25 Zan Dobersek <zandobersek@gmail.com> configure.ac has duplicated AC_MSG_RESULT([$enable_sandbox]) and nothing for seamless iframes diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index cb58b0007..dc00849e3 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -97,6 +97,7 @@ SET(JavaScriptCore_SOURCES heap/HandleSet.cpp heap/HandleStack.cpp heap/Heap.cpp + heap/IncrementalSweeper.cpp heap/MachineStackMarker.cpp heap/MarkedAllocator.cpp heap/MarkedBlock.cpp diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index c80a45805..807d83297 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,425 @@ +2012-05-31 Mark Hahnenberg <mhahnenberg@apple.com> + + JSGlobalObject does not mark m_privateNameStructure + https://bugs.webkit.org/show_bug.cgi?id=88023 + + Rubber stamped by Gavin Barraclough. + + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get + inadvertently garbage collected. + +2012-05-31 Erik Arvidsson <arv@chromium.org> + + Make DOM Exceptions Errors + https://bugs.webkit.org/show_bug.cgi?id=85078 + + Reviewed by Oliver Hunt. + + WebIDL mandates that exceptions should have Error.prototype on its prototype chain. + + For JSC we have access to the Error.prototype from the binding code. + + For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we + set the prototype as needed. + + Updated test: fast/dom/DOMException/prototype-object.html + + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + * runtime/JSGlobalObject.h: + (JSC): + (JSGlobalObject): + (JSC::JSGlobalObject::errorPrototype): + +2012-05-31 Andy Wingo <wingo@igalia.com> + + Fix reference to unset variable in debug mode + https://bugs.webkit.org/show_bug.cgi?id=87981 + + Reviewed by Geoffrey Garen. + + * runtime/JSONObject.cpp (Stringifier::Holder::Holder): + Initialize m_size in debug mode, as we check it later in an assert. + +2012-05-30 Mark Hahnenberg <mhahnenberg@apple.com> + + Heap should sweep incrementally + https://bugs.webkit.org/show_bug.cgi?id=85429 + + We shouldn't have to wait for the opportunistic GC timer to fire in order + to call object destructors. Instead, we should incrementally sweep some + subset of the blocks requiring sweeping periodically. We tie this sweeping + to a timer rather than to collections because we want to reclaim this memory + even if we stop allocating. This way, our memory usage scales smoothly with + actual use, regardless of whether we've recently done an opportunistic GC or not. + + Reviewed by Geoffrey Garen. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * heap/Heap.cpp: + (JSC::Heap::Heap): + (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now, + which we will switch over to being done during incremental sweeping too as soon as + all finalizers can be run lazily (and, by extension, incrementally). + (JSC::Heap::sweeper): + (JSC): + * heap/Heap.h: + (JSC): + (Heap): + * heap/IncrementalSweeper.cpp: Added. + (JSC): + (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to + GCActivityCallback. It is tied to a run-loop based timer that fires periodically based + on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do + anything if the platform doesn't support CoreFoundation. + (JSC::IncrementalSweeper::IncrementalSweeper): + (JSC::IncrementalSweeper::~IncrementalSweeper): + (JSC::IncrementalSweeper::create): + (JSC::IncrementalSweeper::scheduleTimer): + (JSC::IncrementalSweeper::cancelTimer): + (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken + during the last collection, checking to see which blocks need sweeping. If it successfully + gets to the end of the blocks that need sweeping then it cancels the timer. + (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in + a Vector that the incremental sweep will iterate over. We also reset our index into this Vector. + * heap/IncrementalSweeper.h: Added. + (JSC): + (IncrementalSweeper): + * heap/MarkedBlock.h: + (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping + to be usable and to run any destructors that need to be run. + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + [WINCE] Fix JSString after r115516. + https://bugs.webkit.org/show_bug.cgi?id=87892 + + Reviewed by Geoffrey Garen. + + r115516 splitted JSString into two classes, with addition nested classes. + Add a workaround for the WinCE compiler since it can't resolve the friend class + declerations corretly and denies the access to protected members of JSString. + + * runtime/JSString.h: + (JSC::JSRopeString::RopeBuilder::append): + (JSC::JSRopeString::append): + (JSRopeString): + +2012-05-30 Oliver Hunt <oliver@apple.com> + + Really provide error information with the inspector disabled + https://bugs.webkit.org/show_bug.cgi?id=87910 + + Reviewed by Filip Pizlo. + + Don't bother checking for anything other than pre-existing error info. + In the absence of complete line number information you'll only get the + line a function starts on, but at least it's something. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::throwException): + +2012-05-30 Filip Pizlo <fpizlo@apple.com> + + LLInt broken on x86-32 with JIT turned off + https://bugs.webkit.org/show_bug.cgi?id=87906 + + Reviewed by Geoffrey Garen. + + Fixed the code to not clobber registers that contain important things, like the call frame. + + * llint/LowLevelInterpreter32_64.asm: + +2012-05-30 Filip Pizlo <fpizlo@apple.com> + + ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it + https://bugs.webkit.org/show_bug.cgi?id=87887 + + Reviewed by Darin Adler. + + Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0. + + * parser/Nodes.h: + (JSC::ScopeNode::sourceID): + * parser/SourceCode.h: + (JSC::SourceCode::providerID): + (SourceCode): + * parser/SourceProvider.h: + (SourceProvider): + (JSC::SourceProvider::asID): + * runtime/Executable.h: + (JSC::ScriptExecutable::sourceID): + +2012-05-30 Filip Pizlo <fpizlo@apple.com> + + ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it + https://bugs.webkit.org/show_bug.cgi?id=87887 + + Reviewed by Geoffrey Garen. + + * parser/SourceProvider.h: + (JSC::SourceProvider::asID): + +2012-05-30 Oliver Hunt <oliver@apple.com> + + DFG does not correctly handle exceptions caught in the LLInt + https://bugs.webkit.org/show_bug.cgi?id=87885 + + Reviewed by Filip Pizlo. + + Make the DFG use genericThrow, rather than reimplementing a small portion of it. + Also make the LLInt slow paths validate that their PC is correct. + + * dfg/DFGOperations.cpp: + * llint/LLIntSlowPaths.cpp: + (LLInt): + +2012-05-29 Filip Pizlo <fpizlo@apple.com> + + DFG CFA should infer types and values of captured variables + https://bugs.webkit.org/show_bug.cgi?id=87813 + + Reviewed by Gavin Barraclough. + + Slight speed-up in V8/earley-boyer (~1%). + + * bytecode/CodeBlock.h: + (JSC::CodeBlock::argumentsAreCaptured): + (JSC::CodeBlock::argumentIsCaptured): + (CodeBlock): + * dfg/DFGAbstractState.cpp: + (DFG): + (JSC::DFG::AbstractState::beginBasicBlock): + (JSC::DFG::AbstractState::initialize): + (JSC::DFG::AbstractState::endBasicBlock): + (JSC::DFG::AbstractState::execute): + (JSC::DFG::AbstractState::clobberWorld): + (JSC::DFG::AbstractState::clobberStructures): + (JSC::DFG::AbstractState::mergeStateAtTail): + (JSC::DFG::AbstractState::merge): + (JSC::DFG::AbstractState::mergeToSuccessors): + * dfg/DFGAbstractState.h: + (JSC::DFG::AbstractState::variables): + (AbstractState): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Unreviewed. Build fix for !ENABLE(JIT) after r117823. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118868. + http://trac.webkit.org/changeset/118868 + https://bugs.webkit.org/show_bug.cgi?id=87828 + + introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_ + on #webkit). + + * heap/Heap.cpp: + (JSC::Heap::collect): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::sweep): + * heap/MarkedBlock.h: + (JSC::MarkedBlock::sweepWeakSet): + (JSC): + * heap/MarkedSpace.cpp: + (JSC::SweepWeakSet::operator()): + (JSC): + (JSC::MarkedSpace::sweepWeakSets): + * heap/MarkedSpace.h: + (MarkedSpace): + +2012-05-29 Geoffrey Garen <ggaren@apple.com> + + Rolled back in r118646, now that + https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed. + + http://trac.webkit.org/changeset/118646 + https://bugs.webkit.org/show_bug.cgi?id=87599 + + * heap/Heap.cpp: + (JSC::Heap::collect): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::sweep): + * heap/MarkedBlock.h: + (JSC): + * heap/MarkedSpace.cpp: + (JSC): + * heap/MarkedSpace.h: + (MarkedSpace): + +2012-05-29 Filip Pizlo <fpizlo@apple.com> + + DFG should keep captured variables alive until the (inline) return. + https://bugs.webkit.org/show_bug.cgi?id=87205 + + Reviewed by Gavin Barraclough. + + Changes the way we do flushing for captured variables and arguments. Instead of flushing + each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of + whatever was live in the variable previously, and a return will cause a Flush of all + captured variables and all arguments. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::setDirect): + (JSC::DFG::ByteCodeParser::set): + (JSC::DFG::ByteCodeParser::setLocal): + (JSC::DFG::ByteCodeParser::getArgument): + (JSC::DFG::ByteCodeParser::setArgument): + (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument): + (ByteCodeParser): + (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal): + (JSC::DFG::ByteCodeParser::findArgumentPosition): + (JSC::DFG::ByteCodeParser::flush): + (JSC::DFG::ByteCodeParser::flushDirect): + (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables): + (JSC::DFG::ByteCodeParser::handleInlining): + (JSC::DFG::ByteCodeParser::parseBlock): + (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::setLocalStoreElimination): + (JSC::DFG::CSEPhase::performNodeCSE): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck): + +2012-05-29 Geoffrey Garen <ggaren@apple.com> + + WeakGCMap should be lazy-finalization-safe + https://bugs.webkit.org/show_bug.cgi?id=87784 + + Reviewed by Darin Adler. + + * runtime/WeakGCMap.h: + (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and + not Weak<T>, we need to verify manually that the WeakImpl is live before + we return its payload. + +2012-05-29 Mark Hahnenberg <mhahnenberg@apple.com> + + CopiedSpace::doneCopying could start another collection + https://bugs.webkit.org/show_bug.cgi?id=86538 + + Reviewed by Geoffrey Garen. + + It's possible that if we don't have anything at the head of to-space + after a collection and the BlockAllocator doesn't have any fresh blocks + to give us right now we could start another collection while still in + the middle of the first collection when we call CopiedSpace::addNewBlock(). + + One way to resolve this would be to have Heap::shouldCollect() check that + m_operationInProgress is NoOperation. This would prevent the path in + getFreshBlock() that starts the collection if we're already in the middle of one. + + I could not come up with a test case to reproduce this crash on ToT. + + * heap/Heap.h: + (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle + of a collection, i.e. the current operation should be NoOperation. + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118646. + http://trac.webkit.org/changeset/118646 + https://bugs.webkit.org/show_bug.cgi?id=87691 + + broke V8 raytrace benchmark (Requested by pizlo_ on #webkit). + + * heap/Heap.cpp: + (JSC::Heap::collect): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::sweep): + * heap/MarkedBlock.h: + (JSC::MarkedBlock::sweepWeakSet): + (JSC): + * heap/MarkedSpace.cpp: + (JSC::SweepWeakSet::operator()): + (JSC): + (JSC::MarkedSpace::sweepWeakSets): + * heap/MarkedSpace.h: + (MarkedSpace): + +2012-05-28 Filip Pizlo <fpizlo@apple.com> + + DFG should not generate code for code that the CFA proves to be unreachable + https://bugs.webkit.org/show_bug.cgi?id=87682 + + Reviewed by Sam Weinig. + + This also fixes a small performance bug where CFA was not marking blocks + as having constants (and hence not triggering constant folding) if the only + constants were on GetLocals. + + And fixing that bug revealed another bug: constant folding was assuming that + a GetLocal must be the first access to a local in a basic block. This isn't + true. The first access may be a Flush. This patch fixes that issue using the + safest approach possible, since we don't need to be clever for something that + only happens in one of our benchmarks. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGConstantFoldingPhase.cpp: + (JSC::DFG::ConstantFoldingPhase::run): + * dfg/DFGJITCompiler.h: + (JSC::DFG::JITCompiler::noticeOSREntry): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-05-28 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix make distcheck. + + * GNUmakefile.list.am: Add missing header file. + +2012-05-27 Geoffrey Garen <ggaren@apple.com> + + Weak pointer finalization should be lazy + https://bugs.webkit.org/show_bug.cgi?id=87599 + + Reviewed by Darin Adler. + + * heap/Heap.cpp: + (JSC::Heap::collect): Don't force immediate finalization -- it will + happen lazily. + + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the + block. The weak set may not have been swept yet, and this is our last + chance to run weak finalizers before we recycle the memory they reference. + + * heap/MarkedBlock.h: + * heap/MarkedSpace.cpp: + (JSC::MarkedBlock::sweepWeakSets): + * heap/MarkedSpace.h: + (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused + now. + 2012-05-26 Geoffrey Garen <ggaren@apple.com> WebKit should be lazy-finalization-safe (esp. the DOM) v2 diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index fc1a6952f..76440b0a6 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; +ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); @@ -126,4 +127,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index a25aa698d..efd4b5fd8 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -232,6 +232,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/heap/HandleSet.cpp \ Source/JavaScriptCore/heap/HandleSet.h \ Source/JavaScriptCore/heap/HeapBlock.h \ + Source/JavaScriptCore/heap/IncrementalSweeper.h \ + Source/JavaScriptCore/heap/IncrementalSweeper.cpp \ Source/JavaScriptCore/heap/SlotVisitor.h \ Source/JavaScriptCore/heap/HandleStack.cpp \ Source/JavaScriptCore/heap/HandleStack.h \ @@ -537,6 +539,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/runtime/Operations.h \ Source/JavaScriptCore/runtime/Options.cpp \ Source/JavaScriptCore/runtime/Options.h \ + Source/JavaScriptCore/runtime/PrivateName.h \ Source/JavaScriptCore/runtime/PropertyDescriptor.cpp \ Source/JavaScriptCore/runtime/PropertyDescriptor.h \ Source/JavaScriptCore/runtime/PropertyMapHashTable.h \ diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi index 1c3bb0a83..6f4598f41 100644 --- a/Source/JavaScriptCore/JavaScriptCore.gypi +++ b/Source/JavaScriptCore/JavaScriptCore.gypi @@ -134,6 +134,7 @@ 'heap/Heap.h', 'heap/HeapBlock.h', 'heap/HeapRootVisitor.h', + 'heap/IncrementalSweeper.h', 'heap/ListableHandler.h', 'heap/Local.h', 'heap/LocalScope.h', @@ -406,6 +407,7 @@ 'heap/HandleStack.cpp', 'heap/BlockAllocator.cpp', 'heap/Heap.cpp', + 'heap/IncrementalSweeper.cpp', 'heap/MachineStackMarker.cpp', 'heap/MarkedAllocator.cpp', 'heap/MarkedBlock.cpp', diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index 254e2d070..21884df96 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -2158,6 +2158,14 @@ > </File> <File + RelativePath="..\..\heap\IncrementalSweeper.h" + > + </File> + <File + RelativePath="..\..\heap\IncrementalSweeper.cpp" + > + </File> + <File RelativePath="..\..\heap\WeakBlock.cpp" > </File> diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 360c96890..386fcd391 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -524,10 +524,10 @@ A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8A4748E151A8306004123FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A8A4748D151A8306004123FF /* libWTF.a */; }; BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; }; - BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; }; + BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */; }; BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E90B0E1839DB000F9297 /* NativeErrorPrototype.h */; }; - BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E98B0E183E38000F9297 /* ErrorInstance.h */; }; + BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E98B0E183E38000F9297 /* ErrorInstance.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC1166020E1997B4008066DD /* DateInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1166010E1997B1008066DD /* DateInstance.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC11667B0E199C05008066DD /* InternalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC11667A0E199C05008066DD /* InternalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1167D80E19BCC9008066DD /* JSCell.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -637,6 +637,8 @@ BCFD8C930EEB2EE700283848 /* JumpTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFD8C910EEB2EE700283848 /* JumpTable.h */; }; C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F77008E1402FDD60078EB39 /* SamplingCounter.h */; settings = {ATTRIBUTES = (Private, ); }; }; C240305514B404E60079EB64 /* CopiedSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C240305314B404C90079EB64 /* CopiedSpace.cpp */; }; + C25F8BCD157544A900245B71 /* IncrementalSweeper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */; }; + C25F8BCE157544A900245B71 /* IncrementalSweeper.h in Headers */ = {isa = PBXBuildFile; fileRef = C25F8BCC157544A900245B71 /* IncrementalSweeper.h */; settings = {ATTRIBUTES = (Private, ); }; }; C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; C2B916C514DA040C00CBAC86 /* MarkedAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */; }; C2C8D02D14A3C6E000578E65 /* CopiedSpaceInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02B14A3C6B200578E65 /* CopiedSpaceInlineMethods.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -1331,6 +1333,8 @@ BCFD8C900EEB2EE700283848 /* JumpTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JumpTable.cpp; sourceTree = "<group>"; }; BCFD8C910EEB2EE700283848 /* JumpTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpTable.h; sourceTree = "<group>"; }; C240305314B404C90079EB64 /* CopiedSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CopiedSpace.cpp; sourceTree = "<group>"; }; + C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IncrementalSweeper.cpp; sourceTree = "<group>"; }; + C25F8BCC157544A900245B71 /* IncrementalSweeper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncrementalSweeper.h; sourceTree = "<group>"; }; C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedAllocator.h; sourceTree = "<group>"; }; C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedAllocator.cpp; sourceTree = "<group>"; }; C2C8D02B14A3C6B200578E65 /* CopiedSpaceInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopiedSpaceInlineMethods.h; sourceTree = "<group>"; }; @@ -1609,6 +1613,8 @@ 142E312A134FF0A600AFADB5 /* heap */ = { isa = PBXGroup; children = ( + C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */, + C25F8BCC157544A900245B71 /* IncrementalSweeper.h */, 14816E19154CC56C00B8054C /* BlockAllocator.cpp */, 14816E1A154CC56C00B8054C /* BlockAllocator.h */, A7521E121429169A003C8D0C /* CardSet.h */, @@ -2310,6 +2316,7 @@ 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */, C2EAD2FC14F0249800A4B159 /* CopiedAllocator.h in Headers */, C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */, + C25F8BCE157544A900245B71 /* IncrementalSweeper.h in Headers */, BC18C3E60E16F5CD00B34460 /* ArrayConstructor.h in Headers */, BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */, BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */, @@ -3221,6 +3228,7 @@ 0F3B3A2B15475000003ED0FF /* DFGValidate.cpp in Sources */, 0FD81AD2154FB4EE00983E72 /* DFGDominators.cpp in Sources */, 0F16015D156198C900C2587C /* DFGArgumentsSimplificationPhase.cpp in Sources */, + C25F8BCD157544A900245B71 /* IncrementalSweeper.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri index 234078d31..ed682d94a 100644 --- a/Source/JavaScriptCore/Target.pri +++ b/Source/JavaScriptCore/Target.pri @@ -78,6 +78,7 @@ SOURCES += \ heap/HandleStack.cpp \ heap/BlockAllocator.cpp \ heap/Heap.cpp \ + heap/IncrementalSweeper.cpp \ heap/MachineStackMarker.cpp \ heap/MarkStack.cpp \ heap/MarkedAllocator.cpp \ diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index e3ee2ed41..8ef716028 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1021,6 +1021,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& } case op_method_check: { dataLog("[%4d] method_check", location); +#if ENABLE(JIT) if (numberOfMethodCallLinkInfos()) { MethodCallLinkInfo& methodCall = getMethodCallLinkInfo(location); dataLog(" jit("); @@ -1046,6 +1047,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& } dataLog(")"); } +#endif dataLog("\n"); ++it; printGetByIdOp(exec, location, it); diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index ccaca3373..cdc6a19e8 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -462,11 +462,16 @@ namespace JSC { return needsFullScopeChain() && codeType() != GlobalCode; } - bool argumentIsCaptured(int) const + bool argumentsAreCaptured() const { return needsActivation() || usesArguments(); } + bool argumentIsCaptured(int) const + { + return argumentsAreCaptured(); + } + bool localIsCaptured(InlineCallFrame* inlineCallFrame, int operand) const { if (!inlineCallFrame) diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index ff737cf1d..a0849acea 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -33,21 +33,6 @@ namespace JSC { namespace DFG { -#define CFA_PROFILING 0 - -#if CFA_PROFILING -#define PROFILE(flag) SamplingFlags::ScopedFlag scopedFlag(flag) -#else -#define PROFILE(flag) do { } while (false) -#endif - -// Profiling flags -#define FLAG_FOR_BLOCK_INITIALIZATION 17 -#define FLAG_FOR_BLOCK_END 18 -#define FLAG_FOR_EXECUTION 19 -#define FLAG_FOR_MERGE_TO_SUCCESSORS 20 -#define FLAG_FOR_STRUCTURE_CLOBBERING 21 - AbstractState::AbstractState(Graph& graph) : m_codeBlock(graph.m_codeBlock) , m_graph(graph) @@ -61,8 +46,6 @@ AbstractState::~AbstractState() { } void AbstractState::beginBasicBlock(BasicBlock* basicBlock) { - PROFILE(FLAG_FOR_BLOCK_INITIALIZATION); - ASSERT(!m_block); ASSERT(basicBlock->variablesAtHead.numberOfLocals() == basicBlock->valuesAtHead.numberOfLocals()); @@ -97,7 +80,6 @@ void AbstractState::beginBasicBlock(BasicBlock* basicBlock) void AbstractState::initialize(Graph& graph) { - PROFILE(FLAG_FOR_BLOCK_INITIALIZATION); BasicBlock* root = graph.m_blocks[0].get(); root->cfaShouldRevisit = true; root->cfaHasVisited = false; @@ -177,7 +159,6 @@ void AbstractState::initialize(Graph& graph) bool AbstractState::endBasicBlock(MergeMode mergeMode, BranchDirection* branchDirectionPtr) { - PROFILE(FLAG_FOR_BLOCK_END); ASSERT(m_block); BasicBlock* block = m_block; // Save the block for successor merging. @@ -197,14 +178,7 @@ bool AbstractState::endBasicBlock(MergeMode mergeMode, BranchDirection* branchDi dataLog(" Merging state for argument %zu.\n", argument); #endif AbstractValue& destination = block->valuesAtTail.argument(argument); - NodeIndex nodeIndex = block->variablesAtTail.argument(argument); - if (nodeIndex != NoNode && m_graph[nodeIndex].variableAccessData()->isCaptured()) { - if (!destination.isTop()) { - destination.makeTop(); - changed = true; - } - } else - changed |= mergeStateAtTail(destination, m_variables.argument(argument), block->variablesAtTail.argument(argument)); + changed |= mergeStateAtTail(destination, m_variables.argument(argument), block->variablesAtTail.argument(argument)); } for (size_t local = 0; local < block->variablesAtTail.numberOfLocals(); ++local) { @@ -212,14 +186,7 @@ bool AbstractState::endBasicBlock(MergeMode mergeMode, BranchDirection* branchDi dataLog(" Merging state for local %zu.\n", local); #endif AbstractValue& destination = block->valuesAtTail.local(local); - NodeIndex nodeIndex = block->variablesAtTail.local(local); - if (nodeIndex != NoNode && m_graph[nodeIndex].variableAccessData()->isCaptured()) { - if (!destination.isTop()) { - destination.makeTop(); - changed = true; - } - } else - changed |= mergeStateAtTail(destination, m_variables.local(local), block->variablesAtTail.local(local)); + changed |= mergeStateAtTail(destination, m_variables.local(local), block->variablesAtTail.local(local)); } } @@ -250,7 +217,6 @@ void AbstractState::reset() bool AbstractState::execute(unsigned indexInBlock) { - PROFILE(FLAG_FOR_EXECUTION); ASSERT(m_block); ASSERT(m_isValid); @@ -274,11 +240,13 @@ bool AbstractState::execute(unsigned indexInBlock) bool canExit = false; canExit |= variableAccessData->prediction() == PredictNone; if (variableAccessData->isCaptured()) - forNode(nodeIndex).makeTop(); + forNode(nodeIndex) = m_variables.operand(variableAccessData->local()); else { AbstractValue value = m_variables.operand(variableAccessData->local()); if (value.isClear()) canExit |= true; + if (value.value()) + m_foundConstants = true; forNode(nodeIndex) = value; } node.setCanExit(canExit); @@ -286,13 +254,14 @@ bool AbstractState::execute(unsigned indexInBlock) } case GetLocalUnlinked: { - forNode(nodeIndex).makeTop(); + forNode(nodeIndex) = m_variables.operand(node.unlinkedLocal()); node.setCanExit(false); break; } case SetLocal: { if (node.variableAccessData()->isCaptured()) { + m_variables.operand(node.local()) = forNode(node.child1()); node.setCanExit(false); break; } @@ -466,7 +435,7 @@ bool AbstractState::execute(unsigned indexInBlock) break; } if (node.op() == ValueAdd) { - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); forNode(nodeIndex).set(PredictString | PredictInt32 | PredictNumber); node.setCanExit(false); break; @@ -772,12 +741,12 @@ bool AbstractState::execute(unsigned indexInBlock) } else { filter = PredictTop; checker = isAnyPrediction; - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); } } else { filter = PredictTop; checker = isAnyPrediction; - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); } node.setCanExit( !checker(forNode(node.child1()).m_type) @@ -864,7 +833,7 @@ bool AbstractState::execute(unsigned indexInBlock) break; } if (!isActionableArrayPrediction(m_graph[node.child1()].prediction()) || !m_graph[node.child2()].shouldSpeculateInteger()) { - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); forNode(nodeIndex).makeTop(); break; } @@ -958,7 +927,7 @@ bool AbstractState::execute(unsigned indexInBlock) #endif ) { ASSERT(node.op() == PutByVal); - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); forNode(nodeIndex).makeTop(); break; } @@ -1241,7 +1210,10 @@ bool AbstractState::execute(unsigned indexInBlock) break; case CheckArgumentsNotCreated: - node.setCanExit(true); + node.setCanExit( + !isEmptyPrediction( + m_variables.operand( + m_graph.argumentsRegisterFor(node.codeOrigin)).m_type)); break; case GetMyArgumentsLength: @@ -1249,20 +1221,21 @@ bool AbstractState::execute(unsigned indexInBlock) // the arguments a bit. Note that this is not sufficient to force constant folding // of GetMyArgumentsLength, because GetMyArgumentsLength is a clobbering operation. // We perform further optimizations on this later on. - if (node.codeOrigin.inlineCallFrame) { + if (node.codeOrigin.inlineCallFrame) forNode(nodeIndex).set(jsNumber(node.codeOrigin.inlineCallFrame->arguments.size() - 1)); - node.setCanExit(false); - break; - } - node.setCanExit(true); - forNode(nodeIndex).set(PredictInt32); + else + forNode(nodeIndex).set(PredictInt32); + node.setCanExit( + !isEmptyPrediction( + m_variables.operand( + m_graph.argumentsRegisterFor(node.codeOrigin)).m_type)); break; case GetMyArgumentsLengthSafe: node.setCanExit(false); // This potentially clobbers all structures if the arguments object had a getter // installed on the length property. - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); // We currently make no guarantee about what this returns because it does not // speculate that the length property is actually a length. forNode(nodeIndex).makeTop(); @@ -1278,10 +1251,10 @@ bool AbstractState::execute(unsigned indexInBlock) break; case GetMyArgumentByValSafe: - node.setCanExit(false); + node.setCanExit(true); // This potentially clobbers all structures if the property we're accessing has // a getter. We don't speculate against this. - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); // But we do speculate that the index is an integer. forNode(node.child1()).filter(PredictInt32); // And the result is unknown. @@ -1324,7 +1297,7 @@ bool AbstractState::execute(unsigned indexInBlock) } if (isCellPrediction(m_graph[node.child1()].prediction())) forNode(node.child1()).filter(PredictCell); - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); forNode(nodeIndex).makeTop(); break; @@ -1502,7 +1475,7 @@ bool AbstractState::execute(unsigned indexInBlock) case PutByIdDirect: node.setCanExit(true); forNode(node.child1()).filter(PredictCell); - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); break; case GetGlobalVar: @@ -1545,7 +1518,7 @@ bool AbstractState::execute(unsigned indexInBlock) case ResolveBaseStrictPut: case ResolveGlobal: node.setCanExit(true); - clobberStructures(indexInBlock); + clobberWorld(node.codeOrigin, indexInBlock); forNode(nodeIndex).makeTop(); break; @@ -1568,16 +1541,35 @@ bool AbstractState::execute(unsigned indexInBlock) return m_isValid; } +inline void AbstractState::clobberWorld(const CodeOrigin& codeOrigin, unsigned indexInBlock) +{ + if (codeOrigin.inlineCallFrame) { + const BitVector& capturedVars = codeOrigin.inlineCallFrame->capturedVars; + for (size_t i = capturedVars.size(); i--;) { + if (!capturedVars.quickGet(i)) + continue; + m_variables.local(i).makeTop(); + } + } else { + for (size_t i = m_codeBlock->m_numCapturedVars; i--;) + m_variables.local(i).makeTop(); + } + if (m_codeBlock->argumentsAreCaptured()) { + for (size_t i = m_variables.numberOfArguments(); i--;) + m_variables.argument(i).makeTop(); + } + clobberStructures(indexInBlock); +} + inline void AbstractState::clobberStructures(unsigned indexInBlock) { - PROFILE(FLAG_FOR_STRUCTURE_CLOBBERING); if (!m_haveStructures) return; for (size_t i = indexInBlock + 1; i--;) forNode(m_block->at(i)).clobberStructures(); - for (size_t i = 0; i < m_variables.numberOfArguments(); ++i) + for (size_t i = m_variables.numberOfArguments(); i--;) m_variables.argument(i).clobberStructures(); - for (size_t i = 0; i < m_variables.numberOfLocals(); ++i) + for (size_t i = m_variables.numberOfLocals(); i--;) m_variables.local(i).clobberStructures(); m_haveStructures = false; } @@ -1597,46 +1589,56 @@ inline bool AbstractState::mergeStateAtTail(AbstractValue& destination, Abstract dataLog(" It's live, node @%u.\n", nodeIndex); #endif - switch (node.op()) { - case Phi: - case SetArgument: - case Flush: - // The block transfers the value from head to tail. + if (node.variableAccessData()->isCaptured()) { source = inVariable; #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) dataLog(" Transfering "); source.dump(WTF::dataFile()); - dataLog(" from head to tail.\n"); + dataLog(" from last access due to captured variable.\n"); #endif - break; + } else { + switch (node.op()) { + case Phi: + case SetArgument: + case Flush: + // The block transfers the value from head to tail. + source = inVariable; +#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) + dataLog(" Transfering "); + source.dump(WTF::dataFile()); + dataLog(" from head to tail.\n"); +#endif + break; - case GetLocal: - // The block refines the value with additional speculations. - source = forNode(nodeIndex); + case GetLocal: + // The block refines the value with additional speculations. + source = forNode(nodeIndex); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) - dataLog(" Refining to "); - source.dump(WTF::dataFile()); - dataLog("\n"); + dataLog(" Refining to "); + source.dump(WTF::dataFile()); + dataLog("\n"); #endif - break; + break; - case SetLocal: - // The block sets the variable, and potentially refines it, both - // before and after setting it. - if (node.variableAccessData()->shouldUseDoubleFormat()) - source.set(PredictDouble); - else - source = forNode(node.child1()); + case SetLocal: + // The block sets the variable, and potentially refines it, both + // before and after setting it. + if (node.variableAccessData()->shouldUseDoubleFormat()) { + // FIXME: This unnecessarily loses precision. + source.set(PredictDouble); + } else + source = forNode(node.child1()); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) - dataLog(" Setting to "); - source.dump(WTF::dataFile()); - dataLog("\n"); + dataLog(" Setting to "); + source.dump(WTF::dataFile()); + dataLog("\n"); #endif - break; + break; - default: - ASSERT_NOT_REACHED(); - break; + default: + ASSERT_NOT_REACHED(); + break; + } } if (destination == source) { @@ -1667,27 +1669,11 @@ inline bool AbstractState::merge(BasicBlock* from, BasicBlock* to) for (size_t argument = 0; argument < from->variablesAtTail.numberOfArguments(); ++argument) { AbstractValue& destination = to->valuesAtHead.argument(argument); - NodeIndex nodeIndex = from->variablesAtTail.argument(argument); - if (nodeIndex != NoNode && m_graph[nodeIndex].variableAccessData()->isCaptured()) { - if (destination.isTop()) - continue; - destination.makeTop(); - changed = true; - continue; - } changed |= mergeVariableBetweenBlocks(destination, from->valuesAtTail.argument(argument), to->variablesAtHead.argument(argument), from->variablesAtTail.argument(argument)); } for (size_t local = 0; local < from->variablesAtTail.numberOfLocals(); ++local) { AbstractValue& destination = to->valuesAtHead.local(local); - NodeIndex nodeIndex = from->variablesAtTail.local(local); - if (nodeIndex != NoNode && m_graph[nodeIndex].variableAccessData()->isCaptured()) { - if (destination.isTop()) - continue; - destination.makeTop(); - changed = true; - continue; - } changed |= mergeVariableBetweenBlocks(destination, from->valuesAtTail.local(local), to->variablesAtHead.local(local), from->variablesAtTail.local(local)); } @@ -1702,8 +1688,6 @@ inline bool AbstractState::merge(BasicBlock* from, BasicBlock* to) inline bool AbstractState::mergeToSuccessors( Graph& graph, BasicBlock* basicBlock, BranchDirection branchDirection) { - PROFILE(FLAG_FOR_MERGE_TO_SUCCESSORS); - Node& terminal = graph[basicBlock->last()]; ASSERT(terminal.isTerminal()); diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.h b/Source/JavaScriptCore/dfg/DFGAbstractState.h index 4ce3df19b..4b0a248f3 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.h @@ -136,6 +136,11 @@ public: return forNode(nodeUse.index()); } + Operands<AbstractValue>& variables() + { + return m_variables; + } + // Call this before beginning CFA to initialize the abstract values of // arguments, and to indicate which blocks should be listed for CFA // execution. @@ -208,7 +213,8 @@ public: void dump(FILE* out); private: - void clobberStructures(unsigned); + void clobberWorld(const CodeOrigin&, unsigned indexInBlock); + void clobberStructures(unsigned indexInBlock); bool mergeStateAtTail(AbstractValue& destination, AbstractValue& inVariable, NodeIndex); diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index 43157963c..358171029 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -142,20 +142,21 @@ private: { return getDirect(m_inlineStackTop->remapOperand(operand)); } - void setDirect(int operand, NodeIndex value) + enum SetMode { NormalSet, SetOnEntry }; + void setDirect(int operand, NodeIndex value, SetMode setMode = NormalSet) { // Is this an argument? if (operandIsArgument(operand)) { - setArgument(operand, value); + setArgument(operand, value, setMode); return; } // Must be a local. - setLocal((unsigned)operand, value); + setLocal((unsigned)operand, value, setMode); } - void set(int operand, NodeIndex value) + void set(int operand, NodeIndex value, SetMode setMode = NormalSet) { - setDirect(m_inlineStackTop->remapOperand(operand), value); + setDirect(m_inlineStackTop->remapOperand(operand), value, setMode); } NodeIndex injectLazyOperandPrediction(NodeIndex nodeIndex) @@ -236,37 +237,19 @@ private: return nodeIndex; } - void setLocal(unsigned operand, NodeIndex value) + void setLocal(unsigned operand, NodeIndex value, SetMode setMode = NormalSet) { bool isCaptured = m_codeBlock->localIsCaptured(m_inlineStackTop->m_inlineCallFrame, operand); + if (setMode == NormalSet) { + ArgumentPosition* argumentPosition = findArgumentPositionForLocal(operand); + if (isCaptured || argumentPosition) + flushDirect(operand, argumentPosition); + } + VariableAccessData* variableAccessData = newVariableAccessData(operand, isCaptured); NodeIndex nodeIndex = addToGraph(SetLocal, OpInfo(variableAccessData), value); m_currentBlock->variablesAtTail.local(operand) = nodeIndex; - - bool shouldFlush = isCaptured; - - if (!shouldFlush) { - // If this is in argument position, then it should be flushed. - for (InlineStackEntry* stack = m_inlineStackTop; ; stack = stack->m_caller) { - InlineCallFrame* inlineCallFrame = stack->m_inlineCallFrame; - if (!inlineCallFrame) - break; - if (static_cast<int>(operand) >= inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize) - continue; - if (static_cast<int>(operand) == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset()) - continue; - if (operand < inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize - inlineCallFrame->arguments.size()) - continue; - int argument = operandToArgument(operand - inlineCallFrame->stackOffset); - stack->m_argumentPositions[argument]->addVariable(variableAccessData); - shouldFlush = true; - break; - } - } - - if (shouldFlush) - addToGraph(Flush, OpInfo(variableAccessData), nodeIndex); } // Used in implementing get/set, above, where the operand is an argument. @@ -292,7 +275,7 @@ private: VariableAccessData* variableAccessData = flushChild.variableAccessData(); variableAccessData->mergeIsCaptured(isCaptured); nodeIndex = injectLazyOperandPrediction(addToGraph(GetLocal, OpInfo(variableAccessData), nodeIndex)); - m_currentBlock->variablesAtTail.local(operand) = nodeIndex; + m_currentBlock->variablesAtTail.argument(argument) = nodeIndex; return nodeIndex; } nodePtr = &flushChild; @@ -336,31 +319,70 @@ private: return nodeIndex; } - void setArgument(int operand, NodeIndex value) + void setArgument(int operand, NodeIndex value, SetMode setMode = NormalSet) { unsigned argument = operandToArgument(operand); bool isCaptured = m_codeBlock->argumentIsCaptured(argument); ASSERT(argument < m_numArguments); + // Always flush arguments, except for 'this'. + if (argument && setMode == NormalSet) + flushDirect(operand); + VariableAccessData* variableAccessData = newVariableAccessData(operand, isCaptured); - InlineStackEntry* stack = m_inlineStackTop; - while (stack->m_inlineCallFrame) // find the machine stack entry. - stack = stack->m_caller; - stack->m_argumentPositions[argument]->addVariable(variableAccessData); NodeIndex nodeIndex = addToGraph(SetLocal, OpInfo(variableAccessData), value); m_currentBlock->variablesAtTail.argument(argument) = nodeIndex; - // Always flush arguments, except for 'this'. - if (argument) - addToGraph(Flush, OpInfo(variableAccessData), nodeIndex); } - VariableAccessData* flushArgument(int operand) + ArgumentPosition* findArgumentPositionForArgument(int argument) + { + InlineStackEntry* stack = m_inlineStackTop; + while (stack->m_inlineCallFrame) + stack = stack->m_caller; + return stack->m_argumentPositions[argument]; + } + + ArgumentPosition* findArgumentPositionForLocal(int operand) + { + for (InlineStackEntry* stack = m_inlineStackTop; ; stack = stack->m_caller) { + InlineCallFrame* inlineCallFrame = stack->m_inlineCallFrame; + if (!inlineCallFrame) + break; + if (operand >= inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize) + continue; + if (operand == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset()) + continue; + if (static_cast<unsigned>(operand) < inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize - inlineCallFrame->arguments.size()) + continue; + int argument = operandToArgument(operand - inlineCallFrame->stackOffset); + return stack->m_argumentPositions[argument]; + } + return 0; + } + + ArgumentPosition* findArgumentPosition(int operand) + { + if (operandIsArgument(operand)) + return findArgumentPositionForArgument(operandToArgument(operand)); + return findArgumentPositionForLocal(operand); + } + + void flush(int operand) + { + flushDirect(m_inlineStackTop->remapOperand(operand)); + } + + void flushDirect(int operand) + { + flushDirect(operand, findArgumentPosition(operand)); + } + + void flushDirect(int operand, ArgumentPosition* argumentPosition) { // FIXME: This should check if the same operand had already been flushed to // some other local variable. - operand = m_inlineStackTop->remapOperand(operand); bool isCaptured = m_codeBlock->isCaptured(m_inlineStackTop->m_inlineCallFrame, operand); ASSERT(operand < FirstConstantRegisterIndex); @@ -398,7 +420,9 @@ private: VariableAccessData* variableAccessData = node.variableAccessData(); variableAccessData->mergeIsCaptured(isCaptured); addToGraph(Flush, OpInfo(variableAccessData), nodeIndex); - return variableAccessData; + if (argumentPosition) + argumentPosition->addVariable(variableAccessData); + return; } VariableAccessData* variableAccessData = newVariableAccessData(operand, isCaptured); @@ -413,7 +437,21 @@ private: m_currentBlock->variablesAtTail.local(index) = nodeIndex; m_currentBlock->variablesAtHead.setLocalFirstTime(index, nodeIndex); } - return variableAccessData; + if (argumentPosition) + argumentPosition->addVariable(variableAccessData); + } + + void flushArgumentsAndCapturedVariables() + { + int numArguments; + if (m_inlineStackTop->m_inlineCallFrame) + numArguments = m_inlineStackTop->m_inlineCallFrame->arguments.size(); + else + numArguments = m_inlineStackTop->m_codeBlock->numParameters(); + for (unsigned argument = numArguments; argument-- > 1;) + flush(argumentToOperand(argument)); + for (unsigned local = m_inlineStackTop->m_codeBlock->m_numCapturedVars; local--;) + flush(local); } // Get an operand, and perform a ToInt32/ToNumber conversion on it. @@ -1219,17 +1257,6 @@ bool ByteCodeParser::handleInlining(bool usesResult, int callTarget, NodeIndex c // FIXME: Don't flush constants! - Vector<VariableAccessData*, 8> arguments; - for (int i = 1; i < argumentCountIncludingThis; ++i) { - VariableAccessData* variableAccessData = - flushArgument(registerOffset + argumentToOperand(i)); - arguments.append(variableAccessData); - - // Are we going to be capturing arguments? If so make sure we record this fact. - if (codeBlock->argumentIsCaptured(i)) - variableAccessData->mergeIsCaptured(true); - } - int inlineCallFrameStart = m_inlineStackTop->remapOperand(registerOffset) - RegisterFile::CallFrameHeaderSize; // Make sure that the area used by the call frame is reserved. @@ -1251,13 +1278,6 @@ bool ByteCodeParser::handleInlining(bool usesResult, int callTarget, NodeIndex c usesResult ? resultOperand : InvalidVirtualRegister), (VirtualRegister)inlineCallFrameStart, argumentCountIncludingThis, kind); - // Link up the argument variable access datas to their argument positions. - for (int i = 1; i < argumentCountIncludingThis; ++i) { - if (static_cast<size_t>(i) >= inlineStackEntry.m_argumentPositions.size()) - break; - inlineStackEntry.m_argumentPositions[i]->addVariable(arguments[i - 1]); - } - // This is where the actual inlining really happens. unsigned oldIndex = m_currentIndex; unsigned oldProfilingIndex = m_currentProfilingIndex; @@ -1578,7 +1598,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) case op_enter: // Initialize all locals to undefined. for (int i = 0; i < m_inlineStackTop->m_codeBlock->m_numVars; ++i) - set(i, constantUndefined()); + set(i, constantUndefined(), SetOnEntry); NEXT_OPCODE(op_enter); case op_convert_this: { @@ -2352,6 +2372,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) } case op_ret: + flushArgumentsAndCapturedVariables(); if (m_inlineStackTop->m_inlineCallFrame) { if (m_inlineStackTop->m_returnValue != InvalidVirtualRegister) setDirect(m_inlineStackTop->m_returnValue, get(currentInstruction[1].u.operand)); @@ -2379,15 +2400,18 @@ bool ByteCodeParser::parseBlock(unsigned limit) LAST_OPCODE(op_ret); case op_end: + flushArgumentsAndCapturedVariables(); ASSERT(!m_inlineStackTop->m_inlineCallFrame); addToGraph(Return, get(currentInstruction[1].u.operand)); LAST_OPCODE(op_end); case op_throw: + flushArgumentsAndCapturedVariables(); addToGraph(Throw, get(currentInstruction[1].u.operand)); LAST_OPCODE(op_throw); case op_throw_reference_error: + flushArgumentsAndCapturedVariables(); addToGraph(ThrowReferenceError); LAST_OPCODE(op_throw_reference_error); @@ -2818,8 +2842,8 @@ ByteCodeParser::InlineStackEntry::InlineStackEntry( , m_didEarlyReturn(false) , m_caller(byteCodeParser->m_inlineStackTop) { - m_argumentPositions.resize(codeBlock->numParameters()); - for (unsigned i = codeBlock->numParameters(); i--;) { + m_argumentPositions.resize(argumentCountIncludingThis); + for (unsigned i = argumentCountIncludingThis; i--;) { byteCodeParser->m_graph.m_argumentPositions.append(ArgumentPosition()); ArgumentPosition* argumentPosition = &byteCodeParser->m_graph.m_argumentPositions.last(); m_argumentPositions[i] = argumentPosition; diff --git a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp index 3eeb70e05..31488cb1c 100644 --- a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -620,7 +620,7 @@ private: } // This returns the Flush node that is keeping a SetLocal alive. - NodeIndex setLocalStoreElimination(VirtualRegister local) + NodeIndex setLocalStoreElimination(VirtualRegister local, NodeIndex expectedNodeIndex) { for (unsigned i = m_indexInBlock; i--;) { NodeIndex index = m_currentBlock->at(i); @@ -629,7 +629,7 @@ private: continue; switch (node.op()) { case GetLocal: - case SetLocal: + case Flush: if (node.local() == local) return NoNode; break; @@ -639,19 +639,13 @@ private: return NoNode; break; - case Flush: { + case SetLocal: { if (node.local() != local) break; - if (!i) - break; - NodeIndex prevIndex = m_currentBlock->at(i - 1); - if (prevIndex != node.child1().index()) - break; - ASSERT(m_graph[prevIndex].local() == local); - ASSERT(m_graph[prevIndex].variableAccessData() == node.variableAccessData()); - ASSERT(m_graph[prevIndex].shouldGenerate()); - if (m_graph[prevIndex].refCount() > 1) - break; + if (index != expectedNodeIndex) + return NoNode; + if (m_graph[index].refCount() > 1) + return NoNode; return index; } @@ -660,6 +654,14 @@ private: return NoNode; break; + case TearOffActivation: + case TearOffArguments: + // If an activation is being torn off then it means that captured variables + // are live. We could be clever here and check if the local qualifies as an + // argument register. But that seems like it would buy us very little since + // any kind of tear offs are rare to begin with. + return NoNode; + default: if (m_graph.clobbersWorld(index)) return NoNode; @@ -855,27 +857,26 @@ private: break; } - case SetLocal: { + case Flush: { if (m_fixpointState == FixpointNotConverged) break; VariableAccessData* variableAccessData = node.variableAccessData(); if (!variableAccessData->isCaptured()) break; VirtualRegister local = variableAccessData->local(); - NodeIndex replacementIndex = setLocalStoreElimination(local); + NodeIndex replacementIndex = setLocalStoreElimination(local, node.child1().index()); if (replacementIndex == NoNode) break; Node& replacement = m_graph[replacementIndex]; - ASSERT(replacement.op() == Flush); + ASSERT(replacement.op() == SetLocal); ASSERT(replacement.refCount() == 1); ASSERT(replacement.shouldGenerate()); - ASSERT(replacement.mustGenerate()); - replacement.setOpAndDefaultFlags(Phantom); - NodeIndex setLocalIndex = replacement.child1().index(); - ASSERT(m_graph[setLocalIndex].op() == SetLocal); - m_graph.clearAndDerefChild1(replacement); - replacement.children.child1() = m_graph[setLocalIndex].child1(); - m_graph.ref(replacement.child1()); + node.setOpAndDefaultFlags(Phantom); + NodeIndex dataNodeIndex = replacement.child1().index(); + ASSERT(m_graph[dataNodeIndex].hasResult()); + m_graph.clearAndDerefChild1(node); + node.children.child1() = Edge(dataNodeIndex); + m_graph.ref(dataNodeIndex); break; } diff --git a/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp b/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp index b2b74ba04..1e75ddea1 100644 --- a/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp @@ -77,13 +77,42 @@ public: ASSERT(m_graph[node.child1()].op() == Phi); ASSERT(!m_graph[node.child1()].hasResult()); - ASSERT(block->variablesAtHead.operand(node.local()) == nodeIndex); - ASSERT(block->isInPhis(node.child1().index())); - block->variablesAtHead.operand(node.local()) = node.child1().index(); + NodeIndex previousLocalAccess = NoNode; + if (block->variablesAtHead.operand(node.local()) == nodeIndex) { + // We expect this to be the common case. + ASSERT(block->isInPhis(node.child1().index())); + previousLocalAccess = node.child1().index(); + block->variablesAtHead.operand(node.local()) = previousLocalAccess; + } else { + ASSERT(indexInBlock > 0); + // Must search for the previous access to this local. + for (BlockIndex subIndexInBlock = indexInBlock - 1; subIndexInBlock--;) { + NodeIndex subNodeIndex = block->at(subIndexInBlock); + Node& subNode = m_graph[subNodeIndex]; + if (!subNode.shouldGenerate()) + continue; + if (!subNode.hasVariableAccessData()) + continue; + if (subNode.local() != node.local()) + continue; + // The two must have been unified. + ASSERT(subNode.variableAccessData() == node.variableAccessData()); + // Currently, the previous node must be a flush. + // NOTE: This assertion should be removed if we ever do + // constant folding on captured variables. In particular, + // this code does not require the previous node to be a flush, + // but we are asserting this anyway because it is a constraint + // of the IR and this is as good a place as any to assert it. + ASSERT(subNode.op() == Flush); + previousLocalAccess = subNodeIndex; + break; + } + ASSERT(previousLocalAccess != NoNode); + } NodeIndex tailNodeIndex = block->variablesAtTail.operand(node.local()); if (tailNodeIndex == nodeIndex) - block->variablesAtTail.operand(node.local()) = node.child1().index(); + block->variablesAtTail.operand(node.local()) = previousLocalAccess; else { ASSERT(m_graph[tailNodeIndex].op() == Flush || m_graph[tailNodeIndex].op() == SetLocal); diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.h b/Source/JavaScriptCore/dfg/DFGJITCompiler.h index 360165b24..d3ff3be07 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.h +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.h @@ -304,6 +304,10 @@ public: void noticeOSREntry(BasicBlock& basicBlock, JITCompiler::Label blockHead, LinkBuffer& linkBuffer) { #if DFG_ENABLE(OSR_ENTRY) + // OSR entry is not allowed into blocks deemed unreachable by control flow analysis. + if (!basicBlock.cfaHasVisited) + return; + OSREntryData* entry = codeBlock()->appendDFGOSREntryData(basicBlock.bytecodeBegin, linkBuffer.offsetOf(blockHead)); entry->m_expectedValues = basicBlock.valuesAtHead; diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index f95b993d7..b5ac4601a 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -34,6 +34,7 @@ #include "GetterSetter.h" #include <wtf/InlineASM.h> #include "Interpreter.h" +#include "JITExceptions.h" #include "JSActivation.h" #include "JSGlobalData.h" #include "JSStaticScopeObject.h" @@ -1149,35 +1150,31 @@ DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState* exec, uint32_t { JSGlobalData* globalData = &exec->globalData(); NativeCallFrameTracer tracer(globalData, exec); - + JSValue exceptionValue = exec->exception(); ASSERT(exceptionValue); - + unsigned vPCIndex = exec->codeBlock()->bytecodeOffsetForCallAtIndex(callIndex); - HandlerInfo* handler = exec->globalData().interpreter->throwException(exec, exceptionValue, vPCIndex); - - void* catchRoutine = handler ? handler->nativeCode.executableAddress() : (void*)ctiOpThrowNotCaught; - ASSERT(catchRoutine); - return dfgHandlerEncoded(exec, catchRoutine); + ExceptionHandler handler = genericThrow(globalData, exec, exceptionValue, vPCIndex); + ASSERT(handler.catchRoutine); + return dfgHandlerEncoded(handler.callFrame, handler.catchRoutine); } DFGHandlerEncoded DFG_OPERATION lookupExceptionHandlerInStub(ExecState* exec, StructureStubInfo* stubInfo) { JSGlobalData* globalData = &exec->globalData(); NativeCallFrameTracer tracer(globalData, exec); - + JSValue exceptionValue = exec->exception(); ASSERT(exceptionValue); CodeOrigin codeOrigin = stubInfo->codeOrigin; while (codeOrigin.inlineCallFrame) codeOrigin = codeOrigin.inlineCallFrame->caller; - - HandlerInfo* handler = exec->globalData().interpreter->throwException(exec, exceptionValue, codeOrigin.bytecodeIndex); - - void* catchRoutine = handler ? handler->nativeCode.executableAddress() : (void*)ctiOpThrowNotCaught; - ASSERT(catchRoutine); - return dfgHandlerEncoded(exec, catchRoutine); + + ExceptionHandler handler = genericThrow(globalData, exec, exceptionValue, codeOrigin.bytecodeIndex); + ASSERT(handler.catchRoutine); + return dfgHandlerEncoded(handler.callFrame, handler.catchRoutine); } double DFG_OPERATION dfgConvertJSValueToNumber(ExecState* exec, EncodedJSValue value) diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index caa21aabf..9b82121b3 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -967,6 +967,16 @@ void SpeculativeJIT::compile(BasicBlock& block) if (!block.isReachable) return; + + if (!block.cfaHasVisited) { + // Don't generate code for basic blocks that are unreachable according to CFA. + // But to be sure that nobody has generated a jump to this block, drop in a + // breakpoint here. +#if !ASSERT_DISABLED + m_jit.breakpoint(); +#endif + return; + } m_blockHeads[m_block] = m_jit.label(); #if DFG_ENABLE(JIT_BREAK_ON_EVERY_BLOCK) @@ -990,20 +1000,18 @@ void SpeculativeJIT::compile(BasicBlock& block) ASSERT(m_variables.size() == block.variablesAtHead.numberOfLocals()); for (size_t i = 0; i < m_variables.size(); ++i) { NodeIndex nodeIndex = block.variablesAtHead.local(i); - // FIXME: Use the variable access data, not the first node in the block. - // https://bugs.webkit.org/show_bug.cgi?id=87205 - if (m_jit.codeBlock()->localIsCaptured(at(block[0]).codeOrigin.inlineCallFrame, i)) - m_variables[i] = ValueSource(ValueInRegisterFile); - else if (nodeIndex == NoNode) + if (nodeIndex == NoNode) m_variables[i] = ValueSource(SourceIsDead); else if (at(nodeIndex).variableAccessData()->isArgumentsAlias()) m_variables[i] = ValueSource(ArgumentsSource); + else if (at(nodeIndex).variableAccessData()->isCaptured()) + m_variables[i] = ValueSource(ValueInRegisterFile); else if (!at(nodeIndex).refCount()) m_variables[i] = ValueSource(SourceIsDead); else if (at(nodeIndex).variableAccessData()->shouldUseDoubleFormat()) m_variables[i] = ValueSource(DoubleInRegisterFile); else - m_variables[i] = ValueSource::forPrediction(at(nodeIndex).variableAccessData()->prediction()); + m_variables[i] = ValueSource::forPrediction(at(nodeIndex).variableAccessData()->argumentAwarePrediction()); } m_lastSetOperand = std::numeric_limits<int>::max(); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 912078a79..56a1a1861 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -2191,22 +2191,23 @@ public: unsigned setLocalIndexInBlock = m_indexInBlock + 1; Node* setLocal = &at(m_jit.graph().m_blocks[m_block]->at(setLocalIndexInBlock)); + bool hadInt32ToDouble = false; if (setLocal->op() == Int32ToDouble) { setLocal = &at(m_jit.graph().m_blocks[m_block]->at(++setLocalIndexInBlock)); + hadInt32ToDouble = true; + } + if (setLocal->op() == Flush) + setLocal = &at(m_jit.graph().m_blocks[m_block]->at(++setLocalIndexInBlock)); + + if (hadInt32ToDouble) ASSERT(at(setLocal->child1()).child1() == m_compileIndex); - } else + else ASSERT(setLocal->child1() == m_compileIndex); - ASSERT(setLocal->op() == SetLocal); ASSERT(setLocal->codeOrigin == at(m_compileIndex).codeOrigin); Node* nextNode = &at(m_jit.graph().m_blocks[m_block]->at(setLocalIndexInBlock + 1)); - if (nextNode->codeOrigin == at(m_compileIndex).codeOrigin) { - ASSERT(nextNode->op() == Flush); - nextNode = &at(m_jit.graph().m_blocks[m_block]->at(setLocalIndexInBlock + 2)); - ASSERT(nextNode->codeOrigin != at(m_compileIndex).codeOrigin); // duplicate the same assertion as below so that if we fail, we'll know we came down this path. - } ASSERT(nextNode->codeOrigin != at(m_compileIndex).codeOrigin); OSRExit& exit = m_jit.codeBlock()->lastOSRExit(); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index 6c0093e41..00a83000a 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -3858,12 +3858,16 @@ void SpeculativeJIT::compile(Node& node) } case CheckArgumentsNotCreated: { - speculationCheck( - Uncountable, JSValueRegs(), NoNode, - m_jit.branch32( - JITCompiler::NotEqual, - JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), - TrustedImm32(JSValue::EmptyValueTag))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + Uncountable, JSValueRegs(), NoNode, + m_jit.branch32( + JITCompiler::NotEqual, + JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), + TrustedImm32(JSValue::EmptyValueTag))); + } noResult(m_compileIndex); break; } @@ -3872,12 +3876,16 @@ void SpeculativeJIT::compile(Node& node) GPRTemporary result(this); GPRReg resultGPR = result.gpr(); - speculationCheck( - ArgumentsEscaped, JSValueRegs(), NoNode, - m_jit.branch32( - JITCompiler::NotEqual, - JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), - TrustedImm32(JSValue::EmptyValueTag))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + ArgumentsEscaped, JSValueRegs(), NoNode, + m_jit.branch32( + JITCompiler::NotEqual, + JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), + TrustedImm32(JSValue::EmptyValueTag))); + } ASSERT(!node.codeOrigin.inlineCallFrame); m_jit.load32(JITCompiler::payloadFor(RegisterFile::ArgumentCount), resultGPR); @@ -3929,12 +3937,16 @@ void SpeculativeJIT::compile(Node& node) GPRReg resultPayloadGPR = resultPayload.gpr(); GPRReg resultTagGPR = resultTag.gpr(); - speculationCheck( - ArgumentsEscaped, JSValueRegs(), NoNode, - m_jit.branch32( - JITCompiler::NotEqual, - JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), - TrustedImm32(JSValue::EmptyValueTag))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + ArgumentsEscaped, JSValueRegs(), NoNode, + m_jit.branch32( + JITCompiler::NotEqual, + JITCompiler::tagFor(m_jit.argumentsRegisterFor(node.codeOrigin)), + TrustedImm32(JSValue::EmptyValueTag))); + } m_jit.add32(TrustedImm32(1), indexGPR, resultPayloadGPR); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index e4939b23a..ca57743a6 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -3880,12 +3880,16 @@ void SpeculativeJIT::compile(Node& node) GPRTemporary result(this); GPRReg resultGPR = result.gpr(); - speculationCheck( - ArgumentsEscaped, JSValueRegs(), NoNode, - m_jit.branchTestPtr( - JITCompiler::NonZero, - JITCompiler::addressFor( - m_jit.argumentsRegisterFor(node.codeOrigin)))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + ArgumentsEscaped, JSValueRegs(), NoNode, + m_jit.branchTestPtr( + JITCompiler::NonZero, + JITCompiler::addressFor( + m_jit.argumentsRegisterFor(node.codeOrigin)))); + } ASSERT(!node.codeOrigin.inlineCallFrame); m_jit.load32(JITCompiler::payloadFor(RegisterFile::ArgumentCount), resultGPR); @@ -3935,12 +3939,16 @@ void SpeculativeJIT::compile(Node& node) GPRReg indexGPR = index.gpr(); GPRReg resultGPR = result.gpr(); - speculationCheck( - ArgumentsEscaped, JSValueRegs(), NoNode, - m_jit.branchTestPtr( - JITCompiler::NonZero, - JITCompiler::addressFor( - m_jit.argumentsRegisterFor(node.codeOrigin)))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + ArgumentsEscaped, JSValueRegs(), NoNode, + m_jit.branchTestPtr( + JITCompiler::NonZero, + JITCompiler::addressFor( + m_jit.argumentsRegisterFor(node.codeOrigin)))); + } m_jit.add32(TrustedImm32(1), indexGPR, resultGPR); if (node.codeOrigin.inlineCallFrame) { @@ -4024,12 +4032,16 @@ void SpeculativeJIT::compile(Node& node) } case CheckArgumentsNotCreated: { - speculationCheck( - ArgumentsEscaped, JSValueRegs(), NoNode, - m_jit.branchTestPtr( - JITCompiler::NonZero, - JITCompiler::addressFor( - m_jit.argumentsRegisterFor(node.codeOrigin)))); + if (!isEmptyPrediction( + m_state.variables().operand( + m_jit.graph().argumentsRegisterFor(node.codeOrigin)).m_type)) { + speculationCheck( + ArgumentsEscaped, JSValueRegs(), NoNode, + m_jit.branchTestPtr( + JITCompiler::NonZero, + JITCompiler::addressFor( + m_jit.argumentsRegisterFor(node.codeOrigin)))); + } noResult(m_compileIndex); break; } diff --git a/Source/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp index 9b68fb10a..90c4bb72c 100644 --- a/Source/JavaScriptCore/heap/Heap.cpp +++ b/Source/JavaScriptCore/heap/Heap.cpp @@ -27,6 +27,7 @@ #include "ConservativeRoots.h" #include "GCActivityCallback.h" #include "HeapRootVisitor.h" +#include "IncrementalSweeper.h" #include "Interpreter.h" #include "JSGlobalData.h" #include "JSGlobalObject.h" @@ -245,6 +246,7 @@ Heap::Heap(JSGlobalData* globalData, HeapType heapType) , m_objectSpace(this) , m_storageSpace(this) , m_activityCallback(DefaultGCActivityCallback::create(this)) + , m_sweeper(IncrementalSweeper::create(this)) , m_machineThreads(this) , m_sharedData(globalData) , m_slotVisitor(m_sharedData) @@ -703,9 +705,11 @@ void Heap::collect(SweepToggle sweepToggle) GCPHASE(Sweeping); m_objectSpace.sweep(); m_objectSpace.shrink(); - m_bytesAbandoned = 0; } + m_sweeper->startSweeping(m_objectSpace.blocks().set()); + m_bytesAbandoned = 0; + { GCPHASE(ResetAllocators); m_objectSpace.resetAllocators(); @@ -737,6 +741,11 @@ GCActivityCallback* Heap::activityCallback() return m_activityCallback.get(); } +IncrementalSweeper* Heap::sweeper() +{ + return m_sweeper.get(); +} + void Heap::setGarbageCollectionTimerEnabled(bool enable) { activityCallback()->setEnabled(enable); diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h index edfd91483..296447d7b 100644 --- a/Source/JavaScriptCore/heap/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h @@ -47,6 +47,7 @@ namespace JSC { class GlobalCodeBlock; class Heap; class HeapRootVisitor; + class IncrementalSweeper; class JSCell; class JSGlobalData; class JSValue; @@ -100,6 +101,8 @@ namespace JSC { JS_EXPORT_PRIVATE void setActivityCallback(PassOwnPtr<GCActivityCallback>); JS_EXPORT_PRIVATE void setGarbageCollectionTimerEnabled(bool); + IncrementalSweeper* sweeper(); + // true if an allocation or collection is in progress inline bool isBusy(); @@ -217,6 +220,7 @@ namespace JSC { OwnPtr<HashSet<MarkedArgumentBuffer*> > m_markListSet; OwnPtr<GCActivityCallback> m_activityCallback; + OwnPtr<IncrementalSweeper> m_sweeper; MachineThreads m_machineThreads; @@ -240,9 +244,9 @@ namespace JSC { inline bool Heap::shouldCollect() { #if ENABLE(GGC) - return m_objectSpace.nurseryWaterMark() >= m_minBytesPerCycle && m_isSafeToCollect; + return m_objectSpace.nurseryWaterMark() >= m_minBytesPerCycle && m_isSafeToCollect && m_operationInProgress == NoOperation; #else - return m_bytesAllocated > m_bytesAllocatedLimit && m_isSafeToCollect; + return m_bytesAllocated > m_bytesAllocatedLimit && m_isSafeToCollect && m_operationInProgress == NoOperation; #endif } diff --git a/Source/JavaScriptCore/heap/IncrementalSweeper.cpp b/Source/JavaScriptCore/heap/IncrementalSweeper.cpp new file mode 100644 index 000000000..08a9f6c73 --- /dev/null +++ b/Source/JavaScriptCore/heap/IncrementalSweeper.cpp @@ -0,0 +1,107 @@ +#include "config.h" +#include "IncrementalSweeper.h" + +#include "APIShims.h" +#include "Heap.h" +#include "JSObject.h" +#include "JSString.h" +#include "MarkedBlock.h" +#include "ScopeChain.h" +#include <wtf/HashSet.h> +#include <wtf/WTFThreadData.h> + +namespace JSC { + +#if USE(CF) + +static const CFTimeInterval decade = 60 * 60 * 24 * 365 * 10; +static const CFTimeInterval sweepTimeSlicePerBlock = 0.01; +static const CFTimeInterval sweepTimeMultiplier = 1.0 / sweepTimeSlicePerBlock; + +void IncrementalSweeper::timerDidFire(CFRunLoopTimerRef, void* info) +{ + Heap* heap = static_cast<Heap*>(info); + APIEntryShim shim(heap->globalData()); + heap->sweeper()->doSweep(WTF::monotonicallyIncreasingTime()); +} + +IncrementalSweeper::IncrementalSweeper(Heap* heap, CFRunLoopRef runLoop) + : m_heap(heap) + , m_currentBlockToSweepIndex(0) + , m_lengthOfLastSweepIncrement(0.0) +{ + memset(&m_context, 0, sizeof(CFRunLoopTimerContext)); + m_context.info = m_heap; + m_runLoop = runLoop; + m_timer.adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent(), decade, 0, 0, &timerDidFire, &m_context)); + CFRunLoopAddTimer(m_runLoop.get(), m_timer.get(), kCFRunLoopCommonModes); +} + +IncrementalSweeper::~IncrementalSweeper() +{ + CFRunLoopRemoveTimer(m_runLoop.get(), m_timer.get(), kCFRunLoopCommonModes); + CFRunLoopTimerInvalidate(m_timer.get()); +} + +PassOwnPtr<IncrementalSweeper> IncrementalSweeper::create(Heap* heap) +{ + return adoptPtr(new IncrementalSweeper(heap, CFRunLoopGetCurrent())); +} + +void IncrementalSweeper::scheduleTimer() +{ + CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + (m_lengthOfLastSweepIncrement * sweepTimeMultiplier)); +} + +void IncrementalSweeper::cancelTimer() +{ + CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + decade); +} + +void IncrementalSweeper::doSweep(double sweepBeginTime) +{ + for (; m_currentBlockToSweepIndex < m_blocksToSweep.size(); m_currentBlockToSweepIndex++) { + MarkedBlock* nextBlock = m_blocksToSweep[m_currentBlockToSweepIndex]; + if (!nextBlock->needsSweeping()) + continue; + + nextBlock->sweep(); + m_blocksToSweep[m_currentBlockToSweepIndex++] = 0; + m_lengthOfLastSweepIncrement = WTF::monotonicallyIncreasingTime() - sweepBeginTime; + scheduleTimer(); + return; + } + + m_blocksToSweep.clear(); + cancelTimer(); +} + +void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>& blockSnapshot) +{ + WTF::copyToVector(blockSnapshot, m_blocksToSweep); + m_currentBlockToSweepIndex = 0; + scheduleTimer(); +} + +#else + +IncrementalSweeper::IncrementalSweeper() +{ +} + +IncrementalSweeper::~IncrementalSweeper() +{ +} + +PassOwnPtr<IncrementalSweeper> IncrementalSweeper::create(Heap*) +{ + return adoptPtr(new IncrementalSweeper()); +} + +void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>&) +{ +} + +#endif + +} // namespace JSC diff --git a/Source/JavaScriptCore/heap/IncrementalSweeper.h b/Source/JavaScriptCore/heap/IncrementalSweeper.h new file mode 100644 index 000000000..48f040409 --- /dev/null +++ b/Source/JavaScriptCore/heap/IncrementalSweeper.h @@ -0,0 +1,51 @@ +#ifndef IncrementalSweeper_h +#define IncrementalSweeper_h + +#include "MarkedBlock.h" +#include <wtf/HashSet.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RetainPtr.h> +#include <wtf/Vector.h> + +#if USE(CF) +#include <CoreFoundation/CoreFoundation.h> +#endif + +namespace JSC { + +class Heap; + +class IncrementalSweeper { +public: + ~IncrementalSweeper(); + + static PassOwnPtr<IncrementalSweeper> create(Heap*); + void startSweeping(const HashSet<MarkedBlock*>& blockSnapshot); + +private: +#if USE(CF) + IncrementalSweeper(Heap*, CFRunLoopRef); + + static void timerDidFire(CFRunLoopTimerRef, void*); + void doSweep(double startTime); + void scheduleTimer(); + void cancelTimer(); + + Heap* m_heap; + unsigned m_currentBlockToSweepIndex; + RetainPtr<CFRunLoopTimerRef> m_timer; + RetainPtr<CFRunLoopRef> m_runLoop; + CFRunLoopTimerContext m_context; + + double m_lengthOfLastSweepIncrement; + Vector<MarkedBlock*> m_blocksToSweep; +#else + + IncrementalSweeper(); + +#endif +}; + +} // namespace JSC + +#endif diff --git a/Source/JavaScriptCore/heap/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index c21e20b19..b94c1e2b0 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h @@ -157,6 +157,8 @@ namespace JSC { bool isLiveCell(const void*); void setMarked(const void*); + bool needsSweeping(); + #if ENABLE(GGC) void setDirtyObject(const void* atom) { @@ -416,6 +418,11 @@ namespace JSC { } } + inline bool MarkedBlock::needsSweeping() + { + return m_state == Marked; + } + #if ENABLE(GGC) template <int _cellSize> void MarkedBlock::gatherDirtyCellsWithSize(DirtyCellVector& dirtyCells) { diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 5eaed9657..ba72e9bba 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -1024,7 +1024,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV if (exception->isErrorInstance() && static_cast<ErrorInstance*>(exception)->appendSourceToMessage()) appendSourceToError(callFrame, static_cast<ErrorInstance*>(exception), bytecodeOffset); - if (codeBlock->hasLineInfo() && !hasErrorInfo(callFrame, exception)) { + if (!hasErrorInfo(callFrame, exception)) { // FIXME: should only really be adding these properties to VM generated exceptions, // but the inspector currently requires these for all thrown objects. addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source()); diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp index 5cba5ea70..b13e84b53 100644 --- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp +++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp @@ -53,8 +53,16 @@ namespace JSC { namespace LLInt { JSGlobalData& globalData = exec->globalData(); \ NativeCallFrameTracer tracer(&globalData, exec) -#define LLINT_SET_PC_FOR_STUBS() \ - exec->setCurrentVPC(pc + 1) +#ifndef NDEBUG +#define LLINT_SET_PC_FOR_STUBS() do { \ + exec->codeBlock()->bytecodeOffset(pc); \ + exec->setCurrentVPC(pc + 1); \ + } while (false) +#else +#define LLINT_SET_PC_FOR_STUBS() do { \ + exec->setCurrentVPC(pc + 1); \ + } while (false) +#endif #define LLINT_BEGIN() \ LLINT_BEGIN_NO_SET_PC(); \ diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm index dd5ab674a..95b26d42f 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm @@ -1668,8 +1668,8 @@ macro nativeCallTrampoline(executableOffsetToFunction) storei CellTag, ScopeChain + TagOffset[cfr] storei t1, ScopeChain + PayloadOffset[cfr] if X86 - loadp JITStackFrame::globalData + 4[sp], t0 # Additional offset for return address - storep cfr, JSGlobalData::topCallFrame[t0] + loadp JITStackFrame::globalData + 4[sp], t3 # Additional offset for return address + storep cfr, JSGlobalData::topCallFrame[t3] peek 0, t1 storep t1, ReturnPC[cfr] move cfr, t2 # t2 = ecx @@ -1681,8 +1681,8 @@ macro nativeCallTrampoline(executableOffsetToFunction) addp 16 - 4, sp loadp JITStackFrame::globalData + 4[sp], t3 elsif ARMv7 - loadp JITStackFrame::globalData[sp], t1 - storep cfr, JSGlobalData::topCallFrame[t1] + loadp JITStackFrame::globalData[sp], t3 + storep cfr, JSGlobalData::topCallFrame[t3] move t0, t2 preserveReturnAddressAfterCall(t3) storep t3, ReturnPC[cfr] diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h index 26c829da6..5c90bb9fe 100644 --- a/Source/JavaScriptCore/parser/Nodes.h +++ b/Source/JavaScriptCore/parser/Nodes.h @@ -1399,7 +1399,7 @@ namespace JSC { const SourceCode& source() const { return m_source; } const UString& sourceURL() const { return m_source.provider()->url(); } - intptr_t sourceID() const { return m_source.provider()->asID(); } + intptr_t sourceID() const { return m_source.providerID(); } void setFeatures(CodeFeatures features) { m_features = features; } CodeFeatures features() { return m_features; } diff --git a/Source/JavaScriptCore/parser/SourceCode.h b/Source/JavaScriptCore/parser/SourceCode.h index a33ffea72..11a00337d 100644 --- a/Source/JavaScriptCore/parser/SourceCode.h +++ b/Source/JavaScriptCore/parser/SourceCode.h @@ -67,6 +67,13 @@ namespace JSC { return m_provider->getRange(m_startChar, m_endChar); } + intptr_t providerID() const + { + if (!m_provider) + return SourceProvider::nullID; + return m_provider->asID(); + } + bool isNull() const { return !m_provider; } SourceProvider* provider() const { return m_provider.get(); } int firstLine() const { return m_firstLine; } diff --git a/Source/JavaScriptCore/parser/SourceProvider.h b/Source/JavaScriptCore/parser/SourceProvider.h index 20be63cac..946792b2c 100644 --- a/Source/JavaScriptCore/parser/SourceProvider.h +++ b/Source/JavaScriptCore/parser/SourceProvider.h @@ -40,6 +40,8 @@ namespace JSC { class SourceProvider : public RefCounted<SourceProvider> { public: + static const intptr_t nullID = 1; + SourceProvider(const UString& url, const TextPosition& startPosition, SourceProviderCache* cache = 0) : m_url(url) , m_startPosition(startPosition) @@ -61,7 +63,13 @@ namespace JSC { const UString& url() { return m_url; } TextPosition startPosition() const { return m_startPosition; } - intptr_t asID() { return reinterpret_cast<intptr_t>(this); } + intptr_t asID() + { + ASSERT(this); + if (!this) // Be defensive in release mode. + return nullID; + return reinterpret_cast<intptr_t>(this); + } bool isValid() const { return m_validated; } void setValid() { m_validated = true; } diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index debb3e369..e999d3a08 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -285,7 +285,7 @@ namespace JSC { #endif const SourceCode& source() { return m_source; } - intptr_t sourceID() const { return m_source.provider()->asID(); } + intptr_t sourceID() const { return m_source.providerID(); } const UString& sourceURL() const { return m_source.provider()->url(); } int lineNo() const { return m_firstLine; } int lastLine() const { return m_lastLine; } diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 8c8aa9079..86186b7e1 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -244,8 +244,8 @@ void JSGlobalObject::reset(JSValue prototype) m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec)); - ErrorPrototype* errorPrototype = ErrorPrototype::create(exec, this, ErrorPrototype::createStructure(exec->globalData(), this, m_objectPrototype.get())); - m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), this, errorPrototype)); + m_errorPrototype.set(exec->globalData(), this, ErrorPrototype::create(exec, this, ErrorPrototype::createStructure(exec->globalData(), this, m_objectPrototype.get()))); + m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), this, m_errorPrototype.get())); // Constructors @@ -259,9 +259,9 @@ void JSGlobalObject::reset(JSValue prototype) m_regExpConstructor.set(exec->globalData(), this, RegExpConstructor::create(exec, this, RegExpConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()), m_regExpPrototype.get())); - m_errorConstructor.set(exec->globalData(), this, ErrorConstructor::create(exec, this, ErrorConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()), errorPrototype)); + m_errorConstructor.set(exec->globalData(), this, ErrorConstructor::create(exec, this, ErrorConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()), m_errorPrototype.get())); - Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), this, errorPrototype); + Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), this, m_errorPrototype.get()); Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()); m_evalErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError")); m_rangeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError")); @@ -278,7 +278,7 @@ void JSGlobalObject::reset(JSValue prototype) m_numberPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum); m_datePrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum); m_regExpPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum); - errorPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum); + m_errorPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum); @@ -374,6 +374,7 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) visitIfNeeded(visitor, &thisObject->m_numberPrototype); visitIfNeeded(visitor, &thisObject->m_datePrototype); visitIfNeeded(visitor, &thisObject->m_regExpPrototype); + visitIfNeeded(visitor, &thisObject->m_errorPrototype); visitIfNeeded(visitor, &thisObject->m_argumentsStructure); visitIfNeeded(visitor, &thisObject->m_arrayStructure); @@ -389,6 +390,7 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) visitIfNeeded(visitor, &thisObject->m_boundFunctionStructure); visitIfNeeded(visitor, &thisObject->m_namedFunctionStructure); visitIfNeeded(visitor, &thisObject->m_numberObjectStructure); + visitIfNeeded(visitor, &thisObject->m_privateNameStructure); visitIfNeeded(visitor, &thisObject->m_regExpMatchesArrayStructure); visitIfNeeded(visitor, &thisObject->m_regExpStructure); visitIfNeeded(visitor, &thisObject->m_stringObjectStructure); diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index 59b49755b..1e75b7267 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -41,6 +41,7 @@ namespace JSC { class DatePrototype; class Debugger; class ErrorConstructor; + class ErrorPrototype; class FunctionPrototype; class GetterSetter; class GlobalCodeBlock; @@ -117,6 +118,7 @@ namespace JSC { WriteBarrier<NumberPrototype> m_numberPrototype; WriteBarrier<DatePrototype> m_datePrototype; WriteBarrier<RegExpPrototype> m_regExpPrototype; + WriteBarrier<ErrorPrototype> m_errorPrototype; WriteBarrier<Structure> m_argumentsStructure; WriteBarrier<Structure> m_arrayStructure; @@ -252,6 +254,7 @@ namespace JSC { NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); } DatePrototype* datePrototype() const { return m_datePrototype.get(); } RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); } + ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); } JSObject* methodCallDummy() const { return m_methodCallDummy.get(); } diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp index de9977d6e..065ae3828 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.cpp +++ b/Source/JavaScriptCore/runtime/JSONObject.cpp @@ -471,6 +471,9 @@ inline Stringifier::Holder::Holder(JSGlobalData& globalData, JSObject* object) : m_object(globalData, object) , m_isArray(object->inherits(&JSArray::s_info)) , m_index(0) +#ifndef NDEBUG + , m_size(0) +#endif { } diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h index 5079e8583..111853c39 100644 --- a/Source/JavaScriptCore/runtime/JSString.h +++ b/Source/JavaScriptCore/runtime/JSString.h @@ -200,9 +200,7 @@ namespace JSC { { if (m_index == JSRopeString::s_maxInternalRopeLength) expand(); - m_jsString->m_fibers[m_index++].set(m_globalData, m_jsString, jsString); - m_jsString->m_length += jsString->m_length; - m_jsString->m_is8Bit = m_jsString->m_is8Bit && jsString->m_is8Bit; + m_jsString->append(m_globalData, m_index++, jsString); } JSRopeString* release() @@ -252,6 +250,13 @@ namespace JSC { JSString::finishCreation(globalData); } + void append(JSGlobalData& globalData, size_t index, JSString* jsString) + { + m_fibers[index].set(globalData, this, jsString); + m_length += jsString->m_length; + m_is8Bit = m_is8Bit && jsString->m_is8Bit; + } + static JSRopeString* createNull(JSGlobalData& globalData) { JSRopeString* newString = new (NotNull, allocateCell<JSRopeString>(globalData.heap)) JSRopeString(globalData); diff --git a/Source/JavaScriptCore/runtime/WeakGCMap.h b/Source/JavaScriptCore/runtime/WeakGCMap.h index 98483c312..9e8db4d60 100644 --- a/Source/JavaScriptCore/runtime/WeakGCMap.h +++ b/Source/JavaScriptCore/runtime/WeakGCMap.h @@ -69,7 +69,10 @@ public: ExternalType get(const KeyType& key) const { - return HandleTypes<MappedType>::getFromSlot(const_cast<JSValue*>(&m_map.get(key)->jsValue())); + WeakImpl* impl = m_map.get(key); + if (!impl || impl->state() != WeakImpl::Live) + return ExternalType(); + return HandleTypes<MappedType>::getFromSlot(const_cast<JSValue*>(&impl->jsValue())); } void set(JSGlobalData&, const KeyType& key, ExternalType value) diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 7aa43c332..b8710abfc 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,87 @@ +2012-05-31 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Migrate to WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=87788 + + Reviewed by James Robinson. + + * chromium/public/WebTransformationMatrix.h: + (WebTransformationMatrix): + +2012-05-31 Dana Jansens <danakj@chromium.org> + + [chromium] Add copy constructor to WebFilterOperations + https://bugs.webkit.org/show_bug.cgi?id=87970 + + Reviewed by James Robinson. + + * chromium/public/WebFilterOperations.h: + (WebKit::WebFilterOperations::WebFilterOperations): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] create WebTransformOperation interface for chromium platform + https://bugs.webkit.org/show_bug.cgi?id=87510 + + Reviewed by James Robinson. + + * Platform.gypi: + * chromium/public/WebTransformOperations.h: Added. + (WebKit): + (WebTransformOperations): + (WebKit::WebTransformOperations::~WebTransformOperations): + (WebKit::WebTransformOperations::WebTransformOperations): + (WebKit::WebTransformOperations::operator=): + +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add MemoryUsageSupport::processMemorySizesInBytes + https://bugs.webkit.org/show_bug.cgi?id=87830 + + Reviewed by James Robinson. + + * chromium/public/Platform.h: + (Platform): + (WebKit::Platform::processMemorySizesInBytes): moved this method from + Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h, also + removed 'get' prefix. + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Call fileExists through fileUtilities(), not directly. + + * chromium/public/Platform.h: + (Platform): + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * chromium/public/Platform.h: + (WebKit::Platform::fileExists): + (Platform): + +2012-05-29 Shawn Singh <shawnsingh@chromium.org> + + [chromium] make WebTransformationMatrix object usable by non-webkit code + https://bugs.webkit.org/show_bug.cgi?id=87315 + + Reviewed by James Robinson. + + * chromium/public/WebTransformationMatrix.h: + (WebKit::WebTransformationMatrix::~WebTransformationMatrix): + (WebTransformationMatrix): + 2012-05-25 Kinuko Yasuda <kinuko@chromium.org> [chromium] Deprecate FileUtilities::getFileSize and getFileModifiedTime in favor of getFileMetadata diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index a84fb4732..54af19623 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -100,6 +100,7 @@ 'chromium/public/WebThread.h', 'chromium/public/WebThreadSafeData.h', 'chromium/public/WebTransformationMatrix.h', + 'chromium/public/WebTransformOperations.h', 'chromium/public/WebPrerender.h', 'chromium/public/WebURL.h', 'chromium/public/WebURLError.h', diff --git a/Source/Platform/chromium/public/Platform.h b/Source/Platform/chromium/public/Platform.h index 86c1538a6..5dabb9432 100644 --- a/Source/Platform/chromium/public/Platform.h +++ b/Source/Platform/chromium/public/Platform.h @@ -106,6 +106,7 @@ public: // Must return non-null. virtual WebFileSystem* fileSystem() { return 0; } + // Gamepad ------------------------------------------------------------- virtual void sampleGamepads(WebGamepads& into) { into.length = 0; } @@ -152,6 +153,10 @@ public: // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high. virtual size_t highUsageDeltaMB() { return 128; } + // Returns private and shared usage, in bytes. Private bytes is the amount of + // memory currently allocated to this process that cannot be shared. Returns + // false on platform specific error conditions. + virtual bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes) { return false; } // Network ------------------------------------------------------------- diff --git a/Source/Platform/chromium/public/WebFilterOperations.h b/Source/Platform/chromium/public/WebFilterOperations.h index 9e32c0a22..c2e473098 100644 --- a/Source/Platform/chromium/public/WebFilterOperations.h +++ b/Source/Platform/chromium/public/WebFilterOperations.h @@ -38,6 +38,11 @@ class WebFilterOperationsPrivate; class WebFilterOperations { public: WebFilterOperations() { initialize(); } + WebFilterOperations(const WebFilterOperations& other) + { + initialize(); + assign(other); + } WebFilterOperations& operator=(const WebFilterOperations& other) { assign(other); diff --git a/Source/Platform/chromium/public/WebTransformOperations.h b/Source/Platform/chromium/public/WebTransformOperations.h new file mode 100644 index 000000000..a497aaa55 --- /dev/null +++ b/Source/Platform/chromium/public/WebTransformOperations.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTransformOperations_h +#define WebTransformOperations_h + +#include <public/WebTransformationMatrix.h> + +namespace WebKit { + +class WebTransformOperationsPrivate; + +// Transform operations are a decomposed transformation matrix. It can be +// applied to obtain a WebTransformationMatrix at any time, and can be blended +// intelligently with other transform operations, so long as they represent the +// same decomposition. For example, if we have a transform that is made up of +// a rotation followed by skew, it can be blended intelligently with another +// transform made up of a rotation followed by a skew. Blending is possible if +// we have two dissimilar sets of transform operations, but the effect may not +// be what was intended. For more information, see the comments for the blend +// function below. +class WebTransformOperations { +public: + ~WebTransformOperations() { reset(); } + + WebTransformOperations() { initialize(); } + WebTransformOperations(const WebTransformOperations& other) { initialize(other); } + WebTransformOperations& operator=(const WebTransformOperations& other) + { + initialize(other); + return *this; + } + + // Returns a transformation matrix representing these transform operations. + WEBKIT_EXPORT WebTransformationMatrix apply() const; + + // Given another set of transform operations and a progress in the range + // [0, 1], returns a transformation matrix representing the intermediate + // value. If this->matchesTypes(from), then each of the operations are + // blended separately and then combined. Otherwise, the two sets of + // transforms are baked to matrices (using apply), and the matrices are + // then decomposed and interpolated. For more information, see + // http://www.w3.org/TR/2011/WD-css3-2d-transforms-20111215/#matrix-decomposition. + WEBKIT_EXPORT WebTransformationMatrix blend(const WebTransformOperations& from, double progress) const; + + // Returns true if this operation and its descendants have the same types + // as other and its descendants. + WEBKIT_EXPORT bool matchesTypes(const WebTransformOperations& other) const; + + WEBKIT_EXPORT void appendTranslate(double x, double y, double z); + WEBKIT_EXPORT void appendRotate(double x, double y, double z, double degrees); + WEBKIT_EXPORT void appendScale(double x, double y, double z); + WEBKIT_EXPORT void appendSkew(double x, double y); + WEBKIT_EXPORT void appendPerspective(double depth); + WEBKIT_EXPORT void appendMatrix(const WebTransformationMatrix&); + +private: + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void initialize(const WebTransformOperations& prototype); + + WebPrivateOwnPtr<WebTransformOperationsPrivate> m_private; +}; + +} // namespace WebKit + +#endif // WebTransformOperations_h + diff --git a/Source/Platform/chromium/public/WebTransformationMatrix.h b/Source/Platform/chromium/public/WebTransformationMatrix.h index ac4a2c051..3135b4e68 100644 --- a/Source/Platform/chromium/public/WebTransformationMatrix.h +++ b/Source/Platform/chromium/public/WebTransformationMatrix.h @@ -35,24 +35,24 @@ #include "FloatPoint.h" #include "FloatPoint3D.h" #include "FloatQuad.h" +#include "TransformationMatrix.h" #endif #include "WebCommon.h" #include "WebPrivateOwnPtr.h" -namespace WebCore { -class TransformationMatrix; -} - namespace WebKit { class WebTransformationMatrix { public: WebTransformationMatrix(); WebTransformationMatrix(double a, double b, double c, double d, double e, double f); + WebTransformationMatrix(double m11, double m12, double m13, double m14, + double m21, double m22, double m23, double m24, + double m31, double m32, double m33, double m34, + double m41, double m42, double m43, double m44); WebTransformationMatrix(const WebTransformationMatrix&); - ~WebTransformationMatrix() { reset(); } - void reset(); + ~WebTransformationMatrix() { } // Operations that return a separate matrix and do not modify this one. WebTransformationMatrix inverse() const; @@ -136,7 +136,7 @@ public: #if WEBKIT_IMPLEMENTATION // Conversions between WebKit::WebTransformationMatrix and WebCore::TransformationMatrix explicit WebTransformationMatrix(const WebCore::TransformationMatrix&); - WebCore::TransformationMatrix& toWebCoreTransform() const; + WebCore::TransformationMatrix toWebCoreTransform() const; // FIXME: these map functions should not exist, should be using CCMathUtil // instead. Eventually CCMathUtil functions could be merged here, but its @@ -151,9 +151,27 @@ public: #endif protected: - WebPrivateOwnPtr<WebCore::TransformationMatrix> m_private; + + // While migrating this code: Code that is external to WebKit should have no knowledge + // of WebCore::TransformationMatrix. But in those cases, this class still needs to + // be the same size so that the class can be passed back and forth between WebKit and + // non-WebKit code. + // + // The end goal is eventually for this class to only exist at the API boundary, as a + // conversion between WebCore TransformationMatrix and the compositor's internal + // implementation of matrix transforms. + // +#if WEBKIT_IMPLEMENTATION + WebCore::TransformationMatrix m_private; +#else + double m_matrix[4][4]; +#endif }; +#if WEBKIT_IMPLEMENTATION +COMPILE_ASSERT(sizeof(WebCore::TransformationMatrix) == sizeof(double[4][4]), WebTransformationMatrix_has_unexpected_size); +#endif + } // namespace WebKit #endif diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index ac464e541..dc0480385 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,147 @@ +2012-05-31 Anders Carlsson <andersca@apple.com> + + Enable support for rvalue references when building with a version of clang that supports them + https://bugs.webkit.org/show_bug.cgi?id=88018 + + Re-enable support for rvalue references when building with a version of Xcode newer than 4.2. + + * wtf/Compiler.h: + +2012-05-31 Filip Pizlo <fpizlo@apple.com> + + DataLog should be usable outside of JSC + https://bugs.webkit.org/show_bug.cgi?id=88015 + + Reviewed by Oliver Hunt. + + * wtf/DataLog.h: + (WTF): + +2012-05-31 Anders Carlsson <andersca@apple.com> + + Disable support for rvalue references until I figure out why this is breaking the Xcode 4.2 build. + + * wtf/Compiler.h: + +2012-05-31 Anders Carlsson <andersca@apple.com> + + Vector should have a move constructor and move assignment operator + https://bugs.webkit.org/show_bug.cgi?id=87997 + + Reviewed by Andreas Kling. + + * wtf/Compiler.h: + Use __has_extension so we can use move semantics and other C++11 features even when building as C++98. + + * wtf/Vector.h: + Add a move constructor and a move assignment operator to Vector. + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * wtf/qt/UtilsQt.h: + +2012-05-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + HashTable.h has using directives for std::pair and std::make_pair + https://bugs.webkit.org/show_bug.cgi?id=29919 + + Reviewed by Darin Adler. + + * wtf/HashTraits.h: + (WTF): Remove the directives. + +2012-05-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + HashTable.h has using directives for std::pair and std::make_pair + https://bugs.webkit.org/show_bug.cgi?id=29919 + + Reviewed by Darin Adler. + + Change code to use std::pair and std::make_pair. Later patch will remove the + 'using' directives. + + * wtf/HashTable.h: + (WTF::hashTableSwap): + (HashTable): + * wtf/HashTraits.h: + (PairHashTraits): + (WTF::PairHashTraits::emptyValue): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Build fix for WinCE after r118603. + + * wtf/Atomics.h: + (WTF::weakCompareAndSwap): + +2012-05-29 Anders Carlsson <andersca@apple.com> + + String should be move enabled/optimized + https://bugs.webkit.org/show_bug.cgi?id=87596 + + Reviewed by Andreas Kling. + + Add move constructors and move assignment operators to String and AtomicString when building with + compilers that support rvalue references. This gets rid of ref-churn when the source of the + constructor or assignment is a temporary object. + + * wtf/text/AtomicString.h: + (AtomicString): + (WTF::AtomicString::AtomicString): + (WTF::AtomicString::operator=): + * wtf/text/WTFString.h: + (String): + (WTF::String::String): + (WTF::String::operator=): + +2012-05-29 Alexandre Elias <aelias@google.com> + + Support WebKit log messages on Android + https://bugs.webkit.org/show_bug.cgi?id=87773 + + Reviewed by Darin Adler. + + This sends WebKit log messages to the Android "logcat" facility, as + Android sends stderr to /dev/null. + + * wtf/Assertions.cpp: + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Remove duplication of logic for disabling selected warnings related to C++11 + + This is already handled in unix/default_post.prf + + Reviewed by Simon Hausmann. + + * WTF.pro: + +2012-05-27 Darin Adler <darin@apple.com> + + Fix an incorrect assertion in Vector::remove + https://bugs.webkit.org/show_bug.cgi?id=87612 + + Reviewed by Dan Bernstein. + + * wtf/Vector.h: There's no good reason to disallow calling remove + with a size of 0, even when the position is at the end of the vector, + so changed the two-argument Vector::remove assertion to assert that + the position is <= size rather than < size. + +2012-05-27 Yoshifumi Inoue <yosin@chromium.org> + + [WTF] Introduce UINT64_C to MathExtras.h + https://bugs.webkit.org/show_bug.cgi?id=87485 + + Reviewed by Kent Tamura. + + * wtf/MathExtras.h: + 2012-05-25 Filip Pizlo <fpizlo@apple.com> weakCompareAndSwap should work on Windows diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro index 06ba5cb71..3384770a8 100644 --- a/Source/WTF/WTF.pro +++ b/Source/WTF/WTF.pro @@ -240,22 +240,8 @@ QT -= gui QMAKE_CFLAGS += -mieee -w } -lessThan(QT_GCC_MAJOR_VERSION, 5) { - # GCC 4.5 and before - lessThan(QT_GCC_MINOR_VERSION, 6) { - # Disable C++0x mode in JSC for those who enabled it in their Qt's mkspec. - *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x - } - - # GCC 4.6 and after. - greaterThan(QT_GCC_MINOR_VERSION, 5) { - if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) { - # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr). - QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat - QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat - QMAKE_CFLAGS += -Wno-c++0x-compat - QMAKE_CXXFLAGS += -Wno-c++0x-compat - } - } +*-g++*:lessThan(QT_GCC_MAJOR_VERSION, 5):lessThan(QT_GCC_MINOR_VERSION, 6) { + # For GCC 4.5 and before we disable C++0x mode in JSC for if enabled in Qt's mkspec + QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp index 8549f1ef2..8fe8a38de 100644 --- a/Source/WTF/wtf/Assertions.cpp +++ b/Source/WTF/wtf/Assertions.cpp @@ -58,6 +58,10 @@ #include <execinfo.h> #endif +#if OS(ANDROID) +#include "android/log.h" +#endif + #if PLATFORM(BLACKBERRY) #include <BlackBerryPlatformLog.h> #endif @@ -106,6 +110,8 @@ static void vprintf_stderr_common(const char* format, va_list args) #elif PLATFORM(BLACKBERRY) BlackBerry::Platform::logStreamV(format, args); +#elif OS(ANDROID) + __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args); #elif HAVE(ISDEBUGGERPRESENT) if (IsDebuggerPresent()) { size_t size = 1024; diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h index d70c72a1f..0442a7df4 100644 --- a/Source/WTF/wtf/Atomics.h +++ b/Source/WTF/wtf/Atomics.h @@ -121,7 +121,11 @@ inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_ #if OS(WINDOWS) inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) { +#if OS(WINCE) + return InterlockedCompareExchange(reinterpret_cast<LONG*>(const_cast<unsigned*>(location)), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected); +#else return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected); +#endif } inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue) diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h index 9637dc0bc..f40e15e60 100644 --- a/Source/WTF/wtf/Compiler.h +++ b/Source/WTF/wtf/Compiler.h @@ -48,9 +48,14 @@ #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA) /* Specific compiler features */ -#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_feature(cxx_variadic_templates) -#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_feature(cxx_rvalue_references) -#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_feature(cxx_deleted_functions) +#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_extension(cxx_variadic_templates) + +/* There is a bug in clang that comes with Xcode 4.2 where AtomicStrings can't be implicitly converted to Strings + in the presence of move constructors and/or move assignment operators. This bug has been fixed in Xcode 4.3 clang, so we + check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_member_init feature which we know was added in 4.3 */ +#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_references) && __has_extension(cxx_nonstatic_member_init) + +#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_extension(cxx_deleted_functions) #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr) #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert) diff --git a/Source/WTF/wtf/DataLog.h b/Source/WTF/wtf/DataLog.h index bcbebb9e2..cca04a3c4 100644 --- a/Source/WTF/wtf/DataLog.h +++ b/Source/WTF/wtf/DataLog.h @@ -33,10 +33,10 @@ namespace WTF { -FILE* dataFile(); +WTF_EXPORT_PRIVATE FILE* dataFile(); -void dataLogV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0); -void dataLog(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); +WTF_EXPORT_PRIVATE void dataLogV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0); +WTF_EXPORT_PRIVATE void dataLog(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); } // namespace WTF diff --git a/Source/WTF/wtf/HashTable.h b/Source/WTF/wtf/HashTable.h index 7625e56fe..ccf62dc00 100644 --- a/Source/WTF/wtf/HashTable.h +++ b/Source/WTF/wtf/HashTable.h @@ -285,7 +285,7 @@ namespace WTF { } // Swap pairs by component, in case of pair members that specialize swap. - template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b) + template<typename T, typename U> inline void hashTableSwap(std::pair<T, U>& a, std::pair<T, U>& b) { swap(a.first, b.first); swap(a.second, b.second); @@ -392,8 +392,8 @@ namespace WTF { static ValueType* allocateTable(int size); static void deallocateTable(ValueType* table, int size); - typedef pair<ValueType*, bool> LookupType; - typedef pair<LookupType, unsigned> FullLookupType; + typedef std::pair<ValueType*, bool> LookupType; + typedef std::pair<LookupType, unsigned> FullLookupType; LookupType lookupForWriting(const Key& key) { return lookupForWriting<IdentityTranslatorType>(key); }; template<typename HashTranslator, typename T> FullLookupType fullLookupForWriting(const T&); diff --git a/Source/WTF/wtf/HashTraits.h b/Source/WTF/wtf/HashTraits.h index fdf1ab941..21ffdbb45 100644 --- a/Source/WTF/wtf/HashTraits.h +++ b/Source/WTF/wtf/HashTraits.h @@ -34,9 +34,6 @@ namespace WTF { template<typename T> class OwnPtr; template<typename T> class PassOwnPtr; - using std::pair; - using std::make_pair; - template<typename T> struct HashTraits; template<bool isInteger, typename T> struct GenericHashTraitsBase; @@ -169,14 +166,14 @@ namespace WTF { // special traits for pairs, helpful for their use in HashMap implementation template<typename FirstTraitsArg, typename SecondTraitsArg> - struct PairHashTraits : GenericHashTraits<pair<typename FirstTraitsArg::TraitType, typename SecondTraitsArg::TraitType> > { + struct PairHashTraits : GenericHashTraits<std::pair<typename FirstTraitsArg::TraitType, typename SecondTraitsArg::TraitType> > { typedef FirstTraitsArg FirstTraits; typedef SecondTraitsArg SecondTraits; - typedef pair<typename FirstTraits::TraitType, typename SecondTraits::TraitType> TraitType; - typedef pair<typename FirstTraits::EmptyValueType, typename SecondTraits::EmptyValueType> EmptyValueType; + typedef std::pair<typename FirstTraits::TraitType, typename SecondTraits::TraitType> TraitType; + typedef std::pair<typename FirstTraits::EmptyValueType, typename SecondTraits::EmptyValueType> EmptyValueType; static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero; - static EmptyValueType emptyValue() { return make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); } + static EmptyValueType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); } static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction; @@ -187,7 +184,7 @@ namespace WTF { }; template<typename First, typename Second> - struct HashTraits<pair<First, Second> > : public PairHashTraits<HashTraits<First>, HashTraits<Second> > { }; + struct HashTraits<std::pair<First, Second> > : public PairHashTraits<HashTraits<First>, HashTraits<Second> > { }; } // namespace WTF diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h index 956fc94cc..154c88725 100644 --- a/Source/WTF/wtf/MathExtras.h +++ b/Source/WTF/wtf/MathExtras.h @@ -302,6 +302,14 @@ using std::wtf_isnan; #define isnan(x) wtf_isnan(x) #endif +#ifndef UINT64_C +#if COMPILER(MSVC) +#define UINT64_C(c) c ## ui64 +#else +#define UINT64_C(c) c ## ull +#endif +#endif + // decompose 'number' to its sign, exponent, and mantissa components. // The result is interpreted as: diff --git a/Source/WTF/wtf/Vector.h b/Source/WTF/wtf/Vector.h index 19e6ffb8c..a3b6a0e62 100644 --- a/Source/WTF/wtf/Vector.h +++ b/Source/WTF/wtf/Vector.h @@ -518,6 +518,11 @@ namespace WTF { template<size_t otherCapacity> Vector& operator=(const Vector<T, otherCapacity>&); +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + Vector(Vector&&); + Vector& operator=(Vector&&); +#endif + size_t size() const { return m_size; } size_t capacity() const { return m_buffer.capacity(); } bool isEmpty() const { return !size(); } @@ -759,6 +764,24 @@ namespace WTF { return *this; } +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + template<typename T, size_t inlineCapacity> + Vector<T, inlineCapacity>::Vector(Vector<T, inlineCapacity>&& other) + : m_size(0) + { + // It's a little weird to implement a move constructor using swap but this way we + // don't have to add a move constructor to VectorBuffer. + swap(other); + } + + template<typename T, size_t inlineCapacity> + Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(Vector<T, inlineCapacity>&& other) + { + swap(other); + return *this; + } +#endif + template<typename T, size_t inlineCapacity> template<typename U> bool Vector<T, inlineCapacity>::contains(const U& value) const @@ -1110,7 +1133,7 @@ namespace WTF { template<typename T, size_t inlineCapacity> inline void Vector<T, inlineCapacity>::remove(size_t position, size_t length) { - ASSERT(position < size()); + ASSERT(position <= size()); ASSERT(position + length <= size()); T* beginSpot = begin() + position; T* endSpot = beginSpot + length; diff --git a/Source/WTF/wtf/qt/UtilsQt.h b/Source/WTF/wtf/qt/UtilsQt.h index 74067a8ee..61c9e32c1 100644 --- a/Source/WTF/wtf/qt/UtilsQt.h +++ b/Source/WTF/wtf/qt/UtilsQt.h @@ -21,13 +21,13 @@ #define WTF_UtilsQt_h #include <QString> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) #include <QTextDocument> #endif inline QString escapeHtml(const QString& string) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) return string.toHtmlEscaped(); #else return Qt::escape(string); diff --git a/Source/WTF/wtf/text/AtomicString.h b/Source/WTF/wtf/text/AtomicString.h index ca133a5e1..73a855997 100644 --- a/Source/WTF/wtf/text/AtomicString.h +++ b/Source/WTF/wtf/text/AtomicString.h @@ -51,6 +51,17 @@ public: ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { } AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_string(add(baseString, start, length)) { } +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + // We have to declare the copy constructor and copy assignment operator as well, otherwise + // they'll be implicitly deleted by adding the move constructor and move assignment operator. + // FIXME: Instead of explicitly casting to String&& here, we should use std::move, but that requires us to + // have a standard library that supports move semantics. + AtomicString(const AtomicString& other) : m_string(other.m_string) { } + AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_string)) { } + AtomicString& operator=(const AtomicString& other) { m_string = other.m_string; return *this; } + AtomicString& operator=(AtomicString&& other) { m_string = static_cast<String&&>(other.m_string); return *this; } +#endif + // Hash table deleted values, which are only constructed and never copied or destroyed. AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { } bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); } diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h index 5e1763ad7..bfbfda4d4 100644 --- a/Source/WTF/wtf/text/WTFString.h +++ b/Source/WTF/wtf/text/WTFString.h @@ -131,6 +131,15 @@ public: String(PassRefPtr<StringImpl> impl) : m_impl(impl) { } String(RefPtr<StringImpl> impl) : m_impl(impl) { } +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + // We have to declare the copy constructor and copy assignment operator as well, otherwise + // they'll be implicitly deleted by adding the move constructor and move assignment operator. + String(const String& other) : m_impl(other.m_impl) { } + String(String&& other) : m_impl(other.m_impl.release()) { } + String& operator=(const String& other) { m_impl = other.m_impl; return *this; } + String& operator=(String&& other) { m_impl = other.m_impl.release(); return *this; } +#endif + // Inline the destructor. ALWAYS_INLINE ~String() { } diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 94ff7bc8c..7d6ea1cfc 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -477,6 +477,7 @@ SET(WebCore_SOURCES css/CSSFunctionValue.cpp css/CSSGradientValue.cpp css/CSSImageGeneratorValue.cpp + css/CSSImageSetValue.cpp css/CSSImageValue.cpp css/CSSImportRule.cpp css/CSSInheritedValue.cpp @@ -1059,6 +1060,7 @@ SET(WebCore_SOURCES page/FrameTree.cpp page/FrameView.cpp page/GroupSettings.cpp + page/GestureTapHighlighter.cpp page/History.cpp page/Location.cpp page/MemoryInfo.cpp @@ -1088,6 +1090,7 @@ SET(WebCore_SOURCES page/WebKitAnimation.cpp page/WebKitAnimationList.cpp page/WindowFeatures.cpp + page/WindowFocusAllowedIndicator.cpp page/animation/AnimationBase.cpp page/animation/AnimationController.cpp @@ -1107,6 +1110,7 @@ SET(WebCore_SOURCES platform/ContentType.cpp platform/CrossThreadCopier.cpp platform/DateComponents.cpp + platform/Decimal.cpp platform/DragData.cpp platform/DragImage.cpp platform/EventTracer.cpp @@ -1410,6 +1414,7 @@ SET(WebCore_SOURCES rendering/style/StyleBackgroundData.cpp rendering/style/StyleBoxData.cpp rendering/style/StyleCachedImage.cpp + rendering/style/StyleCachedImageSet.cpp rendering/style/StyleDeprecatedFlexibleBoxData.cpp rendering/style/StyleFilterData.cpp rendering/style/StyleFlexibleBoxData.cpp @@ -1976,8 +1981,8 @@ IF (ENABLE_SVG) svg/SVGURIReference.cpp svg/SVGUseElement.cpp svg/SVGViewElement.cpp - svg/SVGVKernElement.cpp svg/SVGViewSpec.cpp + svg/SVGVKernElement.cpp svg/SVGZoomAndPan.cpp svg/SVGZoomEvent.cpp svg/animation/SMILTime.cpp @@ -2135,6 +2140,7 @@ IF (ENABLE_SVG) svg/SVGUnitTypes.idl svg/SVGUseElement.idl svg/SVGViewElement.idl + svg/SVGViewSpec.idl svg/SVGVKernElement.idl svg/SVGZoomAndPan.idl svg/SVGZoomEvent.idl diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 2574f055c..b9f59d6bd 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,6325 @@ +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: change type of injected script id from long to int + https://bugs.webkit.org/show_bug.cgi?id=87837 + + Reviewed by Pavel Feldman. + + Changed injected script id type from long to int so that we don't + lose precision when sending the id over the protocol. + + * bindings/js/JSInjectedScriptManager.cpp: + (WebCore::InjectedScriptManager::createInjectedScript): + (WebCore::InjectedScriptManager::injectedScriptFor): + * bindings/v8/custom/V8InjectedScriptManager.cpp: + (WebCore::InjectedScriptManager::createInjectedScript): + (WebCore::InjectedScriptManager::injectedScriptFor): + * inspector/InjectedScriptManager.cpp: + (WebCore::InjectedScriptManager::injectedScriptForId): + (WebCore::InjectedScriptManager::injectedScriptIdFor): + (WebCore::InjectedScriptManager::injectScript): + * inspector/InjectedScriptManager.h: + (InjectedScriptManager): + * inspector/PageRuntimeAgent.cpp: + (WebCore::PageRuntimeAgent::notifyContextCreated): + +2012-05-29 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: draw pie-chart based on memory data received from backend + https://bugs.webkit.org/show_bug.cgi?id=87737 + + Reviewed by Pavel Feldman. + + Added pie chart for memory data received from inspector memory agent. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/NativeMemorySnapshotView.js: + (WebInspector.NativeMemorySnapshotView): + (WebInspector.NativeMemoryProfileType): + (WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot): + (WebInspector.NativeMemoryProfileType.prototype.buttonClicked): + (WebInspector.NativeMemoryProfileHeader): + (WebInspector.MemoryBlockViewProperties): + (WebInspector.MemoryBlockViewProperties._initialize): + (WebInspector.MemoryBlockViewProperties._forMemoryBlock): + (WebInspector.NativeMemoryPieChart): + (WebInspector.NativeMemoryPieChart.prototype.onResize): + (WebInspector.NativeMemoryPieChart.prototype._updateSize): + (WebInspector.NativeMemoryPieChart.prototype._addBlockLabels): + (WebInspector.NativeMemoryPieChart.prototype._paint.paintPercentAndLabel): + (WebInspector.NativeMemoryPieChart.prototype._paint): + (WebInspector.NativeMemoryPieChart.prototype._clear): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/nativeMemoryProfiler.css: Added. + (.memory-pie-chart-container): + (.memory-pie-chart): + (.memory-blocks-list .swatch): + (.memory-blocks-list): + (.memory-blocks-list .item): + +2012-05-31 Dominic Cooney <dominicc@chromium.org> + + [V8] Expando properties on attribute nodes disappear + https://bugs.webkit.org/show_bug.cgi?id=87925 + + Reviewed by Adam Barth. + + Test: fast/dom/gc-attribute-node.html + + * bindings/v8/V8GCController.cpp: + (WebCore::calculateGroupId): Group attributes like other nodes. + +2012-05-31 Alexander Shalamov <alexander.shalamov@intel.com> + + [EFL] <input type="number"> is not a spinbutton + https://bugs.webkit.org/show_bug.cgi?id=86846 + + Reviewed by Kenneth Rohde Christiansen. + + Implemented adjustInnerSpinButtonStyle and + paintInnerSpinButton in RenderThemeEfl. + + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::applyEdjeStateFromForm): + (WebCore::RenderThemeEfl::edjeGroupFromFormType): + (WebCore::RenderThemeEfl::adjustInnerSpinButtonStyle): + (WebCore): + (WebCore::RenderThemeEfl::paintInnerSpinButton): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + The test tries to reach an invalid SpellChecker object. Such an access should be guarded + beforehand. + + Asynchronous spellchecking can return results after originated + frame is gone, which triggered an invalid access to the dead spellchecker + object. This chagne prevents it by marking request objects from + the spellchecker as invalid: + + - Originally TextCheckerClient API was passed a SpellCheker object. + This change abstracted it behind TextCheckingRequest interface, + didSucceed() and didCancel() method specifically. + - TextCheckingRequest was turned from a plain old object into + a refcounted abstract class, which is now subclassed by SpellCheckRequest. + - SpellChecker now marks pending SpellCheckRequest objects as invalid + on its destructor. + + Test: editing/spelling/spellcheck-async-remove-frame.html + + * WebCore.exp.in: + * editing/SpellChecker.cpp: + (WebCore::SpellCheckRequest::SpellCheckRequest): + (WebCore::SpellCheckRequest::create): + (WebCore::SpellCheckRequest::didSucceed): + (WebCore): + (WebCore::SpellCheckRequest::didCancel): + (WebCore::SpellCheckRequest::wasRequestedBy): + (WebCore::SpellCheckRequest::requesterDestroyed): + (WebCore::SpellChecker::~SpellChecker): + (WebCore::SpellChecker::requestCheckingFor): + (WebCore::SpellChecker::invokeRequest): + (WebCore::SpellChecker::didCheckSucceed): + (WebCore::SpellChecker::didCheckCancel): + * editing/SpellChecker.h: + (WebCore): + (SpellCheckRequest): + (WebCore::SpellCheckRequest::isStarted): + (SpellChecker): + * loader/EmptyClients.h: + (WebCore::EmptyTextCheckerClient::requestCheckingOfString): + * platform/text/TextCheckerClient.h: + (TextCheckerClient): + * platform/text/TextChecking.h: + (GrammarDetail): + (TextCheckingResult): + (TextCheckingRequest): + (WebCore::TextCheckingRequest::~TextCheckingRequest): + +2012-05-31 Tony Chang <tony@chromium.org> + + initial flex value should be 1 1 auto + https://bugs.webkit.org/show_bug.cgi?id=86526 + + Reviewed by Ojan Vafai. + + Also, if -webkit-flex is used to set the positive flex to 0 and + the negative flex is omitted, the negative flex is set to 0. + + New test cases in: flex-property-parsing.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseFlex): + * css/StyleBuilder.cpp: + (WebCore::ApplyPropertyFlex::applyValue): + * rendering/style/RenderStyle.h: + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119146. + http://trac.webkit.org/changeset/119146 + https://bugs.webkit.org/show_bug.cgi?id=88035 + + android breakage fixed in http://crrev.com/139945 (Requested + by fischman on #webkit). + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): + (WebCore::HTMLMediaElement::startProgressEventTimer): + (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle): + (WebCore::HTMLMediaElement::progressEventTimerFired): + (WebCore::HTMLMediaElement::startPlaybackProgressTimer): + * platform/graphics/MediaPlayer.cpp: + (WebCore::NullMediaPlayerPrivate::didLoadingProgress): + (WebCore::MediaPlayer::didLoadingProgress): + * platform/graphics/MediaPlayer.h: + * platform/graphics/MediaPlayerPrivate.h: + (MediaPlayerPrivateInterface): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): + (WebCore::MediaPlayerPrivateAVFoundation::didLoadingProgress): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + (MediaPlayerPrivateAVFoundation): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::didLoadingProgress): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): + (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + (MediaPlayerPrivateGStreamer): + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + (MediaPlayerPrivateQTKit): + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit): + (WebCore::MediaPlayerPrivateQTKit::didLoadingProgress): + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + (WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt): + (WebCore::MediaPlayerPrivateQt::didLoadingProgress): + * platform/graphics/qt/MediaPlayerPrivateQt.h: + (MediaPlayerPrivateQt): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext): + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::didLoadingProgress): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h: + (MediaPlayerPrivateQuickTimeVisualContext): + * platform/graphics/wince/MediaPlayerPrivateWinCE.h: + (MediaPlayerPrivate): + +2012-05-31 Tom Sepez <tsepez@chromium.org> + + XSSAuditor bypass with leading /*///*/ comment + https://bugs.webkit.org/show_bug.cgi?id=88002 + + Reviewed by Adam Barth. + + Fixes issue in xssauditor's parsing of /*/. + + Test: http/tests/security/xssAuditor/script-tag-with-trailing-comment4.html + + * html/parser/XSSAuditor.cpp: + (WebCore::XSSAuditor::decodedSnippetForJavaScript): + +2012-05-31 Hans Muller <hmuller@adobe.com> + + Bug: Negative SVG rect rx,ry corner radii values aren't handled correctly + https://bugs.webkit.org/show_bug.cgi?id=87859 + + Reviewed by Dirk Schulze. + + Added the rect element corner radius constraints specified in steps 2-4 of + http://www.w3.org/TR/SVG/shapes.html#RectElement to Path::addRoundedRect(). + Support for steps 6 and 7 was already included. Steps 2-4: + + 2 - If neither rx nor ry are properly specified, then set both rx and ry to 0. (This will result in square corners.) + 3 - Otherwise, if a properly specified value is provided for rx, but not for ry then set both rx and ry to the value of rx. + 4 - Otherwise, if a properly specified value is provided for ry, but not for rx, then set both rx and ry to the value of ry. + + Tests: svg/custom/rect-negative-corner-radii-expected.svg + svg/custom/rect-negative-corner-radii.svg + + * platform/graphics/Path.cpp: + (WebCore::Path::addRoundedRect): + +2012-05-31 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Migrate to WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=87788 + + Reviewed by James Robinson. + + Covered by all existing layout tests and unit tests. + + This patch replaces all occurrences of WebCore::TransformationMatrix + with WebKit::WebTransformationMatrix in the chromium compositor code. + + * platform/chromium/support/WebTransformationMatrix.cpp: + (WebKit::WebTransformationMatrix::WebTransformationMatrix): + (WebKit): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::setSublayerTransform): + (WebCore::LayerChromium::setTransform): + (WebCore::LayerChromium::setTransformFromAnimation): + * platform/graphics/chromium/LayerChromium.h: + (LayerChromium): + (WebCore::LayerChromium::sublayerTransform): + (WebCore::LayerChromium::drawTransform): + (WebCore::LayerChromium::setDrawTransform): + (WebCore::LayerChromium::screenSpaceTransform): + (WebCore::LayerChromium::setScreenSpaceTransform): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawCheckerboardQuad): + (WebCore::LayerRendererChromium::drawDebugBorderQuad): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderSurfaceQuad): + (WebCore::LayerRendererChromium::drawSolidColorQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawHeadsUpDisplay): + (WebCore::LayerRendererChromium::toGLMatrix): + (WebCore::LayerRendererChromium::drawTexturedQuad): + (WebCore::LayerRendererChromium::copyTextureToFramebuffer): + * platform/graphics/chromium/LayerRendererChromium.h: + (WebCore::LayerRendererChromium::projectionMatrix): + (WebCore::LayerRendererChromium::windowMatrix): + (LayerRendererChromium): + * platform/graphics/chromium/LinkHighlight.cpp: + (WebCore::LinkHighlight::LinkHighlight): + * platform/graphics/chromium/RenderSurfaceChromium.h: + (WebCore::RenderSurfaceChromium::drawTransform): + (WebCore::RenderSurfaceChromium::setDrawTransform): + (WebCore::RenderSurfaceChromium::originTransform): + (WebCore::RenderSurfaceChromium::setOriginTransform): + (WebCore::RenderSurfaceChromium::screenSpaceTransform): + (WebCore::RenderSurfaceChromium::setScreenSpaceTransform): + (WebCore::RenderSurfaceChromium::replicaDrawTransform): + (WebCore::RenderSurfaceChromium::setReplicaDrawTransform): + (WebCore::RenderSurfaceChromium::replicaOriginTransform): + (WebCore::RenderSurfaceChromium::setReplicaOriginTransform): + (WebCore::RenderSurfaceChromium::replicaScreenSpaceTransform): + (WebCore::RenderSurfaceChromium::setReplicaScreenSpaceTransform): + (RenderSurfaceChromium): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateTiles): + * platform/graphics/chromium/cc/CCAnimationCurve.h: + (WebCore): + (CCTransformAnimationCurve): + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::extendDamageForLayer): + (WebCore::CCDamageTracker::extendDamageForRenderSurface): + * platform/graphics/chromium/cc/CCDrawQuad.h: + (WebCore::CCDrawQuad::quadTransform): + (WebCore::CCDrawQuad::layerTransform): + * platform/graphics/chromium/cc/CCKeyframedAnimationCurve.cpp: + (WebCore::CCTransformKeyframe::clone): + (WebCore::CCKeyframedTransformAnimationCurve::getValue): + * platform/graphics/chromium/cc/CCKeyframedAnimationCurve.h: + (CCKeyframedTransformAnimationCurve): + * platform/graphics/chromium/cc/CCLayerAnimationController.cpp: + (WebCore::CCLayerAnimationController::tickAnimations): + * platform/graphics/chromium/cc/CCLayerAnimationController.h: + (WebKit): + (WebCore): + (CCLayerAnimationControllerClient): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::quadTransform): + (WebCore::CCLayerImpl::setTransformFromAnimation): + (WebCore::CCLayerImpl::setSublayerTransform): + (WebCore::CCLayerImpl::setTransform): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + (WebCore::CCLayerImpl::sublayerTransform): + (WebCore::CCLayerImpl::drawTransform): + (WebCore::CCLayerImpl::setDrawTransform): + (WebCore::CCLayerImpl::screenSpaceTransform): + (WebCore::CCLayerImpl::setScreenSpaceTransform): + * platform/graphics/chromium/cc/CCLayerSorter.cpp: + (WebCore::CCLayerSorter::LayerShape::LayerShape): + (WebCore::CCLayerSorter::createGraphNodes): + * platform/graphics/chromium/cc/CCLayerSorter.h: + (WebKit): + (LayerShape): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::CCLayerTreeHostCommon::calculateVisibleRect): + (WebCore::isSurfaceBackFaceVisible): + (WebCore::calculateVisibleLayerRect): + (WebCore::isScaleOrTranslation): + (WebCore::calculateDrawTransformsAndVisibilityInternal): + (WebCore::CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.h: + (CCLayerTreeHostCommon): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::damageInSurfaceSpace): + (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + * platform/graphics/chromium/cc/CCMathUtil.cpp: + (WebCore::projectPoint): + (WebCore::mapPoint): + (WebCore::CCMathUtil::mapClippedRect): + (WebCore::CCMathUtil::projectClippedRect): + (WebCore::CCMathUtil::mapClippedQuad): + (WebCore::CCMathUtil::mapQuad): + (WebCore::CCMathUtil::projectQuad): + * platform/graphics/chromium/cc/CCMathUtil.h: + (WebKit): + (WebCore): + (CCMathUtil): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::transformSurfaceOpaqueRegion): + (WebCore::reduceOcclusionBelowSurface): + (WebCore::contentToScreenSpaceTransform): + (WebCore::contentToTargetSurfaceTransform): + (WebCore::addOcclusionBehindLayer): + (WebCore::::markOccludedBehindLayer): + (WebCore::testContentRectOccluded): + (WebCore::computeUnoccludedContentRect): + (WebCore::::unoccludedContributingSurfaceContentRect): + * platform/graphics/chromium/cc/CCOcclusionTracker.h: + * platform/graphics/chromium/cc/CCOverdrawMetrics.cpp: + (WebCore::CCOverdrawMetrics::didUpload): + (WebCore::CCOverdrawMetrics::didCullForDrawing): + (WebCore::CCOverdrawMetrics::didDraw): + * platform/graphics/chromium/cc/CCOverdrawMetrics.h: + (WebKit): + (CCOverdrawMetrics): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore::CCRenderSurface::setDrawTransform): + (WebCore::CCRenderSurface::drawTransform): + (WebCore::CCRenderSurface::setOriginTransform): + (WebCore::CCRenderSurface::originTransform): + (WebCore::CCRenderSurface::setScreenSpaceTransform): + (WebCore::CCRenderSurface::screenSpaceTransform): + (WebCore::CCRenderSurface::setReplicaDrawTransform): + (WebCore::CCRenderSurface::replicaDrawTransform): + (WebCore::CCRenderSurface::setReplicaOriginTransform): + (WebCore::CCRenderSurface::replicaOriginTransform): + (WebCore::CCRenderSurface::setReplicaScreenSpaceTransform): + (WebCore::CCRenderSurface::replicaScreenSpaceTransform): + (CCRenderSurface): + * platform/graphics/chromium/cc/CCSharedQuadState.cpp: + (WebCore::CCSharedQuadState::create): + (WebCore::CCSharedQuadState::CCSharedQuadState): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (CCSharedQuadState): + (WebCore::CCSharedQuadState::quadTransform): + (WebCore::CCSharedQuadState::layerTransform): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: + (WebCore::CCSolidColorLayerImpl::quadTransform): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + (CCSolidColorLayerImpl): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::quadTransform): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] Single thread proxy should not tick animations unless the layer renderer has been initialized + https://bugs.webkit.org/show_bug.cgi?id=87873 + + Reviewed by James Robinson. + + When the layer renderer fails to initialize, be sure to stop the animation timer. + + Unit test: CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation.runSingleThread + + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::initializeLayerRenderer): + (WebCore::CCSingleThreadProxy::didAddAnimation): + (WebCore::CCSingleThreadProxy::animationTimerDelay): + (WebCore): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + +2012-05-31 Simon Fraser <simon.fraser@apple.com> + + RenderLayerCompositor cleanup: make RenderGeometryMap part of the OverlapMap + https://bugs.webkit.org/show_bug.cgi?id=88021 + + Reviewed by James Robinson. + + We only ever use the RenderGeometryMap when we have an OverlapMap, so make + it a member of the OverlapMap. + + No behavior change. + + * rendering/RenderLayerCompositor.cpp: + (RenderLayerCompositor::OverlapMap): + (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): + (WebCore::RenderLayerCompositor::updateCompositingLayers): + (WebCore::RenderLayerCompositor::addToOverlapMap): + (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + * rendering/RenderLayerCompositor.h: + (WebCore): + (RenderLayerCompositor): + +2012-05-31 Kentaro Hara <haraken@chromium.org> + + [V8] Pass Isolate to v8Boolean() + https://bugs.webkit.org/show_bug.cgi?id=87948 + + Reviewed by Adam Barth. + + The objective is to pass Isolate around in V8 bindings. + This patch passes Isolate to v8Boolean(). + + No tests. No change in behavior. + + * bindings/v8/SerializedScriptValue.cpp: + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + (WebCore::V8DOMStringMap::namedPropertyDeleter): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback): + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore::storageDeleter): + * bindings/v8/custom/V8WebSocketCustom.cpp: + (WebCore::V8WebSocket::sendCallback): + +2012-05-31 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + Added "error" attribute to IDBRequest and IDBTransaction. Update + IDBDatabaseError to honor the IDBDatabaseException behavior + of dealing with IDB-specific throws of DOMException codes, + as per the spec. + + Existing tests which previously tested 'errorCode' and + 'webkitErrorMessage' have been updated to use the new attribute. + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::setVersion): + * Modules/indexeddb/IDBDatabaseError.h: + (WebCore::IDBDatabaseError::create): + (WebCore::IDBDatabaseError::code): + (WebCore::IDBDatabaseError::idbCode): + (WebCore::IDBDatabaseError::name): + (WebCore::IDBDatabaseError::IDBDatabaseError): + (IDBDatabaseError): + * Modules/indexeddb/IDBDatabaseException.cpp: + (WebCore): + (WebCore::getErrorEntry): + (WebCore::IDBDatabaseException::initializeDescription): + (WebCore::IDBDatabaseException::getErrorName): + (WebCore::IDBDatabaseException::getLegacyErrorCode): + * Modules/indexeddb/IDBDatabaseException.h: + (IDBDatabaseException): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::error): + (WebCore): + (WebCore::IDBRequest::resetReadyState): + (WebCore::IDBRequest::abort): + (WebCore::IDBRequest::onError): + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::onSuccessWithContinuation): + (WebCore::IDBRequest::dispatchEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + * Modules/indexeddb/IDBRequest.idl: + * Modules/indexeddb/IDBTransaction.cpp: + (WebCore::IDBTransaction::error): + (WebCore): + (WebCore::IDBTransaction::setError): + * Modules/indexeddb/IDBTransaction.h: + (IDBTransaction): + * Modules/indexeddb/IDBTransaction.idl: + +2012-05-31 James Robinson <jamesr@chromium.org> + + [chromium] Assertion failures during compositor startup in lost context situations + https://bugs.webkit.org/show_bug.cgi?id=87912 + + Reviewed by Adrienne Walker. + + getShaderiv and getProgramiv may return 0 if the context is lost. We correctly recover in this case, so it's + bogus to fail an ASSERT in debug in this case. + + Added new unit test in LayerRendererChromiumTest to cover this. + + * platform/graphics/chromium/ProgramBinding.cpp: + (WebCore::contextLost): + (WebCore): + (WebCore::ProgramBindingBase::init): + (WebCore::ProgramBindingBase::createShaderProgram): + +2012-05-31 Ben Murdoch <benm@google.com> + + Fix crash in V8Document::createTouchListCallback. + https://bugs.webkit.org/show_bug.cgi?id=87085 + + Reviewed by Abhishek Arya. + + Test: fast/events/touch/document-create-touch-list-crash.html + + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::V8Document::createTouchListCallback): Verify the native type + of the arguments passed to createTouchList are Touches before appending + them to the TouchList. In the case of a non-Touch argument, insert + null into the TouchList. This consolidates V8 and JSC bindings + behaviour. + * dom/Document.cpp: Remove dead code. + * dom/Document.h: ditto. + +2012-05-31 Simon Fraser <simon.fraser@apple.com> + + Remove some duplicate code in RenderLayerCompositor + https://bugs.webkit.org/show_bug.cgi?id=88009 + + Reviewed by Anders Carlsson. + + RenderLayerCompositor::hasNonAffineTransform() has the same code + as the existing RenderLayer::has3DTransform(), so just use the + RenderLayer method and remove hasNonAffineTransform(). + + No behavior change. + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + * rendering/RenderLayerCompositor.h: + (RenderLayerCompositor): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119125. + http://trac.webkit.org/changeset/119125 + https://bugs.webkit.org/show_bug.cgi?id=88007 + + Will break android build if rolled (Requested by rafaelw_ on + #webkit). + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): + (WebCore::HTMLMediaElement::startProgressEventTimer): + (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle): + (WebCore::HTMLMediaElement::progressEventTimerFired): + (WebCore::HTMLMediaElement::startPlaybackProgressTimer): + * platform/graphics/MediaPlayer.cpp: + (WebCore::NullMediaPlayerPrivate::bytesLoaded): + (WebCore::MediaPlayer::bytesLoaded): + * platform/graphics/MediaPlayer.h: + * platform/graphics/MediaPlayerPrivate.h: + (MediaPlayerPrivateInterface): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): + (WebCore::MediaPlayerPrivateAVFoundation::bytesLoaded): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + (MediaPlayerPrivateAVFoundation): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::bytesLoaded): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): + (WebCore::MediaPlayerPrivateGStreamer::bytesLoaded): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + (MediaPlayerPrivateGStreamer): + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + (MediaPlayerPrivateQTKit): + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit): + (WebCore::MediaPlayerPrivateQTKit::bytesLoaded): + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + (WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt): + (WebCore::MediaPlayerPrivateQt::bytesLoaded): + * platform/graphics/qt/MediaPlayerPrivateQt.h: + (MediaPlayerPrivateQt): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext): + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::bytesLoaded): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h: + (MediaPlayerPrivateQuickTimeVisualContext): + * platform/graphics/wince/MediaPlayerPrivateWinCE.h: + (MediaPlayerPrivate): + +2012-05-31 Andy Estes <aestes@apple.com> + + Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC) + https://bugs.webkit.org/show_bug.cgi?id=87933 + + Reviewed by Dan Bernstein. + + * editing/Editor.cpp: + * editing/Editor.h: + * loader/EmptyClients.h: + * page/ContextMenuController.cpp: + (WebCore::ContextMenuController::contextMenuItemSelected): + * page/EditorClient.h: + +2012-05-31 Dana Jansens <danakj@chromium.org> + + [chromium] Move drawing code for RenderSurfaces into LayerRendererChromium + https://bugs.webkit.org/show_bug.cgi?id=87877 + + Reviewed by James Robinson. + + We add data to CCRenderSurfaceDrawQuad so that the only use of + CCRenderSurface directly from LayerRendererChromium is to + reserve, release, and use the surface's textures, and to set the + scissor rect. Each of these changes will be done independent + of this change. + + Covered by existing tests. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::applyFilters): + (WebCore): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderSurfaceQuad): + (WebCore::LayerRendererChromium::copyTextureToFramebuffer): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::contentsTextureId): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsAndVisibilityInternal): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + * platform/graphics/chromium/cc/CCQuadCuller.h: + (CCQuadCuller): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore): + (WebCore::CCRenderSurface::CCRenderSurface): + (WebCore::CCRenderSurface::prepareContentsTexture): + (WebCore::CCRenderSurface::releaseContentsTexture): + (WebCore::CCRenderSurface::hasValidContentsTexture): + (WebCore::CCRenderSurface::releaseBackgroundTexture): + (WebCore::CCRenderSurface::hasValidBackgroundTexture): + (WebCore::CCRenderSurface::hasMask): + (WebCore::CCRenderSurface::replicaHasMask): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + (CCRenderSurface): + * platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.cpp: + (WebCore::CCRenderSurfaceDrawQuad::create): + (WebCore::CCRenderSurfaceDrawQuad::CCRenderSurfaceDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.h: + (WebKit): + (CCRenderSurfaceDrawQuad): + (WebCore::CCRenderSurfaceDrawQuad::maskTextureId): + (WebCore::CCRenderSurfaceDrawQuad::filters): + (WebCore::CCRenderSurfaceDrawQuad::backgroundFilters): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::contentsTextureId): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + +2012-05-31 Brady Eidson <beidson@apple.com> + + <rdar://problem/11544454> and https://bugs.webkit.org/show_bug.cgi?id=87990 + Crashes unregistering DOMWindowProperties while releasing CachedPages + + Reviewed by Jessie Berlin. + + This patch rewrites DOMWindowProperty to always keep direct track of the DOMWindow + it has registered with and to only ever unregister from that very same DOMWindow. + + No new tests. (While the direct cause of the crash is understood, reproducing it is not) + + * page/DOMWindowProperty.cpp: + (WebCore::DOMWindowProperty::DOMWindowProperty): + (WebCore::DOMWindowProperty::~DOMWindowProperty): + (WebCore::DOMWindowProperty::disconnectFrameForPageCache): + (WebCore::DOMWindowProperty::reconnectFrameFromPageCache): + (WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame): + (WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame): + (WebCore::DOMWindowProperty::willDetachGlobalObjectFromFrame): + * page/DOMWindowProperty.h: + (DOMWindowProperty): + +2012-05-31 Tony Chang <tony@chromium.org> + + rename flexbox CSS properties from flex-align and flex-item-align to align-items and align-self + https://bugs.webkit.org/show_bug.cgi?id=87907 + + Reviewed by Ojan Vafai. + + This was recently changed in the spec: + http://dev.w3.org/csswg/css3-flexbox/#align-items-property + + No new tests, updated the tests to use the new naming. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): + (WebCore::isKeywordPropertyID): + (WebCore::CSSParser::parseValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EAlignItems): + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): + * css/CSSPropertyNames.in: + * css/StyleBuilder.cpp: + (WebCore::StyleBuilder::StyleBuilder): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::sizesToIntrinsicLogicalWidth): + * rendering/RenderFlexibleBox.cpp: + (WebCore::alignmentForChild): + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): + (WebCore::RenderFlexibleBox::alignChildren): + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyleConstants.h: + * rendering/style/StyleFlexibleBoxData.cpp: + (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData): + (WebCore::StyleFlexibleBoxData::operator==): + * rendering/style/StyleFlexibleBoxData.h: + (StyleFlexibleBoxData): Move member variables to StyleRareNonInheritedData + because these values will eventually apply to more than just flexbox. + * rendering/style/StyleRareNonInheritedData.cpp: + (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): + (WebCore::StyleRareNonInheritedData::operator==): + * rendering/style/StyleRareNonInheritedData.h: + (StyleRareNonInheritedData): + +2012-05-31 Ami Fischman <fischman@chromium.org> + + Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress() + https://bugs.webkit.org/show_bug.cgi?id=86113 + + Reviewed by Eric Carlson. + + No new functionality, so no new tests. Loading progress is already tested by existing layouttests. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): + (WebCore::HTMLMediaElement::startProgressEventTimer): + (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle): + (WebCore::HTMLMediaElement::progressEventTimerFired): + (WebCore::HTMLMediaElement::startPlaybackProgressTimer): + * platform/graphics/MediaPlayer.cpp: + (WebCore::NullMediaPlayerPrivate::didLoadingProgress): + (WebCore::MediaPlayer::didLoadingProgress): + * platform/graphics/MediaPlayer.h: + * platform/graphics/MediaPlayerPrivate.h: + (MediaPlayerPrivateInterface): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + (MediaPlayerPrivateAVFoundation): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::didLoadingProgress): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): + (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + (MediaPlayerPrivateGStreamer): + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + (MediaPlayerPrivateQTKit): + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit): + (WebCore::MediaPlayerPrivateQTKit::didLoadingProgress): + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + (WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt): + (WebCore::MediaPlayerPrivateQt::didLoadingProgress): + * platform/graphics/qt/MediaPlayerPrivateQt.h: + (MediaPlayerPrivateQt): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext): + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::didLoadingProgress): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h: + (MediaPlayerPrivateQuickTimeVisualContext): + * platform/graphics/wince/MediaPlayerPrivateWinCE.h: + (MediaPlayerPrivate): + +2012-05-31 Erik Arvidsson <arv@chromium.org> + + Make DOM Exceptions Errors + https://bugs.webkit.org/show_bug.cgi?id=85078 + + Reviewed by Oliver Hunt. + + WebIDL mandates that exceptions should have Error.prototype on its prototype chain. + + For JSC we have access to the Error.prototype from the binding code. + + For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we + set the prototype as needed. + + Updated test: fast/dom/DOMException/prototype-object.html + + * ForwardingHeaders/runtime/ErrorPrototype.h: Added. + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNamedConstructorCallback): + (GenerateImplementation): + * bindings/scripts/test/JS/JSTestException.cpp: + (WebCore::JSTestException::createPrototype): + * bindings/scripts/test/JS/JSTestException.h: + * bindings/scripts/test/V8/V8Float64Array.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestEventConstructor.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestEventTarget.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestException.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestInterface.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestNode.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore): + (WebCore::V8TestObj::installPerContextProperties): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + (WebCore): + * bindings/v8/NPV8Object.cpp: + (WebCore::npObjectTypeInfo): + * bindings/v8/V8BindingPerContextData.cpp: + (WebCore): + (WebCore::V8BindingPerContextData::init): + (WebCore::V8BindingPerContextData::createWrapperFromCacheSlowCase): + (WebCore::V8BindingPerContextData::constructorForTypeSlowCase): + * bindings/v8/V8BindingPerContextData.h: + (V8BindingPerContextData): + * bindings/v8/V8HiddenPropertyName.h: + (WebCore): + * bindings/v8/WrapperTypeInfo.h: + (WebCore): + (WrapperTypeInfo): + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + (WebCore): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] create WebTransformOperation interface for chromium platform + https://bugs.webkit.org/show_bug.cgi?id=87510 + + Reviewed by James Robinson. + + Unit tests: + WebTransformOperationsTest.transformTypesAreUnique + WebTransformOperationsTest.matchesTypesSameLength + WebTransformOperationsTest.matchesTypesDifferentLength + WebTransformOperationsTest.applyTranslate + WebTransformOperationsTest.applyRotate + WebTransformOperationsTest.applyScale + WebTransformOperationsTest.applySkew + WebTransformOperationsTest.applyPerspective + WebTransformOperationsTest.applyMatrix + WebTransformOperationsTest.applyOrder + WebTransformOperationsTest.blendOrder + WebTransformOperationsTest.blendProgress + WebTransformOperationsTest.blendWhenTypesDoNotMatch + + * WebCore.gypi: + * platform/chromium/support/WebTransformOperations.cpp: Added. + (WebKit): + (WebTransformOperationsPrivate): + (WebKit::WebTransformOperations::apply): + (WebKit::WebTransformOperations::blend): + (WebKit::WebTransformOperations::matchesTypes): + (WebKit::WebTransformOperations::appendTranslate): + (WebKit::WebTransformOperations::appendRotate): + (WebKit::WebTransformOperations::appendScale): + (WebKit::WebTransformOperations::appendSkew): + (WebKit::WebTransformOperations::appendPerspective): + (WebKit::WebTransformOperations::appendMatrix): + (WebKit::WebTransformOperations::reset): + (WebKit::WebTransformOperations::initialize): + +2012-05-31 Yury Semikhatsky <yurys@chromium.org> + + m_totalAllocated should be intialized in RenderArena constructor + https://bugs.webkit.org/show_bug.cgi?id=87967 + + Reviewed by Ojan Vafai. + + * rendering/RenderArena.cpp: + (WebCore::RenderArena::RenderArena): added missing initializer. + +2012-05-31 Julien Chaffraix <jchaffraix@webkit.org> + + The difference between a column and a column group renderer is badly drawn + https://bugs.webkit.org/show_bug.cgi?id=87556 + + Reviewed by Abhishek Arya. + + No expected change in behavior. + + This patch tries to draw a better line between those 3 concepts: + - renderer is a RenderTableCol (RenderObject::isRenderTableCol). + - renderer is a column (RenderTableCol::isTableColumn()). + - renderer is a column group (RenderTableCol::isTableColumnGroup()). + (most of the code that needs to know the difference manipulate a RenderTableCol + so there was no need to move the 2 last helpers into RenderObject) + + * rendering/AutoTableLayout.cpp: + (WebCore::AutoTableLayout::recalcColumn): + Factored the code to use the column / column group iteration we + set up in the rest of the code. Made the code more self-describing + by using more RenderTableCol functions. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::addChild): + Factored the code to use the isTableColumn() and isTableColumnGroup() to + better underline what we check. + + * rendering/RenderObject.h: + (WebCore::RenderObject::isRenderTableCol): + (WebCore::RenderObject::isTablePart): + Renamed isTableCol to isRenderTableCol to match the class as this doesn't + imply that the renderer is actually a column. + + * html/HTMLTableColElement.cpp: + (WebCore::HTMLTableColElement::parseAttribute): + * rendering/AutoTableLayout.cpp: + (WebCore::AutoTableLayout::fullRecalc): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::addChild): + (WebCore::RenderTable::layout): + (WebCore::RenderTable::firstColumn): + Updated after the isRenderTableCol rename. + + * dom/Text.cpp: + (WebCore::Text::rendererIsNeeded): + * editing/htmlediting.cpp: + (WebCore::isTableStructureNode): + Ditto and renamed some variables. + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::rendererIsNeeded): + Ditto and added a FIXME as the logic doesn't seem very bullet proof. + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::computeCollapsedStartBorder): + (WebCore::RenderTableCell::computeCollapsedEndBorder): + (WebCore::RenderTableCell::computeCollapsedBeforeBorder): + (WebCore::RenderTableCell::computeCollapsedAfterBorder): + Changed to use the enclosingColumnGroup* helpers. + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::paintCell): + * rendering/RenderTableCol.cpp: + (WebCore::RenderTableCol::isChildAllowed): + (WebCore::RenderTableCol::canHaveChildren): + (WebCore::RenderTableCol::enclosingColumnGroup): + (WebCore::RenderTableCol::nextColumn): + Updated to use the new functions. + + * rendering/RenderTableCol.h: + (WebCore::RenderTableCol::isTableColumn): + (WebCore::RenderTableCol::isTableColumnGroup): + (WebCore::RenderTableCol::enclosingColumnGroupIfAdjacentBefore): + (WebCore::RenderTableCol::enclosingColumnGroupIfAdjacentAfter): + Added the following new helpers. + +2012-05-31 Jessie Berlin <jberlin@apple.com> + + Fix Lion build after r119073. + + * platform/Decimal.cpp: + (WebCore::Decimal::toString): + Do not attempt to assign a unsigned long long to an int. + +2012-05-31 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Enable CSS_IMAGE_SET flag + https://bugs.webkit.org/show_bug.cgi?id=87727 + + Reviewed by Adam Roben. + + Fix CMakeLists.txt so that CSSImageSetValue.cpp gets compiled if + CSS_IMAGE_SET flag is enabled. + + * CMakeLists.txt: + +2012-05-31 Keyar Hood <keyar@chromium.org> + + the imageSmoothingEnabled flag needs to be in the state object + https://bugs.webkit.org/show_bug.cgi?id=87853 + + Reviewed by Darin Adler. + + Updated fast/canvas/canvas-imageSmoothingEnabled.html instead of + adding a new test. + + The imageSmoothingEnabled flag is saved in the draw state now. + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D): + (WebCore::CanvasRenderingContext2D::State::State): + (WebCore::CanvasRenderingContext2D::State::operator=): + (WebCore::CanvasRenderingContext2D::webkitImageSmoothingEnabled): + (WebCore::CanvasRenderingContext2D::setWebkitImageSmoothingEnabled): + * html/canvas/CanvasRenderingContext2D.h: + (State): + +2012-05-31 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: Fix checkbox position on Settings screen. + https://bugs.webkit.org/show_bug.cgi?id=87007 + + Reviewed by Yury Semikhatsky. + + Checkbox seems to be improperly aligned. + It is "shifted" up on 1px on Mac and 2px on Linux. + Also, keyboard-shortcuts screen has "wrapped" key descriptions on Mac. + + UI changes, no new tests. + + * inspector/front-end/helpScreen.css: + (.help-container): Fixed column width. + (.help-block): Ditto. + (.help-key-cell): Ditto. + (body.platform-mac .help-container): Ditto. + (body.platform-mac .help-block): Ditto. + (body.platform-mac .help-key-cell): Ditto. + (.help-content p): Ajdusted spacing between lines + (.help-content input[type=checkbox]): Fixed alignment. + (body.platform-mac .help-content input[type=checkbox]): Ditto. + (.help-content input[type=radio]): Fixed alignment. + (body.platform-mac .help-content input[type=radio]): Ditto. + +2012-05-30 Andreas Kling <kling@webkit.org> + + Have StylePropertySet constructor take array/length instead of vector. + <http://webkit.org/b/87876> + + Reviewed by Antti Koivisto. + + Remove the StylePropertyVector typedef and have StylePropertySet constructors + take CSSProperty*/length since we are copying the data into a tightly packed + array anyway. This frees up the call sites to use whatever storage they please + rather than being restricted to a vector with inlineCapacity=4. + + Change said call sites to use an arbitrary high inline capacity (256) for their + stack-allocated temporary vectors. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): + * css/CSSParser.cpp: + (WebCore::filterProperties): + (WebCore::CSSParser::createStylePropertySet): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::createImmutable): + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::removePropertiesInSet): + (WebCore::StylePropertySet::copyPropertiesInSet): + * css/StylePropertySet.h: + (WebCore::StylePropertySet::create): + (StylePropertySet): + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * bridge/qt/qt_class.cpp: + * bridge/qt/qt_instance.cpp: + * bridge/qt/qt_runtime.h: + * page/qt/EventHandlerQt.cpp: + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/OpenGLShims.cpp: + * platform/graphics/OpenGLShims.h: + * platform/graphics/gstreamer/PlatformVideoWindowPrivate.h: + * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp: + * platform/graphics/qt/GraphicsContext3DQt.cpp: + * platform/graphics/qt/SimpleFontDataQt.cpp: + * platform/graphics/texmap/TextureMapper.h: + * platform/graphics/texmap/TextureMapperGL.cpp: + * platform/qt/DeviceMotionProviderQt.h: + * platform/qt/DeviceOrientationProviderQt.h: + * platform/qt/KURLQt.cpp: + * platform/qt/PlatformScreenQt.cpp: + * platform/qt/QWebPageClient.h: + * plugins/qt/PluginPackageQt.cpp: + * plugins/qt/PluginViewQt.cpp: + +2012-05-30 Andreas Kling <kling@webkit.org> + + Have StylePropertySet constructor take array/length instead of vector. + <http://webkit.org/b/87876> + + Reviewed by Antti Koivisto. + + Remove the StylePropertyVector typedef and have StylePropertySet constructors + take CSSProperty*/length since we are copying the data into a tightly packed + array anyway. This frees up the call sites to use whatever storage they please + rather than being restricted to a vector with inlineCapacity=4. + + Change said call sites to use an arbitrary high inline capacity (256) for their + stack-allocated temporary vectors. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): + * css/CSSParser.cpp: + (WebCore::filterProperties): + (WebCore::CSSParser::createStylePropertySet): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::createImmutable): + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::removePropertiesInSet): + (WebCore::StylePropertySet::copyPropertiesInSet): + * css/StylePropertySet.h: + (WebCore::StylePropertySet::create): + (StylePropertySet): + +2012-05-31 Mike West <mkwst@chromium.org> + + Fixing compilation with SVG disabled. + https://bugs.webkit.org/show_bug.cgi?id=87944 + + This patch adds the missing enumeration value + 'CSSPropertyWebkitBoxDecorationBreak' into switch statements to make + clang happy. + + Reviewed by Alexis Menard. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Implementation of Decimal(int32_t) isn't portable. + https://bugs.webkit.org/show_bug.cgi?id=87941 + + Reviewed by Kent Tamura. + + This patch changes negation of integer to make unsigned integer + in portable way. + + No new tests. This patch doesn't change behavior. + + * platform/Decimal.cpp: + (WebCore::Decimal::Decimal): Use uint64_t(-int64_t(i32)) instead of uint64_t(-i32) + +2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE][EFL] Remove unneeded include path + https://bugs.webkit.org/show_bug.cgi?id=87927 + + Reviewed by Kenneth Rohde Christiansen. + + Though *wtf* directory was moved to Source/WTF, PlatformEfl.cmake is still including the previous + path. In addition, files on EFL port are using "<wtf/gobject/XXX>" directly in #include line. + So, EFL port doesn't need to include ${JAVASCRIPTCORE_DIR}/wtf/gobject path anymore. + + * PlatformEfl.cmake: Remove '${JAVASCRIPTCORE_DIR}/wtf/gobject' path from include path list. + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added new class Decimal for decimal arithmatic in two + files: platform/Decimal.cpp and Decimal.h with unit test. + + Test: WebKit/chromium/tests/DecimalTest.cpp + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/Decimal.cpp: Added. + (WebCore): + (DecimalPrivate): + (SpecialValueHandler): + (WebCore::DecimalPrivate::SpecialValueHandler::SpecialValueHandler): + (WebCore::DecimalPrivate::SpecialValueHandler::handle): + (WebCore::DecimalPrivate::SpecialValueHandler::value): + (UInt128): + (WebCore::DecimalPrivate::UInt128::UInt128): + (WebCore::DecimalPrivate::UInt128::high): + (WebCore::DecimalPrivate::UInt128::low): + (WebCore::DecimalPrivate::UInt128::multiply): + (WebCore::DecimalPrivate::UInt128::highUInt32): + (WebCore::DecimalPrivate::UInt128::lowUInt32): + (WebCore::DecimalPrivate::UInt128::isZero): + (WebCore::DecimalPrivate::UInt128::makeUInt64): + (WebCore::DecimalPrivate::UInt128::operator/=): + (WebCore::DecimalPrivate::UInt128::multiplyHigh): + (WebCore::DecimalPrivate::countDigits): + (WebCore::DecimalPrivate::scaleDown): + (WebCore::DecimalPrivate::scaleUp): + (WebCore::Decimal::EncodedData::EncodedData): + (WebCore::Decimal::EncodedData::operator==): + (WebCore::Decimal::Decimal): + (WebCore::Decimal::operator=): + (WebCore::Decimal::operator+=): + (WebCore::Decimal::operator-=): + (WebCore::Decimal::operator*=): + (WebCore::Decimal::operator/=): + (WebCore::Decimal::operator-): + (WebCore::Decimal::operator+): + (WebCore::Decimal::operator*): + (WebCore::Decimal::operator/): + (WebCore::Decimal::operator==): + (WebCore::Decimal::operator!=): + (WebCore::Decimal::operator<): + (WebCore::Decimal::operator<=): + (WebCore::Decimal::operator>): + (WebCore::Decimal::operator>=): + (WebCore::Decimal::abs): + (WebCore::Decimal::alignOperands): + (WebCore::Decimal::ceiling): + (WebCore::Decimal::compareTo): + (WebCore::Decimal::floor): + (WebCore::Decimal::fromString): + (WebCore::Decimal::infinity): + (WebCore::Decimal::nan): + (WebCore::Decimal::remainder): + (WebCore::Decimal::round): + (WebCore::Decimal::toString): + (WebCore::Decimal::zero): + * platform/Decimal.h: Added. + (WebCore): + (DecimalPrivate): + (Decimal): + (EncodedData): + (WebCore::Decimal::EncodedData::operator!=): + (WebCore::Decimal::EncodedData::coefficient): + (WebCore::Decimal::EncodedData::exponent): + (WebCore::Decimal::EncodedData::isFinite): + (WebCore::Decimal::EncodedData::isNaN): + (WebCore::Decimal::EncodedData::isSpecial): + (WebCore::Decimal::EncodedData::isZero): + (WebCore::Decimal::EncodedData::sign): + (WebCore::Decimal::EncodedData::setSign): + (WebCore::Decimal::EncodedData::formatClass): + (WebCore::Decimal::isFinite): + (WebCore::Decimal::isNaN): + (WebCore::Decimal::isNegative): + (WebCore::Decimal::isPositive): + (WebCore::Decimal::isSpecial): + (WebCore::Decimal::isZero): + (WebCore::Decimal::value): + (AlignedOperands): + (WebCore::Decimal::invertSign): + (WebCore::Decimal::exponent): + (WebCore::Decimal::sign): + +2012-05-31 Kentaro Hara <haraken@chromium.org> + + [V8] Pass Isolate to v8String() in custom bindings + https://bugs.webkit.org/show_bug.cgi?id=87825 + + Reviewed by Adam Barth. + + The objective is to pass Isolate around in V8 bindings. + This patch passes Isolate to v8String() in custom bindings. + + No tests. No change in behavior. + + * bindings/v8/custom/V8ArrayBufferViewCustom.cpp: + (WebCore::installFastSet): + * bindings/v8/custom/V8ArrayBufferViewCustom.h: + (WebCore): + (WebCore::setWebGLArrayHelper): + * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp: + (WebCore::V8CSSStyleDeclaration::namedPropertyEnumerator): + (WebCore::V8CSSStyleDeclaration::namedPropertyGetter): + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + (WebCore::toV8Object): + * bindings/v8/custom/V8ClipboardCustom.cpp: + (WebCore::V8Clipboard::typesAccessorGetter): + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + (WebCore::V8DOMStringMap::namedPropertyGetter): + (WebCore::V8DOMStringMap::namedPropertyEnumerator): + * bindings/v8/custom/V8FileReaderCustom.cpp: + (WebCore::V8FileReader::resultAccessorGetter): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::V8HTMLCanvasElement::toDataURLCallback): + * bindings/v8/custom/V8HTMLElementCustom.cpp: + (WebCore::toV8Object): + * bindings/v8/custom/V8HTMLInputElementCustom.cpp: + (WebCore::V8HTMLInputElement::selectionDirectionAccessorGetter): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8IDBKeyCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::V8InjectedScriptHost::databaseIdCallback): + (WebCore::V8InjectedScriptHost::storageIdCallback): + * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp: + (WebCore::V8InspectorFrontendHost::platformCallback): + * bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp: + (WebCore::V8JavaScriptCallFrame::typeAccessorGetter): + * bindings/v8/custom/V8LocationCustom.cpp: + (WebCore::V8Location::toStringCallback): + * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp: + (WebCore::V8SQLResultSetRowList::itemCallback): + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore::V8Storage::namedPropertyEnumerator): + (WebCore::storageGetter): + * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: + (WebCore::V8XMLHttpRequest::responseTextAccessorGetter): + * bindings/v8/custom/V8XSLTProcessorCustom.cpp: + (WebCore::V8XSLTProcessor::getParameterCallback): + +2012-05-31 Hayato Ito <hayato@chromium.org> + + ComposedShadowTreeWalker should support traversing nodes in an orphaned shadow subtree. + https://bugs.webkit.org/show_bug.cgi?id=87493 + + Reviewed by Dimitri Glazkov. + + ComposedShadowTreeWalker assumed that a visited shadow root is + always assigned to a shadow insertion point since it only + traverses nodes which are rendered. But there is an exceptional + use case such as an event dispatching. Some events, such as a + 'click' event, may happen in an orphaned shadow subtree. In such + cases, traversal might start with a node in an orphaned shadow + subtree. So ComposedShadowTreeWalker can not assume that visited + shadow root is always assigned to a shadow insertion point. + + This patch only fixes ComposedShadowTreeWalker. + ComposedShadowTreeParentWalker will be fixed in another patch with + an event dispatching test. + + Test: fast/dom/shadow/composed-shadow-tree-walker.html + + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost): + + +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add MemoryUsageSupport::processMemorySizesInBytes + https://bugs.webkit.org/show_bug.cgi?id=87830 + + Reviewed by James Robinson. + + Added a method for getting process memory usage in bytes. It is + used in the inspector memory instrumentation to get process total + memory usage. + + * inspector/InspectorMemoryAgent.cpp: + (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution): + * platform/MemoryUsageSupport.cpp: + (WebCore::MemoryUsageSupport::processMemorySizesInBytes): + (WebCore): + * platform/MemoryUsageSupport.h: + (MemoryUsageSupport): provided embedders with a way to report WebKit process + memory usage. + * platform/chromium/MemoryUsageSupportChromium.cpp: + (WebCore::MemoryUsageSupport::processMemorySizesInBytes): + (WebCore): + +2012-05-31 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r119062 and r119064. + http://trac.webkit.org/changeset/119062 + http://trac.webkit.org/changeset/119064 + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Broke build on Lion, SnowLoepard, Chromium Windows, and + Chromium Linux 32 + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/Decimal.cpp: Removed. + * platform/Decimal.h: Removed. + +2012-05-31 Shane Stephens <shanestephens@google.com> + + text-decoration should not be propagated through absolutely positioned elements to <a> tags + https://bugs.webkit.org/show_bug.cgi?id=86517 + + Reviewed by Darin Adler. + + Test: fast/css/text-decoration-in-second-order-descendants.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::getTextDecorationColors): + Remove fix from 18611 as it doesn't work on second order descendants. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::adjustRenderStyle): + Add floating and positioned checks when deciding whether to avoid propagating text decoration. Move all checks into new method to improve readability. + (WebCore::doesNotInheritTextDecoration): Added + +2012-05-30 Yoshifumi Inoue <yosin@chromium.org> + + Build fix for Linon/SnowLeopard after r119062 + + * platform/Decimal.cpp: + (WebCore::Decimal::Decimal): + +2012-05-30 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added new class Decimal for decimal arithmatic in two + files: platform/Decimal.cpp and Decimal.h with unit test. + + Test: WebKit/chromium/tests/DecimalTest.cpp + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/Decimal.cpp: Added. + (WebCore): + (DecimalPrivate): + (SpecialValueHandler): + (WebCore::DecimalPrivate::SpecialValueHandler::SpecialValueHandler): + (WebCore::DecimalPrivate::SpecialValueHandler::handle): + (WebCore::DecimalPrivate::SpecialValueHandler::value): + (UInt128): + (WebCore::DecimalPrivate::UInt128::UInt128): + (WebCore::DecimalPrivate::UInt128::high): + (WebCore::DecimalPrivate::UInt128::low): + (WebCore::DecimalPrivate::UInt128::multiply): + (WebCore::DecimalPrivate::UInt128::highUInt32): + (WebCore::DecimalPrivate::UInt128::lowUInt32): + (WebCore::DecimalPrivate::UInt128::isZero): + (WebCore::DecimalPrivate::UInt128::makeUInt64): + (WebCore::DecimalPrivate::UInt128::operator/=): + (WebCore::DecimalPrivate::UInt128::multiplyHigh): + (WebCore::DecimalPrivate::countDigits): + (WebCore::DecimalPrivate::scaleDown): + (WebCore::DecimalPrivate::scaleUp): + (WebCore::Decimal::EncodedData::EncodedData): + (WebCore::Decimal::EncodedData::operator==): + (WebCore::Decimal::Decimal): + (WebCore::Decimal::operator=): + (WebCore::Decimal::operator+=): + (WebCore::Decimal::operator-=): + (WebCore::Decimal::operator*=): + (WebCore::Decimal::operator/=): + (WebCore::Decimal::operator-): + (WebCore::Decimal::operator+): + (WebCore::Decimal::operator*): + (WebCore::Decimal::operator/): + (WebCore::Decimal::operator==): + (WebCore::Decimal::operator!=): + (WebCore::Decimal::operator<): + (WebCore::Decimal::operator<=): + (WebCore::Decimal::operator>): + (WebCore::Decimal::operator>=): + (WebCore::Decimal::abs): + (WebCore::Decimal::alignOperands): + (WebCore::Decimal::ceiling): + (WebCore::Decimal::compareTo): + (WebCore::Decimal::floor): + (WebCore::Decimal::fromString): + (WebCore::Decimal::infinity): + (WebCore::Decimal::nan): + (WebCore::Decimal::remainder): + (WebCore::Decimal::round): + (WebCore::Decimal::toString): + (WebCore::Decimal::zero): + * platform/Decimal.h: Added. + (WebCore): + (DecimalPrivate): + (Decimal): + (EncodedData): + (WebCore::Decimal::EncodedData::operator!=): + (WebCore::Decimal::EncodedData::coefficient): + (WebCore::Decimal::EncodedData::exponent): + (WebCore::Decimal::EncodedData::isFinite): + (WebCore::Decimal::EncodedData::isNaN): + (WebCore::Decimal::EncodedData::isSpecial): + (WebCore::Decimal::EncodedData::isZero): + (WebCore::Decimal::EncodedData::sign): + (WebCore::Decimal::EncodedData::setSign): + (WebCore::Decimal::EncodedData::formatClass): + (WebCore::Decimal::isFinite): + (WebCore::Decimal::isNaN): + (WebCore::Decimal::isNegative): + (WebCore::Decimal::isPositive): + (WebCore::Decimal::isSpecial): + (WebCore::Decimal::isZero): + (WebCore::Decimal::value): + (AlignedOperands): + (WebCore::Decimal::invertSign): + (WebCore::Decimal::exponent): + (WebCore::Decimal::sign): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Build fix for WinCE after r116723. + + * platform/graphics/wince/FontWinCE.cpp: + (WebCore::TextRunComponent::TextRunComponent): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + Implement CSSParser::determineNameInNamespace() as a helper function for CSSGrammar.y + https://bugs.webkit.org/show_bug.cgi?id=87799 + + Reviewed by Darin Adler. + + As pointed out by darin@ in https://bugs.webkit.org/show_bug.cgi?id=87627#c12, + we should avoid repeating the following code in CSSGrammar.y: + + if (p->m_styleSheet) + $$->setTag(QualifiedName(namespacePrefix, $2, p->m_styleSheet->determineNamespace(namespacePrefix))); + else + $$->setTag(QualifiedName(namespacePrefix, $2, p->m_defaultNamespace)); + + This patch implements CSSParser::determineNameInNamespace() as a helper function + and replaces the above code. + + Tests: fast/dom/SelectorAPI/*. No change in test results. + + * css/CSSGrammar.y: + * css/CSSParser.cpp: + (WebCore::CSSParser::determineNameInNamespace): + (WebCore): + * css/CSSParser.h: + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Build fix for WinCE after r117697. + + * page/wince/FrameWinCE.cpp: + (WebCore::computePageRectsForFrame): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix min/max bounds error in CCMathUtil.cpp + https://bugs.webkit.org/show_bug.cgi?id=87915 + + Reviewed by James Robinson. + + Two unit tests added to CCMathUtilTest: + CCMathUtilTest.verifyEnclosingClippedRectUsesCorrectInitialBounds + CCMathUtilTest.verifyEnclosingRectOfVerticesUsesCorrectInitialBounds + + While computing bounds, the initial values for xmax and ymax are + intended to be set to -float_max. It turns out that + std::numeric_limits<float>::min() actually returns the smallest + positive value close to zero, which is not what was intended. This + patch fixes the code to use -float_max instead, which is the + intended value. + + * platform/graphics/chromium/cc/CCMathUtil.cpp: + (WebCore::CCMathUtil::mapClippedRect): + (WebCore::CCMathUtil::projectClippedRect): + (WebCore::CCMathUtil::computeEnclosingRectOfVertices): + (WebCore::CCMathUtil::computeEnclosingClippedRect): + (WebCore): + * platform/graphics/chromium/cc/CCMathUtil.h: + (WebCore::HomogeneousCoordinate::HomogeneousCoordinate): + (HomogeneousCoordinate): + (WebCore::HomogeneousCoordinate::shouldBeClipped): + (WebCore::HomogeneousCoordinate::cartesianPoint2d): + (WebCore): + (CCMathUtil): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Build fix for WinCE after r118568. + + * platform/text/wince/TextBreakIteratorWinCE.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): + +2012-05-30 Abhishek Arya <inferno@chromium.org> + + Crash in ContainerNode::parserAddChild. + https://bugs.webkit.org/show_bug.cgi?id=87903 + + Reviewed by Ryosuke Niwa. + + Call the ChildNodeInsertionNotifier.notify call at the end since + it can destroy |this| and some of the local pointers like |last|. + This also matches the order of calls - childrenChanged precedes + ChildNodeInsertionNotifier.notify in updateTreeAfterInsertion and + ContainerNode::parserInsertBefore. + + Also remove a FIXME since we use ChildNodeInsertionNotifier.notify + instead of ChildNodeInsertionNotifier.notifyInsertedIntoDocument + (as recommended in the FIXME). + + Test: fast/dom/child-insertion-notify-crash.html + + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::parserAddChild): + +2012-05-30 Rick Byers <rbyers@chromium.org> + + [chromium] Implement pointer and hover CSS media features + https://bugs.webkit.org/show_bug.cgi?id=87403 + + Reviewed by Adam Barth. + + Add initial support for the pointer and hover media features as defined + here: + http://dev.w3.org/csswg/css4-mediaqueries/#pointer + http://dev.w3.org/csswg/css4-mediaqueries/#hover + + For now this only supports the case where we know a touch screen is + available (currently known only for the chromium port on certain + platforms). All other cases continue to behave exactly as if the media + feature isn't supported. + + Tests: fast/media/mq-pointer.html + + * css/CSSValueKeywords.in: + * css/MediaFeatureNames.h: + (MediaFeatureNames): + * css/MediaQueryEvaluator.cpp: + (WebCore::getLeastCapablePrimaryPointerDeviceType): + (WebCore): + (WebCore::hoverMediaFeatureEval): + (WebCore::pointerMediaFeatureEval): + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::restoreTo): + (WebCore::InternalSettings::setDeviceSupportsTouch): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + +2012-05-30 Julien Chaffraix <jchaffraix@webkit.org> + + Add an helper function to get the style for a cell's flow computation + https://bugs.webkit.org/show_bug.cgi?id=87902 + + Reviewed by Ojan Vafai. + + No expected change in behavior. + + This change introduces styleForCellFlow that unify which function we use + to determine a cell's direction and writing mode. + + This unification will make it easier to support direction on table row + group (section in WebKit land). + + * rendering/RenderTableCell.h: + (WebCore::RenderTableCell::styleForCellFlow): + Added the new function along with a comment as to its purpose. + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::clippedOverflowRectForRepaint): + (WebCore::RenderTableCell::computeCollapsedStartBorder): + (WebCore::RenderTableCell::computeCollapsedEndBorder): + (WebCore::RenderTableCell::computeCollapsedBeforeBorder): + (WebCore::RenderTableCell::computeCollapsedAfterBorder): + (WebCore::RenderTableCell::borderHalfLeft): + (WebCore::RenderTableCell::borderHalfRight): + (WebCore::RenderTableCell::borderHalfTop): + (WebCore::RenderTableCell::borderHalfBottom): + (WebCore::RenderTableCell::borderHalfStart): + (WebCore::RenderTableCell::borderHalfEnd): + (WebCore::RenderTableCell::borderHalfBefore): + (WebCore::RenderTableCell::borderHalfAfter): + (WebCore::RenderTableCell::paintCollapsedBorders): + Mostly mechanical replacement. + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::cachedCollapsedLeftBorder): + (WebCore::RenderTableCell::cachedCollapsedRightBorder): + (WebCore::RenderTableCell::cachedCollapsedTopBorder): + (WebCore::RenderTableCell::cachedCollapsedBottomBorder): + Made the argument 'const' now. + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layoutRows): + Added a FIXME to unify with the rest. + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [JSC] SerializedScriptValue.create() succeeds even if MessagePort object cannot be found in transferred ports + https://bugs.webkit.org/show_bug.cgi?id=87118 + + Reviewed by Adam Barth. + + Make SerializedScriptValue.create() throw an exception if one of the + MessagePort objects cannot be found in the transferred ports. This + matches the behavior of the V8 implementation. + + Test: webintents/web-intents-obj-constructor.html + + * bindings/js/SerializedScriptValue.cpp: + (WebCore::CloneSerializer::dumpIfTerminal): + +2012-05-30 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call fileUtilities methods directly + https://bugs.webkit.org/show_bug.cgi?id=87852 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * platform/chromium/DragDataChromium.cpp: + (WebCore::DragData::asURL): + * platform/chromium/FileSystemChromium.cpp: + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::getFileMetadata): + (WebCore::directoryName): + (WebCore::pathByAppendingComponent): + (WebCore::makeAllDirectories): + (WebCore::openFile): + (WebCore::closeFile): + (WebCore::seekFile): + (WebCore::truncateFile): + (WebCore::readFromFile): + (WebCore::writeToFile): + * platform/chromium/PlatformSupport.h: + (PlatformSupport): + +2012-05-30 Kent Tamura <tkent@chromium.org> + + Form controls in <fieldset disabled> should not be focusable. + https://bugs.webkit.org/show_bug.cgi?id=87380 + + Reviewed by Darin Adler. + + Test: fast/forms/fieldset/focus-in-fieldset-disabled.html + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::supportsFocus): + Refer to disabled() instead of m_disabled to take account of wrapping + fieldset elements. + +2012-05-30 Robin Dunn <robin@alldunn.com> + + [wx] Implement HTML clipboard support. + https://bugs.webkit.org/show_bug.cgi?id=87883 + + Reviewed by Kevin Ollivier. + + * platform/wx/ClipboardWx.cpp: + (WebCore::ClipboardWx::writeRange): + * platform/wx/PasteboardWx.cpp: + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::documentFragment): + +2012-05-30 Garrett Casto <gcasto@chromium.org> + + TextFieldDecorationElement should respect style attribute + https://bugs.webkit.org/show_bug.cgi?id=87762 + + Reviewed by Kent Tamura. + + * html/shadow/TextFieldDecorationElement.cpp: Use style set on the + Element when creating rendering style. + (WebCore::TextFieldDecorationElement::customStyleForRenderer): + +2012-05-30 Ojan Vafai <ojan@chromium.org> + + Avoid second layout for flex-direction:row, flex-basis:auto flex items + https://bugs.webkit.org/show_bug.cgi?id=87901 + + Reviewed by Tony Chang. + + No new tests. This is strictly a performance optimization and has no other + web visible changes. + + Also, add FIXMEs for other cases where we could avoid doing layouts. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): + (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): + +2012-05-30 Zhenyao Mo <zmo@google.com> + + WebKit incorrectly clears the alpha channel on readPixels, even for Framebuffers + https://bugs.webkit.org/show_bug.cgi?id=87310 + + Reviewed by Kenneth Russell. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::getParameter): set DEPTH_BITS/STENCIL_BITS to 0 if related channels are not requested. + (WebCore::WebGLRenderingContext::readPixels): don't do the alpha value fix if the current bound is not the internal drawing buffer. + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118986. + http://trac.webkit.org/changeset/118986 + https://bugs.webkit.org/show_bug.cgi?id=87914 + + Caused several IndexedDB browser_test failures on Chromium + canary builders (Requested by rafaelw_ on #webkit). + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::setVersion): + * Modules/indexeddb/IDBDatabaseError.h: + (WebCore::IDBDatabaseError::create): + (IDBDatabaseError): + (WebCore::IDBDatabaseError::createWithoutOffset): + (WebCore::IDBDatabaseError::code): + (WebCore::IDBDatabaseError::setCode): + (WebCore::IDBDatabaseError::setMessage): + (WebCore::IDBDatabaseError::IDBDatabaseError): + * Modules/indexeddb/IDBDatabaseException.cpp: + (WebCore): + (WebCore::IDBDatabaseException::initializeDescription): + * Modules/indexeddb/IDBDatabaseException.h: + (IDBDatabaseException): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::resetReadyState): + (WebCore::IDBRequest::abort): + (WebCore::IDBRequest::onError): + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::onSuccessWithContinuation): + (WebCore::IDBRequest::dispatchEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + * Modules/indexeddb/IDBRequest.idl: + * Modules/indexeddb/IDBTransaction.cpp: + * Modules/indexeddb/IDBTransaction.h: + (IDBTransaction): + * Modules/indexeddb/IDBTransaction.idl: + +2012-05-30 Dominic Mazzoni <dmazzoni@chromium.org> + + [Chromium] AX: WebAccessibilityObject should check if an AccessibilityObject is detached + https://bugs.webkit.org/show_bug.cgi?id=87778 + + Reviewed by Adam Barth. + + Chromium was never actually using AccessibilityObjectWrapper, so + this change deletes it. Instead, it's replaced with a simple bool + that keeps track of whether an AccessibilityObject was detached or + not. WebKit/chromium/public/WebAccessibilityObject can then use this + to determine if an object is still valid. + + Test: accessibility/accessibility-object-detached.html + + * WebCore.gypi: + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::AccessibilityObject): + (WebCore::AccessibilityObject::detach): + (WebCore::AccessibilityObject::isDetached): + (WebCore): + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/chromium/AXObjectCacheChromium.cpp: + (WebCore): + (WebCore::AXObjectCache::detachWrapper): + (WebCore::AXObjectCache::attachWrapper): + * accessibility/chromium/AccessibilityObjectWrapper.h: Removed. + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + Simplify TransformationMatrix rotation code to improve precision + https://bugs.webkit.org/show_bug.cgi?id=86666 + + Reviewed by Adrienne Walker. + + Change covered by existing layout tests; + Additional unit tests added. + + The original rotation code for WebCore::TransformationMatrix was + using indirect trig identities to compute basic rotation + matrices. As far as I can imagine, this is unnecessary, and brief + informal experiments showed that we can gain a few extra bits of + precision by avoiding that indirection. + + Indeed, precision improved such that it revealed a mistake on one + of the unit tests, where the test was actually degenerate so that + the layer was aligned with a viewport boundary. When it was + imprecise, it didnt appear to be aligned. Putting an additional + translation on that test fixes it so it is no longer a degenerate + test. + + This patch also revealed a few chinks in the unit testing armor of + this code, an error that should have been caught in unit tests was + luckily caught by SVG layout tests. This chink is fixed by adding + 2 extra unit tests. + + * platform/graphics/transforms/TransformationMatrix.cpp: + (WebCore::TransformationMatrix::rotate3d): + +2012-05-30 Alec Flett <alecflett@chromium.org> + + IndexedDB: Remove old get/getKey implementations + https://bugs.webkit.org/show_bug.cgi?id=87879 + + Reviewed by Ojan Vafai. + + Removal of dead code, was scaffolding for a complicated + Chromium landing. + + * Modules/indexeddb/IDBIndexBackendImpl.cpp: + (WebCore::IDBIndexBackendImpl::getInternal): + (WebCore::IDBIndexBackendImpl::getKeyInternal): + (WebCore::IDBIndexBackendImpl::get): + (WebCore::IDBIndexBackendImpl::getKey): + * Modules/indexeddb/IDBIndexBackendImpl.h: + (IDBIndexBackendImpl): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::get): + (WebCore::IDBObjectStoreBackendImpl::getInternal): + * Modules/indexeddb/IDBObjectStoreBackendImpl.h: + (IDBObjectStoreBackendImpl): + +2012-05-30 Joe Mason <jmason@rim.com> + + [BlackBerry] Fix assertion fail on redirect due to multiple jobs per handle + https://bugs.webkit.org/show_bug.cgi?id=87579 + + Reviewed by George Staikos. + + RIM PR #158892: + + When we start a redirect, we now call cancelJob instead of just deleting it immediately to make sure + that all cleanup is performed. However, we also reassign the ResourceHandle to the new job, and + since cancelJob is asynchronous it is now assigned to two jobs simultaneously. + + Work around this by only returning handles that have not been cancelled from findJobForHandle. + Cancelled jobs still technically exist in the jobs list, but they're invisible to callers. This is + safe because there is literally nothing that can be done with a cancelled job - it is supposed to + merely consume any notifications that are already in progress and then kill itself off - so no + callers of findJobForHandle are expecting a cancelled job. (All existing callers call methods on the + returned job which are no-ops for cancelled jobs, so there is no behaviour change.) + + No new tests because there is no behaviour change (fixes a regression). + + * platform/network/blackberry/NetworkManager.cpp: + (WebCore::NetworkManager::findJobForHandle): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8][Performance] Optimize DOM attribute getters that return an empty string + https://bugs.webkit.org/show_bug.cgi?id=87820 + + Reviewed by Adam Barth. + + This patch optimizes the performance of DOM attribute getters that return an + empty string by 65.8% (e.g. div.id, div.className, div.title, div.lang ...etc) + + Performance test: Bindings/undefined-id-getter.html + + [Without the patch] + RESULT Bindings: undefined-id-getter= 441.984669644 runs/s + median= 445.544554455 runs/s, stdev= 11.8406070959 runs/s, min= 405.063291139 runs/s, max= 447.204968944 runs/s + + [With the patch] + RESULT Bindings: undefined-id-getter= 738.840460474 runs/s + median= 738.786279683 runs/s, stdev= 2.00249797161 runs/s, min= 733.944954128 runs/s, max= 741.721854305 runs/s + + - This patch passes Isolate to v8::String::Empty(), which removes Isolate + look-up inside v8::String::Empty(). + + - This patch inlines V8Binding::getElementStringAttr() and + V8Binding::setElementStringAttr(). + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + * bindings/v8/V8Binding.h: + (WebCore::StringCache::v8ExternalString): + (StringCache): + (WebCore::v8ExternalString): + (WebCore): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8] Implement V8Binding::v8BooleanWithCheck(isolate) + https://bugs.webkit.org/show_bug.cgi?id=87814 + + Reviewed by Adam Barth. + + The objective is to pass Isolate to v8::True() and v8::False(). + Similarly to v8NullWithCheck() (bug 87713), this patch implements + V8Binding::v8BooleanWithCheck(isolate), which calls v8::True()/v8::False() + or v8::True(isolate)/v8::False(isolate) depending on whether the + passed isolate is null or not. + + This patch also passes Isolate to v8Boolean() in CodeGeneratorV8.pm. + + No tests. No behavior change. + + * bindings/scripts/CodeGeneratorV8.pm: + (NativeToJSValue): + * bindings/scripts/test/V8/V8TestEventTarget.cpp: + (WebCore::TestEventTargetV8Internal::dispatchEventCallback): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::createAttrGetter): + (WebCore::TestObjV8Internal::reflectedBooleanAttrAttrGetter): + (WebCore::TestObjV8Internal::reflectedCustomBooleanAttrAttrGetter): + * bindings/v8/V8Binding.h: + (WebCore::v8Boolean): + (WebCore): + (WebCore::v8BooleanWithCheck): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8] Replace v8::True() and v8::False() with v8Boolean() + https://bugs.webkit.org/show_bug.cgi?id=87812 + + Reviewed by Adam Barth. + + To avoid implementing all of v8TrueWithCheck(isolate), v8FalseWithCheck(isolate) + and v8BooleanWithCheck(isolate), we can first replace v8::True() and v8::False() + with v8Boolean(). Then we can just implement v8BooleanWithCheck(isolate). + + No tests. No change in behavior. + + * bindings/v8/SerializedScriptValue.cpp: + * bindings/v8/V8Binding.h: + (WebCore::v8StringOrFalse): + * bindings/v8/V8NPUtils.cpp: + (WebCore::convertNPVariantToV8Object): + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + (WebCore::V8DOMStringMap::namedPropertyDeleter): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback): + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore::storageDeleter): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8] Replace v8::Null() with v8NullWithCheck(isolate) in custom bindings where isolate can be 0 + https://bugs.webkit.org/show_bug.cgi?id=87807 + + Reviewed by Adam Barth. + + The objective is to pass Isolate around in V8 bindings. + This patch replaces v8::Null() with v8NullWithCheck(isolate) + in custom bindings where isolate can be 0. + + 'where isolate can be 0' means all the places where we cannot + retrieve Isolate directly from AccessorInfo or Arguments. + + No tests. No behavior change. + + * bindings/v8/custom/V8BlobCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8CSSRuleCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8CSSStyleSheetCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8CSSValueCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DOMTokenListCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DataViewCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8EntryCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8EntrySyncCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8EventCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Float32ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Float64ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8HTMLElementCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8IDBKeyCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8ImageDataCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Int16ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Int32ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Int8ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8LocationCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8NodeCustom.cpp: + (WebCore::toV8Slow): + * bindings/v8/custom/V8SVGDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8SVGElementCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8SVGPathSegCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8ScriptProfileCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8ScriptProfileNodeCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8StyleSheetCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Uint16ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Uint32ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Uint8ArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8WorkerContextCustom.cpp: + (WebCore::toV8): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8] Replace v8::Null() with v8::Null(isolate) or v8NullWithCheck(isolate) in non-custom bindings + https://bugs.webkit.org/show_bug.cgi?id=87810 + + Reviewed by Adam Barth. + + The objective is to pass Isolate around in V8 bindings. + For non-custom bindings, we replace v8::Null() with v8::Null(isolate) + where isolate cannot be 0, and replace v8::Null() with v8NullWithCheck(isolate) + where isolate can be 0. + + This will be the final patch for passing Isolate to v8::Null(). + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateFunctionCallback): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::contentDocumentAttrGetter): + (WebCore::TestObjV8Internal::getSVGDocumentCallback): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + (WebCore::TestSerializedScriptValueInterfaceV8Internal::cachedValueAttrGetter): + (WebCore::TestSerializedScriptValueInterfaceV8Internal::cachedReadonlyValueAttrGetter): + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::deserialize): + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertEventTargetToV8Object): + +2012-05-30 Kentaro Hara <haraken@chromium.org> + + [V8] Replace v8::Null() with v8::Null(isolate) in custom bindings where isolate shouldn't be 0 + https://bugs.webkit.org/show_bug.cgi?id=87809 + + Reviewed by Adam Barth. + + The objective is to pass Isolate around in V8 bindings. + This patch replaces v8::Null() with v8::Null(isolate) in custom bindings + where isolate shouldn't be 0. 'where isolate shouldn't be 0' is the place + where isolate is retrieved directly from AccessorInfo and Arguments. + + This patch includes a couple of refactorings: + + - Makes V8DeviceMotionEvent::createAccelerationObject() and + V8DeviceMotionEvent::createRotationRateObject() static + + - Moves V8HTMLElement::toV8Object() into the existing ENABLE(MICRODATA) flag. + + No tests. No change in behavior. + + * bindings/v8/custom/V8ClipboardCustom.cpp: + (WebCore::V8Clipboard::typesAccessorGetter): + * bindings/v8/custom/V8CoordinatesCustom.cpp: + (WebCore::V8Coordinates::altitudeAccessorGetter): + (WebCore::V8Coordinates::altitudeAccuracyAccessorGetter): + (WebCore::V8Coordinates::headingAccessorGetter): + (WebCore::V8Coordinates::speedAccessorGetter): + * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: + (WebCore::V8DeviceMotionEvent::accelerationAccessorGetter): + (WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter): + (WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter): + (WebCore::V8DeviceMotionEvent::intervalAccessorGetter): + * bindings/v8/custom/V8DeviceOrientationEventCustom.cpp: + (WebCore::V8DeviceOrientationEvent::alphaAccessorGetter): + (WebCore::V8DeviceOrientationEvent::betaAccessorGetter): + (WebCore::V8DeviceOrientationEvent::gammaAccessorGetter): + (WebCore::V8DeviceOrientationEvent::absoluteAccessorGetter): + * bindings/v8/custom/V8DocumentLocationCustom.cpp: + (WebCore::V8Document::locationAccessorGetter): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::V8HTMLCanvasElement::getContextCallback): + * bindings/v8/custom/V8HTMLElementCustom.cpp: + (WebCore::toV8): + (WebCore): + (WebCore::toV8Object): + * bindings/v8/custom/V8HistoryCustom.cpp: + (WebCore::V8History::stateAccessorGetter): + * bindings/v8/custom/V8MessageEventCustom.cpp: + (WebCore::V8MessageEvent::dataAccessorGetter): + * bindings/v8/custom/V8NodeCustom.cpp: + (WebCore::V8Node::insertBeforeCallback): + (WebCore::V8Node::replaceChildCallback): + (WebCore::V8Node::removeChildCallback): + (WebCore::V8Node::appendChildCallback): + * bindings/v8/custom/V8PopStateEventCustom.cpp: + (WebCore::V8PopStateEvent::stateAccessorGetter): + * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp: + (WebCore::V8SQLResultSetRowList::itemCallback): + * bindings/v8/custom/V8TrackEventCustom.cpp: + (WebCore::V8TrackEvent::trackAccessorGetter): + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + (WebCore::toV8Object): + (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback): + (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback): + +2012-05-30 Nico Weber <thakis@chromium.org> + + Make the files attribute of HTMLInputElement writable + https://bugs.webkit.org/show_bug.cgi?id=87154 + + Reviewed by Adam Barth. + + whatwg thread: + http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html + + * bindings/objc/PublicDOMInterfaces.h: + Remove readonly on files property. + * html/FileInputType.cpp: + (FileInputType): + Add a NULL check to setFiles(). + * html/FileInputType.h: + (FileInputType): + Let setFiles() overwrite the base class's method. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::setFiles): + Add setFiles() implementation, delegate to input type. + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLInputElement.idl: + * html/InputType.cpp: + (WebCore::InputType::setFiles): + setFiles() does nothing by default. + * html/InputType.h: + (InputType): + Add a virtual setFiles() method. + +2012-05-30 Joe Mason <jmason@rim.com> + + [BlackBerry] Remove useless string->char*->string conversion in NetworkJob. + https://bugs.webkit.org/show_bug.cgi?id=87861 + + Reviewed by Antonio Gomes. + + RIM PR #152383: username is a WTF::String. ResourceHandleInternal::m_user is a string. Yet they're + assigned with "username = m_user.utf8().data()". Pointless: "username = m_user" will do. + + No new tests since there is no behaviour change. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::sendRequestWithCredentials): + +2012-05-30 Dan Bernstein <mitz@apple.com> + + [Qt] REGRESSION(r118568): It broke fast/forms/textarea-maxlength.html on Qt 4.8 + https://bugs.webkit.org/show_bug.cgi?id=87740 + + Reviewed by Darin Adler. + + * platform/text/qt/TextBreakIteratorQt.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Changed to use + the return value of setUpIterator. + +2012-05-30 Zeno Albisser <zeno@webkit.org> + + GraphicsSurface: allow importing and exporting of textures directly on GPU side. + https://bugs.webkit.org/show_bug.cgi?id=87725 + + Add copyFromFramebuffer function to copy a texture from an FBO + onto the GraphicsSurface. + Add getTextureID function to export the texture ID. + This allows binding/blitting the texture directly on the GPU. + + Reviewed by Noam Rosenthal. + + * platform/graphics/surfaces/GraphicsSurface.cpp: + (WebCore::GraphicsSurface::getTextureID): + (WebCore): + (WebCore::GraphicsSurface::copyFromFramebuffer): + * platform/graphics/surfaces/GraphicsSurface.h: + (GraphicsSurface): + * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: + (WebCore::GraphicsSurface::platformGetTextureID): + (WebCore): + (WebCore::GraphicsSurface::platformCopyFromFramebuffer): + +2012-05-30 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + Added "error" attribute to IDBRequest and IDBTransaction. Update + IDBDatabaseError to honor the IDBDatabaseException behavior + of dealing with IDB-specific throws of DOMException codes, + as per the spec. + + Existing tests which previously tested 'errorCode' and + 'webkitErrorMessage' have been updated to use the new attribute. + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::setVersion): + * Modules/indexeddb/IDBDatabaseError.h: + (WebCore::IDBDatabaseError::create): + (WebCore::IDBDatabaseError::code): + (WebCore::IDBDatabaseError::idbCode): + (WebCore::IDBDatabaseError::name): + (WebCore::IDBDatabaseError::IDBDatabaseError): + (IDBDatabaseError): + * Modules/indexeddb/IDBDatabaseException.cpp: + (WebCore): + (WebCore::getErrorEntry): + (WebCore::IDBDatabaseException::initializeDescription): + (WebCore::IDBDatabaseException::getErrorName): + (WebCore::IDBDatabaseException::getLegacyErrorCode): + * Modules/indexeddb/IDBDatabaseException.h: + (IDBDatabaseException): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::error): + (WebCore): + (WebCore::IDBRequest::resetReadyState): + (WebCore::IDBRequest::abort): + (WebCore::IDBRequest::onError): + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::onSuccessWithContinuation): + (WebCore::IDBRequest::dispatchEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + * Modules/indexeddb/IDBRequest.idl: + * Modules/indexeddb/IDBTransaction.cpp: + (WebCore::IDBTransaction::error): + (WebCore): + (WebCore::IDBTransaction::setError): + * Modules/indexeddb/IDBTransaction.h: + (IDBTransaction): + * Modules/indexeddb/IDBTransaction.idl: + +2012-05-30 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] ImageDecoderQt doesn't support some decoders. + https://bugs.webkit.org/show_bug.cgi?id=87851 + + Reviewed by Kenneth Rohde Christiansen. + + If forced to decode GIF and JPEG, ImageDecoderQt show several + artifacts. This is caused by mismatched decoded image-formats. + + Convert mismatched color spaces into ARGB color space, and perform + manual mem-copy when the image has been decoded into a new buffer. + + This patch also add support for down-scaling in the decoder. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::internalDecodeSize): + (WebCore::ImageDecoderQt::internalHandleCurrentImage): + +2012-05-30 Emil A Eklund <eae@chromium.org> + + Floats wraps incorrectly when top edge has subpixel precision + https://bugs.webkit.org/show_bug.cgi?id=87688 + + Reviewed by Levi Weintraub. + + When computing the logical left and right offsets for a float we + incorrectly floored the logical top when passing it to the float search + adapter. This caused it to return incorrect values where the floored and + pixel snapped values are not the same. + + Test: fast/sub-pixel/float-wrap-with-subpixel-top.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::logicalLeftOffsetForLine): + (WebCore::RenderBlock::logicalRightOffsetForLine): + +2012-05-30 Emil A Eklund <eae@chromium.org> + + Inline blocks with margin wrap incorrectly with subpixel layout turned on + https://bugs.webkit.org/show_bug.cgi?id=87897 + + Reviewed by Levi Weintraub. + + Change WebCore::getBorderPaddingMargin and the helper function + getBPMWidth to return a LayoutUnit rather than an int as the padding and + margin values have subpixel precision. This fixes an issue where we would + incorrectly wrap inline blocks with a subpixel padding or margin. + + Test: fast/sub-pixel/inline-block-with-margin.html + + * rendering/RenderBlock.cpp: + (WebCore::getBPMWidth): + (WebCore::getBorderPaddingMargin): + (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): + +2012-05-30 Tony Chang <tony@chromium.org> + + rename flexbox css values from justify and distribute to space-between and space-around + https://bugs.webkit.org/show_bug.cgi?id=87867 + + Reviewed by Ojan Vafai. + + This was recently changed in the spec: + http://dev.w3.org/csswg/css3-flexbox/#justify-content + + No new tests, updated existing tests and expectations. + + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EFlexPack): + (WebCore::CSSPrimitiveValue::operator EFlexLinePack): + * css/CSSValueKeywords.in: + * rendering/RenderFlexibleBox.cpp: + (WebCore::initialPackingOffset): + (WebCore::packingSpaceBetweenChildren): + (WebCore::initialLinePackingOffset): + (WebCore::linePackingSpaceBetweenChildren): + * rendering/style/RenderStyleConstants.h: + +2012-05-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Make sure we get the file size with the proper native type. + + * platform/wx/FileSystemWx.cpp: + (WebCore::getFileMetadata): + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118913. + http://trac.webkit.org/changeset/118913 + https://bugs.webkit.org/show_bug.cgi?id=87891 + + patch is incorrect (see comments in + https://bugs.webkit.org/show_bug.cgi?id=87889) (Requested by + thorton on #webkit). + + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): + * css/CSSFontFaceSrcValue.h: + (CSSFontFaceSrcValue): + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): + * css/CSSPrimitiveValue.h: + (CSSPrimitiveValue): + * css/CSSReflectValue.cpp: + (WebCore::CSSReflectValue::addSubresourceStyleURLs): + * css/CSSReflectValue.h: + (CSSReflectValue): + * css/CSSValue.cpp: + (WebCore::CSSValue::addSubresourceStyleURLs): + * css/CSSValue.h: + (CSSValue): + * css/CSSValueList.cpp: + (WebCore::CSSValueList::addSubresourceStyleURLs): + * css/CSSValueList.h: + (CSSValueList): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::addSubresourceStyleURLs): + * css/StylePropertySet.h: + (StylePropertySet): + * css/StyleSheetContents.cpp: + (WebCore::StyleSheetContents::addSubresourceStyleURLs): + * css/StyleSheetContents.h: + (StyleSheetContents): + * dom/Element.h: + * dom/Node.cpp: + (WebCore::Node::getSubresourceURLs): + * dom/Node.h: + (WebCore::Node::addSubresourceAttributeURLs): + (WebCore): + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::addSubresourceAttributeURLs): + * dom/ProcessingInstruction.h: + (ProcessingInstruction): + * dom/StyledElement.cpp: + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (StyledElement): + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::addSubresourceAttributeURLs): + * html/HTMLBodyElement.h: + (HTMLBodyElement): + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::addSubresourceAttributeURLs): + * html/HTMLEmbedElement.h: + (HTMLEmbedElement): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::addSubresourceAttributeURLs): + * html/HTMLImageElement.h: + (HTMLImageElement): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::addSubresourceAttributeURLs): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::addSubresourceAttributeURLs): + * html/HTMLLinkElement.h: + (HTMLLinkElement): + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::addSubresourceAttributeURLs): + * html/HTMLObjectElement.h: + (HTMLObjectElement): + * html/HTMLParamElement.cpp: + (WebCore::HTMLParamElement::addSubresourceAttributeURLs): + * html/HTMLParamElement.h: + (HTMLParamElement): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::addSubresourceAttributeURLs): + * html/HTMLScriptElement.h: + (HTMLScriptElement): + * html/HTMLStyleElement.cpp: + (WebCore::HTMLStyleElement::addSubresourceAttributeURLs): + * html/HTMLStyleElement.h: + (HTMLStyleElement): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::addSubresourceAttributeURLs): + * html/HTMLTableCellElement.h: + (HTMLTableCellElement): + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::addSubresourceAttributeURLs): + * html/HTMLTableElement.h: + (HTMLTableElement): + * svg/SVGCursorElement.cpp: + (WebCore::SVGCursorElement::addSubresourceAttributeURLs): + * svg/SVGCursorElement.h: + (SVGCursorElement): + * svg/SVGFEImageElement.cpp: + (WebCore::SVGFEImageElement::addSubresourceAttributeURLs): + * svg/SVGFEImageElement.h: + (SVGFEImageElement): + * svg/SVGImageElement.cpp: + (WebCore::SVGImageElement::addSubresourceAttributeURLs): + * svg/SVGImageElement.h: + (SVGImageElement): + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::addSubresourceAttributeURLs): + * svg/SVGScriptElement.h: + (SVGScriptElement): + +2012-05-30 Shezan Baig <shezbaig.wk@gmail.com> + + Rename offsetTopLeft in RenderBoxModelObject to something better + https://bugs.webkit.org/show_bug.cgi?id=85915 + + Reviewed by Darin Adler. + + Renamed offsetTopLeft in RenderBoxModelObject to + adjustedPositionRelativeToOffsetParent, because it returns the given + startPoint after adjusting it to be relative to the top-left corner of + the offsetParent. The definition of offsetParent itself is non-trivial + and is documented within the body of RenderObject::offsetParent, + therefore I decided to reuse this term, as-is, in the name of this + function. + + No new tests; no functional or visible changes. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::offsetLeft): + (WebCore::RenderBox::offsetTop): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent): + (WebCore::RenderBoxModelObject::offsetLeft): + (WebCore::RenderBoxModelObject::offsetTop): + * rendering/RenderBoxModelObject.h: + (RenderBoxModelObject): + * rendering/RenderInline.cpp: + (WebCore::RenderInline::offsetLeft): + (WebCore::RenderInline::offsetTop): + +2012-05-29 Adrienne Walker <enne@google.com> + + Transformed fixed position layers have an incorrect overlap map entry + https://bugs.webkit.org/show_bug.cgi?id=64201 + + Reviewed by Darin Adler. + + Previously, layers that both had a transform and were fixed position + were not considered as being fixed position in RenderGeometryMap or in + RenderBox::mapLocalToContainer (although this case is not incorrect in + the case of painting, so an external caller likely adjusts for this). + + Tests: compositing/layer-creation/fixed-position-and-transform.html + compositing/layer-creation/fixed-position-under-transform.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::mapLocalToContainer): + * rendering/RenderGeometryMap.cpp: + (WebCore::RenderGeometryMap::mapToAbsolute): + +2012-05-30 Ulan Degenbaev <ulan@chromium.org> + + [v8] Crash after redefining setter on typed array to a number + https://bugs.webkit.org/show_bug.cgi?id=87862 + + Reviewed by Kenneth Russell. + + Remove calls to typed array set() method from C++. + Store the copying script as a hidden property of a typed array prototype. + + Test: fast/canvas/webgl/array-override-set.html + + * bindings/v8/custom/V8ArrayBufferViewCustom.cpp: + (WebCore): + (WebCore::getHiddenCopyMethod): + (WebCore::installHiddenCopyMethod): + (WebCore::copyElements): + * bindings/v8/custom/V8ArrayBufferViewCustom.h: + (WebCore): + (WebCore::constructWebGLArray): + (WebCore::setWebGLArrayHelper): + * bindings/v8/custom/V8ArrayBufferViewCustomScript.js: + +2012-05-30 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87882 + + [New Multicolumn] Rename layoutColumns to relayoutForPagination and make it + virtual so that it can be implemented by RenderMultiColumnBlock. + + Reviewed by Anders Carlsson. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlock): + (WebCore::RenderBlock::relayoutForPagination): + * rendering/RenderBlock.h: + (RenderBlock): + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::relayoutForPagination): + (WebCore): + * rendering/RenderMultiColumnBlock.h: + (RenderMultiColumnBlock): + +2012-05-30 Daniel Drake <dsd@laptop.org> + + Check for GTK2/GTK3 symbol mismatch earlier + https://bugs.webkit.org/show_bug.cgi?id=87687 + + Reviewed by Martin Robinson. + + No new tests. Regressions in core behavior are covered by existing + plugin tests and the fix deals with particular aspects of the system + environment that are difficult to test. + + Detect plugins that would mix GTK+ symbols earlier, so that the + WebKit can skip them and choose a more appropriate plugin module. + + * plugins/gtk/PluginPackageGtk.cpp: Move this code from PluginViewGtk. + (WebCore::moduleMixesGtkSymbols): + (WebCore::PluginPackage::load): + * plugins/gtk/PluginViewGtk.cpp: Move this code to PluginPackageGtk. + (WebCore::PluginView::platformStart): + +2012-05-30 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Support IMAGE_DECODER_DOWN_SAMPLING flag. + https://bugs.webkit.org/show_bug.cgi?id=87840 + + Based on patches by Qi Zhang and Jussi Lehto. + Reviewed by Kenneth Rohde Christiansen. + + * platform/graphics/Image.cpp: + (WebCore::Image::adjustSourceRectForDownSampling): + * platform/graphics/Image.h: + (Image): + * platform/graphics/openvg/ImageOpenVG.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/qt/ImageQt.cpp: + (WebCore::Image::drawPattern): + (WebCore::BitmapImage::draw): + +2012-05-30 Shinya Kawanaka <shinyak@chromium.org> + + comparePositions in htmlediting should consider nested Shadow DOM. + https://bugs.webkit.org/show_bug.cgi?id=87623 + + Reviewed by Ryosuke Niwa. + + comparePositions in htmlediting.cpp didn't consider nested Shadow DOM. + This patch makes it possible to compare the nodes in nested Shadow DOM. + + The algorithm is: we calculate the common tree scope of node A and B, and + adjust the nodes to the treeScope, then compare them. If the adjusted nodes + are the same, we check the shadow descendent of each node. + + Test: editing/shadow/compare-positions-in-nested-shadow.html + + * dom/TreeScope.cpp: + (WebCore::listTreeScopes): + (WebCore): + (WebCore::commonTreeScope): + * dom/TreeScope.h: + (WebCore): + * editing/htmlediting.cpp: + (WebCore::comparePositions): + +2012-05-30 Erik Arvidsson <arv@chromium.org> + + [V8] Clean up V8LazyEventListener to use one less function call + https://bugs.webkit.org/show_bug.cgi?id=87785 + + Reviewed by Kentaro Hara. + + Instead of relying on 'arguments' we rely on 'this'. 'this' cannot be intercepted by a + with-statement so it is safe to use that to bind the context objects. This allows us to + remove one layer of function indirection in the generated code. + + Covered by existing tests. + + * bindings/v8/V8LazyEventListener.cpp: + (WebCore::V8LazyEventListener::prepareListenerObject): + +2012-05-30 Tim Horton <timothy_horton@apple.com> + + Factor DeferrableOneShotTimer out of GraphicsContextCG/GeneratorGeneratedImage + https://bugs.webkit.org/show_bug.cgi?id=87824 + + Reviewed by Simon Fraser. + + DeferrableOneShotTimer is a timer which takes a class and method to call (as Timer does), + and a delay. It exposes restart(), stop(), and isActive(), and none of the rest of + the TimerBase interface. On restart(), the timer is started with the given delay, + unless it's already running, in which case a flag is set to automatically restart + the timer when it fires instead of calling the given method. This provides a + low-overhead way to implement a deferrable timer. + + No new tests, refactoring. + + * platform/Timer.h: + (DeferrableOneShotTimer): + (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer): New class. + (WebCore::DeferrableOneShotTimer::restart): + (WebCore::DeferrableOneShotTimer::fired): + * platform/graphics/GeneratorGeneratedImage.cpp: + (WebCore::GeneratorGeneratedImage::invalidateCacheTimerFired): + * platform/graphics/GeneratorGeneratedImage.h: + (WebCore::GeneratorGeneratedImage::GeneratorGeneratedImage): Make use of DeferrableOneShotTimer. + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::SubimageCacheWithTimer::SubimageCacheWithTimer): Make use of DeferrableOneShotTimer. + (WebCore::SubimageCacheWithTimer::invalidateCacheTimerFired): + +2012-05-30 Xueqing Huang <huangxueqing@baidu.com> + + eventSender.beginDragWithFiles should be implemented in Windows, which blocked drag and drop related tests. + https://bugs.webkit.org/show_bug.cgi?id=86296 + + Reviewed by Tony Chang. + + Test: This change was requirement for eventSender.beginDragWithFiles, update win/Skipped file to remove drag and drop related tests will valiate it. + + * platform/win/DragDataWin.cpp: + (WebCore::DragData::numberOfFiles): + +2012-05-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + HashTable.h has using directives for std::pair and std::make_pair + https://bugs.webkit.org/show_bug.cgi?id=29919 + + Reviewed by Darin Adler. + + Change code to use std::pair and std::make_pair. + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::postNotification): + * html/MediaFragmentURIParser.cpp: + (WebCore::MediaFragmentURIParser::parseFragments): + * html/parser/HTMLMetaCharsetParser.cpp: + (WebCore::HTMLMetaCharsetParser::processMeta): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::brokenImage): + * page/PageSerializer.cpp: + (WebCore::isCharsetSpecifyingNode): + +2012-05-30 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: disable ExactlyInt feature in InspectorTypeBuilder since it breaks release Windows 7 WK2 + https://bugs.webkit.org/show_bug.cgi?id=87857 + + Reviewed by Yury Semikhatsky. + + Code generator is patched to support old style of int parameter. + + * inspector/CodeGeneratorInspector.py: + (TypeModel.init_class): + +2012-05-30 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Add trace() method to the WorkerConsole + https://bugs.webkit.org/show_bug.cgi?id=87656 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshotProxy.js: + (WebInspector.HeapSnapshotRealWorker.prototype._messageReceived): + * inspector/front-end/HeapSnapshotWorker.js: + (WebInspector.WorkerConsole.prototype.trace): + +2012-05-30 Kinuko Yasuda <kinuko@chromium.org> + + File.lastModifiedDate must return null if the modified time info is not available + https://bugs.webkit.org/show_bug.cgi?id=87709 + + Reviewed by Kentaro Hara. + + Per File API spec, File.lastModifiedDate must return null if the + modified time info is not available. + http://dev.w3.org/2006/webapi/FileAPI/#dfn-lastModifiedDate + + Test: http/tests/local/fileapi/file-last-modified-after-delete.html + + * fileapi/File.cpp: + (WebCore::File::lastModifiedDateForBinding): Added. + (WebCore): + * fileapi/File.h: + (File): + * fileapi/File.idl: Added ImplementedAs=lastModifiedDateForBinding. + +2012-05-30 Jochen Eisinger <jochen@chromium.org> + + Match Firefox restrictions to window.blur and window.focus + https://bugs.webkit.org/show_bug.cgi?id=86969 + + Reviewed by Adam Barth. + + Disallow window.blur altogether, and only allow window.focus to be + invoked from the context that created this very window. + + There's a new setting (windowFocusRestricted) that defaults to true. If + false, the new restrictions are lifted. This can be used by ports that + would prefer to stick with the old behavior. + + For tests, this setting is accessible in window.internals.settings + + To temporarily allow window.focus(), an object of type + WindowFocusAllowedIndicator can be created. It is currently used to + enable window.focus() during dispatch of the click event for + notifications. + + Tests: fast/dom/Window/mozilla-focus-blur.html + fast/notifications/notifications-click-event-focus.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * notifications/Notification.cpp: + (WebCore::Notification::dispatchClickEvent): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::focus): + (WebCore::DOMWindow::blur): + * page/DOMWindow.h: + (DOMWindow): + * page/DOMWindow.idl: + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + (WebCore::Settings::setWindowFocusRestricted): + (WebCore::Settings::windowFocusRestricted): + * page/WindowFocusAllowedIndicator.cpp: Added. + (WebCore): + (WebCore::WindowFocusAllowedIndicator::windowFocusAllowed): + (WebCore::WindowFocusAllowedIndicator::WindowFocusAllowedIndicator): + (WebCore::WindowFocusAllowedIndicator::~WindowFocusAllowedIndicator): + * page/WindowFocusAllowedIndicator.h: Added. + (WebCore): + (WindowFocusAllowedIndicator): + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::restoreTo): + (WebCore::InternalSettings::setWindowFocusRestricted): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + +2012-05-30 Mariusz Grzegorczyk <mariusz.g@samsung.com>, Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Fix WebKit2-EFL build + https://bugs.webkit.org/show_bug.cgi?id=83693 + + Reviewed by Carlos Garcia Campos. + + * CMakeLists.txt: Add GestureTapHighlighter.cpp. + +2012-05-29 Antti Koivisto <antti@apple.com> + + Rename Foo::addSubresourceStyleURLs and Node::addSubresourceAttributeURLs + https://bugs.webkit.org/show_bug.cgi?id=87739 + + Rubber-stamped by Andreas Kling. + + Rename them to collectSubresourceURLs and collectSubresourceURLsFromAttributes to match + the naming conventions. + + Move collectSubresourceURLsFromAttributes from Node to Element as only elements have attributes. + + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::collectSubresourceURLs): + * css/CSSFontFaceSrcValue.h: + (CSSFontFaceSrcValue): + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::collectSubresourceURLs): + * css/CSSPrimitiveValue.h: + (CSSPrimitiveValue): + * css/CSSReflectValue.cpp: + (WebCore::CSSReflectValue::collectSubresourceURLs): + * css/CSSReflectValue.h: + (CSSReflectValue): + * css/CSSValue.cpp: + (WebCore::CSSValue::collectSubresourceURLs): + * css/CSSValue.h: + (CSSValue): + * css/CSSValueList.cpp: + (WebCore::CSSValueList::collectSubresourceURLs): + * css/CSSValueList.h: + (CSSValueList): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::collectSubresourceURLs): + * css/StylePropertySet.h: + (StylePropertySet): + * css/StyleSheetContents.cpp: + (WebCore::StyleSheetContents::collectSubresourceURLs): + * css/StyleSheetContents.h: + (StyleSheetContents): + * dom/Element.h: + (WebCore::Element::collectSubresourceURLsFromAttributes): + (Element): + * dom/Node.cpp: + (WebCore::Node::getSubresourceURLs): + * dom/Node.h: + (WebCore): + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::collectSubresourceURLsFromAttributes): + * dom/ProcessingInstruction.h: + (ProcessingInstruction): + * dom/StyledElement.cpp: + (WebCore::StyledElement::collectSubresourceURLsFromAttributes): + * dom/StyledElement.h: + (StyledElement): + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::collectSubresourceURLsFromAttributes): + * html/HTMLBodyElement.h: + (HTMLBodyElement): + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::collectSubresourceURLsFromAttributes): + * html/HTMLEmbedElement.h: + (HTMLEmbedElement): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::collectSubresourceURLsFromAttributes): + * html/HTMLImageElement.h: + (HTMLImageElement): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::collectSubresourceURLsFromAttributes): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::collectSubresourceURLsFromAttributes): + * html/HTMLLinkElement.h: + (HTMLLinkElement): + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::collectSubresourceURLsFromAttributes): + * html/HTMLObjectElement.h: + (HTMLObjectElement): + * html/HTMLParamElement.cpp: + (WebCore::HTMLParamElement::collectSubresourceURLsFromAttributes): + * html/HTMLParamElement.h: + (HTMLParamElement): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::collectSubresourceURLsFromAttributes): + * html/HTMLScriptElement.h: + (HTMLScriptElement): + * html/HTMLStyleElement.cpp: + (WebCore::HTMLStyleElement::collectSubresourceURLsFromAttributes): + * html/HTMLStyleElement.h: + (HTMLStyleElement): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::collectSubresourceURLsFromAttributes): + * html/HTMLTableCellElement.h: + (HTMLTableCellElement): + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::collectSubresourceURLsFromAttributes): + * html/HTMLTableElement.h: + (HTMLTableElement): + * svg/SVGCursorElement.cpp: + (WebCore::SVGCursorElement::collectSubresourceURLsFromAttributes): + * svg/SVGCursorElement.h: + (SVGCursorElement): + * svg/SVGFEImageElement.cpp: + (WebCore::SVGFEImageElement::collectSubresourceURLsFromAttributes): + * svg/SVGFEImageElement.h: + (SVGFEImageElement): + * svg/SVGImageElement.cpp: + (WebCore::SVGImageElement::collectSubresourceURLsFromAttributes): + * svg/SVGImageElement.h: + (SVGImageElement): + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::collectSubresourceURLsFromAttributes): + * svg/SVGScriptElement.h: + (SVGScriptElement): + +2012-05-30 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: Fix JS compiler warning + https://bugs.webkit.org/show_bug.cgi?id=87836 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/SettingsScreen.js: Fix method annotation. + +2012-05-30 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder + https://bugs.webkit.org/show_bug.cgi?id=80400 + + This change modifies the default ImageDecoder for Qt-port from QImageDecoder to WebCore ImageDecoder. + The new behavior is to use QImageDecoder only if WebCoreImageDecoder - and the platform - doesn't support + the requested image type. + The WTF_USE_QT_IMAGE_DECODER macro has been removed, since it is no longer needed. + + This change adds build depedency (except Qt-MAC and Qt-WIN platform) for libpng-dev and libjpeg-dev packages, + because PNG and JPEG imagedecoders need not only these libraries, but their headers also. Qmake-config + tests for these libraries were introduced in r110045. + + Notice: with using libjpeg-turbo as a system library I measured 10% performance improvement on Methanol benchmark + (collection of popular sites, page-loading benchmark) with this patch. + + Reviewed by Simon Hausmann. + + No new tests needed. + + * Target.pri: Move WebCore ImageDecoder files out of guards. Remove ImageFrameQt.cpp from sources. + * WebCore.pri: Move WebCore ImageDecoder include paths out of guards. + * platform/MIMETypeRegistry.cpp: + (WebCore::initializeSupportedImageMIMETypes): Add WebCore supported and Qt supported MIME types. + (WebCore::initializeSupportedImageMIMETypesForEncoding): Use Qt supported MIME types. + * platform/graphics/ImageSource.cpp: Remove unnecessary includes. + * platform/graphics/ImageSource.h: Remove unnecessary typedefs. + (WebCore): + * platform/graphics/qt/ImageDecoderQt.cpp: Remove ImageDecoder::create, since it is no longer needed. + (WebCore::ImageDecoderQt::filenameExtension): Remove unnecessary semicolon. + (WebCore::ImageDecoderQt::internalHandleCurrentImage): Use QImage and ImageFrame instead of QPixmap. + (WebCore): + (WebCore::ImageFrame::asNewNativeImage): Moved here from removed ImageFrameQt.cpp. + * platform/image-decoders/ImageDecoder.cpp: Reorganize the includes of the header. + (WebCore::ImageDecoder::create): Add platform macro guarded fallback case for QImageDecoder. Add guards + for JPEG, PNG, ICO decoder for Qt-MAC and Qt-WIN platform. + * platform/image-decoders/ImageDecoder.h: Remove Qt-specific codes. + (WebCore::ImageFrame::getAddr): Remove Qt-specific case, since it is no longer needed. + (ImageFrame): + * platform/image-decoders/qt/ImageFrameQt.cpp: Removed. Dead code, other code has been moved to + ImageDecoderQt.cpp. + +2012-05-23 Kinuko Yasuda <kinuko@chromium.org> + + REGRESSION: We should allow null modificationTime when snapshot metadata is given + https://bugs.webkit.org/show_bug.cgi?id=86811 + + Reviewed by Jian Li. + + r117432 has introduced a new File constructor which allows the caller + to pass in a snapshot file metadata. In the change we had considered the + given metadata is valid if "metadata.length >= 0 AND metadata.lastModifiedDate != 0", + but we should drop the latter condition (lastModifiedDate != 0) because + + 1. the value 0 is used to indicate the time information is unavailable in File, and + 2. it is valid per spec (http://dev.w3.org/2006/webapi/FileAPI/#dfn-lastModifiedDate says the UA must return null if the information is not available). + + (Note: the current js/v8 binding returns Date(0) for the time value 0, + which is still valid as epoch time but would fail to indicate the + unavailability of the information. In this patch I added FIXME in + File.idl and filed a separate issue http://webkit.org/b/87709) + + No new tests as this change does not affect regular files/filesystems behavior. + (Tests in Chrome OS port should be able to verify this) + + * fileapi/File.cpp: + (WebCore::File::lastModifiedDate): + (WebCore::File::size): + (WebCore::File::captureSnapshot): + * fileapi/File.h: + (File): + +2012-05-30 MORITA Hajime <morrita@google.com> + + [Shadow DOM] HTMLContentElement and HTMLShadowElement constructors should be visible. + https://bugs.webkit.org/show_bug.cgi?id=87818 + + Reviewed by Kentaro Hara. + + Added them as DOMWindow properties + + Tests: fast/dom/shadow/content-element-api.html + fast/dom/shadow/shadow-element.html + + * page/DOMWindow.idl: + +2012-05-30 Mike Lawther <mikelawther@chromium.org> + + CSS3 calc: Implement CSSOM support + https://bugs.webkit.org/show_bug.cgi?id=84551 + + Reviewed by Ryosuke Niwa. + + Adds a pretty printer for the calc expression tree. + + Test: css3/calc/cssom.html + + * css/CSSCalculationValue.cpp: + (WebCore::CSSCalcValue::customCssText): + (WebCore::CSSCalcPrimitiveValue::customCssText): + (WebCore::CSSCalcBinaryOperation::customCssText): + (CSSCalcBinaryOperation): + * css/CSSCalculationValue.h: + (CSSCalcExpressionNode): + +2012-05-29 Li Yin <li.yin@intel.com> + + [FileAPI] The result attribute of FileReader shuold use null to replace empty string + https://bugs.webkit.org/show_bug.cgi?id=87578 + + Reviewed by Jian Li. + + Spec: http://www.w3.org/TR/FileAPI/#dfn-result + If the readyState is EMPTY (no read method has been called) or an error + in reading the File or Blob has occurred (using any read method), then the + result attribute MUST return null. + + Currently, Firefox11, Opera and IE 10 follows the spec, but Webkit based + browser doesn't. + WebKit should change the returned value empty string into null to keep + conformance with the spec. + + Tests: fast/files/read-file-async.html + fast/files/workers/worker-read-file-async.html + + * fileapi/FileReader.cpp: + (WebCore::FileReader::arrayBufferResult): + (WebCore::FileReader::stringResult): + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Call fileExists through fileUtilities(), not directly. + + * platform/chromium/FileSystemChromium.cpp: + (WebCore::fileExists): + +2012-05-29 Kentaro Hara <haraken@chromium.org> + + Remove a dummy style sheet from CSSParser::parseFlowThread() + https://bugs.webkit.org/show_bug.cgi?id=87715 + + Reviewed by Darin Adler. + + r118736 changed CSSGrammar.y so that it works fine with no style sheet. + r118736 removed a dummy style sheet from CSSParser::parserSelector(). + Now we can safely remove a dummy style sheet from parserFlowThread(). + + Tests: fast/regions. No change in test results. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseFlowThread): + +2012-05-29 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r111497): The "option" element doesn't match CSS pseudo class :enabled + https://bugs.webkit.org/show_bug.cgi?id=87719 + + Reviewed by Kent Tamura. + + This patch added checking of "option" element for CSS pseudo class :enabled as same as + :disabled to selector checker. Before r111497, it was done by using isFormControlElement. + After that revision, HTMLOptionElement was no longer derived from HTMLFormControlElement. + + Test: fast/form/select/optgroup-rendering.html + + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkOneSelector): Checking element is option element as same + as PseudoDisabled in PseudoEnabled case. + +2012-05-29 Hayato Ito <hayato@chromium.org> + + Introduces ComposedShadowTreeParentWalker, extracted from ComposedShadowTreeWalker. + https://bugs.webkit.org/show_bug.cgi?id=87004 + + Reviewed by Dimitri Glazkov. + + Introduces a ComposedShadowTreeParentWalker, which is only used + for traversing a parent node (including shadow roots and insertion + points) and get rid of an equivalent function from + ComposedShadowTreeWalker. + + Before this patch, there is an inconsistency inside of + ComposedShadowTreeWalker. The Walker uses 'Policy' to decide + whether it should visit shadow roots or not, but + parentIncludingInsertionPointAndShadowRoot() member function + ignores the policy. We can not add an assertion in its + constructor due to this inconsistency. To resolve it, we could + add yet another special policy, but that makes the implementation + complex and may add some overhead in runtime. So separate the + functionality into another class as ComposedShadowTreeParentWalker. + + No new tests, no new functionality except for assertion. + + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::ComposedShadowTreeWalker::ComposedShadowTreeWalker): + (WebCore::ComposedShadowTreeParentWalker::ComposedShadowTreeParentWalker): + (WebCore): + (WebCore::ComposedShadowTreeParentWalker::parentIncludingInsertionPointAndShadowRoot): + (WebCore::ComposedShadowTreeParentWalker::traverseParentIncludingInsertionPointAndShadowRoot): + * dom/ComposedShadowTreeWalker.h: + (ComposedShadowTreeWalker): + (WebCore::ComposedShadowTreeWalker::assertPrecondition): + (WebCore): + (ComposedShadowTreeParentWalker): + (WebCore::ComposedShadowTreeParentWalker::get): + * dom/EventDispatcher.cpp: + (WebCore::EventRelatedTargetAdjuster::adjust): + (WebCore::EventDispatcher::ensureEventAncestors): + * page/EventHandler.cpp: + (WebCore::EventHandler::updateMouseEventTargetNode): + +2012-05-29 Hayato Ito <hayato@chromium.org> + + Add assertions to make sure that event's target and relatedTarget are accessible. + https://bugs.webkit.org/show_bug.cgi?id=87641 + + Reviewed by Dimitri Glazkov. + + No new tests. No new functionality except for assertions. + + * dom/EventContext.cpp: + (WebCore::EventContext::EventContext): + * dom/EventContext.h: + (WebCore): + (EventContext): + (WebCore::EventContext::setRelatedTarget): + (WebCore::EventContext::accessible): + +2012-05-29 Kent Tamura <tkent@chromium.org> + + Fix inefficient usage of traverseNextNode() + https://bugs.webkit.org/show_bug.cgi?id=87804 + + Reviewed by Ryosuke Niwa. + + foo->traverseNextNode(foo) is equivalent to foo->firstChild(), and + firstChild() is more efficient. + + No new tests because of no behavior change. + + * html/HTMLFieldSetElement.cpp: + (WebCore::HTMLFieldSetElement::invalidateDisabledStateUnder): + Replace traverseNextNode() with firstChild(), and shorten a variable name. + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::getElementById): + Replace traverseNextNode() with firstChild(). + +2012-05-29 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Loading media data with http authentication + https://bugs.webkit.org/show_bug.cgi?id=84214 + + Reviewed by George Staikos. + + RIM PR: 117618 + Implemented http authentication feature for media by implementing + two interface functions in class MediaPlayerPrivate: + onAuthenticationNeeded(): this function is triggered when MMR + engine requires http authentication. We search the CredentialStorage + to see if we have already stored existing credential information, + or challenge user to provide it. + OnAuthenticationAccepted(): this function is triggered when MMR + engine accepts the credential information, and we need to save + it in CredentialStorage for later use. + + Internally reviewed by Max Feil <mfeil@qnx.com>. + + Manual test case: blackberry/video-load-with-authentication.html + + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::generateProtectionSpaceFromMMRAuthChallenge): + (WebCore): + (WebCore::MediaPlayerPrivate::onAuthenticationNeeded): + (WebCore::MediaPlayerPrivate::onAuthenticationAccepted): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + +2012-05-29 MORITA Hajime <morrita@google.com> + + [Shadow DOM] Node distribution should be orthogonal from node attachment + https://bugs.webkit.org/show_bug.cgi?id=87223 + + Reviewed by Dimitri Glazkov. + + This chagne reorganizes Shadow DOM subtree distribution implementation. + + Originally, it was interleaved across attach() of several classes like + InsertionPoint and ShadowRoot. Its invalidation was also mixed as a part of + the style recalculation and detach()-es. + + This change extracts these bits of code to a set of ContentDistributor methods, which are + facaded by two ElementShadow API. Following two API are the primary entry points: + + - ElementShadow::ensureDistribution() + - ElementShadow::invalidateDistribution() + + The actual implementations are ContentDistributor::distribute() and + ContentDistributor::invalidate() respectively. + + When clients need to traverse composed tree, before attach() for + example, they should call ensureDistribution() to make sure that + the traversal data structure ("the distribution") is ready. When + there is any DOM mutation which can result a composed tree + mutation, then clients should call invalidateDistribution() to + mark the distribution being dated. + + Here are such DOM mutations: + + - The children of any ShadowRoots are changed, + - The children of any InsertionPoints are changed, + - The children of any host elements are changed, + - Any insertion point is inserted to or removed from the shadow tree, + - @select attribute of <content> is modified and + - New ShadowRoot is added to the shadow tree. + + Note that the validity of the distribution is tracked and + unnecessary distribution requests are ignored. + + After the invalidation, that shadow subtrees are detached once and + request their re-attachment through the style recalculation. + Then, on the responding style recalculation and attach(), new + distribution will be computed. + + No new tests. Covered by existing tests. + + * dom/Element.cpp: + (WebCore::Element::~Element): + (WebCore::Element::childrenChanged): + * dom/ElementShadow.cpp: + (WebCore::ElementShadow::~ElementShadow): + (WebCore::ElementShadow::addShadowRoot): + (WebCore::ElementShadow::removeAllShadowRoots): + (WebCore::ElementShadow::attach): + (WebCore::ElementShadow::recalcStyle): + (WebCore::ElementShadow::ensureDistribution): + (WebCore::ElementShadow::invalidateDistribution): + * dom/ElementShadow.h: + (ElementShadow): + * dom/NodeRenderingContext.cpp: + (WebCore::NodeRenderingContext::NodeRenderingContext): + (WebCore::NodeRendererFactory::createRendererIfNeeded): + * dom/NodeRenderingContext.h: + (NodeRenderingContext): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::setApplyAuthorStyles): + (WebCore::ShadowRoot::attach): + (WebCore::ShadowRoot::childrenChanged): + (WebCore): + * dom/ShadowRoot.h: + (ShadowRoot): + * html/HTMLFormControlElement.cpp: + * html/ValidationMessage.cpp: + (WebCore::ValidationMessage::buildBubbleTree): + * html/shadow/ContentDistributor.cpp: + (WebCore::ContentDistributor::ContentDistributor): + (WebCore::ContentDistributor::~ContentDistributor): + (WebCore::ContentDistributor::findInsertionPointFor): + (WebCore::ContentDistributor::distribute): + (WebCore::ContentDistributor::invalidate): + (WebCore::ContentDistributor::finishInivalidation): + (WebCore::ContentDistributor::distributeSelectionsTo): + (WebCore::ContentDistributor::distributeShadowChildrenTo): + (WebCore::ContentDistributor::invalidateDistributionIn): + * html/shadow/ContentDistributor.h: + (WebCore::ContentDistributor::needsInvalidation): + (ContentDistributor): + (WebCore::ContentDistributor::needsDistribution): + * html/shadow/HTMLContentElement.cpp: + (WebCore::HTMLContentElement::parseAttribute): + * html/shadow/InsertionPoint.cpp: + (WebCore::InsertionPoint::attach): + (WebCore::InsertionPoint::detach): + (WebCore::InsertionPoint::nextTo): + (WebCore::InsertionPoint::previousTo): + (WebCore::InsertionPoint::childrenChanged): + * html/shadow/InsertionPoint.h: + (WebCore::InsertionPoint::setDistribution): + (WebCore::InsertionPoint::clearDistribution): + (InsertionPoint): + +2012-05-29 Luke Macpherson <macpherson@chromium.org> + + Implement post-landing feedback for WebKitCSSTransformValue::customCSSText(). + https://bugs.webkit.org/show_bug.cgi?id=87684 + + Reviewed by Darin Adler. + + Darin provided some style suggesting on https://bugs.webkit.org/show_bug.cgi?id=87462 after it landed. + This patch incorporates those suggestions, namely using 0 instead of empty string for UnknownTransformOperation + and WTF_ARRAY_LENGTH instead of hard coding the array length. + + Covered by existing transform tests. + + * css/WebKitCSSTransformValue.cpp: + (WebCore): + (WebCore::WebKitCSSTransformValue::customCssText): + +2012-05-29 Eric Seidel <eric@webkit.org> + + Fix ENABLE_IFRAME_SEAMLESS to actually fully disable <iframe seamless> + https://bugs.webkit.org/show_bug.cgi?id=87646 + + Reviewed by Adam Barth. + + In the process of moving the seamless feature out of github and into bugs.webkit.org + multiple versions of the shouldDisplaySeamlessly function got written + (and moved from HTMLIFrameElement to Document), but only one of them was wrapped + in ENABLE_IFRAME_SEAMLESS. HTMLIFrameElement was checking mayDisplaySeamlessly + directly (as was my original design), which got around the ENABLE_IFRAME_SEAMLESS check. + I've fixed this oversight, and the feature is now off when we tell it to be off. + + This is covered by many existing tests. I've verified locally that + all tests fail when ENABLE_IFRAME_SEAMLESS is disabled instead of + only some of them. + + * dom/SecurityContext.h: + (SecurityContext): + * html/HTMLIFrameElement.cpp: + (WebCore::HTMLIFrameElement::shouldDisplaySeamlessly): + +2012-05-29 Scott Graham <scottmg@chromium.org> + + Fix warning in preprocessing Source/WebCore/dom/DOMError.idl + https://bugs.webkit.org/show_bug.cgi?id=87763 + + Reviewed by Adam Barth. + + Add newline at end of file to avoid warning: + ../dom/DOMError.idl:35:2: warning: no newline at end of file + + * dom/DOMError.idl: + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * platform/chromium/FileSystemChromium.cpp: + (WebCore::fileExists): + * platform/chromium/PlatformSupport.h: + (PlatformSupport): + +2012-05-29 Kentaro Hara <haraken@chromium.org> + + [V8] Rename v8Null() to v8NullWithCheck() + https://bugs.webkit.org/show_bug.cgi?id=87713 + + Reviewed by Adam Barth. + + In IRC, cmarcelo@ pointed out that v8::Null() and v8Null() + are confusing. This patch renames v8Null() to v8NullWithCheck(). + + No tests. No behavior change. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeader): + * bindings/scripts/test/V8/V8TestActiveDOMObject.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestEventConstructor.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestEventTarget.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestException.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestInterface.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestMediaQueryListListener.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestNamedConstructor.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestNode.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestObj.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h: + (WebCore::toV8): + * bindings/v8/V8Binding.h: + (WebCore::v8NullWithCheck): + (WebCore::v8DateOrNull): + +2012-05-29 Christophe Dumez <christophe.dumez@intel.com> + + Some Content Security Policy console messages are missing line numbers in JSC + https://bugs.webkit.org/show_bug.cgi?id=87558 + + Reviewed by Adam Barth. + + Make ScriptController::eventHandlerPosition() behave the same way on + JSC than V8. This means that TextPosition::minimumPosition() is + returned if parser is null, instead of + TextPosition::belowRangePosition(). The line numbers are now correctly + printed in the output of Content Security Policy tests. + + Tests: http/tests/security/contentSecurityPolicy/inline-script-blocked-javascript-url.html + http/tests/security/contentSecurityPolicy/javascript-url-blocked.html + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::eventHandlerPosition): + +2012-05-29 Shawn Singh <shawnsingh@chromium.org> + + [chromium] make WebTransformationMatrix object usable by non-webkit code + https://bugs.webkit.org/show_bug.cgi?id=87315 + + Reviewed by James Robinson. + + This change is covered by existing tests and by whether it + compiles. There should be no changes in behavior. + + * platform/chromium/support/WebTransformationMatrix.cpp: + (WebKit::WebTransformationMatrix::WebTransformationMatrix): + (WebKit::WebTransformationMatrix::operator=): + (WebKit::WebTransformationMatrix::operator==): + (WebKit::WebTransformationMatrix::inverse): + (WebKit::WebTransformationMatrix::to2dTransform): + (WebKit::WebTransformationMatrix::multiply): + (WebKit::WebTransformationMatrix::makeIdentity): + (WebKit::WebTransformationMatrix::translate): + (WebKit::WebTransformationMatrix::translate3d): + (WebKit::WebTransformationMatrix::translateRight3d): + (WebKit::WebTransformationMatrix::scale): + (WebKit::WebTransformationMatrix::scaleNonUniform): + (WebKit::WebTransformationMatrix::scale3d): + (WebKit::WebTransformationMatrix::rotate): + (WebKit::WebTransformationMatrix::rotate3d): + (WebKit::WebTransformationMatrix::skewX): + (WebKit::WebTransformationMatrix::skewY): + (WebKit::WebTransformationMatrix::applyPerspective): + (WebKit::WebTransformationMatrix::blend): + (WebKit::WebTransformationMatrix::hasPerspective): + (WebKit::WebTransformationMatrix::isInvertible): + (WebKit::WebTransformationMatrix::isBackFaceVisible): + (WebKit::WebTransformationMatrix::isIdentity): + (WebKit::WebTransformationMatrix::isIdentityOrTranslation): + (WebKit::WebTransformationMatrix::isIntegerTranslation): + (WebKit::WebTransformationMatrix::m11): + (WebKit::WebTransformationMatrix::setM11): + (WebKit::WebTransformationMatrix::m12): + (WebKit::WebTransformationMatrix::setM12): + (WebKit::WebTransformationMatrix::m13): + (WebKit::WebTransformationMatrix::setM13): + (WebKit::WebTransformationMatrix::m14): + (WebKit::WebTransformationMatrix::setM14): + (WebKit::WebTransformationMatrix::m21): + (WebKit::WebTransformationMatrix::setM21): + (WebKit::WebTransformationMatrix::m22): + (WebKit::WebTransformationMatrix::setM22): + (WebKit::WebTransformationMatrix::m23): + (WebKit::WebTransformationMatrix::setM23): + (WebKit::WebTransformationMatrix::m24): + (WebKit::WebTransformationMatrix::setM24): + (WebKit::WebTransformationMatrix::m31): + (WebKit::WebTransformationMatrix::setM31): + (WebKit::WebTransformationMatrix::m32): + (WebKit::WebTransformationMatrix::setM32): + (WebKit::WebTransformationMatrix::m33): + (WebKit::WebTransformationMatrix::setM33): + (WebKit::WebTransformationMatrix::m34): + (WebKit::WebTransformationMatrix::setM34): + (WebKit::WebTransformationMatrix::m41): + (WebKit::WebTransformationMatrix::setM41): + (WebKit::WebTransformationMatrix::m42): + (WebKit::WebTransformationMatrix::setM42): + (WebKit::WebTransformationMatrix::m43): + (WebKit::WebTransformationMatrix::setM43): + (WebKit::WebTransformationMatrix::m44): + (WebKit::WebTransformationMatrix::setM44): + (WebKit::WebTransformationMatrix::a): + (WebKit::WebTransformationMatrix::setA): + (WebKit::WebTransformationMatrix::b): + (WebKit::WebTransformationMatrix::setB): + (WebKit::WebTransformationMatrix::c): + (WebKit::WebTransformationMatrix::setC): + (WebKit::WebTransformationMatrix::d): + (WebKit::WebTransformationMatrix::setD): + (WebKit::WebTransformationMatrix::e): + (WebKit::WebTransformationMatrix::setE): + (WebKit::WebTransformationMatrix::f): + (WebKit::WebTransformationMatrix::setF): + (WebKit::WebTransformationMatrix::toWebCoreTransform): + (WebKit::WebTransformationMatrix::mapRect): + (WebKit::WebTransformationMatrix::mapPoint): + (WebKit::WebTransformationMatrix::mapQuad): + (WebKit::WebTransformationMatrix::projectPoint): + +2012-05-29 Alexis Menard <alexis.menard@openbossa.org> + + [CSS3 Backgrounds and Borders] Implement box-decoration-break parsing. + https://bugs.webkit.org/show_bug.cgi?id=87678 + + Reviewed by Eric Seidel. + + Implement the parsing part of box-decoration-break. The specification + is located at http://www.w3.org/TR/css3-background/#box-decoration-break. + So far Opera implements it. This patch only implements the parsing part of + the property. A following patch will implement the rendering part. Despite + the rendering part missing it improves http://css3test.com by 1%. + + Test: fast/box-decoration-break/box-decoration-break-parsing.html + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): + (WebCore::isKeywordPropertyID): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore): + (WebCore::CSSPrimitiveValue::operator EBoxDecorationBreak): + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): + * css/CSSPropertyNames.in: + * css/CSSValueKeywords.in: + * css/StyleBuilder.cpp: + (WebCore::StyleBuilder::StyleBuilder): + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyleConstants.h: + * rendering/style/StyleBoxData.cpp: + (WebCore::StyleBoxData::StyleBoxData): + (WebCore::StyleBoxData::operator==): + * rendering/style/StyleBoxData.h: + (WebCore::StyleBoxData::boxDecorationBreak): + (StyleBoxData): + +2012-05-29 David Barr <davidbarr@chromium.org> + + [text-overflow: ellipsis] WebKit should ignore the ellipsis for the purpose of dispatching mouse events + https://bugs.webkit.org/show_bug.cgi?id=63781 + + Reviewed by Eric Seidel. + + "Ellipsing only affects rendering and must not affect layout nor dispatching of pointer events." + http://www.w3.org/TR/2012/WD-css3-ui-20120117/#text-overflow + + Test: fast/css/text-overflow-ellipsis-hit-test.html + + * rendering/EllipsisBox.cpp: + (WebCore::EllipsisBox::nodeAtPoint): Always return false. + +2012-05-29 Gavin Peters <gavinp@chromium.org> + + [Chromium] Remove assertions on state in Prerender.cpp + https://bugs.webkit.org/show_bug.cgi?id=87746 + + Chrome was crashing in the new Prerender API on Google Web Search; this was because the DOM would stop(), setting the + state of the Prerenders in the document to Inactive, but an asyncronous GC would later come come along and trigger the + removedFromDocument behaviour on each element, including the <link> element launching the prerender. This causes an + assertion failure. + + I believe the late-deletion of the DOM, and the HTMLElement::removedFromDocument calls are legal, and it was the + overzealous assertions in Prerender that were inappropriate. + + Reviewed by Adam Barth. + + No new automated tests, working on a Chromium browser test. Manually test by entering many prerender and non-prerendered + queries into Google Web Search. + + * platform/chromium/Prerender.cpp: + (WebCore::Prerender::Prerender): + (WebCore::Prerender::add): + (WebCore::Prerender::cancel): + (WebCore::Prerender::abandon): + * platform/chromium/Prerender.h: + (Prerender): + +2012-05-29 Victor Carbune <victor@rosedu.org> + + Display cues in the controls area + https://bugs.webkit.org/show_bug.cgi?id=87591 + + Reviewed by Eric Carlson. + + Changed the behaviour to implicitly hide the volume slidebar + if the controls are hidden (due mouse moving out of the video + area or controls are toggled through JS). + + This seems to be the simplest fix to this issue, otherwise + on toggling the display:none property on the controls the + volume slidebar might appear below the video. + + Re-enabled failing tests for this functionality. + + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlPanelElement::makeTransparent): Re-enabled + timer to set the display:none property on the controls. + * html/shadow/MediaControlRootElement.cpp: + (WebCore::MediaControlRootElement::hide): Added a call to hide + the volume slider. + (WebCore::MediaControlRootElement::makeTransparent): Same. + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::hide): Same. + (WebCore::MediaControlRootElementChromium::makeTransparent): Same. + +2012-05-29 Adrienne Walker <enne@google.com> + + Fix transparent iframes with composited contents in WK1 on Mac + https://bugs.webkit.org/show_bug.cgi?id=76478 + + Reviewed by Simon Fraser. + + Test: compositing/iframes/repaint-after-losing-scrollbars.html + + * page/FrameView.cpp: + (WebCore::FrameView::useSlowRepaints): + +2012-05-29 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87787 + + [New Multicolumn] Refactor the region and flow thread code so that it can pick up the correct column widths + and heights when determining the logical width and height of the flow thread itself. + + This patch adds new virtual methods to RenderRegion: logicalWidthForFlowThreadContent and logicalHeightForFlowThreadContent. + For normal regions, these methods return the contentWidth and contentHeight of the regions themselves. For column sets, + however, these methods actually return the column widths and heights. + + This allows the flow thread to properly lay out according to the column width. + + Region invalidation is also done properly by using these new methods. + + In some cases the code is actually simplified, since we can get rid of some isHorizontalWritingMode() switching. + + With this patch the flow thread now actually lays out and paints at the right width (spilling out of the region set in a single unbroken + column). + + Reviewed by Dan Bernstein. + + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::layout): + (WebCore::RenderFlowThread::computeLogicalWidth): + (WebCore::RenderFlowThread::computeLogicalHeight): + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::ensureColumnSets): + * rendering/RenderMultiColumnBlock.h: + (WebCore::RenderMultiColumnBlock::isRenderMultiColumnBlock): + (RenderMultiColumnBlock): + (WebCore::toRenderMultiColumnBlock): + (WebCore): + * rendering/RenderMultiColumnSet.cpp: + (WebCore::RenderMultiColumnSet::computeLogicalWidth): + (WebCore): + (WebCore::RenderMultiColumnSet::computeLogicalHeight): + * rendering/RenderMultiColumnSet.h: + (WebCore::RenderMultiColumnSet::setColumnWidthAndCount): + (RenderMultiColumnSet): + * rendering/RenderObject.h: + (WebCore::RenderObject::isRenderMultiColumnBlock): + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::logicalWidthForFlowThreadContent): + (WebCore): + (WebCore::RenderRegion::logicalHeightForFlowThreadContent): + (WebCore::RenderRegion::layout): + * rendering/RenderRegion.h: + (RenderRegion): + +2012-05-29 Alec Flett <alecflett@chromium.org> + + IndexedDB: Align codes and names for IDB-specific and DOM-specific errors/exceptions + https://bugs.webkit.org/show_bug.cgi?id=87276 + + Reviewed by Tony Chang. + + No new tests. Existing tests have been updated to use the new + exception constant values. + + The IDB spec has evolved to DOM4-style DOMExceptions, which are + referred to with MixedCase, string-based style names for + exceptions rather than UNDERSCORE_CONSTANT_ERR codes. Change to + use MixedCase error/exception names, and tease out the + IDB-specific exception/error codes/names from the system-level + codes. Make sure that the legacy IDB-masked exception code values + match the DOM exception values. Make sure that + IDBDatabaseException[exception.name] still works. + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::createObjectStore): + (WebCore::IDBDatabase::transaction): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::deleteObjectStore): + (WebCore::IDBDatabaseBackendImpl::setVersion): + (WebCore::IDBDatabaseBackendImpl::transaction): + * Modules/indexeddb/IDBDatabaseException.cpp: + (IDBDatabaseExceptionNameDescription): + (WebCore): + (WebCore::IDBDatabaseException::initializeDescription): + * Modules/indexeddb/IDBDatabaseException.h: + * Modules/indexeddb/IDBDatabaseException.idl: + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::index): + (WebCore::IDBObjectStoreBackendImpl::deleteIndex): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::abort): + * Modules/indexeddb/IDBTransactionBackendImpl.cpp: + (WebCore::IDBTransactionBackendImpl::objectStore): + +2012-05-29 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87775 + + [New Multicolumn] Make sure RenderMultiColumnSets have their own copy of the count, width and height of their columns. + + Reviewed by Anders Carlsson. + + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock): + (WebCore::RenderMultiColumnBlock::ensureColumnSets): + * rendering/RenderMultiColumnBlock.h: + (WebCore::RenderMultiColumnBlock::columnWidth): + (WebCore::RenderMultiColumnBlock::columnCount): + (RenderMultiColumnBlock): + * rendering/RenderMultiColumnSet.cpp: + (WebCore::RenderMultiColumnSet::RenderMultiColumnSet): + * rendering/RenderMultiColumnSet.h: + (WebCore::RenderMultiColumnSet::columnCount): + (WebCore::RenderMultiColumnSet::columnWidth): + (WebCore::RenderMultiColumnSet::columnHeight): + (RenderMultiColumnSet): + (WebCore::RenderMultiColumnSet::setColumnWidthAndCount): + (WebCore::RenderMultiColumnSet::setColumnHeight): + +2012-05-29 Simon Fraser <simon.fraser@apple.com> + + Incomplete repaint on twitter.com when replying to a tweet + https://bugs.webkit.org/show_bug.cgi?id=87553 + + Reviewed by Dean Jackson. + + Style changes can cause a compositing layer to change between + requiring its own backing store or not, e.g. with the addition + or removal of a transform. + + When that happens, we need to repaint the ancesetor layer that + this layer was, or will be drawing into. + + Factored some code out of layerWillBeRemoved() to be able to + also call it from setRequiresOwnBackingStore(). + + New manual test, ManualTests/compositing/requires-backing-change.html. + I was not able to get an automated pixel test to work. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::setRequiresOwnBackingStore): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateCompositingLayers): Remove trailing whitespace. + (WebCore::RenderLayerCompositor::repaintInCompositedAncestor): + (WebCore::RenderLayerCompositor::layerWillBeRemoved): + * rendering/RenderLayerCompositor.h: + +2012-05-29 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87771 + + [New Multicolumn] Make sure we have one column set by default and add it to the flow thread's region list. + + Reviewed by Anders Carlsson. + + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::ensureColumnSets): + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::RenderRegion): + +2012-05-29 John Sullivan <sullivan@apple.com> + + Update label for blacklisted plug-in + https://bugs.webkit.org/show_bug.cgi?id=87767 + rdar://problem/11550048 + + Reviewed by Kevin Decker. + + * English.lproj/Localizable.strings: + Regenerated. + + * platform/LocalizedStrings.cpp: + (WebCore::insecurePluginVersionText): + Changed this string. + +2012-05-29 Julien Chaffraix <jchaffraix@webkit.org> + + REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout + https://bugs.webkit.org/show_bug.cgi?id=87536 + + Reviewed by Tony Chang. + + Tests: fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html + fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html + fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html + fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html + + The change in r111742 completely ignored border-sizing (following the table's code lead unfortunately). + The issue is that we would count the borders and paddings twice for the border-box case which would lead + to the content-box including them too. From a web-author, this behavior is equivalent to ignoring box-sizing. + + * rendering/FixedTableLayout.cpp: + (WebCore::FixedTableLayout::calcWidthArray): + Reworked the function to properly use computeBorderBoxLogicalWidth() for correctness. This matches + what RenderBox and the rendering code does generally. Also refactored the code to avoid the need + for local variables and make it more readable. + +2012-05-25 Ojan Vafai <ojan@chromium.org> + + Absolute positioned elements in a relative positioned CSS3 Flexbox fail to display properly + https://bugs.webkit.org/show_bug.cgi?id=58453 + + Reviewed by Tony Chang. + + Test: css3/flexbox/align-absolute-child.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout): + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): + (WebCore::RenderFlexibleBox::adjustAlignmentForChild): + When adjusting positioned items, adjust their static position, not their location. + (WebCore::RenderFlexibleBox::flipForRightToLeftColumn): + (WebCore::RenderFlexibleBox::flipForWrapReverse): + * rendering/RenderFlexibleBox.h: + +2012-05-29 Abhishek Arya <inferno@chromium.org> + + Crash due to text fragment destruction when updating first-letter block. + https://bugs.webkit.org/show_bug.cgi?id=87751 + + Reviewed by Eric Seidel. + + Test: fast/text/text-fragment-first-letter-update-crash.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::setStyle): + +2012-05-29 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87764 + + Add implementation of checkForPaginationLogicalHeightChange to RenderMultiColumnBlock. + + Also stub out ensureColumnSets() and write a comment describing how it's going to work. + + Reviewed by Anders Carlsson. + + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock): + (WebCore::RenderMultiColumnBlock::checkForPaginationLogicalHeightChange): + (WebCore): + (WebCore::RenderMultiColumnBlock::ensureColumnSets): + * rendering/RenderMultiColumnBlock.h: + (WebCore::RenderMultiColumnBlock::columnHeight): + (WebCore::RenderMultiColumnBlock::setColumnHeight): + (RenderMultiColumnBlock): + +2012-05-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118620. + http://trac.webkit.org/changeset/118620 + https://bugs.webkit.org/show_bug.cgi?id=87760 + + This patch causes regression to read an empty file/blob via + FileReader (Requested by jianli on #webkit). + + * fileapi/FileReader.cpp: + (WebCore::FileReader::stringResult): + +2012-05-29 Andreas Kling <kling@webkit.org> + + Make StylePropertySet a variable-sized object to reduce memory use. + <http://webkit.org/b/87506> + + Reviewed by Antti Koivisto. + + Make immutable StylePropertySet objects variable-sized and allocate exactly + the space needed to hold the CSSProperty objects passed at construction. + This lets us avoid the memory overhead of Vector<CSSProperty, 4>. + + Renamed StylePropertySet::adopt* to create and createImmutable since they no + longer adopt the incoming vector. More cleanup will follow in this area. + + This reduces memory usage across the board - the more CSS declarations, + the bigger the benefit. As an example, we save around ~0.5MB on wsj.com. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): + * css/CSSParser.cpp: + (WebCore::CSSParser::createStylePropertySet): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::createImmutable): + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::~StylePropertySet): + (WebCore::StylePropertySet::copyPropertiesFrom): + (WebCore::StylePropertySet::removeProperty): + (WebCore::StylePropertySet::setProperty): + (WebCore::StylePropertySet::parseDeclaration): + (WebCore::StylePropertySet::addParsedProperties): + (WebCore::StylePropertySet::asText): + (WebCore::StylePropertySet::merge): + (WebCore::StylePropertySet::addSubresourceStyleURLs): + (WebCore::StylePropertySet::removePropertiesInSet): + (WebCore::StylePropertySet::findPropertyWithId): + (WebCore::StylePropertySet::removeEquivalentProperties): + (WebCore::StylePropertySet::copyPropertiesInSet): + (WebCore::StylePropertySet::averageSizeInBytes): + (SameSizeAsStylePropertySet): + (WebCore::StylePropertySet::append): + * css/StylePropertySet.h: + (WebCore::StylePropertySet::create): + (StylePropertySet): + (WebCore::StylePropertySet::propertyAt): + (WebCore::StylePropertySet::propertyCount): + (WebCore::StylePropertySet::isEmpty): + (WebCore::StylePropertySet::array): + * dom/StyledElement.cpp: + (WebCore::StyledElement::updateAttributeStyle): + +2012-05-29 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87759 + + Pull the initial page logical height checking for columns into its own separate function. This + will allow the derived RenderMultiColumnBlock class to do its own setup there. It also has the + effect of cleaning up layoutBlock even for the existing code. + + Reviewed by Anders Carlsson. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::checkForPaginationLogicalHeightChange): + (WebCore): + (WebCore::RenderBlock::layoutBlock): + * rendering/RenderBlock.h: + (RenderBlock): + +2012-05-29 Victor Carbune <victor@rosedu.org> + + Update cue event dispatching for zero and negative duration cues + https://bugs.webkit.org/show_bug.cgi?id=85143 + + Reviewed by Eric Carlson. + + Updated existing test. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Explicitly + treated event dispatching for zero and negative duration cues. + (WebCore::HTMLMediaElement::textTrackAddCue): Interval tree doesn't + handle invalid cues with intervals - negative cues need to be treated + as zero-length cues as they are always missed cues anyway. + (WebCore::HTMLMediaElement::textTrackRemoveCue): Same. + +2012-05-29 MORITA Hajime <morrita@google.com> + + ShadowRoot.getElementById() returns removed node. + https://bugs.webkit.org/show_bug.cgi?id=62184 + + Deregitration of m_elementsById map is done at Element::removedFrom() + But the tree scope of the removed node is already reset from a shadow root + to a document. + + This change lookup the old shadow root through its parent node and + deregitrater the node against it. + + Reviewed by Dimitri Glazkov. + + Test: fast/dom/shadow/get-element-by-id-in-shadow-mutation.html + + * dom/Element.cpp: + (WebCore::treeScopeOfParent): + (WebCore): + (WebCore::Element::removedFrom): + * dom/Element.h: + (Element): + (WebCore::Element::updateId): + (WebCore): + +2012-05-29 Dana Jansens <danakj@chromium.org> + + [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect + https://bugs.webkit.org/show_bug.cgi?id=87677 + + Reviewed by Adrienne Walker. + + When a contributing surface is visited, and we have not visited another + surface, then we know the surface is completely unoccluded. However, the + root scissor rect should still be applied, and anything outside of it + should be considered occluded. + + Unit test: WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor + + * platform/graphics/chromium/RenderSurfaceChromium.cpp: + (WebCore::RenderSurfaceChromium::targetRenderSurface): + (WebCore): + * platform/graphics/chromium/RenderSurfaceChromium.h: + (RenderSurfaceChromium): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::unoccludedContributingSurfaceContentRect): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::targetRenderSurface): + (WebCore): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-05-29 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Refactoring http/proxy authentication to use authcallback mechanism introduced with libcurl + https://bugs.webkit.org/show_bug.cgi?id=87706 + + Reviewed by Antonio Gomes. + + Because we use authentication callback mechanism of libcurl, + which will take care of all the authentication communication + between UA and server, so the only thing we need to do is to + provide credential information when authentication callback + is triggered. By using this we don't need to process + intermediate headers for each http authentication scheme. + + Implemented interface function notifyAuthReceived() in + NetworkJob to handle the authentication notification from + networking thread. + When the authentication callback is triggered, we should + cancel the current loading request and restart a new one with + credential information attached which comes from + credentialStorage or user input. + + Internally reviewed by Joe Mason <jmason@rim.com>. + + No new tests since there is no behavior change. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::notifyAuthReceived): + (WebCore): + (WebCore::NetworkJob::handleNotifyHeaderReceived): + (WebCore::NetworkJob::sendRequestWithCredentials): + * platform/network/blackberry/NetworkJob.h: + (NetworkJob): + +2012-05-29 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authentication challenge issue when loading subresource + https://bugs.webkit.org/show_bug.cgi?id=87660 + + Reviewed by Rob Buis. + + We should try to store the credential information as soon as we + receive http status notification which indicates that the + authentication succeeds, instead of storing credentials when the + main resource receives notify done which is too late for loading + subresource. + + Internally reviewed by Joe Mason <jmason@rim.com> + + No new tests since there is no change in behavior. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyStatusReceived): + (WebCore::NetworkJob::handleNotifyClose): + +2012-05-29 Alexey Proskuryakov <ap@apple.com> + + [Mac] Move DefaultFonts.plist to C++ code + https://bugs.webkit.org/show_bug.cgi?id=87560 + <rdar://problem/11466119> + + Reviewed by Dan Bernstein. + + * DerivedSources.make: + * Resources/DefaultFonts.plist.in: Removed. + * WebCore.xcodeproj/project.pbxproj: + * page/mac/SettingsMac.mm: (WebCore::Settings::initializeDefaultFontFamilies): + Instead of having a separate configuration file, just hardcode the settings in C++. + +2012-05-29 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Retainers are missing for all objects + https://bugs.webkit.org/show_bug.cgi?id=87655 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshotDataGrids.js: + (WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource): + +2012-05-29 Philippe Normand <pnormand@igalia.com> + + [GStreamer] Video sink doesn't respect WebKit code style + https://bugs.webkit.org/show_bug.cgi?id=87693 + + Reviewed by Alexis Menard. + + No change in behavior of the sink, this patch only adapts the code + style to WebKit's. + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: + (_WebKitVideoSinkPrivate): + (webkitVideoSinkTimeoutCallback): + (webkitVideoSinkRender): + (webkitVideoSinkDispose): + (unlockBufferMutex): + (webkitVideoSinkUnlock): + (webkitVideoSinkUnlockStop): + (webkitVideoSinkStop): + (webkitVideoSinkStart): + (webkitVideoSinkMarshalVoidAndMiniObject): + (webkit_video_sink_class_init): + (webkitVideoSinkNew): + * platform/graphics/gstreamer/VideoSinkGStreamer.h: + (_WebKitVideoSink): + (_WebKitVideoSinkClass): + +2012-05-29 Roland Takacs <takacs.roland@stud.u-szeged.hu> + + [Qt] Uninitialized shader compiler when GLES is used + https://bugs.webkit.org/show_bug.cgi?id=87712 + + The '#if !defined(QT_OPENGL_ES_2)' has been removed before the initialization + of shader compiler to compile shader codes for ES-platforms as well. + + Reviewed by Noam Rosenthal. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::GraphicsContext3D): + +2012-05-29 Taiju Tsuiki <tzik@chromium.org> + + Add InspectorFileSystemAgent::FrontendProvider + https://bugs.webkit.org/show_bug.cgi?id=87635 + + InspectorFileSystemAgent needs weak reference to its frontend to perform + asynchronous operation. + + Reviewed by Yury Semikhatsky. + + * inspector/InspectorFileSystemAgent.cpp: + (InspectorFileSystemAgent::FrontendProvider): + (WebCore): + (WebCore::InspectorFileSystemAgent::~InspectorFileSystemAgent): + (WebCore::InspectorFileSystemAgent::enable): + (WebCore::InspectorFileSystemAgent::disable): + (WebCore::InspectorFileSystemAgent::setFrontend): + (WebCore::InspectorFileSystemAgent::clearFrontend): + (WebCore::InspectorFileSystemAgent::restore): + (WebCore::InspectorFileSystemAgent::InspectorFileSystemAgent): + * inspector/InspectorFileSystemAgent.h: + (InspectorFileSystemAgent): + +2012-05-29 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r109729): The optgroup element's "disabled" attribute has no effect to rendering and selection + https://bugs.webkit.org/show_bug.cgi?id=87614 + + Reviewed by Kent Tamura. + + This patch adds HTMLOptGroupElement::disabled and isEnabledFormControl + methods which was implemented in HTMLFormControlElement at r109729 and + updates CSS pseudo class checker to check "optgroup" element. + + Tests: fast/forms/select/optgroup-clicking.html + fast/forms/select/optgroup-disabled.html + fast/forms/select/optgroup-rendering.html + + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkOneSelector): On disabled and enabled pseudo class checker. + We checked tag name "optgroup" in addition isFormControlElement. + * css/StyleResolver.cpp: + (WebCore::StyleResolver::canShareStyleWithElement): Checks optgroup.disabled. + * html/HTMLOptGroupElement.cpp: + (WebCore::HTMLOptGroupElement::disabled): Added. + * html/HTMLOptGroupElement.h: + (HTMLOptGroupElement): Added isEnabledFormControl. + +2012-05-29 Alexander Pavlov <apavlov@chromium.org> + + [Chromium] [Regression] SELECT popup misplaced when there is not enough vertical space + https://bugs.webkit.org/show_bug.cgi?id=87735 + + Reviewed by Kent Tamura. + + This change fixes the obsolete WebWidget Y-repositioning code for the insufficient vertical space case, not removed in r113418. + + No new tests, as popups are not testable in Chromium. + + * platform/chromium/PopupContainer.cpp: + (WebCore::PopupContainer::layoutAndCalculateWidgetRect): + +2012-05-29 Andrei Bucur <abucur@adobe.com> + + [CSS Regions]Rename NamedFlow::overflow to NamedFlow::overset + https://bugs.webkit.org/show_bug.cgi?id=87491 + + This patch updates the CSSOM property name overflow to overset. There are no changes in functionality. + Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/ + + Reviewed by Andreas Kling. + + Test: fast/regions/webkit-named-flow-overset.html + + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::overset): + * dom/WebKitNamedFlow.h: + (WebKitNamedFlow): + * dom/WebKitNamedFlow.idl: + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::RenderFlowThread): + (WebCore::RenderFlowThread::computeOverflowStateForRegions): + * rendering/RenderFlowThread.h: + +2012-05-29 Andreas Kling <kling@webkit.org> + + Give StylePropertySet a proper mutability flag. + <http://webkit.org/b/87675> + + Reviewed by Antti Koivisto. + + Add a flag to StylePropertySet that determines whether it's mutable or not. Only objects + constructed from the CSS parser (by way of StylePropertySet::adopt()) are made immutable. + This is clean-up and prep work for implementing a more efficient storage scheme for immutable + StylePropertySets (fixed-size array instead of vector) as the vast majority of them are + unlikely to ever mutate during their lifetime. + + Sprinkled ASSERT(isMutable()) all over StylePropertySet to catch any attempts to modify + an immutable object. + + Also made properties() const on StyleRule and friends, which brought some additional code + churn along with it. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): + * css/CSSFontFaceRule.cpp: + (WebCore::CSSFontFaceRule::style): + (WebCore::CSSFontFaceRule::reattach): + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): + * css/CSSFontFaceSrcValue.h: + (CSSFontFaceSrcValue): + * css/CSSPageRule.cpp: + (WebCore::CSSPageRule::style): + (WebCore::CSSPageRule::reattach): + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): + * css/CSSPrimitiveValue.h: + (CSSPrimitiveValue): + * css/CSSReflectValue.cpp: + (WebCore::CSSReflectValue::addSubresourceStyleURLs): + * css/CSSReflectValue.h: + (CSSReflectValue): + * css/CSSStyleRule.cpp: + (WebCore::CSSStyleRule::style): + (WebCore::CSSStyleRule::reattach): + * css/CSSValue.cpp: + (WebCore::CSSValue::addSubresourceStyleURLs): + * css/CSSValue.h: + (CSSValue): + * css/CSSValueList.cpp: + (WebCore::CSSValueList::addSubresourceStyleURLs): + * css/CSSValueList.h: + (CSSValueList): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::setCSSParserMode): + (WebCore): + (WebCore::StylePropertySet::copyPropertiesFrom): + (WebCore::StylePropertySet::removeShorthandProperty): + (WebCore::StylePropertySet::removeProperty): + (WebCore::StylePropertySet::setProperty): + (WebCore::StylePropertySet::parseDeclaration): + (WebCore::StylePropertySet::addParsedProperties): + (WebCore::StylePropertySet::addParsedProperty): + (WebCore::StylePropertySet::merge): + (WebCore::StylePropertySet::addSubresourceStyleURLs): + (WebCore::StylePropertySet::removePropertiesInSet): + (WebCore::StylePropertySet::findPropertyWithId): + (WebCore::StylePropertySet::removeEquivalentProperties): + (WebCore::StylePropertySet::copyPropertiesInSet): + * css/StylePropertySet.h: + (WebCore::StylePropertySet::adopt): + (WebCore::StylePropertySet::adoptMutable): + (StylePropertySet): + (WebCore::StylePropertySet::isMutable): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::addMatchedProperties): + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/StyleResolver.h: + (StyleResolver): + * css/StyleRule.cpp: + (WebCore::StyleRule::mutableProperties): + (WebCore): + (WebCore::StyleRulePage::mutableProperties): + (WebCore::StyleRuleFontFace::mutableProperties): + * css/StyleRule.h: + (WebCore::StyleRule::properties): + (StyleRule): + (WebCore::StyleRuleFontFace::properties): + (StyleRuleFontFace): + (WebCore::StyleRulePage::properties): + (StyleRulePage): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::updateInlineStyleAvoidingMutation): + * editing/EditingStyle.cpp: + (WebCore::styleFromMatchedRulesForElement): + * svg/SVGFontFaceElement.cpp: + (WebCore::SVGFontFaceElement::parseAttribute): + (WebCore::SVGFontFaceElement::rebuildFontFace): + (WebCore::SVGFontFaceElement::removedFrom): + +2012-05-29 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL] Refactoring. Get rid of unnecessary singleCharacterString() function + https://bugs.webkit.org/show_bug.cgi?id=87654 + + Reviewed by Csaba Osztrogonác. + + Evas key events already provide key string, so no practical need for singleCharacterString() + evaluating the event string from keyname. + Modified code related functionality is already covered with fast/events and fast/forms tests. + + * platform/efl/EflKeyboardUtilities.cpp: + * platform/efl/PlatformKeyboardEventEfl.cpp: + (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): + +2012-05-29 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed: Web Inspector: single line fix after r118742. + + * inspector/front-end/HeapSnapshotView.js: + (WebInspector.HeapProfileHeader.prototype.saveToFile): + +2012-05-29 Kentaro Hara <haraken@chromium.org> + + Remove m_rootNode and m_selectorChecker from SelectorQuery.h + https://bugs.webkit.org/show_bug.cgi?id=87650 + + Reviewed by Antti Koivisto. + + To avoid parsing CSS selectors every time, I am planning to cache + SelectorQuery objects into a HashMap, which will be defined in + Node::querySelector(). To make the size of SelectorQuery small, + this patch removes m_rootNode and m_selectorChecker from SelectorQuery.h. + + Tests: fast/dom/SelectorAPI/*. No change in test results. + + * dom/Node.cpp: + (WebCore::Node::querySelector): + (WebCore::Node::querySelectorAll): + * dom/SelectorQuery.cpp: + (WebCore::SelectorQuery::SelectorQuery): + (WebCore): + (WebCore::SelectorQuery::queryAll): + (WebCore::SelectorQuery::queryFirst): + * dom/SelectorQuery.h: + (SelectorQuery): + +2012-05-29 Eugene Klyuchnikov <eustas.bug@gmail.com> + + Web Inspector: Tabbed Settings Screen + https://bugs.webkit.org/show_bug.cgi?id=87497 + + Reviewed by Yury Semikhatsky. + + Combine settings screen and shortcuts screen + to a single tabbed settings screen. + This will make shortcuts screen more discoverable. + + * inspector/front-end/HelpScreen.js: + (WebInspector.HelpScreen): Make titled tamplate optional. + (WebInspector.HelpScreen.prototype._createCloseButton): Extract method. + * inspector/front-end/SettingsScreen.js: + (WebInspector.SettingsScreen): Split initialization and UI construction. + (WebInspector.SettingsScreen.prototype._createSettingsTabView.appendSection): + (WebInspector.SettingsScreen.prototype._createSettingsTabView): + Extract GUI construction method. + (WebInspector.SettingsScreen.prototype._getOrCreateTabbedPane): + Make GUI construction lazy. + (WebInspector.SettingsScreen.prototype.selectTab): + Add method for external tab swithching. + (WebInspector.SettingsScreen.prototype.wasShown): + Make GUI construction lazy. + (WebInspector.SettingsScreenTabbedPane): + Extend class to access protected member. + (WebInspector.SettingsController.prototype._buttonClicked): + Change "showSettingsScreen" visibility and parameters. + (WebInspector.SettingsController.prototype._onHideSettingsScreen): + Preserve settings screen state. + (WebInspector.SettingsController.prototype.showSettingsScreen): + Change method visibility and parameters. + * inspector/front-end/ShortcutsScreen.js: + (WebInspector.ShortcutsScreen): Remove inheritance from HelpScreen. + (WebInspector.ShortcutsScreen.prototype._createShortcutsTabView): + Refactoring of GUI construction. + (WebInspector.ShortcutsSection.prototype.renderSection): + Ditto. + * inspector/front-end/helpScreen.css: + (.help-window-main ::-webkit-scrollbar): Rebind scrollbar settings. + (.help-window-main ::-webkit-resizer): Ditto. + (.help-window-main ::-webkit-scrollbar-thumb:vertical): Ditto. + (.help-window-main ::-webkit-scrollbar-thumb:vertical:active): Ditto. + (.help-window-main ::-webkit-scrollbar-track:vertical): Ditto. + (body:not(.compact) #settings-screen .tabbed-pane): Fix container height. + (#settings-screen .tabbed-pane-header): Ditto. + (#settings-screen .tabbed-pane-header-tabs): Adjust spacing. + (#settings-screen .tabbed-pane-header-tab): Adjust style. + (#settings-screen .help-close-button): Adjust spacing. + (#settings-screen .tabbed-pane-header-tab.selected): + Erase line below active tab. + (#settings-screen .tabbed-pane-content): Adjust spacing. + (#settings-screen .help-content): Ditto. + * inspector/front-end/inspector.js: + (WebInspector.documentKeyDown): Use Settings screen to show shortcuts. + +2012-05-29 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: REGRESSION: load heap snapshot doesn't work. + https://bugs.webkit.org/show_bug.cgi?id=87642 + + HeapSnapshotReceiver interface was introduced. + It declares the API for HeapSnapshotLoader, HeapSnapshotLoaderProxy and HeapSnapshotSaveToFileReceiver. + The HeapProfileHeader was refactored and tests were added. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshotLoader.js: + (WebInspector.HeapSnapshotLoader): + (WebInspector.HeapSnapshotLoader.prototype.startLoading): + (WebInspector.HeapSnapshotLoader.prototype.dispose): + (WebInspector.HeapSnapshotLoader.prototype._reset): + (WebInspector.HeapSnapshotLoader.prototype.finishLoading): + * inspector/front-end/HeapSnapshotProxy.js: + (WebInspector.HeapSnapshotWorker.prototype.startCheckingForLongRunningCalls): + (WebInspector.HeapSnapshotLoaderProxy.prototype.startLoading): + (WebInspector.HeapSnapshotLoaderProxy.prototype.pushJSONChunk): + (WebInspector.HeapSnapshotLoaderProxy.prototype.finishLoading): + * inspector/front-end/HeapSnapshotView.js: + (WebInspector.HeapSnapshotReceiver): + (WebInspector.HeapSnapshotReceiver.prototype.startLoading): + (WebInspector.HeapSnapshotReceiver.prototype.pushJSONChunk): + (WebInspector.HeapSnapshotReceiver.prototype.finishLoading): + (WebInspector.HeapSnapshotReceiver.prototype.dispose): + (WebInspector.HeapProfileHeader): + (WebInspector.HeapProfileHeader.prototype.load): + (WebInspector.HeapProfileHeader.prototype._setupWorker): + (WebInspector.HeapProfileHeader.prototype.dispose): + (WebInspector.HeapProfileHeader.prototype._saveStatusUpdate): + (WebInspector.HeapProfileHeader.prototype.pushJSONChunk): + (WebInspector.HeapProfileHeader.prototype._parsed): + (WebInspector.HeapProfileHeader.prototype.finishHeapSnapshot): + (WebInspector.HeapProfileHeader.prototype.saveToFile): + (WebInspector.HeapProfileHeader.prototype.loadFromFile.onLoad): + (WebInspector.HeapProfileHeader.prototype.loadFromFile): + (WebInspector.HeapProfileHeader.prototype._loadNextChunk): + (WebInspector.HeapProfileHeader.prototype._nextChunkLoaded): + (WebInspector.HeapProfileHeader.prototype._createFileReader): + (WebInspector.HeapSnapshotSaveToFileReceiver): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype.startLoading): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype.pushJSONChunk): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype.finishLoading): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype.dispose): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype._startSavingSnapshot): + (WebInspector.HeapSnapshotSaveToFileReceiver.prototype._saveStatusUpdate): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype._createFileSelectorElement.onChange): + (WebInspector.ProfilesPanel.prototype._createFileSelectorElement): + (WebInspector.ProfilesPanel.prototype._loadFromFile): + +2012-05-29 Eric Seidel <eric@webkit.org> + + Add HTMLIFrameElement.seamless property accessor now that seamless is enabled and works + https://bugs.webkit.org/show_bug.cgi?id=87708 + + Reviewed by Adam Barth. + + Lots of tests in fast/frames/seamless cover this property. + + * html/HTMLIFrameElement.idl: + +2012-05-29 Kentaro Hara <haraken@chromium.org> + + [Performance] Optimize querySelector() and querySelectorAll() by removing + redundant dummy style sheet creations + https://bugs.webkit.org/show_bug.cgi?id=87627 + + Reviewed by Antti Koivisto. + + This patch improves performance of querySelector("#id") by 4.2% ~ 17.7% + in Safari and Chromium. + + Performance tests: https://bugs.webkit.org/attachment.cgi?id=144288 + + The performance test results in my desktop: + + [Safari/Mac] + document.querySelector("#headId") : 13.60 ms => 12.40 ms +9.68% + document.querySelector("#duplicatedId") : 14.80 ms => 14.20 ms +4.23% + document.querySelector("#tailId") : 13.80 ms => 12.20 ms +13.11% + document.querySelectorAll("#headId") : 17.80 ms => 14.60 ms +21.92% + document.querySelectorAll("#duplicatedId") : 513.80 ms => 471.60 ms +8.95% + document.querySelectorAll("#tailId") : 19.20 ms => 16.40 ms +17.07% + document.querySelector("h1") : 14.40 ms => 13.60 ms +5.88% + document.querySelector("h2") : 14.80 ms => 13.80 ms +7.25% + document.querySelector("h3") : 312.00 ms => 306.60 ms +1.76% + document.querySelectorAll("h1") : 322.00 ms => 314.60 ms +2.35% + document.querySelectorAll("h2") : 481.00 ms => 420.60 ms +14.36% + document.querySelectorAll("h3") : 326.80 ms => 315.80 ms +3.48% + document.querySelector(".headClass") : 16.20 ms => 15.40 ms +5.19% + document.querySelector(".duplicatedClass") : 17.00 ms => 15.40 ms +10.39% + document.querySelector(".tailClass") : 369.60 ms => 362.60 ms +1.93% + document.querySelectorAll(".headClass") : 388.20 ms => 377.60 ms +2.81% + document.querySelectorAll(".duplicatedClass") : 605.00 ms => 581.20 ms +4.09% + document.querySelectorAll(".tailClass") : 401.60 ms => 391.40 ms +2.61% + + [Chromium/Linux] + ocument.querySelector("#headId") : 16.00 ms => 13.60 ms +17.65% + document.querySelector("#duplicatedId") : 16.80 ms => 15.40 ms +9.09% + document.querySelector("#tailId") : 16.00 ms => 13.60 ms +17.65% + document.querySelectorAll("#headId") : 29.00 ms => 25.00 ms +16.00% + document.querySelectorAll("#duplicatedId") : 561.40 ms => 505.20 ms +11.12% + document.querySelectorAll("#tailId") : 34.00 ms => 26.80 ms +26.87% + document.querySelector("h1") : 18.20 ms => 15.80 ms +15.19% + document.querySelector("h2") : 19.00 ms => 16.60 ms +14.46% + document.querySelector("h3") : 280.40 ms => 274.00 ms +2.34% + document.querySelectorAll("h1") : 300.20 ms => 365.20 ms -17.80% + document.querySelectorAll("h2") : 487.60 ms => 504.20 ms -3.29% + document.querySelectorAll("h3") : 349.40 ms => 324.00 ms +7.84% + document.querySelector(".headClass") : 18.40 ms => 16.00 ms +15.00% + document.querySelector(".duplicatedClass") : 19.40 ms => 16.20 ms +19.75% + document.querySelector(".tailClass") : 349.60 ms => 345.40 ms +1.22% + document.querySelectorAll(".headClass") : 382.80 ms => 378.20 ms +1.22% + document.querySelectorAll(".duplicatedClass") : 550.80 ms => 574.20 ms -4.08% + document.querySelectorAll(".tailClass") : 381.00 ms => 387.00 ms -1.55% + + I've found that StyleSheetInternal::create() in CSSParser::parseSelector() + is a bottleneck of querySelector() and querySelectorAll(). + + void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorList) + { + RefPtr<StyleSheetInternal> dummyStyleSheet = StyleSheetInternal::create(); + setStyleSheet(dummyStyleSheet.get()); + ...; + } + + This patch removes a dummy style sheet. Previously the dummy style sheet + was needed to avoid null checks of m_styleSheet in CSSGrammer.y. + This patch fixes CSSGrammer.y so that it works fine with a null m_styleSheet. + + Tests: fast/dom/SelectorAPI/*. No change in the test results. + + * css/CSSGrammar.y: + * css/CSSParser.cpp: + (WebCore::CSSParser::parseSelector): + +2012-05-29 Nikolas Zimmermann <nzimmermann@rim.com> + + SVGViewSpec DOM bindings aka SVGSVGElement.currentView is unimplemented + https://bugs.webkit.org/show_bug.cgi?id=15495 + + Reviewed by Rob Buis. + + Finish SVGViewSpec implementation and expose it to the Web. Numerous smaller bugs are fixed: + - SVGViewSpec and all of its contents should be read-only. Enforce that and test it. + Add a new enum to SVGPropertyInfo so that each SVGAnimatedProperty knows if its content is supposed to be read-write or read-only. + - Make the 'transform' attribute of SVGViewSpec exposable by switching to a SVGTransformListProperty - it can now be accessed from JS. + - Assure that following XXXString methods are in sync with the corresponding SVG DOM interfaces + readonly attribute DOMString viewBoxString; + readonly attribute DOMString preserveAspectRatioString; + readonly attribute DOMString transformString; + readonly attribute DOMString viewTargetString; + - Cleanup code in svg/properties that was intended to handle SVGViewSpec. Turns out lot of the complexity was unncessary, and can be removed. + - Move SVGFitToViewBox to the same pattern SVGZoomAndPan uses since two days, that avoids any virtual function calls for attribute parsing. + - Create/expose ObjectiveC/JS bindings for SVGViewSpec. + - Enable SVGViewSpec constructor. + + Tests: svg/custom/linking-a-03-b-all-expected.svg + svg/dom/SVGViewSpec-defaults.html + svg/dom/SVGViewSpec.html + svg/dom/complex-svgView-specification.html + svg/dom/viewspec-parser.html + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSSVGLengthCustom.cpp: + (WebCore::JSSVGLength::setValue): + (WebCore::JSSVGLength::convertToSpecifiedUnits): + * bindings/objc/DOMSVG.h: + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorObjC.pm: + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + (GenerateFunctionCallback): + * bindings/v8/custom/V8SVGLengthCustom.cpp: + (WebCore::V8SVGLength::valueAccessorSetter): + (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback): + * page/DOMWindow.idl: + * rendering/svg/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::buildTileImageTransform): + * svg/SVGFitToViewBox.cpp: + * svg/SVGFitToViewBox.h: + (SVGFitToViewBox): + (WebCore::SVGFitToViewBox::parseAttribute): + * svg/SVGMarkerElement.cpp: + (WebCore::SVGMarkerElement::orientTypePropertyInfo): + (WebCore::SVGMarkerElement::parseAttribute): + (WebCore::SVGMarkerElement::synchronizeOrientType): + (WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper): + * svg/SVGPathElement.cpp: + (WebCore::SVGPathElement::dPropertyInfo): + (WebCore::SVGPathElement::svgAttributeChanged): + (WebCore::SVGPathElement::pathByteStream): + (WebCore::SVGPathElement::lookupOrCreateDWrapper): + (WebCore::SVGPathElement::synchronizeD): + * svg/SVGPathSegWithContext.h: + (WebCore::SVGPathSegWithContext::animatedProperty): + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::parseAttribute): + * svg/SVGPolyElement.cpp: + (WebCore::SVGPolyElement::pointsPropertyInfo): + (WebCore::SVGPolyElement::parseAttribute): + (WebCore::SVGPolyElement::synchronizePoints): + (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): + * svg/SVGRect.h: + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::~SVGSVGElement): + (WebCore::SVGSVGElement::currentView): + (WebCore::SVGSVGElement::parseAttribute): + (WebCore::SVGSVGElement::currentViewBoxRect): + (WebCore::SVGSVGElement::viewBoxToViewTransform): + (WebCore::SVGSVGElement::setupInitialView): + (WebCore::SVGSVGElement::inheritViewAttributes): + * svg/SVGSVGElement.h: + (SVGSVGElement): + * svg/SVGSVGElement.idl: + * svg/SVGSymbolElement.cpp: + (WebCore::SVGSymbolElement::parseAttribute): + * svg/SVGTests.cpp: + (WebCore::SVGTests::requiredFeaturesPropertyInfo): + (WebCore::SVGTests::requiredExtensionsPropertyInfo): + (WebCore::SVGTests::systemLanguagePropertyInfo): + (WebCore::SVGTests::synchronizeRequiredFeatures): + (WebCore::SVGTests::synchronizeRequiredExtensions): + (WebCore::SVGTests::synchronizeSystemLanguage): + * svg/SVGTextContentElement.cpp: + (WebCore::SVGTextContentElement::textLengthPropertyInfo): + (WebCore::SVGTextContentElement::synchronizeTextLength): + (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): + * svg/SVGViewElement.cpp: + (WebCore::SVGViewElement::parseAttribute): + * svg/SVGViewElement.h: + * svg/SVGViewSpec.cpp: + (WebCore::SVGViewSpec::viewBoxPropertyInfo): + (WebCore::SVGViewSpec::preserveAspectRatioPropertyInfo): + (WebCore::SVGViewSpec::transformPropertyInfo): + (WebCore::SVGViewSpec::SVGViewSpec): + (WebCore::SVGViewSpec::viewBoxIdentifier): + (WebCore::SVGViewSpec::preserveAspectRatioIdentifier): + (WebCore::SVGViewSpec::transformIdentifier): + (WebCore::SVGViewSpec::setZoomAndPan): + (WebCore::SVGViewSpec::setTransformString): + (WebCore::SVGViewSpec::transformString): + (WebCore::SVGViewSpec::viewBoxString): + (WebCore::SVGViewSpec::preserveAspectRatioString): + (WebCore::SVGViewSpec::viewTarget): + (WebCore::SVGViewSpec::transform): + (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): + (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper): + (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): + (WebCore::SVGViewSpec::reset): + (WebCore::SVGViewSpec::parseViewSpec): + * svg/SVGViewSpec.h: + (WebCore::SVGViewSpec::~SVGViewSpec): + (SVGViewSpec): + (WebCore::SVGViewSpec::create): + (WebCore::SVGViewSpec::setViewTargetString): + (WebCore::SVGViewSpec::setZoomAndPan): + (WebCore::SVGViewSpec::contextElement): + (WebCore::SVGViewSpec::resetContextElement): + (WebCore::SVGViewSpec::transformBaseValue): + (WebCore::SVGViewSpec::viewBoxAnimated): + (WebCore::SVGViewSpec::viewBox): + (WebCore::SVGViewSpec::viewBoxBaseValue): + (WebCore::SVGViewSpec::setViewBoxBaseValue): + (WebCore::SVGViewSpec::preserveAspectRatioAnimated): + (WebCore::SVGViewSpec::preserveAspectRatio): + (WebCore::SVGViewSpec::preserveAspectRatioBaseValue): + (WebCore::SVGViewSpec::setPreserveAspectRatioBaseValue): + * svg/SVGViewSpec.idl: + * svg/properties/SVGAnimatedProperty.h: + (WebCore::SVGAnimatedProperty::isReadOnly): + (WebCore::SVGAnimatedProperty::setIsReadOnly): + (SVGAnimatedProperty): + (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper): + (WebCore::SVGAnimatedProperty::lookupWrapper): + (WebCore::SVGAnimatedProperty::SVGAnimatedProperty): + * svg/properties/SVGAnimatedPropertyMacros.h: + (WebCore::SVGSynchronizableAnimatedProperty::synchronize): + (SVGSynchronizableAnimatedProperty): + * svg/properties/SVGAnimatedPropertySynchronizer.h: Removed. + * svg/properties/SVGAttributeToPropertyMap.h: + * svg/properties/SVGListProperty.h: + * svg/properties/SVGListPropertyTearOff.h: + (SVGListPropertyTearOff): + (WebCore::SVGListPropertyTearOff::isReadOnly): + * svg/properties/SVGPathSegListPropertyTearOff.h: + (SVGPathSegListPropertyTearOff): + (WebCore::SVGPathSegListPropertyTearOff::isReadOnly): + * svg/properties/SVGProperty.h: + (SVGProperty): + * svg/properties/SVGPropertyInfo.h: + (WebCore::SVGPropertyInfo::SVGPropertyInfo): + (SVGPropertyInfo): + * svg/properties/SVGPropertyTearOff.h: + (WebCore::SVGPropertyTearOff::isReadOnly): + * svg/properties/SVGStaticListPropertyTearOff.h: + (SVGStaticListPropertyTearOff): + (WebCore::SVGStaticListPropertyTearOff::isReadOnly): + +2012-05-29 Kent Tamura <tkent@chromium.org> + + REGRESSION (r90971): the cursor is painted “behind” the placeholder text + https://bugs.webkit.org/show_bug.cgi?id=87155 + + Reviewed by Hajime Morita. + + This regression happened only on platforms on which + RenderTheme::shouldShowPlaceholderWhenFocused() returns true. + + Because the order of renderers for the editable node and the placeholder + node was: + - A renderer for the editable node + - A renderer for the placeholder node, + The text caret was painted, then the palceholder was painted. + + We should not use z-index in the built-in shadow nodes. So the patch + fixes this bug by re-ordering these renderers. + + Tests: fast/forms/input-placeholder-paint-order-2.html + fast/forms/input-placeholder-paint-order.html + fast/forms/textarea/textarea-placeholder-paint-order-2.html + fast/forms/textarea/textarea-placeholder-paint-order.html + + * html/HTMLTextFormControlElement.cpp: + (WebCore::HTMLTextFormControlElement::fixPlaceholderRenderer): + Added. Reorder the order of renderers so that the placeholder renderer + precedes the inner text renderer. + * html/HTMLTextFormControlElement.h: Add fixPlaceholderRenderer() declaration. + + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::attach): Calls fixPlaceholderRenderer(). + (WebCore::HTMLTextAreaElement::updatePlaceholderText): + ditto. Also, use innerTextElement() to improvde code readability. + * html/HTMLTextAreaElement.h: + (HTMLTextAreaElement): Overrides attach(). + + * html/TextFieldInputType.cpp: + (WebCore::TextFieldInputType::updatePlaceholderText): + Calls fixPlaceholderRenderer(). + (WebCore::TextFieldInputType::attach): ditto. + * html/TextFieldInputType.h: + (TextFieldInputType): Overrides attach(). + +2012-05-28 Kentaro Hara <haraken@chromium.org> + + [V8] Implement V8Binding::v8Null(isolate) and use it in CodeGeneratorV8.pm + https://bugs.webkit.org/show_bug.cgi?id=87692 + + Reviewed by Adam Barth. + + Since v8::Null(isolate) crashes if we pass a NULL isolate, we are planning + to pass Isolate to v8::Null() in the following steps: + + [1] Implement V8Bindings::v8Null(isolate). v8Null(isolate) does the NULL check. + If isolate is NULL, v8Null(isolate) calls v8::Null(). Otherwise, + v8Null(isolate) calls v8::Null(isolate). + + [2] In V8 bindings, we replace v8::Null() with v8::Null(isolate) for a non-optional + 'isolate' parameter. (e.g. void foo(..., Isolate* isolate) { v8::Null(); } ) + + [3] In V8 bindings, we replace v8::Null() with v8Null(isolate) for an optional + 'isolate' parameter. (e.g. void foo(..., Isolate* isolate = 0) { v8::Null(); } ) + + This bug fixes [1] by implementing V8Binding::v8Null(isolate). Also this patch uses + V8Binding::v8Null(isolate) in bindings/v8/*.{h,cpp}. + + No tests. No behavior change. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeader): + (NativeToJSValue): + * bindings/scripts/test/V8/V8Float64Array.h: + * bindings/scripts/test/V8/V8TestActiveDOMObject.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestEventConstructor.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestEventTarget.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestException.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestInterface.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestMediaQueryListListener.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestNamedConstructor.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestNode.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestObj.h: + (WebCore::toV8): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + (WebCore::TestSerializedScriptValueInterfaceV8Internal::valueAttrGetter): + (WebCore::TestSerializedScriptValueInterfaceV8Internal::readonlyValueAttrGetter): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h: + (WebCore::toV8): + * bindings/v8/V8Binding.h: + (WebCore::v8Null): + (WebCore): + (WebCore::v8DateOrNull): + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8DOMWrapper.h: + (WebCore): + +2012-05-28 Kent Tamura <tkent@chromium.org> + + Fix a crash in HTMLFormControlElement::disabled(). + https://bugs.webkit.org/show_bug.cgi?id=86534 + + Reviewed by Ryosuke Niwa. + + Stop to hold pointers of fildset and legend elements. We can avoid it by + holding ancestor's disabled state. + + The ancesotr's disabled state should be invalidated when + - fieldset's disabled value is changed. + - fieldset's children is updated because a legend position might be changed. + - A form control is attached to or detached from a tree. + + No new tests. It's almost impossible to make a reliable test. + + * html/HTMLFieldSetElement.cpp: + (WebCore::HTMLFieldSetElement::invalidateDisabledStateUnder): + Added. Invalidate disabled state of form controls under the specified node. + (WebCore::HTMLFieldSetElement::disabledAttributeChanged): + Uses invalidateDisabledStateUnder(). + (WebCore::HTMLFieldSetElement::childrenChanged): + Added new override function. We need invalidate disabled state of form + controls under legend elements. + + * html/HTMLFieldSetElement.h: + (HTMLFieldSetElement): Add invalidateDisabledStateUnder() and childrenChanged(). + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::HTMLFormControlElement): + Remove initialization of the removed data members. + Initialize m_ancestorDisabledState. + (WebCore::HTMLFormControlElement::updateAncestorDisabledState): + Update m_ancestorDisabledState. It should be + AncestorDisabledStateDisabled if the control is under a disabled + fieldset and not under the first legend child of the disabled filedset. + (WebCore::HTMLFormControlElement::ancestorDisabledStateWasChanged): + Invalidate m_ancestorDisabledState. + (WebCore::HTMLFormControlElement::insertedInto): ditto. + (WebCore::HTMLFormControlElement::removedFrom): ditto. + (WebCore::HTMLFormControlElement::disabled): + Calls updateAncestorDisabledState() if needed. + (WebCore::HTMLFormControlElement::recalcWillValidate): + Remove unnecessary check for m_legendAncestor. + + * html/HTMLFormControlElement.h: + (HTMLFormControlElement): + - Rename updateFieldSetAndLegendAncestor() to updateAncestorDisabledState(), and make it private. + - Remove m_fieldSetAncestor, m_legendAncestor, and m_fieldSetAncestorValid. + - Add m_ancestorDisabledState. + +2012-05-28 Takashi Toyoshima <toyoshim@chromium.org> + + [WebSocket] Receiving reserved close codes, 1005, 1006, and 1015 must appear as code=1006 and wasClean=false + https://bugs.webkit.org/show_bug.cgi?id=87084 + + Reviewed by Kent Tamura. + + Status codes 1005, 1006, and 1015 are forbidden to be sent in actual close frames. + If a client received these frames, the client should handle them as broken. + Close frames containing invalid body size are the same as these forbidden cases. + Update close-code-and-reason tests to verify this patch. + + * Modules/websockets/WebSocket.cpp: Handle AbnormalClosure as wasClean == false + (WebCore::WebSocket::didClose): + * Modules/websockets/WebSocketChannel.cpp: Handle close frames' status code carefully + (WebCore::WebSocketChannel::processFrame): + * Modules/websockets/WebSocketChannel.h: Update on newly defined close event codes + +2012-05-28 Kentaro Hara <haraken@chromium.org> + + [V8] Avoid passing NULL to an 'isolate' parameter + https://bugs.webkit.org/show_bug.cgi?id=87689 + + Reviewed by Adam Barth. + + v8::Null(isolate) crashes if we pass a NULL isolate. + Thus we are planning to replace v8::Null()s in a following way: + + - Implement V8Bindings::v8Null(isolate). v8Null(isolate) does the NULL check. + If isolate is NULL, v8Null(isolate) calls v8::Null(). Otherwise, + v8Null(isolate) calls v8::Null(isolate). + + - In V8 bindings, we replace v8::Null() with v8::Null(isolate) for a + non-optional 'isolate' parameter. + (e.g. void foo(..., Isolate* isolate) { v8::Null(); } ) + + - In V8 bindings, we replace v8::Null() with v8Null(isolate) for an + optional 'isolate' parameter. + (e.g. void foo(..., Isolate* isolate = 0) { v8::Null(); } ) + + However, currently we cannot do the replacement mechanically, since some code + pass NULL to a non-optional 'isolate' parameter. In other words, currently + "non-optional" does not guarantee that 'isolate' is not NULL. + + This patch removes all the code that passes NULL to a non-optional 'isolate' + parameter. This will enable us to achieve the replacement mechanically. + + No tests. No behavior change. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateCallbackImplementation): + (NativeToJSValue): + * bindings/scripts/test/V8/V8TestCallback.cpp: + (WebCore::V8TestCallback::callbackWithClass1Param): + (WebCore::V8TestCallback::callbackWithClass2Param): + (WebCore::V8TestCallback::callbackWithStringList): + (WebCore::V8TestCallback::callbackRequiresThisToPass): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::V8TestObj::installPerContextProperties): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8SQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8MutationCallbackCustom.cpp: + (WebCore::V8MutationCallback::handleEvent): + +2012-05-28 Kent Tamura <tkent@chromium.org> + + Form controls in <fieldset disabled> should not be validated. + https://bugs.webkit.org/show_bug.cgi?id=87381 + + Reviewed by Hajime Morita. + + We need to use disabeld() instead of m_disabled to calculate + willValidate property. Also, we need to update willValidate if + necessary. + + Test: fast/forms/fieldset/validation-in-fieldset.html + + * html/HTMLFieldSetElement.cpp: + (WebCore::HTMLFieldSetElement::disabledAttributeChanged): + - Do not traverse this. + - Calls ancestorDisabledStateWasChanged() instead of + setNeedsStyleRecalc() because we'd like to do additional tasks. + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::ancestorDisabledStateWasChanged): + Added. Just calls disabledAttributeChanged(). + (WebCore::HTMLFormControlElement::parseAttribute): + Do not call setNeedsWillValidateCheck() whenever an attribute is updated. + It should be called only if disabled or readonly attribute is updated. + (WebCore::HTMLFormControlElement::disabledAttributeChanged): + Add setNeedsWillValidateCheck(). It was moved from parseAttribute(). + (WebCore::HTMLFormControlElement::insertedInto): + Invalidate ancestor information. + (WebCore::HTMLFormControlElement::recalcWillValidate): + Use disabled() instead of m_disabled. disabled() takes care of + ancestor's disabled state. + * html/HTMLFormControlElement.h: + (HTMLFormControlElement): + +2012-05-28 Rakesh KN <rakesh.kn@motorola.com> + + [Forms] HTMLFieldSetElement.idl doesn't have elements attribute. + https://bugs.webkit.org/show_bug.cgi?id=80110 + + Reviewed by Kent Tamura. + + Implemented elements attribute for HTMLFieldSetElement. This is spec'ed at + http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-fieldset-elements + + Tests: fast/forms/fieldset/fieldset-elements.html + fast/forms/fieldset/fieldset-form-collection-radionode-list.html + + * dom/Node.cpp: + (WebCore::Node::radioNodeList): + Extended ASSERT to assert if not HTMLFieldSetElement or HTMLFormElement. + * html/HTMLFieldSetElement.cpp: + (WebCore::HTMLFieldSetElement::elements): + Elements attribute implementation. + (WebCore::HTMLFieldSetElement::refreshElementsIfNeeded): + Update the formcontrol elements collections if dom tree got modified. + (WebCore::HTMLFieldSetElement::associatedElements): + FormControl elements collection accessor. + (WebCore::HTMLFieldSetElement::length): + Number of elements in the fieldset group. + * html/HTMLFieldSetElement.h: + Added elements collection member and form control collection members. + * html/HTMLFieldSetElement.idl: + Added elements attribute. + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::formControlElements): + Added support for HTMLFieldSetElement, based on base element type gets its associated elements. + (WebCore::HTMLFormCollection::numberOfFormControlElements): Ditto + (WebCore::HTMLFormCollection::getNamedFormItem): Process image elements only for form element. + (WebCore::HTMLFormCollection::updateNameCache): Ditto + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): + DynamicSubTree root element is decided based on the type whether base element is form or fieldset element. + Renamed m_formElement to m_baseElement. + (WebCore::RadioNodeList::~RadioNodeList): + Renamed m_formElement to m_baseElement. + (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter): + Form element specific changes moved under form element check. + * html/RadioNodeList.h: + (WebCore::RadioNodeList::create): + (RadioNodeList): + Renamed m_formElement to m_baseElement. + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail + https://bugs.webkit.org/show_bug.cgi?id=80135 + + Reviewed by Rob Buis. + + RIM PR: 145660 + Fixed a regression introduced by r111810, we should cancel the new + request when user press cancel button in http authentication challenge + dialog, and we should also allow sending empty username and password + with the request. + Also removed redundant codes which checked the existence of the + FrameLoaderClient pointer, as we've already moved authenticationChallenge() + out of class FrameLoaderClient, it is not needed. + + Manual test added. Testing http authentication dialog relies on user interaction. + + Resubmit the patch reverted by r115104 after the digest infinite loop + issue for BlackBerry porting get identified and fixed. + + Internally reviewed by Joe Mason <jmason@rim.com> + + * platform/blackberry/PageClientBlackBerry.h: + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::sendRequestWithCredentials): + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authentication challenge issue when loading favicon + https://bugs.webkit.org/show_bug.cgi?id=87665 + + Reviewed by Rob Buis. + + Provide the TargetType when generating a favicon loading + request. Loading favicons is triggered after the main resource + has been loaded and parsed, so if we cancel the authentication + challenge when loading main resource, we should also cancel + loading the favicon when it starts to load. If not we will + receive another challenge after we canceled the main resource + loading, which may confuse the user. + + Internally reviewed by Joe Mason <jmason@rim.com> + + No new tests because of no behavior changes. + + * loader/icon/IconLoader.cpp: + (WebCore::IconLoader::startLoading): + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::sendRequestWithCredentials): + +2012-05-28 MORITA Hajime <morrita@google.com> + + Rename FrameLoaderClient::shadowDOMAllowed() to allowShadowDOM() + https://bugs.webkit.org/show_bug.cgi?id=87101 + + Reviewed by Kentaro Hara. + + No new tests. No behavior change. + + * bindings/generic/ContextEnabledFeatures.cpp: + (WebCore::ContextEnabledFeatures::shadowDOMEnabled): + * loader/FrameLoaderClient.h: + (WebCore::FrameLoaderClient::allowShadowDOM): + +2012-05-28 David Barton <dbarton@mathscribe.com> + + mathml/presentation/mo-stretch.html and mroot-pref-width.html tests fail on Mac + https://bugs.webkit.org/show_bug.cgi?id=86786 + + Reviewed by Darin Adler. + + The fix to https://bugs.webkit.org/show_bug.cgi?id=84167 changed inline-table baselines, + including for <mtable>. We therefore have to correct <mtable>'s vertical-align CSS + property. + + Tested by existing tests mo-stretch.html, row-alignment.xhtml, and tables.xhtml. + + * css/mathml.css: + (mtable): + +2012-05-28 Luke Macpherson <macpherson@chromium.org> + + Make CSSParser::filteredProperties() O(n) instead of O(n^2) and improve readability. + https://bugs.webkit.org/show_bug.cgi?id=87078 + + Reviewed by Darin Adler. + + This patch implements a number of improvements to filteredProperties: + 1) Make the code more linearly readable by separating out handling of important and non-important properties. + 2) Eliminate one BitArray instance (reduces hot memory so more cache friendly). + 3) Remove O(n^2) behavior caused by scanning for and removing previously encountered definitions of each property. + The key algorithmic change is to add properties in decreasing precedence: + a) Iterating once per (important, !important) so that important properties are visited first. + b) Reverse iteration of m_parsedProperties visits the properties in decreasing precedence. + + Covered by loads of existing tests - getting CSS property precedence wrong results in too many errors to list. + In particular fast/css contains test cases for important corner cases like duplicated important properties. + + * css/CSSParser.cpp: + (WebCore::CSSParser::createStylePropertySet): + * css/CSSProperty.h: + Add vector traits so that CSSProperty can just be memset by vector without calling constructor. + +2012-05-28 MORITA Hajime <morrita@google.com> + + Can't edit <input> elements with :first-letter + https://bugs.webkit.org/show_bug.cgi?id=87615 + + Reviewed by Kent Tamura. + + A check using canHaveGeneratedChildren() should cover not only + button and menulist, but also RenderTextControl. + This change pulles canHaveGeneratedChildren() up + from RenderDeprecatedFlexibleBox to RenderObject, + and lets RenderTextControl override it. + + Test: fast/forms/input-first-letter-edit.html + + * rendering/RenderBlock.cpp: + (WebCore): + (WebCore::RenderBlock::styleDidChange): + (WebCore::RenderBlock::updateFirstLetter): + * rendering/RenderBlock.h: Removed a static function canHaveGeneratedChildren() + (RenderBlock): + * rendering/RenderDeprecatedFlexibleBox.h: + * rendering/RenderObject.cpp: + (WebCore): + (WebCore::RenderObject::canHaveGeneratedChildren): Added. + * rendering/RenderObject.h: + (RenderObject): + * rendering/RenderTextControl.h: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add support for layers with scale invariant size + https://bugs.webkit.org/show_bug.cgi?id=87601 + + Reviewed by Rob Buis. + + To support layers that have a "floating" appearance, i.e. don't change size + when the web page is drawn at a different scale, we add a new layer property + named "sizeIsScaleInvariant". + + The anchor position will still be given in document coordinates for these + "floating" layers, so this is well suited for interface elements like selection + handles whose size is always the same but move with the web page contents. + + PR #156812 + + * platform/graphics/blackberry/LayerCompositingThread.cpp: + (WebCore::LayerCompositingThread::setDrawTransform): + (WebCore::LayerCompositingThread::drawTextures): + (WebCore::LayerCompositingThread::drawMissingTextures): + * platform/graphics/blackberry/LayerCompositingThread.h: + (LayerCompositingThread): + * platform/graphics/blackberry/LayerCompositingThreadClient.h: + (LayerCompositingThreadClient): + (WebCore::LayerCompositingThreadClient::drawMissingTextures): + * platform/graphics/blackberry/LayerData.h: + (WebCore::LayerData::LayerData): + (WebCore::LayerData::sizeIsScaleInvariant): + (LayerData): + * platform/graphics/blackberry/LayerRenderer.cpp: + (WebCore::LayerRenderer::LayerRenderer): + (WebCore::LayerRenderer::compositeLayers): + (WebCore::LayerRenderer::updateLayersRecursive): + (WebCore::LayerRenderer::compositeLayersRecursive): + * platform/graphics/blackberry/LayerRenderer.h: + (LayerRenderer): + * platform/graphics/blackberry/LayerTiler.cpp: + (WebCore::LayerTiler::updateTextureContentsIfNeeded): + (WebCore::LayerTiler::drawTextures): + (WebCore::LayerTiler::drawMissingTextures): + (WebCore::LayerTiler::drawTexturesInternal): + * platform/graphics/blackberry/LayerTiler.h: + (LayerTiler): + * platform/graphics/blackberry/LayerWebKitThread.h: + (WebCore::LayerWebKitThread::setSizeIsScaleInvariant): + (LayerWebKitThread): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Make it possible to manipulate layers on the compositing thread + https://bugs.webkit.org/show_bug.cgi?id=87602 + + Reviewed by Rob Buis. + + Normally, layers are manipulated on the WebKit thread, and the changes are + synced to the compositing thread during the next accelerated compositing commit + operation. + + However, for overlay layers the ability to manipulate layers on the compositing + thread is necessary for adequate user interface responsiveness. + + Two mechanisms are added: + 1. For a layer with a WebKit-thread counterpart, you can temporarily override + attributes or add animations whose output override attributes. + 2. For a layer with no WebKit-thread counterpart, you can now directly set the + compositing thread values for attributes. If you attempt to do this for layers + that do have a WebKit-thread counterpart, the compositing thread values will + be overwritten at the time of the next commit, which makes the override + mechanism more useful there. + + PR #156812 + + * platform/graphics/blackberry/LayerCompositingThread.cpp: + (WebCore::LayerCompositingThread::addSublayer): + (WebCore): + (WebCore::LayerCompositingThread::updateAnimations): + (WebCore::LayerCompositingThread::removeAnimation): + (WebCore::LayerCompositingThread::override): + (WebCore::LayerCompositingThread::clearOverride): + * platform/graphics/blackberry/LayerCompositingThread.h: + (LayerOverride): + (WebCore::LayerOverride::create): + (WebCore::LayerOverride::setPosition): + (WebCore::LayerOverride::setAnchorPoint): + (WebCore::LayerOverride::setBounds): + (WebCore::LayerOverride::setTransform): + (WebCore::LayerOverride::setOpacity): + (WebCore::LayerOverride::addAnimation): + (WebCore::LayerOverride::LayerOverride): + (WebCore): + (LayerCompositingThread): + (WebCore::LayerCompositingThread::setPosition): + (WebCore::LayerCompositingThread::setAnchorPoint): + (WebCore::LayerCompositingThread::setBounds): + (WebCore::LayerCompositingThread::setSizeIsScaleInvariant): + (WebCore::LayerCompositingThread::setTransform): + (WebCore::LayerCompositingThread::setOpacity): + (WebCore::LayerCompositingThread::setNeedsTexture): + * platform/graphics/blackberry/LayerWebKitThread.cpp: + (WebCore::LayerWebKitThread::LayerWebKitThread): + (WebCore::LayerWebKitThread::commitOnCompositingThread): + * platform/graphics/blackberry/LayerWebKitThread.h: + (LayerWebKitThread): + (WebCore::LayerWebKitThread::clearOverride): + +2012-05-28 Rob Flack <flackr@chromium.org> + + [chromium] Only increase size of Combo Box Options when displayed on touch screen + https://bugs.webkit.org/show_bug.cgi?id=85921 + + Reviewed by Adam Barth. + + Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. + + No new tests as this is a flag change and covered by existing tests: WebKit/chromium/tests/PopupMenuTest.cpp + + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (WebCore::Settings::setDeviceSupportsTouch): + (WebCore::Settings::deviceSupportsTouch): + (Settings): + * platform/chromium/PopupListBox.cpp: + (WebCore::PopupListBox::getRowHeight): + * platform/chromium/PopupListBox.h: + (PopupContainerSettings): + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::show): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Make custom compositing thread layers more flexible + https://bugs.webkit.org/show_bug.cgi?id=87600 + + Reviewed by Rob Buis. + + Introduce a LayerCompositingThreadClient that's used to fine tune the + behaviour of custom layers. Let the LayerTiler be a + LayerCompositingThreadClient and thus decouple it from + LayerCompositingThread. Adjust method signatures to allow a one-to-many + relationship between Client and Layer. + + Remove the old LayerCompositingThread::drawCustom() in favour of this new + Client interface. + + PR #156812 + + * platform/graphics/blackberry/LayerCompositingThread.cpp: + (WebCore::LayerCompositingThread::create): + (WebCore::LayerCompositingThread::LayerCompositingThread): + (WebCore::LayerCompositingThread::~LayerCompositingThread): + (WebCore::LayerCompositingThread::deleteTextures): + (WebCore::LayerCompositingThread::drawTextures): + (WebCore::LayerCompositingThread::hasMissingTextures): + (WebCore::LayerCompositingThread::drawMissingTextures): + (WebCore::LayerCompositingThread::updateTextureContentsIfNeeded): + (WebCore::LayerCompositingThread::bindContentsTexture): + (WebCore::LayerCompositingThread::setVisible): + (WebCore::LayerCompositingThread::scheduleCommit): + * platform/graphics/blackberry/LayerCompositingThread.h: + (WebCore): + (LayerCompositingThread): + * platform/graphics/blackberry/LayerCompositingThreadClient.h: Added. + (WebCore): + (LayerCompositingThreadClient): + (WebCore::LayerCompositingThreadClient::~LayerCompositingThreadClient): + (WebCore::LayerCompositingThreadClient::bindContentsTexture): + (WebCore::LayerCompositingThreadClient::hasMissingTextures): + (WebCore::LayerCompositingThreadClient::drawMissingTextures): + (WebCore::LayerCompositingThreadClient::scheduleCommit): + * platform/graphics/blackberry/LayerRenderer.cpp: + (WebCore::LayerRenderer::drawDebugBorder): + * platform/graphics/blackberry/LayerTiler.cpp: + (WebCore::LayerTiler::LayerTiler): + (WebCore::LayerTiler::layerCompositingThreadDestroyed): + (WebCore::LayerTiler::layerVisibilityChanged): + (WebCore::LayerTiler::uploadTexturesIfNeeded): + (WebCore::LayerTiler::deleteTextures): + (WebCore::LayerTiler::scheduleCommit): + (WebCore): + (WebCore::LayerTiler::bindContentsTexture): + * platform/graphics/blackberry/LayerTiler.h: + (LayerTiler): + (WebCore::LayerTiler::hasMissingTextures): + * platform/graphics/blackberry/LayerWebKitThread.cpp: + (WebCore::LayerWebKitThread::LayerWebKitThread): + * platform/graphics/blackberry/LayerWebKitThread.h: + (LayerWebKitThread): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Add setJavaScriptProfilingEnabled() to window.internals.settings. No new tests, but this + change will allow more tests to run in WebKitTestRunner and DRT for ports that weren't + implementing this function before. + This patch also refactors InspectorController::enableProfiler() and + InspectorController::disableProfiler() to InspectorController::setProfilerEnabled(bool). + + * WebCore.exp.in: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::profilerEnabled): + (WebCore::InspectorController::setProfilerEnabled): + * inspector/InspectorController.h: + (InspectorController): + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::restoreTo): + (WebCore::InternalSettings::setJavaScriptProfilingEnabled): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + +2012-05-28 Yong Li <yoli@rim.com> + + Crash on incomplete :not(). + https://bugs.webkit.org/show_bug.cgi?id=86673 + + Reviewed by Antti Koivisto. + + Add back null-checks for incomplete :not() class + which were dropped by r81845. + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::specificityForOneSelector): + (WebCore::CSSSelector::selectorText): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkOneSelector): + (WebCore::SelectorChecker::determineLinkMatchType): + +2012-05-28 Leo Yang <leo.yang@torchmobile.com.cn> + + FileWriterSync binding should have no static table + https://bugs.webkit.org/show_bug.cgi?id=87645 + + Reviewed by George Staikos. + + FileWriterSync could be used in filesystem FileWriter in worker thread, so we should add ProgressEvent in idl file. + + Covered by existing test: fast/filesystem/workers/sync-operations.html. + + * Modules/filesystem/FileWriterSync.idl: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add an overlay layer + https://bugs.webkit.org/show_bug.cgi?id=87567 + + Reviewed by Antonio Gomes. + + The overlay layer allows us to have compositing layers even though the + web page is not currently using accelerated compositing. + + These layers can be used to implement tap highlight, inspector overlay + and more. + + The WebCore changes support the overlay layer functionality in WebKit + by making it possible to add animations from the compositing thread + without them being instantly overwritten during the next commit. + + Also a new custom layer type is added, which allow an overlay layer to + draw itself using raw OpenGL calls. An instance of a custom subclass of + LayerCompositingThread must be provided when creating the + LayerWebKitThread. Then, the custom layer can be used as the content + layer of a GraphicsLayer, or by itself. + + Reviewed internally by Filip Spacek. + + PR #154335 + + * platform/graphics/blackberry/LayerCompositingThread.cpp: + (WebCore::LayerCompositingThread::~LayerCompositingThread): + (WebCore::LayerCompositingThread::deleteTextures): + (WebCore::LayerCompositingThread::drawTextures): + (WebCore::LayerCompositingThread::drawMissingTextures): + (WebCore::LayerCompositingThread::updateTextureContentsIfNeeded): + (WebCore::LayerCompositingThread::setVisible): + (WebCore::LayerCompositingThread::scheduleCommit): + * platform/graphics/blackberry/LayerCompositingThread.h: + (WebCore::LayerCompositingThread::addAnimation): + (WebCore::LayerCompositingThread::setRunningAnimations): + (WebCore::LayerCompositingThread::setSuspendedAnimations): + (LayerCompositingThread): + (WebCore::LayerCompositingThread::drawCustom): + * platform/graphics/blackberry/LayerData.h: + (LayerData): + * platform/graphics/blackberry/LayerWebKitThread.cpp: + (WebCore::LayerWebKitThread::LayerWebKitThread): + (WebCore): + (WebCore::LayerWebKitThread::~LayerWebKitThread): + (WebCore::LayerWebKitThread::updateTextureContentsIfNeeded): + (WebCore::LayerWebKitThread::startAnimations): + (WebCore::LayerWebKitThread::commitOnCompositingThread): + (WebCore::LayerWebKitThread::setNeedsDisplayInRect): + (WebCore::LayerWebKitThread::setNeedsDisplay): + (WebCore::LayerWebKitThread::setIsMask): + (WebCore::LayerWebKitThread::setRunningAnimations): + (WebCore::LayerWebKitThread::setSuspendedAnimations): + * platform/graphics/blackberry/LayerWebKitThread.h: + (LayerWebKitThread): + +2012-05-28 Leo Yang <leo.yang@torchmobile.com.cn> + + ProgressEvent JSC binding should have no static table + https://bugs.webkit.org/show_bug.cgi?id=87365 + + Reviewed by George Staikos. + + ProgressEvent could be used in filesystem FileWriter in worker thread, so we should add ProgressEvent in idl file. + + Covered by existing test: fast/filesystem/workers/file-writer-events.html. + + * dom/ProgressEvent.idl: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Update WebPageCompositor::render() API + https://bugs.webkit.org/show_bug.cgi?id=87565 + + Reviewed by Rob Buis. + + The new API allows the embedder to specify the root transform and many + OpenGL related parameters. + + Also refactor the code to allow several sets of layers to be rendered, + and to allow interleaving the rendering of layers with rendering of + buffers and checkerboard. + + Reviewed internally by Filip Spacek. + + PR #154334 + + * platform/graphics/blackberry/LayerCompositingThread.cpp: + (WebCore::LayerCompositingThread::drawTextures): + (WebCore::LayerCompositingThread::drawSurface): + * platform/graphics/blackberry/LayerRenderer.cpp: + (WebCore::LayerRenderer::orthoMatrix): + (WebCore::LayerRenderer::LayerRenderer): + (WebCore::LayerRenderer::prepareFrame): + (WebCore): + (WebCore::LayerRenderer::setViewport): + (WebCore::LayerRenderer::compositeLayers): + (WebCore::LayerRenderer::compositeBuffer): + (WebCore::LayerRenderer::drawCheckerboardPattern): + (WebCore::LayerRenderer::drawLayersOnSurfaces): + (WebCore::LayerRenderer::prepareFrameRecursive): + (WebCore::LayerRenderer::updateLayersRecursive): + (WebCore::LayerRenderer::compositeLayersRecursive): + (WebCore::LayerRenderer::updateScissorIfNeeded): + (WebCore::LayerRenderingResults::addHolePunchRect): + * platform/graphics/blackberry/LayerRenderer.h: + (LayerRenderer): + +2012-05-28 Antti Koivisto <antti@apple.com> + + REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute + https://bugs.webkit.org/show_bug.cgi?id=87349 + + Reviewed by Andreas Kling. + + Selector fast path does not trigger lazy style attribute generation. Since attribute selectors matching + style attribute are rare, disallow them from the fast path rather than making it more branchy. + + Test: fast/css/dynamic-style-attribute-query.html + + * css/SelectorChecker.cpp: + (WebCore::isFastCheckableMatch): + +2012-05-28 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: Expose function (closure) scopes in remote protocol + https://bugs.webkit.org/show_bug.cgi?id=86861 + + Reviewed by Yury Semikhatsky. + + A data transfer from V8's FunctionMirror via DebuggerScript.js via InjectedScriptHost is built. + Scope field is added to protocol declaration similar to scopes of stack call frame. + Test for function details is extended. + JSC code binging got fixme for implemting the corresponding feature. + + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::JSInjectedScriptHost::functionDetails): + * bindings/v8/DebuggerScript.js: + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::functionScopes): + (WebCore): + * bindings/v8/ScriptDebugServer.h: + (ScriptDebugServer): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::V8InjectedScriptHost::functionDetailsCallback): + * inspector/InjectedScriptHost.cpp: + (WebCore): + (WebCore::InjectedScriptHost::scriptDebugServer): + * inspector/InjectedScriptHost.h: + (WebCore): + (WebCore::InjectedScriptHost::init): + (InjectedScriptHost): + * inspector/InjectedScriptSource.js: + (.): + * inspector/Inspector.json: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + * inspector/WorkerInspectorController.cpp: + (WebCore::WorkerInspectorController::WorkerInspectorController): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add a constructor to create a Path from an SkPath + https://bugs.webkit.org/show_bug.cgi?id=87566 + + Reviewed by Antonio Gomes. + + Skia allows the creation of more complex paths than WebCore would + allow. This will be used in the BlackBerry port to implement a default + tap highlight appearance. + + Reviewed internally by Mike Lattanzio. + + PR #154329 + + * platform/graphics/Path.h: + (Path): + * platform/graphics/skia/PathSkia.cpp: + (WebCore): + (WebCore::Path::Path): + +2012-05-28 Alexis Menard <alexis.menard@openbossa.org> + + Unreviewed build fix for Mac on Lion. + + * inspector/CodeGeneratorInspector.py: + +2012-05-28 Keishi Hattori <keishi@webkit.org> + + Expose value localization function of HTMLInputElement + https://bugs.webkit.org/show_bug.cgi?id=84356 + + Reviewed by Kent Tamura. + + No new tests. + + We want to localize the values that are defined in the datalist element. + This adds HTMLInputElement::localizeValue() which will localize a given + value. + + * html/BaseDateAndTimeInputType.cpp: + (WebCore::BaseDateAndTimeInputType::localizeValue): + (WebCore): + (WebCore::BaseDateAndTimeInputType::visibleValue): + * html/BaseDateAndTimeInputType.h: + (BaseDateAndTimeInputType): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::localizeValue): + (WebCore): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/InputType.cpp: + (WebCore::InputType::localizeValue): + (WebCore): + * html/InputType.h: + (InputType): + * html/NumberInputType.cpp: + (WebCore::NumberInputType::localizeValue): + (WebCore): + (WebCore::NumberInputType::visibleValue): + * html/NumberInputType.h: + (NumberInputType): + +2012-05-28 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Test fix after r118670: saved timeline data may + not have DOM counters data and MemoryStatistics object should + take this into account. + + * inspector/front-end/MemoryStatistics.js: + (WebInspector.MemoryStatistics.prototype._onRecordAdded): + +2012-05-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118580. + http://trac.webkit.org/changeset/118580 + https://bugs.webkit.org/show_bug.cgi?id=87647 + + Caused webkit_unit_tests to crash on chromium. (Requested by + bulach on #webkit). + + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerPainter::create): + (WebCore::ContentLayerPainter::paint): + (WebCore::ContentLayerPainter::ContentLayerPainter): + (ContentLayerPainter): + (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (UpdatableTile): + (WebCore::UpdatableTile::UpdatableTile): + (WebCore::TiledLayerChromium::updateTiles): + * platform/graphics/chromium/TiledLayerChromium.h: + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::CCSettings::CCSettings): + (CCSettings): + +2012-05-28 Peter Beverloo <peter@chromium.org> + + Æ doesn't get rendered as U+00C6 + https://bugs.webkit.org/show_bug.cgi?id=87465 + + Reviewed by Adam Barth. + + The if-statement to check whether the first entry of a certain letter + already exists in the index used .get(). The very first alphabetical + entry is in position "0", which evaluates to false, causing the first + entry to be ignored. Instead, use a "x not in y" check here. + + Also update WebCore.gyp to list the create-html-entity-table script as + an input for the action, to make sure the table will be recreated. + + Test: html5lib/resources/entities02.dat + + * WebCore.gyp/WebCore.gyp: + * html/parser/create-html-entity-table: + +2012-05-28 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: dom counters graphs vanish on switching between timeline views + https://bugs.webkit.org/show_bug.cgi?id=87628 + + Reviewed by Vsevolod Vlasov. + + MemoryStatistics object now listens to the TimelineModel events instead of being + populated by timeline panel. This behavior mathes that of the overview pane. + + * inspector/front-end/MemoryStatistics.js: + (WebInspector.MemoryStatistics.prototype.addTimlineEvent): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._onTimelineEventRecorded): + (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): + +2012-05-28 Marcus Bulach <bulach@chromium.org> + + [chromium] Buildfix: remove obsolete file from gypi. + https://bugs.webkit.org/show_bug.cgi?id=87643 + + Reviewed by no-reviewer. + + Following http://trac.webkit.org/changeset/118610. + Removes reference to platform/graphics/gstreamer/ImageGStreamerCG.mm + + * WebCore.gypi: + +2012-05-28 MORITA Hajime <morrita@google.com> + + HTMLFormControlElement::m_validationMessage shouldn't be cleared on detach() + https://bugs.webkit.org/show_bug.cgi?id=87608 + + Reviewed by Kent Tamura. + + Moved m_validationMessage clearance from detach() to removedFrom() and + remove detach(). + + No new tests. This change has no visible difference. Upcoming changes rely on this though. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFrom): + +2012-05-28 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: "Record CPU profile" button doesn't change its state after finishing profiling + https://bugs.webkit.org/show_bug.cgi?id=87624 + + Reviewed by Vsevolod Vlasov. + + Keep record button state in sync with the current profiling state. + + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.toggleRecordButton): + +2012-05-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118650. + http://trac.webkit.org/changeset/118650 + https://bugs.webkit.org/show_bug.cgi?id=87639 + + Patch caused massive failures throughout the builders + (Requested by zdobersek on #webkit). + + * css/MediaQuery.cpp: + (WebCore): + (WebCore::MediaQuery::serialize): + (WebCore::MediaQuery::MediaQuery): + (WebCore::MediaQuery::cssText): + * css/MediaQuery.h: + (WebCore::MediaQuery::expressions): + (WebCore::MediaQuery::mediaType): + (MediaQuery): + (WebCore::MediaQuery::copy): + * css/MediaQueryEvaluator.cpp: + (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): + (WebCore::MediaQueryEvaluator): + (WebCore::MediaQueryEvaluator::eval): + (WebCore::aspect_ratioMediaFeatureEval): + (WebCore::device_aspect_ratioMediaFeatureEval): + (WebCore::transform_3dMediaFeatureEval): + (WebCore::view_modeMediaFeatureEval): + (WebCore::createFunctionMap): + * css/MediaQueryEvaluator.h: + (WebCore): + (MediaQueryEvaluator): + * css/StyleResolver.cpp: + (WebCore): + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/StyleResolver.h: + (MediaQueryResult): + (WebCore::MediaQueryResult::MediaQueryResult): + (WebCore): + (StyleResolver): + +2012-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move allowRoundingHacks to Internals interface + https://bugs.webkit.org/show_bug.cgi?id=87328 + + Reviewed by Hajime Morita. + + Add allowRoundingHacks function, because it is able to work in the + cross-port way by means of the Internals interface. + + In addition, a function is added in order to restore default setting values. + + No new tests, since we are improving here the infra-structure for testing + a specific method. + + * testing/Internals.cpp: + (WebCore::Internals::reset): + (WebCore): + (WebCore::Internals::resetDefaultsToConsistentValues): + (WebCore::Internals::allowRoundingHacks): + * testing/Internals.h: + (Internals): + * testing/Internals.idl: + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authentication crash the browser when user commit or cancel the http authentication dialog + https://bugs.webkit.org/show_bug.cgi?id=87579 + + Reviewed by George Staikos. + + In function NetworkJob::startNewJobWithRequest, We should cancel the + NetworkJob first before we start a new NetworkJob which reuses the + resource handle of the old one. If we only set the m_handle = 0 of the + old NetworkJob without cancelling itself, it will still receives data + notification from network thread and handles the received data with + the released resource handler, which will cause the crash. + + No new tests because no behavior has changed. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::startNewJobWithRequest): + +2012-05-27 MORITA Hajime <morrita@google.com> + + [Refactoring][ShadowDOM] Some ElementShadow methods can be inlined. + https://bugs.webkit.org/show_bug.cgi?id=87617 + + Reviewed by Kentaro Hara. + + Inlined ElementShadow::attachHost(), ElementShadow::detachHost() and + ElementShadow::reattach() + + No new tests. No behavior change. + + * dom/Element.cpp: + (WebCore::Element::attach): + (WebCore::Element::detach): + * dom/ElementShadow.cpp: + (WebCore::ElememtnShadow::reattachHostChildrenAndShadow): + * dom/ElementShadow.h: + (ElementShadow): + +2012-05-28 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: CodeGeneratorInspector.py: protect typed API from C++ implicit float to int cast + https://bugs.webkit.org/show_bug.cgi?id=87183 + + Reviewed by Yury Semikhatsky. + + An intermediate C++ class is introduced that uses C++ template technique to control actual type + of its constructor argument. + All input parameters of type "int" now have type ExactlyInt. + All usage sites are fixed accordingly. + + * inspector/CodeGeneratorInspector.py: + (TypeModel.RefPtrBased): + (TypeModel.Enum): + (TypeModel.ValueType): + (TypeModel.ValueType.get_opt_output_type_): + (TypeModel.ValueType.ValueOptional.get_command_return_pass_model): + (TypeModel.ExactlyInt): + (TypeModel.ExactlyInt.__init__): + (TypeModel.ExactlyInt.get_input_param_type_text): + (TypeModel.ExactlyInt.get_opt_output_type_): + (TypeModel.init_class): + (ExactlyInt): + * inspector/InspectorAgent.cpp: + (WebCore::InspectorAgent::enable): + (WebCore::InspectorAgent::didCreateWorker): + (WebCore::InspectorAgent::didDestroyWorker): + (WebCore::InspectorAgent::evaluateForTestInFrontend): + * inspector/InspectorApplicationCacheAgent.cpp: + (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus): + (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::buildObjectForNode): + * inspector/InspectorMemoryAgent.cpp: + (WebCore::jsHeapInfo): + (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution): + * inspector/PageRuntimeAgent.cpp: + (WebCore::PageRuntimeAgent::notifyContextCreated): + +2012-05-28 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Rebaselined run-binding-tests results. + + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: + (WebCore::JSTestActiveDOMObjectOwner::finalize): + * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: + (WebCore::JSTestCustomNamedGetterOwner::finalize): + * bindings/scripts/test/JS/JSTestEventConstructor.cpp: + (WebCore::JSTestEventConstructorOwner::finalize): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: + (WebCore::JSTestEventTargetOwner::finalize): + * bindings/scripts/test/JS/JSTestException.cpp: + (WebCore::JSTestExceptionOwner::finalize): + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore::JSTestInterfaceOwner::finalize): + * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: + (WebCore::JSTestMediaQueryListListenerOwner::finalize): + * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: + (WebCore::JSTestNamedConstructorOwner::finalize): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::JSTestObjOwner::finalize): + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: + (WebCore::JSTestSerializedScriptValueInterfaceOwner::finalize): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::V8TestObj::installPerContextProperties): + +2012-05-28 Darin Adler <darin@apple.com> + + StyleResolver need not allocate each MediaQueryResult on the heap + https://bugs.webkit.org/show_bug.cgi?id=75223 + + Reviewed by Daniel Bates. + + * css/MediaQuery.cpp: Removed some comments that pointed to CSS documents. + There is no guarantee these links will be valid over time. + (WebCore::MediaQuery::MediaQuery): Rewrote for clarity, conventional WebKit coding + style, and simplicity. + (WebCore::MediaQuery::copy): Moved out of line; not performance critical, and this + allows us to cut down header dependencies. + (WebCore::MediaQuery::cssText): Updated for change to data member name. + + * css/MediaQuery.h: Removed unneeded includes. Removed non-helpful argument name + "exprs". Changed expressions function to return a reference instead of + a pointer. Changed mediaType and cssText functions to return a reference. Renamed + m_serializationCache to m_serializedQuery. Moved copy function out of header. + + * css/MediaQueryEvaluator.cpp: Renamed EvalFunc to MediaFeatureEvaluationFunction. + Broke a FIXME into three and reworded for clarity. + (WebCore::MediaQueryEvaluator): Updated for name changes. + (WebCore::MediaQueryEvaluator::eval): Rewrote this for clarity and to regularize + the logic a bit. + (WebCore::aspect_ratioMediaFeatureEval): Got rid of a != 0 that is contrary to the + normal WebKit style. + (WebCore::device_aspect_ratioMediaFeatureEval): Ditto. + (WebCore::transform_3dMediaFeatureEval): Fixed mangled #if that was here. + (WebCore::view_modeMediaFeatureEval): Replaced UNUSED_PARAM usage with ASSERT_UNUSED. + (WebCore::createFunctionMap): Changed this so it returns the map so we can use a + cleaner style in the caller. + (WebCore::MediaQueryEvaluator::eval): Updated to take a reference and improved the + comments and coding style a bit. + + * css/MediaQueryEvaluator.h: Updated comment style. Removed unused constructor. + Removed unneeded destructor declaration. Renamed m_expResult to m_mediaFeatureResult. + + * css/StyleResolver.cpp: Moved the MediaQueryResult class into this file + and made it a structure rather than a class. + (WebCore::StyleResolver::addViewportDependentMediaQueryResult): Updated to take + a reference argument instead of a pointer and for the new vector type. + (WebCore::StyleResolver::affectedByViewportChange): Updated for above changes. + + * css/StyleResolver.h: Removed many unneeded includes and forward declarations of + classes, including now-unneeded include of MediaQueryExp.h. Replaced MediaQueryResult + definition with a forward declaration. Changed addViewportDependentMediaQueryResult + to take a reference instead of a pointer. Changed m_viewportDependentMediaQueryResults + to be a vector of values rather than of pointers. + +2012-05-27 Shinya Kawanaka <shinyak@chromium.org> + + cut, copy or paste event won't be fired in Shadow DOM. + https://bugs.webkit.org/show_bug.cgi?id=87352 + + Reviewed by Dimitri Glazkov. + + cut, copy or paste event was not fired in Shadow DOM. + Since event re-targeting has been implemented, it should be safe to fire them in Shadow DOM now. + + Tests: fast/dom/shadow/cppevent-in-shadow.html + fast/dom/shadow/cppevent-input-in-shadow.html + + * editing/Editor.cpp: + (WebCore::Editor::findEventTargetFrom): + +2012-05-27 Hayato Ito <hayato@chromium.org> + + Support multiple shadow roots in event dispatching. + https://bugs.webkit.org/show_bug.cgi?id=87470 + + Reviewed by Dimitri Glazkov. + + The current implementation does not set event's target correctly + if an event happens on DOM tree with multiple shadow roots. So + this patch updates an event re-targeting algorithm so that it + works even if it is applied to multiple shadow roots. + + Tests: fast/dom/shadow/shadow-dom-event-dispatching.html + + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::ComposedShadowTreeWalker::traverseParentIncludingInsertionPointAndShadowRoot): + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::ensureEventAncestors): + +2012-05-27 Benjamin Poulain <benjamin@webkit.org> + + Minor code cleaning for the interface of MainResourceLoader + https://bugs.webkit.org/show_bug.cgi?id=87607 + + Reviewed by Darin Adler. + + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::MainResourceLoader): + (WebCore::MainResourceLoader::handleSubstituteDataLoadNow): + (WebCore::MainResourceLoader::handleSubstituteDataLoadSoon): + * loader/MainResourceLoader.h: + (MainResourceLoader): + -Add the OVERRIDE keyword for the methods inherited from ResourceLoader. + -Remove the useless declaration of handleDataLoad(ResourceRequest&), this method does not exist. + -Rename handleDataLoadNow() to handleSubstituteDataLoadNow() and make the method private. This should + only be used by handleSubstituteDataLoadSoon() and indirectly through the timer. + +2012-05-27 Yoshifumi Inoue <yosin@chromium.org> + + [WTF] Introduce UINT64_C to MathExtras.h + https://bugs.webkit.org/show_bug.cgi?id=87485 + + Reviewed by Kent Tamura. + + This patch introduces UINT64_C for all platforms to avoid using + conditional compilation. + + No new tests. This patch doesn't change behavior. + + * Modules/websockets/WebSocketFrame.cpp: + (WebCore::WebSocketFrame::parseFrame): Replace conditional compilation with UINT64_C. + +2012-05-27 Luke Macpherson <macpherson@chromium.org> + + Use StringBuilder in WebKitCSSTransformValue::customCssText() to allow code reuse with CSS Variables. + https://bugs.webkit.org/show_bug.cgi?id=87462 + + Reviewed by Dimitri Glazkov. + + Factor out strings into a const char* array, and use a StringBuilder instead of String concatenation. + This will allow future code to re-use the array of transform names, and StringBuilder is generally faster. + + Covered by existing CSS transform tests. + + * css/WebKitCSSTransformValue.cpp: + (WebCore): + (WebCore::WebKitCSSTransformValue::customCssText): + +2012-05-27 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Update color for tap highlight and selection + https://bugs.webkit.org/show_bug.cgi?id=87606 + + Reviewed by Antonio Gomes. + + PR #154813 + + * platform/blackberry/RenderThemeBlackBerry.cpp: + (WebCore::RenderThemeBlackBerry::platformTapHighlightColor): + (WebCore::RenderThemeBlackBerry::platformActiveSelectionBackgroundColor): + +2012-05-27 Benjamin Poulain <bpoulain@apple.com> + + When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called + https://bugs.webkit.org/show_bug.cgi?id=87582 + + Reviewed by Darin Adler. + + Previously, there was a shortcut when a deferred MainResourceLoader is resumed: If the data + was coming from AppCache we could jump directly to startDataLoadTimer(). + + The problem with the shortcut is willSendRequest() is never called in that particular case + (substituteData + deferred-resume). The imbalance between willSendRequest() and didReceiveResponse() + causes problems. + + This patch removes the shortcut so that MainResourceLoader::loadNow() is used regardless of + the deferred loading. The method MainResourceLoader::loadNow() handle the substituteData as if the loading + was not deferred. + + Test: http/tests/appcache/load-from-appcache-defer-resume-crash.html + + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::continueAfterNavigationPolicy): + (WebCore::MainResourceLoader::handleSubstituteDataLoadSoon): + Rename the method to be consistent with the attribute it uses, making the naming more explicit. + (WebCore::MainResourceLoader::loadNow): + (WebCore::MainResourceLoader::setDefersLoading): + * loader/MainResourceLoader.h: + (MainResourceLoader): + 2012-05-27 David Kilzer <ddkilzer@apple.com> Use xcrun to find gperf path on platforms that use Xcode diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp index 11ffbd9c7..8e46992ee 100644 --- a/Source/WebCore/DerivedSources.cpp +++ b/Source/WebCore/DerivedSources.cpp @@ -437,8 +437,9 @@ #include "JSSVGTSpanElement.cpp" #include "JSSVGUnitTypes.cpp" #include "JSSVGUseElement.cpp" -#include "JSSVGViewElement.cpp" #include "JSSVGVKernElement.cpp" +#include "JSSVGViewElement.cpp" +#include "JSSVGViewSpec.cpp" #include "JSSVGZoomAndPan.cpp" #include "JSSVGZoomEvent.cpp" #include "JSText.cpp" diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 9cd509a2f..14731db4c 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -34,7 +34,6 @@ VPATH = \ $(WebCore)/Modules/webaudio \ $(WebCore)/Modules/webdatabase \ $(WebCore)/Modules/websockets \ - $(WebCore)/Resources \ $(WebCore)/bindings/generic \ $(WebCore)/bindings/js \ $(WebCore)/bindings/objc \ @@ -575,6 +574,7 @@ BINDING_IDLS = \ $(WebCore)/svg/SVGUseElement.idl \ $(WebCore)/svg/SVGVKernElement.idl \ $(WebCore)/svg/SVGViewElement.idl \ + $(WebCore)/svg/SVGViewSpec.idl \ $(WebCore)/svg/SVGZoomAndPan.idl \ $(WebCore)/svg/SVGZoomEvent.idl \ $(WebCore)/testing/Internals.idl \ @@ -668,12 +668,6 @@ else ENABLE_ORIENTATION_EVENTS = 0 endif -all: DefaultFonts.plist - -DefaultFonts.plist : DefaultFonts.plist.in - @echo Pre-processing DefaultFonts.plist... - $(CC) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" $< > $@ - else ifndef ENABLE_DASHBOARD_SUPPORT diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index 685da7eb8..238679989 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -606,6 +606,7 @@ contains(DEFINES, ENABLE_SVG=1) { $$PWD/svg/SVGUseElement.idl \ $$PWD/svg/SVGViewElement.idl \ $$PWD/svg/SVGVKernElement.idl \ + $$PWD/svg/SVGViewSpec.idl \ $$PWD/svg/SVGZoomAndPan.idl \ $$PWD/svg/SVGZoomEvent.idl } diff --git a/Source/WebCore/English.lproj/Localizable.strings b/Source/WebCore/English.lproj/Localizable.strings Binary files differindex 6a3864a26..b5e54ea33 100644 --- a/Source/WebCore/English.lproj/Localizable.strings +++ b/Source/WebCore/English.lproj/Localizable.strings diff --git a/Source/WebCore/ForwardingHeaders/runtime/ErrorPrototype.h b/Source/WebCore/ForwardingHeaders/runtime/ErrorPrototype.h new file mode 100644 index 000000000..46b5399a0 --- /dev/null +++ b/Source/WebCore/ForwardingHeaders/runtime/ErrorPrototype.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_ErrorPrototype_h +#define WebCore_FWD_ErrorPrototype_h +#include <JavaScriptCore/ErrorPrototype.h> +#endif diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index f88e6563b..9a98ba087 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -3077,6 +3077,8 @@ webcore_sources += \ Source/WebCore/page/WebKitPoint.h \ Source/WebCore/page/WindowFeatures.cpp \ Source/WebCore/page/WindowFeatures.h \ + Source/WebCore/page/WindowFocusAllowedIndicator.cpp \ + Source/WebCore/page/WindowFocusAllowedIndicator.h \ Source/WebCore/page/WorkerNavigator.cpp \ Source/WebCore/page/WorkerNavigator.h \ Source/WebCore/platform/animation/Animation.cpp \ @@ -3115,6 +3117,8 @@ webcore_sources += \ Source/WebCore/platform/Cursor.h \ Source/WebCore/platform/DateComponents.cpp \ Source/WebCore/platform/DateComponents.h \ + Source/WebCore/platform/Decimal.cpp \ + Source/WebCore/platform/Decimal.h \ Source/WebCore/platform/DragData.cpp \ Source/WebCore/platform/DragData.h \ Source/WebCore/platform/DragImage.cpp \ @@ -4202,7 +4206,6 @@ webcore_sources += \ Source/WebCore/svg/properties/SVGAnimatedProperty.h \ Source/WebCore/svg/properties/SVGAnimatedPropertyDescription.h \ Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h \ - Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h \ Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h \ Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h \ Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h \ @@ -5392,6 +5395,7 @@ webcore_built_sources += \ DerivedSources/WebCore/JSSVGUseElement.h \ DerivedSources/WebCore/JSSVGViewElement.cpp \ DerivedSources/WebCore/JSSVGViewElement.h \ + DerivedSources/WebCore/JSSVGViewSpec.cpp \ DerivedSources/WebCore/JSSVGViewSpec.h \ DerivedSources/WebCore/JSSVGVKernElement.cpp \ DerivedSources/WebCore/JSSVGVKernElement.h \ @@ -5541,6 +5545,7 @@ dom_binding_idls += \ $(WebCore)/svg/SVGUseElement.idl \ $(WebCore)/svg/SVGVKernElement.idl \ $(WebCore)/svg/SVGViewElement.idl \ + $(WebCore)/svg/SVGViewSpec.idl \ $(WebCore)/svg/SVGZoomAndPan.idl \ $(WebCore)/svg/SVGZoomEvent.idl endif # END ENABLE_SVG diff --git a/Source/WebCore/Modules/filesystem/FileWriterSync.idl b/Source/WebCore/Modules/filesystem/FileWriterSync.idl index c561bb43b..57cd2567c 100644 --- a/Source/WebCore/Modules/filesystem/FileWriterSync.idl +++ b/Source/WebCore/Modules/filesystem/FileWriterSync.idl @@ -31,6 +31,7 @@ module html { interface [ Conditional=FILE_SYSTEM, + JSNoStaticTables ] FileWriterSync { // synchronous write/modify methods void write(in Blob data) raises (FileException); diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index 7823042dd..de4ec08fa 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -125,13 +125,13 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRe IDB_TRACE("IDBCursor::update"); if (!m_gotValue) { - ec = INVALID_STATE_ERR; + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return 0; } RefPtr<SerializedScriptValue> value = prpValue; if (value->blobURLs().size() > 0) { // FIXME: Add Blob/File/FileList support - ec = DATA_CLONE_ERR; + ec = IDBDatabaseException::IDB_DATA_CLONE_ERR; return 0; } @@ -148,7 +148,7 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec) { IDB_TRACE("IDBCursor::advance"); if (!m_gotValue) { - ec = INVALID_STATE_ERR; + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return; } @@ -158,8 +158,8 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec) } if (!count) { - // FIXME: spec says we should throw a JavaScript TypeError - ec = TYPE_MISMATCH_ERR; + // FIXME: should be a JavaScript TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 + ec = IDBDatabaseException::IDB_TYPE_MISMATCH_ERR; return; } @@ -186,7 +186,7 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec) } if (!m_gotValue) { - ec = INVALID_STATE_ERR; + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return; } @@ -204,7 +204,7 @@ PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context { IDB_TRACE("IDBCursor::delete"); if (!m_gotValue) { - ec = INVALID_STATE_ERR; + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return 0; } RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index 74816b8b8..e1f44cd50 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -103,7 +103,7 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co } if (!keyPath.isNull() && !keyPath.isValid()) { - ec = SYNTAX_ERR; + ec = IDBDatabaseException::IDB_SYNTAX_ERR; return 0; } @@ -112,7 +112,7 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co options.get("autoIncrement", autoIncrement); if (autoIncrement && ((keyPath.type() == IDBKeyPath::StringType && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::ArrayType)) { - ec = INVALID_ACCESS_ERR; + ec = IDBDatabaseException::IDB_INVALID_ACCESS_ERR; return 0; } @@ -154,7 +154,7 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont { RefPtr<DOMStringList> storeNames = prpStoreNames; if (!storeNames || storeNames->isEmpty()) { - ec = INVALID_ACCESS_ERR; + ec = IDBDatabaseException::IDB_INVALID_ACCESS_ERR; return 0; } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp index 010a120e5..3b2973158 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp @@ -189,7 +189,7 @@ void IDBDatabaseBackendImpl::deleteObjectStore(const String& name, IDBTransactio { RefPtr<IDBObjectStoreBackendImpl> objectStore = m_objectStores.get(name); if (!objectStore) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return; } RefPtr<IDBDatabaseBackendImpl> database = this; @@ -213,7 +213,7 @@ void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCal RefPtr<IDBCallbacks> callbacks = prpCallbacks; RefPtr<IDBDatabaseCallbacks> databaseCallbacks = prpDatabaseCallbacks; if (!m_databaseCallbacksSet.contains(databaseCallbacks)) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ABORT_ERR, "Connection was closed before set version transaction was created")); + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Connection was closed before set version transaction was created")); return; } for (DatabaseCallbacksSet::const_iterator it = m_databaseCallbacksSet.begin(); it != m_databaseCallbacksSet.end(); ++it) { @@ -312,7 +312,7 @@ PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(D { for (size_t i = 0; i < objectStoreNames->length(); ++i) { if (!m_objectStores.contains(objectStoreNames->item(i))) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return 0; } } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseError.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseError.h index 8b42f1707..76ff09f66 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseError.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseError.h @@ -41,28 +41,22 @@ public: { ASSERT(code >= IDBDatabaseException::IDBDatabaseExceptionOffset); ASSERT(code < IDBDatabaseException::IDBDatabaseExceptionMax); - return adoptRef(new IDBDatabaseError(code - IDBDatabaseException::IDBDatabaseExceptionOffset, message)); - } - - static PassRefPtr<IDBDatabaseError> createWithoutOffset(unsigned short code, const String& message) - { - ASSERT(code < IDBDatabaseException::IDBDatabaseExceptionOffset); return adoptRef(new IDBDatabaseError(code, message)); } ~IDBDatabaseError() { } - unsigned short code() const { return m_code; } - void setCode(unsigned short value) { m_code = value; } + unsigned short code() const { return IDBDatabaseException::getLegacyErrorCode(m_code); } + unsigned short idbCode() const { return m_code; } const String& message() const { return m_message; } - void setMessage(const String& value) { m_message = value; } + const String name() const { return IDBDatabaseException::getErrorName(m_code); }; private: IDBDatabaseError(unsigned short code, const String& message) - : m_code(code), m_message(message) { } + : m_code(code), m_message(message) { } - unsigned short m_code; - String m_message; + const unsigned short m_code; + const String m_message; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp index d86a552db..e52c3291d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp @@ -34,42 +34,84 @@ namespace WebCore { -static struct IDBDatabaseExceptionNameDescription { +static const struct IDBDatabaseExceptionNameDescription { const char* const name; const char* const description; + const ExceptionCode legacyCode; } idbDatabaseExceptions[] = { - { "UNKNOWN_ERR", "An unknown error occurred within Indexed Database." }, - { "NON_TRANSIENT_ERR", "NON_TRANSIENT_ERR" }, // FIXME: Write a better message if it's ever possible this is thrown. - { "NOT_FOUND_ERR", "The name supplied does not match any existing item." }, - { "CONSTRAINT_ERR", "The request cannot be completed due to a failed constraint." }, - { "DATA_ERR", "The data provided does not meet the requirements of the function." }, - { "NOT_ALLOWED_ERR", "This function is not allowed to be called in such a context." }, - { "TRANSACTION_INACTIVE_ERR", "A request was placed against a transaction which is either currently not active, or which is finished." }, - { "ABORT_ERR", "The transaction was aborted, so the request cannot be fulfilled." }, - { "READ_ONLY_ERR", "A write operation was attempted in a read-only transaction." }, - { "TIMEOUT_ERR", "A lock for the transaction could not be obtained in a reasonable time." }, // FIXME: This isn't used yet. - { "QUOTA_ERR", "The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database." }, // FIXME: This isn't used yet - { "VER_ERR", "An attempt was made to open a database using a lower version than the existing version." } // FIXME: This isn't used yet + // These are IDB-specific errors from the spec. + { "UnknownError", "An unknown error occurred within Indexed Database.", 0 }, + { "NonTransientError", "NonTransientError", 0 }, // FIXME: No longer in the spec + { 0, 0, 0 }, // FIXME: Previous/legacy value NOT_FOUND_ERR. + { "ConstraintError", "A mutation operation in the transaction failed because a constraint was not satisfied.", 0 }, + { "DataError", "The data provided does not meet requirements.", 0 }, + { "NotAllowedError", "This function is not allowed to be called in such a context.", 0}, // FIXME: no longer in the spec + { "TransactionInactiveError", "A request was placed against a transaction which is either currently not active, or which is finished.", 0 }, + { 0, 0, 0 }, // FIXME: Previous/legacy value was ABORT_ERR. + { "ReadOnlyError", "A write operation was attempted in a read-only transaction.", 0 }, + { 0, 0, 0 }, // FIXME: Previous/legacy value was TIMEOUT_ERR. + { 0, 0, 0 }, // FIXME: Previous/legacy value was QUOTA_ERR. + { "VersionError", "An attempt was made to open a database using a lower version than the existing version.", 0 }, // FIXME: This isn't used yet + + // These are IDB-specific descriptions of generic DOM Exceptions when they are thrown from IDB APIs + { "NotFoundError", "An operation failed because the requested database object could not be found.", NOT_FOUND_ERR }, + { "InvalidStateError", "An operation was called on an object on which it is not allowed or at a time when it is not allowed.", INVALID_STATE_ERR }, + { "InvalidAccessError", "An invalid operation was performed on an object.", INVALID_ACCESS_ERR }, + { "AbortError", "The transaction was aborted, so the request cannot be fulfilled.", ABORT_ERR }, + { "TimeoutError", "A lock for the transaction could not be obtained in a reasonable time.", TIMEOUT_ERR }, // FIXME: This isn't used yet. + { "QuotaExceededError", "The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.", QUOTA_EXCEEDED_ERR }, // FIXME: This isn't used yet + { "SyntaxError", "The keypath argument contains an invalid key path.", SYNTAX_ERR }, + { "DataCloneError", "The data being stored could not be cloned by the internal structured cloning algorithm.", DATA_CLONE_ERR }, + // FIXME: should be a JavaScript TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 + { "TypeMismatchError", "This should be a TypeError", TYPE_MISMATCH_ERR }, + { "NotSupportedError", "Cannot use multiEntry indexed with an array keypath", NOT_SUPPORTED_ERR }, }; +static const IDBDatabaseExceptionNameDescription* getErrorEntry(ExceptionCode ec) +{ + if (ec < IDBDatabaseException::IDBDatabaseExceptionOffset || ec > IDBDatabaseException::IDBDatabaseExceptionMax) + return 0; + + size_t tableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptions); + size_t tableIndex = ec - IDBDatabaseException::UNKNOWN_ERR; + + return tableIndex < tableSize ? &idbDatabaseExceptions[tableIndex] : 0; +} + bool IDBDatabaseException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description) { - if (ec < IDBDatabaseExceptionOffset || ec > IDBDatabaseExceptionMax) + const IDBDatabaseExceptionNameDescription* entry = getErrorEntry(ec); + if (!entry) return false; description->typeName = "DOM IDBDatabase"; - description->code = ec - IDBDatabaseExceptionOffset; + description->code = (entry && entry->legacyCode) ? entry->legacyCode : ec - IDBDatabaseExceptionOffset; description->type = IDBDatabaseExceptionType; - size_t tableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptions); - size_t tableIndex = ec - UNKNOWN_ERR; - - description->name = tableIndex < tableSize ? idbDatabaseExceptions[tableIndex].name : 0; - description->description = tableIndex < tableSize ? idbDatabaseExceptions[tableIndex].description : 0; + description->name = entry ? entry->name : 0; + description->description = entry ? entry->description : 0; return true; } +String IDBDatabaseException::getErrorName(ExceptionCode ec) +{ + const IDBDatabaseExceptionNameDescription* entry = getErrorEntry(ec); + ASSERT(entry); + if (!entry) + return "UnknownError"; + + return entry->name; +} + +ExceptionCode IDBDatabaseException::getLegacyErrorCode(ExceptionCode ec) +{ + const IDBDatabaseExceptionNameDescription* entry = getErrorEntry(ec); + ASSERT(entry); + + return (entry && entry->legacyCode) ? entry->legacyCode : ec - IDBDatabaseExceptionOffset; +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h index 570a2fcd6..35123d563 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h @@ -45,17 +45,28 @@ public: enum IDBDatabaseExceptionCode { NO_ERR = IDBDatabaseExceptionOffset, UNKNOWN_ERR, - NON_TRANSIENT_ERR, - NOT_FOUND_ERR, + NON_TRANSIENT_ERR, // FIXME: No longer in the spec + LEGACY_NOT_FOUND_ERR, // FIXME: Placeholder. CONSTRAINT_ERR, DATA_ERR, - NOT_ALLOWED_ERR, + NOT_ALLOWED_ERR, // FIXME: No longer in the spec TRANSACTION_INACTIVE_ERR, - ABORT_ERR, + LEGACY_ABORT_ERR, // FIXME: Placeholder. READ_ONLY_ERR, - TIMEOUT_ERR, - QUOTA_ERR, - VER_ERR + LEGACY_TIMEOUT_ERR, // FIXME: Placeholder. + LEGACY_QUOTA_ERR, // FIXME: Placeholder. + VER_ERR, + + IDB_NOT_FOUND_ERR, + IDB_INVALID_STATE_ERR, + IDB_INVALID_ACCESS_ERR, + IDB_ABORT_ERR, + IDB_TIMEOUT_ERR, + IDB_QUOTA_EXCEEDED_ERR, + IDB_SYNTAX_ERR, + IDB_DATA_CLONE_ERR, + IDB_TYPE_MISMATCH_ERR, + IDB_NOT_SUPPORTED_ERR, }; static int ErrorCodeToExceptionCode(int errorCode) @@ -66,6 +77,8 @@ public: } static bool initializeDescription(ExceptionCode, ExceptionCodeDescription*); + static String getErrorName(ExceptionCode); + static ExceptionCode getLegacyErrorCode(ExceptionCode); private: IDBDatabaseException(const ExceptionCodeDescription& description) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl index b4f19e1b9..67d811c3e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl @@ -42,16 +42,17 @@ module storage { const unsigned short NO_ERR = 0; const unsigned short UNKNOWN_ERR = 1; const unsigned short NON_TRANSIENT_ERR = 2; - const unsigned short NOT_FOUND_ERR = 3; const unsigned short CONSTRAINT_ERR = 4; const unsigned short DATA_ERR = 5; const unsigned short NOT_ALLOWED_ERR = 6; const unsigned short TRANSACTION_INACTIVE_ERR = 7; - const unsigned short ABORT_ERR = 8; const unsigned short READ_ONLY_ERR = 9; - const unsigned short TIMEOUT_ERR = 10; - const unsigned short QUOTA_ERR = 11; const unsigned short VER_ERR = 12; + + const unsigned short NOT_FOUND_ERR = 8; + const unsigned short ABORT_ERR = 20; + const unsigned short TIMEOUT_ERR = 23; + const unsigned short QUOTA_ERR = 22; }; } diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp index 0e0e52f42..9efe54829 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp @@ -145,20 +145,9 @@ void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCal ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBIndexBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +void IDBIndexBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) { IDB_TRACE("IDBIndexBackendImpl::getInternal"); - String value = index->backingStore()->getObjectViaIndex(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *key); - if (value.isNull()) { - callbacks->onSuccess(SerializedScriptValue::undefinedValue()); - return; - } - callbacks->onSuccess(SerializedScriptValue::createFromWire(value)); -} - -void IDBIndexBackendImpl::getByRangeInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) -{ - IDB_TRACE("IDBIndexBackendImpl::getByRangeInternal"); RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexCursor(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), keyRange.get(), IDBCursor::NEXT); @@ -178,20 +167,9 @@ void IDBIndexBackendImpl::getByRangeInternal(ScriptExecutionContext*, PassRefPtr backingStoreCursor->close(); } -void IDBIndexBackendImpl::getKeyInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) -{ - IDB_TRACE("IDBIndexBackendImpl::getKeyInternal"); - RefPtr<IDBKey> keyResult = index->backingStore()->getPrimaryKeyViaIndex(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *key); - if (!keyResult) { - callbacks->onSuccess(static_cast<IDBKey*>(0)); - return; - } - callbacks->onSuccess(keyResult.get()); -} - -void IDBIndexBackendImpl::getKeyByRangeInternal(ScriptExecutionContext* context, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) +void IDBIndexBackendImpl::getKeyInternal(ScriptExecutionContext* context, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) { - IDB_TRACE("IDBIndexBackendImpl::getByRangeInternal"); + IDB_TRACE("IDBIndexBackendImpl::getInternal"); RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexKeyCursor(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), keyRange.get(), IDBCursor::NEXT); @@ -218,17 +196,7 @@ void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<ID RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getByRangeInternal, index, keyRange, callbacks))) - ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; -} - -void IDBIndexBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - IDB_TRACE("IDBIndexBackendImpl::get"); - RefPtr<IDBIndexBackendImpl> index = this; - RefPtr<IDBKey> key = prpKey; - RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, key, callbacks))) + if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -238,17 +206,7 @@ void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getKeyByRangeInternal, index, keyRange, callbacks))) - ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; -} - -void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - IDB_TRACE("IDBIndexBackendImpl::getKey"); - RefPtr<IDBIndexBackendImpl> index = this; - RefPtr<IDBKey> key = prpKey; - RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getKeyInternal, index, key, callbacks))) + if (!transaction->scheduleTask(createCallbackTask(&getKeyInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h index c7bce0e4a..20f35c4f3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h @@ -71,9 +71,7 @@ public: virtual void count(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); - virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void getKey(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); - virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); private: IDBIndexBackendImpl(IDBBackingStore*, int64_t databaseId, IDBObjectStoreBackendImpl*, int64_t id, const String& name, const IDBKeyPath&, bool unique, bool multiEntry); @@ -81,10 +79,8 @@ private: static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); - static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); - static void getByRangeInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); - static void getKeyInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); - static void getKeyByRangeInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); + static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); + static void getKeyInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); PassRefPtr<IDBBackingStore> backingStore() const { return m_backingStore; } int64_t databaseId() const { return m_databaseId; } diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index 04eba5021..7b245e68a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -126,7 +126,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, Pass RefPtr<SerializedScriptValue> value = prpValue; if (value->blobURLs().size() > 0) { // FIXME: Add Blob/File/FileList support - ec = DATA_CLONE_ERR; + ec = IDBDatabaseException::IDB_DATA_CLONE_ERR; return 0; } @@ -150,7 +150,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, Pass RefPtr<SerializedScriptValue> value = prpValue; if (value->blobURLs().size() > 0) { // FIXME: Add Blob/File/FileList support - ec = DATA_CLONE_ERR; + ec = IDBDatabaseException::IDB_DATA_CLONE_ERR; return 0; } @@ -227,7 +227,7 @@ PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const IDBKe { IDB_TRACE("IDBObjectStore::createIndex"); if (!keyPath.isValid()) { - ec = SYNTAX_ERR; + ec = IDBDatabaseException::IDB_SYNTAX_ERR; return 0; } @@ -238,7 +238,7 @@ PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const IDBKe options.get("multiEntry", multiEntry); if (keyPath.type() == IDBKeyPath::ArrayType && multiEntry) { - ec = NOT_SUPPORTED_ERR; + ec = IDBDatabaseException::IDB_NOT_SUPPORTED_ERR; return 0; } diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp index 5caf79740..b55d1e126 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp @@ -83,31 +83,19 @@ PassRefPtr<DOMStringList> IDBObjectStoreBackendImpl::indexNames() const return indexNames.release(); } -// FIXME: This can be removed once all ports have been updated to call -// the IDBKeyRange version. https://bugs.webkit.org/show_bug.cgi?id=84285 -void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - IDB_TRACE("IDBObjectStoreBackendImpl::get"); - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; - RefPtr<IDBKey> key = prpKey; - RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, key, callbacks))) - ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; -} - void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::get"); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getByRangeInternal, objectStore, keyRange, callbacks))) + if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBObjectStoreBackendImpl::getByRangeInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) +void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks) { - IDB_TRACE("IDBObjectStoreBackendImpl::getByRangeInternal"); + IDB_TRACE("IDBObjectStoreBackendImpl::getInternal"); RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreCursor(objectStore->databaseId(), objectStore->id(), keyRange.get(), IDBCursor::NEXT); if (!backingStoreCursor) { callbacks->onSuccess(SerializedScriptValue::undefinedValue()); @@ -125,18 +113,6 @@ void IDBObjectStoreBackendImpl::getByRangeInternal(ScriptExecutionContext*, Pass backingStoreCursor->close(); } -void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) -{ - IDB_TRACE("IDBObjectStoreBackendImpl::getInternal"); - String wireData = objectStore->backingStore()->getObjectStoreRecord(objectStore->databaseId(), objectStore->id(), *key); - if (wireData.isNull()) { - callbacks->onSuccess(SerializedScriptValue::undefinedValue()); - return; - } - - callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData)); -} - static PassRefPtr<IDBKey> fetchKeyFromKeyPath(SerializedScriptValue* value, const IDBKeyPath& keyPath) { IDB_TRACE("IDBObjectStoreBackendImpl::fetchKeyFromKeyPath"); @@ -554,7 +530,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const Stri { RefPtr<IDBIndexBackendInterface> index = m_indexes.get(name); if (!index) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return 0; } return index.release(); @@ -569,7 +545,7 @@ void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBa RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name); if (!index) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return; } diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h index 06ecac816..a5de7e5d2 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h @@ -67,7 +67,6 @@ public: virtual bool autoIncrement() const { return m_autoIncrement; } virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); - virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void deleteFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); @@ -90,8 +89,7 @@ private: PassRefPtr<IDBKey> genAutoIncrementKey(); void resetAutoIncrementKeyCache() { m_autoIncrementNumber = -1; } - static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); - static void getByRangeInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); + static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); static void deleteInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBCallbacks>); diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index 589042ec0..a316f8d4d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -85,6 +85,15 @@ PassRefPtr<IDBAny> IDBRequest::result(ExceptionCode& ec) const return m_result; } +PassRefPtr<DOMError> IDBRequest::error(ExceptionCode& ec) const +{ + if (m_readyState != DONE) { + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; + return 0; + } + return m_error; +} + unsigned short IDBRequest::errorCode(ExceptionCode& ec) const { if (m_readyState != DONE) { @@ -142,6 +151,7 @@ bool IDBRequest::resetReadyState(IDBTransaction* transaction) m_readyState = PENDING; m_result.clear(); m_errorCode = 0; + m_error.clear(); m_errorMessage = String(); IDBPendingTransactionMonitor::removePendingTransaction(m_transaction->backend()); @@ -172,9 +182,10 @@ void IDBRequest::abort() m_enqueuedEvents.clear(); m_errorCode = 0; + m_error.clear(); m_errorMessage = String(); m_result.clear(); - onError(IDBDatabaseError::create(IDBDatabaseException::ABORT_ERR, "The transaction was aborted, so the request cannot be fulfilled.")); + onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "The transaction was aborted, so the request cannot be fulfilled.")); } void IDBRequest::setCursorType(IDBCursorBackendInterface::CursorType cursorType) @@ -200,6 +211,8 @@ void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error) { ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); m_errorCode = error->code(); + ASSERT(!m_error); + m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode())); m_errorMessage = error->message(); m_cursor.clear(); enqueueEvent(Event::create(eventNames().errorEvent, true, true)); @@ -213,7 +226,7 @@ static PassRefPtr<Event> createSuccessEvent() void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) { IDB_TRACE("IDBRequest::onSuccess(DOMStringList)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(domStringList); enqueueEvent(createSuccessEvent()); } @@ -221,7 +234,7 @@ void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType); RefPtr<IDBCursor> cursor; if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor) @@ -236,7 +249,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (m_contextStopped || !scriptExecutionContext()) return; @@ -250,7 +263,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) { IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (idbKey && idbKey->isValid()) m_result = IDBAny::create(idbKey); else @@ -261,7 +274,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend) { IDB_TRACE("IDBRequest::onSuccess(IDBTransaction)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); RefPtr<IDBTransactionBackendInterface> backend = prpBackend; if (m_contextStopped || !scriptExecutionContext()) { @@ -286,7 +299,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue)"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(serializedScriptValue); m_cursor.clear(); enqueueEvent(createSuccessEvent()); @@ -295,7 +308,7 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal void IDBRequest::onSuccessWithContinuation() { IDB_TRACE("IDBRequest::onSuccessWithContinuation"); - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); ASSERT(m_cursor); setResultCursor(m_cursor, m_cursorType); m_cursor.clear(); @@ -387,8 +400,10 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) if (m_transaction && event->type() != eventNames().blockedEvent) { // If an error event and the default wasn't prevented... - if (dontPreventDefault && event->type() == eventNames().errorEvent) + if (dontPreventDefault && event->type() == eventNames().errorEvent) { + m_transaction->setError(m_error); m_transaction->backend()->abort(); + } m_transaction->backend()->didCompleteTaskEvents(); } return dontPreventDefault; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 055d00190..e104d8f1e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -32,6 +32,7 @@ #if ENABLE(INDEXED_DATABASE) #include "ActiveDOMObject.h" +#include "DOMError.h" #include "DOMStringList.h" #include "Event.h" #include "EventListener.h" @@ -53,6 +54,7 @@ public: PassRefPtr<IDBAny> result(ExceptionCode&) const; unsigned short errorCode(ExceptionCode&) const; + PassRefPtr<DOMError> error(ExceptionCode&) const; String webkitErrorMessage(ExceptionCode&) const; PassRefPtr<IDBAny> source() const; PassRefPtr<IDBTransaction> transaction() const; @@ -109,6 +111,7 @@ protected: RefPtr<IDBAny> m_result; unsigned short m_errorCode; String m_errorMessage; + RefPtr<DOMError> m_error; private: // EventTarget diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.idl b/Source/WebCore/Modules/indexeddb/IDBRequest.idl index 7cd341534..1e4941543 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.idl +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.idl @@ -38,8 +38,11 @@ module storage { getter raises (IDBDatabaseException); readonly attribute unsigned short errorCode getter raises (IDBDatabaseException); + readonly attribute DOMError error + getter raises (IDBDatabaseException); readonly attribute [TreatReturnedNullStringAs=Undefined] DOMString webkitErrorMessage getter raises (IDBDatabaseException); + readonly attribute IDBAny source; readonly attribute IDBTransaction transaction; diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp index e9d3b97f5..f5c744b15 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp @@ -118,6 +118,26 @@ IDBDatabase* IDBTransaction::db() const return m_database.get(); } +PassRefPtr<DOMError> IDBTransaction::error(ExceptionCode& ec) const +{ + if (!m_transactionFinished) { + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; + return 0; + } + return m_error; +} + +void IDBTransaction::setError(PassRefPtr<DOMError> error) +{ + ASSERT(!m_transactionFinished); + ASSERT(error); + + // The first error to be set is the true cause of the + // transaction abort. + if (!m_error) + m_error = error; +} + PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, ExceptionCode& ec) { if (m_transactionFinished) { diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h index 641f62b81..1cebe9c19 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h @@ -29,6 +29,7 @@ #if ENABLE(INDEXED_DATABASE) #include "ActiveDOMObject.h" +#include "DOMError.h" #include "DOMStringList.h" #include "Event.h" #include "EventListener.h" @@ -70,6 +71,9 @@ public: const String& mode() const; IDBDatabase* db() const; + PassRefPtr<DOMError> error(ExceptionCode&) const; + void setError(PassRefPtr<DOMError>); + PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCode&); void abort(); @@ -129,6 +133,7 @@ private: const unsigned short m_mode; bool m_transactionFinished; // Is it possible that we'll fire any more events or allow any new requests? If not, we're finished. bool m_contextStopped; + RefPtr<DOMError> m_error; ListHashSet<IDBRequest*> m_childRequests; diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.idl b/Source/WebCore/Modules/indexeddb/IDBTransaction.idl index b585108b7..a0e54c03e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.idl +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.idl @@ -39,6 +39,9 @@ module storage { // Properties readonly attribute DOMString mode; readonly attribute IDBDatabase db; + readonly attribute DOMError error + getter raises (IDBDatabaseException); + // Methods IDBObjectStore objectStore (in DOMString name) raises (IDBDatabaseException); diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp index 0a79a97a1..d910c6c2c 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp @@ -72,7 +72,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor // Does a linear search, but it really shouldn't be that slow in practice. if (m_mode != IDBTransaction::VERSION_CHANGE && !m_objectStoreNames->contains(name)) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return 0; } @@ -82,7 +82,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor // There's a bug to make this impossible in the spec. When we make it impossible here, we // can remove this check. if (!objectStore) { - ec = IDBDatabaseException::NOT_FOUND_ERR; + ec = IDBDatabaseException::IDB_NOT_FOUND_ERR; return 0; } return objectStore.release(); diff --git a/Source/WebCore/Modules/websockets/WebSocket.cpp b/Source/WebCore/Modules/websockets/WebSocket.cpp index 39dc045c3..3c5c59c6a 100644 --- a/Source/WebCore/Modules/websockets/WebSocket.cpp +++ b/Source/WebCore/Modules/websockets/WebSocket.cpp @@ -557,6 +557,8 @@ void WebSocket::didClose(unsigned long unhandledBufferedAmount, ClosingHandshake if (!m_channel) return; bool wasClean = m_state == CLOSING && !unhandledBufferedAmount && closingHandshakeCompletion == ClosingHandshakeComplete; + if (!m_useHixie76Protocol) + wasClean = wasClean && code != WebSocketChannel::CloseEventCodeAbnormalClosure; m_state = CLOSED; m_bufferedAmount = unhandledBufferedAmount; ASSERT(scriptExecutionContext()); diff --git a/Source/WebCore/Modules/websockets/WebSocketChannel.cpp b/Source/WebCore/Modules/websockets/WebSocketChannel.cpp index 2ce69dd38..c8ee9a8fd 100644 --- a/Source/WebCore/Modules/websockets/WebSocketChannel.cpp +++ b/Source/WebCore/Modules/websockets/WebSocketChannel.cpp @@ -674,12 +674,22 @@ bool WebSocketChannel::processFrame() break; case WebSocketFrame::OpCodeClose: - if (frame.payloadLength >= 2) { + if (!frame.payloadLength) + m_closeEventCode = CloseEventCodeNoStatusRcvd; + else if (frame.payloadLength == 1) { + m_closeEventCode = CloseEventCodeAbnormalClosure; + fail("Received a broken close frame containing an invalid size body."); + return false; + } else { unsigned char highByte = static_cast<unsigned char>(frame.payload[0]); unsigned char lowByte = static_cast<unsigned char>(frame.payload[1]); m_closeEventCode = highByte << 8 | lowByte; - } else - m_closeEventCode = CloseEventCodeNoStatusRcvd; + if (m_closeEventCode == CloseEventCodeNoStatusRcvd || m_closeEventCode == CloseEventCodeAbnormalClosure || m_closeEventCode == CloseEventCodeTLSHandshake) { + m_closeEventCode = CloseEventCodeAbnormalClosure; + fail("Received a broken close frame containing a reserved status code."); + return false; + } + } if (frame.payloadLength >= 3) m_closeEventReason = String::fromUTF8(&frame.payload[2], frame.payloadLength - 2); else diff --git a/Source/WebCore/Modules/websockets/WebSocketChannel.h b/Source/WebCore/Modules/websockets/WebSocketChannel.h index 0b7607ffb..31e470aa9 100644 --- a/Source/WebCore/Modules/websockets/WebSocketChannel.h +++ b/Source/WebCore/Modules/websockets/WebSocketChannel.h @@ -102,7 +102,12 @@ public: CloseEventCodeFrameTooLarge = 1004, CloseEventCodeNoStatusRcvd = 1005, CloseEventCodeAbnormalClosure = 1006, - CloseEventCodeInvalidUTF8 = 1007, + CloseEventCodeInvalidFramePayloadData = 1007, + CloseEventCodePolicyViolation = 1008, + CloseEventCodeMessageTooBig = 1009, + CloseEventCodeMandatoryExt = 1010, + CloseEventCodeInternalError = 1011, + CloseEventCodeTLSHandshake = 1015, CloseEventCodeMinimumUserDefined = 3000, CloseEventCodeMaximumUserDefined = 4999 }; diff --git a/Source/WebCore/Modules/websockets/WebSocketFrame.cpp b/Source/WebCore/Modules/websockets/WebSocketFrame.cpp index fa6f3845e..a2876eadb 100644 --- a/Source/WebCore/Modules/websockets/WebSocketFrame.cpp +++ b/Source/WebCore/Modules/websockets/WebSocketFrame.cpp @@ -27,6 +27,7 @@ #include "WebSocketFrame.h" #include <wtf/CryptographicallyRandomNumber.h> +#include <wtf/MathExtras.h> using namespace std; @@ -94,12 +95,7 @@ WebSocketFrame::ParseFrameResult WebSocketFrame::parseFrame(char* data, size_t d } } - // FIXME: UINT64_C(0x7FFFFFFFFFFFFFFF) should be used but it did not compile on Qt bots. -#if COMPILER(MSVC) - static const uint64_t maxPayloadLength = 0x7FFFFFFFFFFFFFFFui64; -#else - static const uint64_t maxPayloadLength = 0x7FFFFFFFFFFFFFFFull; -#endif + static const uint64_t maxPayloadLength = UINT64_C(0x7FFFFFFFFFFFFFFF); size_t maskingKeyLength = masked ? maskingKeyWidthInBytes : 0; if (payloadLength64 > maxPayloadLength || payloadLength64 + maskingKeyLength > numeric_limits<size_t>::max()) { errorString = "WebSocket frame length too large: " + String::number(payloadLength64) + " bytes"; diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 5ec087e62..e90d78190 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -4,7 +4,6 @@ LIST(APPEND WebCore_LINK_FLAGS ) LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${JAVASCRIPTCORE_DIR}/wtf/gobject" "${WEBCORE_DIR}/accessibility/efl" "${WEBCORE_DIR}/page/efl" "${WEBCORE_DIR}/platform/efl" diff --git a/Source/WebCore/Resources/DefaultFonts.plist.in b/Source/WebCore/Resources/DefaultFonts.plist.in deleted file mode 100644 index 68aa4b3a5..000000000 --- a/Source/WebCore/Resources/DefaultFonts.plist.in +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>hant</key> <!-- Traditional Chinese --> - <dict> - <key>monospace</key> - <string>Heiti TC</string> - <key>standard</key> - <string>Apple LiSung</string> - <key>sans-serif</key> - <string>Heiti TC</string> - <key>serif</key> - <string>Apple LiSung</string> - </dict> - <key>hans</key> <!-- Simplified Chinese --> - <dict> - <key>monospace</key> - <string>Heiti SC</string> - <key>standard</key> - <string>STSong</string> - <key>sans-serif</key> - <string>Heiti SC</string> - <key>serif</key> - <string>STSong</string> - </dict> - <key>hrkt</key> <!-- Japanese --> - <dict> - <key>monospace</key> - <string>Osaka-Mono</string> - <key>standard</key> - <string>Hiragino Mincho ProN</string> - <key>sans-serif</key> - <string>Hiragino Kaku Gothic ProN</string> - <key>serif</key> - <string>Hiragino Mincho ProN</string> - </dict> - <key>hang</key> <!-- Korean --> - <dict> - <key>standard</key> - <string>AppleMyungjo</string> -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) - <key>monospace</key> - <string>Apple SD Gothic Neo</string> - <key>sans-serif</key> - <string>Apple SD Gothic Neo</string> -#else - <key>monospace</key> - <string>AppleGothic</string> - <key>sans-serif</key> - <string>AppleGothic</string> -#endif - <key>serif</key> - <string>AppleMyungjo</string> - </dict> - <key>zyyy</key> <!-- Other scripts (USCRIPT_COMMON) --> - <dict> - <key>monospace</key> - <string>Courier</string> - <key>standard</key> - <string>Times</string> - <key>sans-serif</key> - <string>Helvetica</string> - <key>serif</key> - <string>Times</string> - </dict> -</dict> -</plist> diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index d391afe2f..3ee85e793 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -1061,6 +1061,7 @@ SOURCES += \ page/SuspendableTimer.cpp \ page/UserContentURLPattern.cpp \ page/WindowFeatures.cpp \ + page/WindowFocusAllowedIndicator.cpp \ plugins/PluginData.cpp \ plugins/DOMPluginArray.cpp \ plugins/DOMPlugin.cpp \ @@ -1083,6 +1084,7 @@ SOURCES += \ platform/ContentType.cpp \ platform/CrossThreadCopier.cpp \ platform/DateComponents.cpp \ + platform/Decimal.cpp \ platform/DragData.cpp \ platform/DragImage.cpp \ platform/EventTracer.cpp \ @@ -1091,7 +1093,6 @@ SOURCES += \ platform/FileStream.cpp \ platform/FileSystem.cpp \ platform/HistogramSupport.cpp \ - platform/image-decoders/qt/ImageFrameQt.cpp \ platform/graphics/FontDescription.cpp \ platform/graphics/FontFallbackList.cpp \ platform/graphics/FontFamily.cpp \ @@ -1144,6 +1145,11 @@ SOURCES += \ platform/graphics/transforms/TransformOperations.cpp \ platform/graphics/transforms/TransformState.cpp \ platform/graphics/transforms/TranslateTransformOperation.cpp \ + platform/image-decoders/ImageDecoder.cpp \ + platform/image-decoders/bmp/BMPImageDecoder.cpp \ + platform/image-decoders/bmp/BMPImageReader.cpp \ + platform/image-decoders/gif/GIFImageDecoder.cpp \ + platform/image-decoders/gif/GIFImageReader.cpp\ platform/KillRingNone.cpp \ platform/KURL.cpp \ platform/Language.cpp \ @@ -2188,6 +2194,7 @@ HEADERS += \ page/WebKitAnimation.h \ page/WebKitAnimationList.h \ page/WindowFeatures.h \ + page/WindowFocusAllowedIndicator.h \ page/WorkerNavigator.h \ platform/animation/Animation.h \ platform/animation/AnimationList.h \ @@ -2200,6 +2207,7 @@ HEADERS += \ platform/ContextMenu.h \ platform/CrossThreadCopier.h \ platform/DateComponents.h \ + platform/Decimal.h \ platform/DragData.h \ platform/DragImage.h \ platform/EventTracer.h \ @@ -2300,6 +2308,13 @@ HEADERS += \ platform/graphics/transforms/TransformOperations.h \ platform/graphics/transforms/TransformState.h \ platform/graphics/transforms/TranslateTransformOperation.h \ + platform/image-decoders/bmp/BMPImageDecoder.h \ + platform/image-decoders/bmp/BMPImageReader.h \ + platform/image-decoders/ico/ICOImageDecoder.h \ + platform/image-decoders/gif/GIFImageDecoder.h \ + platform/image-decoders/gif/GIFImageReader.h \ + platform/image-decoders/jpeg/JPEGImageDecoder.h \ + platform/image-decoders/png/PNGImageDecoder.h \ platform/KillRing.h \ platform/KURL.h \ platform/Length.h \ @@ -2634,7 +2649,6 @@ HEADERS += \ svg/properties/SVGAnimatedProperty.h \ svg/properties/SVGAnimatedPropertyDescription.h \ svg/properties/SVGAnimatedPropertyMacros.h \ - svg/properties/SVGAnimatedPropertySynchronizer.h \ svg/properties/SVGAnimatedPropertyTearOff.h \ svg/properties/SVGAnimatedStaticPropertyTearOff.h \ svg/properties/SVGAnimatedTransformListPropertyTearOff.h \ @@ -2878,6 +2892,7 @@ SOURCES += \ platform/graphics/qt/GraphicsContextQt.cpp \ platform/graphics/qt/IconQt.cpp \ platform/graphics/qt/ImageBufferQt.cpp \ + platform/graphics/qt/ImageDecoderQt.cpp \ platform/graphics/qt/ImageQt.cpp \ platform/graphics/qt/IntPointQt.cpp \ platform/graphics/qt/IntRectQt.cpp \ @@ -4053,33 +4068,19 @@ contains(DEFINES, ENABLE_MHTML=1) { page/PageSerializer.cpp } -contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=1) { - HEADERS += platform/graphics/qt/ImageDecoderQt.h - SOURCES += platform/graphics/qt/ImageDecoderQt.cpp -} else { - HEADERS += \ - platform/image-decoders/bmp/BMPImageDecoder.h \ - platform/image-decoders/bmp/BMPImageReader.h \ - platform/image-decoders/gif/GIFImageDecoder.h \ - platform/image-decoders/gif/GIFImageReader.h\ - platform/image-decoders/ico/ICOImageDecoder.h \ - platform/image-decoders/jpeg/JPEGImageDecoder.h \ - platform/image-decoders/png/PNGImageDecoder.h +contains(DEFINES, HAVE_LIBPNG=1) { + SOURCES += platform/image-decoders/ico/ICOImageDecoder.cpp \ + platform/image-decoders/png/PNGImageDecoder.cpp +} - SOURCES += \ - platform/image-decoders/ImageDecoder.cpp \ - platform/image-decoders/bmp/BMPImageDecoder.cpp \ - platform/image-decoders/bmp/BMPImageReader.cpp \ - platform/image-decoders/gif/GIFImageDecoder.cpp \ - platform/image-decoders/gif/GIFImageReader.cpp\ - platform/image-decoders/ico/ICOImageDecoder.cpp \ - platform/image-decoders/jpeg/JPEGImageDecoder.cpp \ - platform/image-decoders/png/PNGImageDecoder.cpp +contains(DEFINES, HAVE_LIBJPEG=1) { + SOURCES += platform/image-decoders/jpeg/JPEGImageDecoder.cpp +} - contains(DEFINES, WTF_USE_WEBP=1) { - HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h - SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp - } +contains(DEFINES, WTF_USE_WEBP=1) { + INCLUDEPATH += platform/image-decoders/webp + HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h + SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp } !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) { diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index de2325023..ba0aac8b9 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -281,7 +281,6 @@ __ZN7WebCore12SharedBufferC1EPKci __ZN7WebCore12SharedBufferC1EPKhi __ZN7WebCore12SharedBufferC1Ev __ZN7WebCore12SharedBufferD1Ev -__ZN7WebCore12SpellChecker17didCheckSucceededEiRKN3WTF6VectorINS_18TextCheckingResultELm0EEE __ZN7WebCore12TextEncodingC1ERKN3WTF6StringE __ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb __ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_13ContainerNodeEiib @@ -1797,8 +1796,7 @@ __ZNK7WebCore12IconDatabase9isEnabledEv #if ENABLE(INSPECTOR) __ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE __ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE -__ZN7WebCore19InspectorController14enableProfilerEv -__ZN7WebCore19InspectorController15disableProfilerEv +__ZN7WebCore19InspectorController18setProfilerEnabledEb __ZN7WebCore19InspectorController15profilerEnabledEv __ZN7WebCore19InspectorController18disconnectFrontendEv __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 309e33584..825588479 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -173,7 +173,6 @@ '../svg/SVGStylable.idl', '../svg/SVGTests.idl', '../svg/SVGTransformable.idl', - '../svg/SVGViewSpec.idl', # FIXME: I don't know why these are excluded, either. # Someone (me?) should figure it out and add appropriate comments. @@ -575,6 +574,7 @@ { 'action_name': 'HTMLEntityTable', 'inputs': [ + '../html/parser/create-html-entity-table', '../html/parser/HTMLEntityNames.in', ], 'outputs': [ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index dfb579af0..18a514f25 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -259,6 +259,7 @@ 'page/UserStyleSheetTypes.h', 'page/WebCoreKeyboardUIMode.h', 'page/WindowFeatures.h', + 'page/WindowFocusAllowedIndicator.h', 'page/animation/AnimationController.h', 'page/mac/WebCoreFrameView.h', 'platform/Clock.h', @@ -271,6 +272,7 @@ 'platform/CookiesStrategy.h', 'platform/Cursor.h', 'platform/DateComponents.h', + 'platform/Decimal.h', 'platform/DragData.h', 'platform/DragImage.h', 'platform/EventTracer.h', @@ -739,7 +741,6 @@ 'svg/properties/SVGAnimatedProperty.h', 'svg/properties/SVGAnimatedPropertyDescription.h', 'svg/properties/SVGAnimatedPropertyMacros.h', - 'svg/properties/SVGAnimatedPropertySynchronizer.h', 'svg/properties/SVGAnimatedPropertyTearOff.h', 'svg/properties/SVGAnimatedStaticPropertyTearOff.h', 'svg/properties/SVGAnimatedTransformListPropertyTearOff.h', @@ -1780,7 +1781,6 @@ 'accessibility/AccessibilityTableRow.h', 'accessibility/chromium/AXObjectCacheChromium.cpp', 'accessibility/chromium/AccessibilityObjectChromium.cpp', - 'accessibility/chromium/AccessibilityObjectWrapper.h', 'accessibility/efl/AccessibilityObjectEfl.cpp', 'accessibility/gtk/AXObjectCacheAtk.cpp', 'accessibility/gtk/AccessibilityObjectAtk.cpp', @@ -3085,6 +3085,7 @@ 'page/WebKitAnimationList.h', 'page/WebKitPoint.h', 'page/WindowFeatures.cpp', + 'page/WindowFocusAllowedIndicator.cpp', 'page/WorkerNavigator.cpp', 'page/WorkerNavigator.h', 'page/animation/AnimationBase.cpp', @@ -3149,6 +3150,7 @@ 'platform/CrossThreadCopier.h', 'platform/Cursor.cpp', 'platform/DateComponents.cpp', + 'platform/Decimal.cpp', 'platform/DragData.cpp', 'platform/DragImage.cpp', 'platform/EventLoop.h', @@ -3875,7 +3877,6 @@ 'platform/graphics/gstreamer/GStreamerGWorld.cpp', 'platform/graphics/gstreamer/GStreamerGWorld.h', 'platform/graphics/gstreamer/ImageGStreamer.h', - 'platform/graphics/gstreamer/ImageGStreamerCG.mm', 'platform/graphics/gstreamer/ImageGStreamerCairo.cpp', 'platform/graphics/gstreamer/ImageGStreamerQt.cpp', 'platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp', @@ -6548,6 +6549,7 @@ 'inspector/front-end/helpScreen.css', 'inspector/front-end/indexedDBViews.css', 'inspector/front-end/inspectorCommon.css', + 'inspector/front-end/nativeMemoryProfiler.css', 'inspector/front-end/navigatorView.css', 'inspector/front-end/networkLogView.css', 'inspector/front-end/networkPanel.css', @@ -7169,6 +7171,8 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGVKernElement.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGVKernElement.mm', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGVKernElementInternal.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGViewSpec.dep', + '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGViewSpec.mm', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGViewElement.dep', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGViewElement.mm', '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMSVGZoomEvent.mm', @@ -8133,6 +8137,9 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewElement.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewElement.dep', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewElement.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewSpec.cpp', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewSpec.dep', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGViewSpec.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGZoomAndPan.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGZoomAndPan.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSVGZoomEvent.cpp', @@ -8324,6 +8331,7 @@ 'platform/chromium/support/WebPrerender.cpp', 'platform/chromium/support/WebThreadSafeData.cpp', 'platform/chromium/support/WebTransformationMatrix.cpp', + 'platform/chromium/support/WebTransformOperations.cpp', 'platform/chromium/support/WebURL.cpp', 'platform/chromium/support/WebURLError.cpp', 'platform/chromium/support/WebURLRequest.cpp', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index 1af438b74..28b7b7a18 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -29345,7 +29345,6 @@ __ZN7WebCore14SVGRectElement36synchronizeExternalResourcesRequiredEv __ZN7WebCore8SVGTests21synchronizePropertiesEPNS_10SVGElementERKNS_13QualifiedNameE __ZN7WebCore8SVGTests27synchronizeRequiredFeaturesEPNS_10SVGElementE __ZNK7WebCore13SVGStringList13valueAsStringEv -__ZN7WebCore31SVGAnimatedPropertySynchronizerILb1EE11synchronizeEPNS_10SVGElementERKNS_13QualifiedNameERKN3WTF12AtomicStringE __ZN7WebCore8SVGTests29synchronizeRequiredExtensionsEPNS_10SVGElementE __ZN7WebCore8SVGTests25synchronizeSystemLanguageEPNS_10SVGElementE __ZN7WebCore37jsSVGNumberListPrototypeFunctionClearEPN3JSC9ExecStateE diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 98444c6e6..08db64c0c 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -65,6 +65,11 @@ INCLUDEPATH += \ $$SOURCE_DIR/platform/graphics/texmap \ $$SOURCE_DIR/platform/graphics/transforms \ $$SOURCE_DIR/platform/image-decoders \ + $$SOURCE_DIR/platform/image-decoders/bmp \ + $$SOURCE_DIR/platform/image-decoders/ico \ + $$SOURCE_DIR/platform/image-decoders/gif \ + $$SOURCE_DIR/platform/image-decoders/jpeg \ + $$SOURCE_DIR/platform/image-decoders/png \ $$SOURCE_DIR/platform/leveldb \ $$SOURCE_DIR/platform/mock \ $$SOURCE_DIR/platform/network \ @@ -223,25 +228,29 @@ contains(DEFINES, WTF_USE_TEXTURE_MAPPER_GL=1)|contains(DEFINES, ENABLE_WEBGL=1) LIBS += -lsqlite3 } -contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=0) { - INCLUDEPATH += \ - $$SOURCE_DIR/platform/image-decoders/bmp \ - $$SOURCE_DIR/platform/image-decoders/gif \ - $$SOURCE_DIR/platform/image-decoders/ico \ - $$SOURCE_DIR/platform/image-decoders/jpeg \ - $$SOURCE_DIR/platform/image-decoders/png +contains(DEFINES, WTF_USE_WEBP=1) { + INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp + LIBS += -lwebp +} - haveQt(5) { - # Qt5 allows us to use config tests to check for the presence of these libraries - !contains(config_test_libjpeg, yes): error("JPEG library not found!") - !contains(config_test_libpng, yes): error("PNG library not found!") +haveQt(5) { + # Qt5 allows us to use config tests to check for the presence of these libraries + contains(config_test_libjpeg, yes) { + DEFINES += HAVE_LIBJPEG=1 + LIBS += -ljpeg + } else { + warning("JPEG library not found! QImageDecoder will decode JPEG images.") } - - LIBS += -ljpeg -lpng - - contains(DEFINES, WTF_USE_WEBP=1) { - INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp - LIBS += -lwebp + contains(config_test_libpng, yes) { + DEFINES += HAVE_LIBPNG=1 + LIBS += -lpng + } else { + warning("PNG library not found! QImageDecoder will decode PNG images.") + } +} else { + !win32-*:!mac { + DEFINES += HAVE_LIBJPEG=1 HAVE_LIBPNG=1 + LIBS += -ljpeg -lpng } } diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 844b8d3d0..c3ccdf97b 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -21834,6 +21834,62 @@ > </File> <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSSVGViewSpec.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSSVGViewSpec.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSSVGVKernElement.cpp" > <FileConfiguration @@ -26891,6 +26947,14 @@ > </File> <File + RelativePath="..\page\WindowFocusAllowedIndicator.cpp" + > + </File> + <File + RelativePath="..\page\WindowFocusAllowedIndicator.h" + > + </File> + <File RelativePath="..\page\WorkerNavigator.cpp" > </File> @@ -27835,6 +27899,14 @@ > </File> <File + RelativePath="..\platform\Decimal.cpp" + > + </File> + <File + RelativePath="..\platform\Decimal.h" + > + </File> + <File RelativePath="..\platform\DragData.cpp" > </File> @@ -72182,10 +72254,6 @@ > </File> <File - RelativePath="..\svg\properties\SVGAnimatedPropertySynchronizer.h" - > - </File> - <File RelativePath="..\svg\properties\SVGAnimatedPropertyTearOff.h" > </File> @@ -74630,6 +74698,10 @@ > </File> <File + RelativePath="..\inspector\front-end\nativeMemoryProfiler.css" + > + </File> + <File RelativePath="..\inspector\front-end\navigatorView.css" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 741bc73f7..9461ef94a 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -137,7 +137,6 @@ 081668D4125603BF006F25DE /* SVGTextChunkBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D2125603BF006F25DE /* SVGTextChunkBuilder.h */; }; 081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */; }; 081AA8DA1111237E002AB06E /* SVGElementRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 081AA8D91111237E002AB06E /* SVGElementRareData.h */; }; - 081CDFBF126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 081CDFBE126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 081EBF3A0FD34F4100DA7559 /* SVGFilterBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */; }; 081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */; }; @@ -1194,6 +1193,8 @@ 450CEBF015073BBE002BB149 /* LabelableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 450CEBEE15073BBE002BB149 /* LabelableElement.cpp */; }; 450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 450CEBEF15073BBE002BB149 /* LabelableElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; }; + 45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; }; 46700ED0127B96CB00F5D5D6 /* FileWriterSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */; }; 46700ED1127B96CB00F5D5D6 /* FileWriterSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */; }; @@ -1804,10 +1805,15 @@ 6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; }; 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; }; 7117445914BC34EC00EE5FC8 /* SVGTextMetricsBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7117445714BC34E200EE5FC8 /* SVGTextMetricsBuilder.h */; }; + 7118FED415685CC60030B79A /* JSSVGViewSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7118FED215685CC60030B79A /* JSSVGViewSpec.cpp */; }; + 7118FED515685CC60030B79A /* JSSVGViewSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 7118FED315685CC60030B79A /* JSSVGViewSpec.h */; }; 7134496D146941B300720312 /* SVGLengthContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7134496B146941B300720312 /* SVGLengthContext.cpp */; }; 7134496E146941B300720312 /* SVGLengthContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134496C146941B300720312 /* SVGLengthContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */ = {isa = PBXBuildFile; fileRef = 715379FF146BD9D6008BD615 /* SVGPathData.h */; }; 7157F062150B6564006EAABD /* SVGAnimatedTransformList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */; }; + 717A1981156A63BE00F9FE8C /* DOMSVGViewSpecInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 710867D51568644B00AA779B /* DOMSVGViewSpecInternal.h */; }; + 71904DE8156A631C001E1BA5 /* DOMSVGViewSpec.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 71FE57EE156A620600ABEBD3 /* DOMSVGViewSpec.h */; }; + 71904DEA156A633A001E1BA5 /* DOMSVGViewSpecInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 718512331568649800C40967 /* DOMSVGViewSpecInternal.h */; }; 71A57DF1154BE25C0009D120 /* SVGPathUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71A57DEF154BE25C0009D120 /* SVGPathUtilities.cpp */; }; 71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; }; 71CC7A20152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71CC7A1F152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp */; }; @@ -1815,6 +1821,8 @@ 71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; }; 71E623D1151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */; }; 71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 71FE57F0156A620600ABEBD3 /* DOMSVGViewSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FE57EE156A620600ABEBD3 /* DOMSVGViewSpec.h */; }; + 71FE57F1156A620600ABEBD3 /* DOMSVGViewSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71FE57EF156A620600ABEBD3 /* DOMSVGViewSpec.mm */; }; 72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; }; 750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; }; 750D029411D0E7F300BD1B27 /* RenderInputSpeech.h in Headers */ = {isa = PBXBuildFile; fileRef = 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */; }; @@ -5421,6 +5429,8 @@ BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8243260D0CE8A200460C8F /* JSSQLTransaction.h */; }; BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */; }; BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8243E70D0CFD7500460C8F /* WindowFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 7E99AF510B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */; }; + 7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC85F23D151915E000BC17BE /* RenderNamedFlowThread.h in Headers */ = {isa = PBXBuildFile; fileRef = BC85F23C151915E000BC17BE /* RenderNamedFlowThread.h */; }; BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */; }; BC8AE34F12EA096A00EB3AE6 /* ScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5912,7 +5922,6 @@ E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E182568E0EF2B02D00933242 /* JSWorkerContext.h */; }; E18258AC0EF3CD7000933242 /* JSWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */; }; E18772F1126E2629003DD586 /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18772F0126E2629003DD586 /* Language.cpp */; }; - E19582311536099C00B60875 /* DefaultFonts.plist in Resources */ = {isa = PBXBuildFile; fileRef = E19582301536099C00B60875 /* DefaultFonts.plist */; }; E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */; }; E1A3162D134BC32D007C9A4F /* WebNSAttributedStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; E1A3162E134BC32D007C9A4F /* WebNSAttributedStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */; }; @@ -6875,7 +6884,9 @@ A80F3B7D0CCDCE24002DD990 /* DOMSVGUseElementInternal.h in Copy Generated Headers */, A8F46A910CB20A9D003A9670 /* DOMSVGViewElement.h in Copy Generated Headers */, A80F3B5F0CCDCE24002DD990 /* DOMSVGViewElementInternal.h in Copy Generated Headers */, + 71904DE8156A631C001E1BA5 /* DOMSVGViewSpec.h in Copy Generated Headers */, A8F46AFD0CB20A9D003A9670 /* DOMSVGZoomAndPan.h in Copy Generated Headers */, + 71904DEA156A633A001E1BA5 /* DOMSVGViewSpecInternal.h in Copy Generated Headers */, A8F46A930CB20A9D003A9670 /* DOMSVGZoomEvent.h in Copy Generated Headers */, A80F3BB10CCDCE24002DD990 /* DOMSVGZoomEventInternal.h in Copy Generated Headers */, 1C11CCC20AA6093700DADB20 /* DOMText.h in Copy Generated Headers */, @@ -7015,7 +7026,6 @@ 081668D7125603D5006F25DE /* SVGTextLayoutEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutEngine.cpp; sourceTree = "<group>"; }; 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngine.h; sourceTree = "<group>"; }; 081AA8D91111237E002AB06E /* SVGElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementRareData.h; sourceTree = "<group>"; }; - 081CDFBE126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertySynchronizer.h; sourceTree = "<group>"; }; 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyInfo.h; sourceTree = "<group>"; }; 081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilterBuilder.cpp; sourceTree = "<group>"; }; 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilterBuilder.h; sourceTree = "<group>"; }; @@ -8195,6 +8205,8 @@ 450CEBEE15073BBE002BB149 /* LabelableElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelableElement.cpp; sourceTree = "<group>"; }; 450CEBEF15073BBE002BB149 /* LabelableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelableElement.h; sourceTree = "<group>"; }; 45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; }; + 45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; }; + 45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; }; 4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; }; 46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileWriterSync.cpp; path = Modules/filesystem/FileWriterSync.cpp; sourceTree = "<group>"; }; 46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileWriterSync.h; path = Modules/filesystem/FileWriterSync.h; sourceTree = "<group>"; }; @@ -8852,13 +8864,17 @@ 6ED878C3147493F4004C3597 /* RenderTableCaption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTableCaption.h; sourceTree = "<group>"; }; 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; }; 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; }; + 710867D51568644B00AA779B /* DOMSVGViewSpecInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGViewSpecInternal.h; sourceTree = "<group>"; }; 7117445614BC34E200EE5FC8 /* SVGTextMetricsBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextMetricsBuilder.cpp; sourceTree = "<group>"; }; 7117445714BC34E200EE5FC8 /* SVGTextMetricsBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextMetricsBuilder.h; sourceTree = "<group>"; }; + 7118FED215685CC60030B79A /* JSSVGViewSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGViewSpec.cpp; sourceTree = "<group>"; }; + 7118FED315685CC60030B79A /* JSSVGViewSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGViewSpec.h; sourceTree = "<group>"; }; 7134496B146941B300720312 /* SVGLengthContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthContext.cpp; sourceTree = "<group>"; }; 7134496C146941B300720312 /* SVGLengthContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthContext.h; sourceTree = "<group>"; }; 715379FE146BD9D6008BD615 /* SVGPathData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathData.cpp; sourceTree = "<group>"; }; 715379FF146BD9D6008BD615 /* SVGPathData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathData.h; sourceTree = "<group>"; }; 7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTransformList.cpp; sourceTree = "<group>"; }; + 718512331568649800C40967 /* DOMSVGViewSpecInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMSVGViewSpecInternal.h; sourceTree = "<group>"; }; 71A57DEF154BE25C0009D120 /* SVGPathUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathUtilities.cpp; sourceTree = "<group>"; }; 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathUtilities.h; sourceTree = "<group>"; }; 71CC7A1F152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedEnumeration.cpp; sourceTree = "<group>"; }; @@ -8867,6 +8883,8 @@ 71E623CE151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedIntegerOptionalInteger.cpp; sourceTree = "<group>"; }; 71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedIntegerOptionalInteger.h; sourceTree = "<group>"; }; 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedEnumerationPropertyTearOff.h; sourceTree = "<group>"; }; + 71FE57EE156A620600ABEBD3 /* DOMSVGViewSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGViewSpec.h; sourceTree = "<group>"; }; + 71FE57EF156A620600ABEBD3 /* DOMSVGViewSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGViewSpec.mm; sourceTree = "<group>"; }; 72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; }; 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; }; 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderInputSpeech.h; sourceTree = "<group>"; }; @@ -12552,6 +12570,8 @@ BC8243260D0CE8A200460C8F /* JSSQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransaction.h; sourceTree = "<group>"; }; BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowFeatures.cpp; sourceTree = "<group>"; }; BC8243E70D0CFD7500460C8F /* WindowFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowFeatures.h; sourceTree = "<group>"; }; + 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowFocusAllowedIndicator.cpp; sourceTree = "<group>"; }; + 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowFocusAllowedIndicator.h; sourceTree = "<group>"; }; BC85F23C151915E000BC17BE /* RenderNamedFlowThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderNamedFlowThread.h; sourceTree = "<group>"; }; BC85F23E1519187300BC17BE /* RenderNamedFlowThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderNamedFlowThread.cpp; sourceTree = "<group>"; }; BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollableArea.cpp; sourceTree = "<group>"; }; @@ -13090,7 +13110,6 @@ E182568E0EF2B02D00933242 /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = "<group>"; }; E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextCustom.cpp; sourceTree = "<group>"; }; E18772F0126E2629003DD586 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Language.cpp; sourceTree = "<group>"; }; - E19582301536099C00B60875 /* DefaultFonts.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DefaultFonts.plist; sourceTree = "<group>"; }; E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerNodeAlgorithms.h; sourceTree = "<group>"; }; E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; }; E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSAttributedStringExtras.mm; sourceTree = "<group>"; }; @@ -13154,7 +13173,6 @@ E1B4CD2410B322E200BFFD7E /* CredentialStorageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CredentialStorageMac.mm; sourceTree = "<group>"; }; E1BE512B0CF6C512002EA959 /* XSLTUnicodeSort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTUnicodeSort.cpp; sourceTree = "<group>"; }; E1BE512C0CF6C512002EA959 /* XSLTUnicodeSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTUnicodeSort.h; sourceTree = "<group>"; }; - E1C2F244153398CE0083F974 /* DefaultFonts.plist.in */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = DefaultFonts.plist.in; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.plist; }; E1C2F2481533A2120083F974 /* SettingsMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsMac.mm; sourceTree = "<group>"; }; E1C362ED0EAF2AA9007410BC /* JSWorkerLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerLocation.h; sourceTree = "<group>"; }; E1C362EE0EAF2AA9007410BC /* JSWorkerLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerLocation.cpp; sourceTree = "<group>"; }; @@ -13788,7 +13806,6 @@ 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */, - 081CDFBE126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h */, 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, 08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */, 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, @@ -13998,7 +14015,6 @@ 46D4F2460AF97E810035385A /* cellCursor.png */, 46D4F2470AF97E810035385A /* contextMenuCursor.png */, 4614A1FD0B23A8D600446E1C /* copyCursor.png */, - E1C2F244153398CE0083F974 /* DefaultFonts.plist.in */, 93153BDD141959F400FCF5BE /* deleteButton.png */, 93153BCC1417FBBF00FCF5BE /* deleteButton@2x.png */, 93153BDF14195A2800FCF5BE /* deleteButtonPressed.png */, @@ -15178,7 +15194,6 @@ E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */, 6565814709D13043000E61D7 /* CSSValueKeywords.gperf */, 6565814809D13043000E61D7 /* CSSValueKeywords.h */, - E19582301536099C00B60875 /* DefaultFonts.plist */, 9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */, 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */, 970B72A5145008EB00F00A37 /* EventHeaders.h */, @@ -15576,6 +15591,8 @@ 494BD7940F55C8EE00747828 /* WebKitPoint.idl */, BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */, BC8243E70D0CFD7500460C8F /* WindowFeatures.h */, + 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */, + 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */, E1271A130EEEC80400F61213 /* WorkerNavigator.cpp */, E1271A0A0EEEC77A00F61213 /* WorkerNavigator.h */, E1271A510EEECD1C00F61213 /* WorkerNavigator.idl */, @@ -16195,6 +16212,9 @@ 859D62970AD888EF00012995 /* DOMSVGViewElement.h */, 859D62980AD888EF00012995 /* DOMSVGViewElement.mm */, A8E543C90CA9D1C10097D09B /* DOMSVGViewElementInternal.h */, + 71FE57EE156A620600ABEBD3 /* DOMSVGViewSpec.h */, + 71FE57EF156A620600ABEBD3 /* DOMSVGViewSpec.mm */, + 718512331568649800C40967 /* DOMSVGViewSpecInternal.h */, 84852281119016A7006EDC7F /* DOMSVGVKernElement.h */, 84852282119016A7006EDC7F /* DOMSVGVKernElement.mm */, 859D62990AD888EF00012995 /* DOMSVGZoomAndPan.h */, @@ -16652,6 +16672,7 @@ 859D62D80AD8892700012995 /* DOMSVGUnitTypesInternal.h */, 859D62D90AD8892700012995 /* DOMSVGUseElementInternal.h */, 859D62DA0AD8892700012995 /* DOMSVGViewElementInternal.h */, + 710867D51568644B00AA779B /* DOMSVGViewSpecInternal.h */, 859D62DB0AD8892700012995 /* DOMSVGZoomEventInternal.h */, 4429AB070CB84F81007647C5 /* DOMTextEventInternal.h */, 85E7118A0AC5D5350053270F /* DOMTextInternal.h */, @@ -18381,6 +18402,8 @@ B2FA3D2D0AB75A6F000E5AC4 /* JSSVGUseElement.h */, B2FA3D2E0AB75A6F000E5AC4 /* JSSVGViewElement.cpp */, B2FA3D2F0AB75A6F000E5AC4 /* JSSVGViewElement.h */, + 7118FED215685CC60030B79A /* JSSVGViewSpec.cpp */, + 7118FED315685CC60030B79A /* JSSVGViewSpec.h */, 848522791190162C006EDC7F /* JSSVGVKernElement.cpp */, 8485227A1190162C006EDC7F /* JSSVGVKernElement.h */, 71DCB6FF1568197600862271 /* JSSVGZoomAndPan.cpp */, @@ -20324,6 +20347,8 @@ F587868402DE3B8601EA4122 /* Cursor.h */, A5732B08136A161D005C8D7C /* DateComponents.cpp */, A5732B09136A161D005C8D7C /* DateComponents.h */, + 45FEA5CD156DDE8C00654101 /* Decimal.cpp */, + 45FEA5CE156DDE8C00654101 /* Decimal.h */, A79546420B5C4CB4007B438F /* DragData.cpp */, A7B6E69D0B291A9600D0529F /* DragData.h */, A7CFB3CF0B7ED10A0070C32D /* DragImage.cpp */, @@ -22083,6 +22108,7 @@ F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */, F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */, F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */, + 45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */, A8C228A111D5722E00D5A7D3 /* DecodedDataDocumentParser.h in Headers */, CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */, 4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */, @@ -24465,7 +24491,6 @@ 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */, 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */, 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */, - 081CDFBF126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h in Headers */, 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */, 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */, 08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */, @@ -24867,6 +24892,7 @@ 939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */, 4123E569127B3041000FEEA7 /* WindowEventContext.h in Headers */, BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */, + 7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */, E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */, 501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */, 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */, @@ -24957,6 +24983,9 @@ E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */, 71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */, 0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */, + 7118FED515685CC60030B79A /* JSSVGViewSpec.h in Headers */, + 71FE57F0156A620600ABEBD3 /* DOMSVGViewSpec.h in Headers */, + 717A1981156A63BE00F9FE8C /* DOMSVGViewSpecInternal.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -25075,7 +25104,6 @@ 46D4F2490AF97E810035385A /* cellCursor.png in Resources */, 46D4F24A0AF97E810035385A /* contextMenuCursor.png in Resources */, 4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */, - E19582311536099C00B60875 /* DefaultFonts.plist in Resources */, 93153BDE141959F400FCF5BE /* deleteButton.png in Resources */, 93153BCD1417FBBF00FCF5BE /* deleteButton@2x.png in Resources */, 93153BE014195A2800FCF5BE /* deleteButtonPressed.png in Resources */, @@ -25577,6 +25605,7 @@ F55B3DB51251F12D003EF269 /* DateInputType.cpp in Sources */, F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */, F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */, + 45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */, A8C228A211D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp in Sources */, 4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */, 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */, @@ -27906,6 +27935,7 @@ 939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */, 4123E56A127B3041000FEEA7 /* WindowEventContext.cpp in Sources */, BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */, + 7E99AF510B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp in Sources */, 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */, 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */, F3820896147D35F90010BC06 /* WorkerConsoleAgent.cpp in Sources */, @@ -27989,6 +28019,8 @@ E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */, 71DCB7011568197600862271 /* JSSVGZoomAndPan.cpp in Sources */, 0F3F0E59157030C3006DA57F /* RenderGeometryMap.cpp in Sources */, + 7118FED415685CC60030B79A /* JSSVGViewSpec.cpp in Sources */, + 71FE57F1156A620600ABEBD3 /* DOMSVGViewSpec.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp index b0288170f..71a2214ea 100644 --- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -525,7 +525,7 @@ void AXObjectCache::postNotification(AccessibilityObject* object, Document* docu return; if (postType == PostAsynchronously) { - m_notificationsToPost.append(make_pair(object, notification)); + m_notificationsToPost.append(std::make_pair(object, notification)); if (!m_notificationPostTimer.isActive()) m_notificationPostTimer.startOneShot(0); } else diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index 54f525e4e..245bda5bf 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -74,6 +74,8 @@ AccessibilityObject::AccessibilityObject() , m_role(UnknownRole) #if PLATFORM(GTK) , m_wrapper(0) +#elif PLATFORM(CHROMIUM) + , m_detached(false) #endif { } @@ -85,11 +87,24 @@ AccessibilityObject::~AccessibilityObject() void AccessibilityObject::detach() { -#if HAVE(ACCESSIBILITY) +#if HAVE(ACCESSIBILITY) && PLATFORM(CHROMIUM) + m_detached = true; +#elif HAVE(ACCESSIBILITY) setWrapper(0); #endif } +bool AccessibilityObject::isDetached() const +{ +#if HAVE(ACCESSIBILITY) && PLATFORM(CHROMIUM) + return m_detached; +#elif HAVE(ACCESSIBILITY) + return !wrapper(); +#else + return true; +#endif +} + bool AccessibilityObject::isAccessibilityObjectSearchMatch(AccessibilityObject* axObject, AccessibilitySearchCriteria* criteria) { if (!axObject || !criteria) diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h index 1ca68d41b..649ddd70c 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.h +++ b/Source/WebCore/accessibility/AccessibilityObject.h @@ -43,8 +43,6 @@ #elif PLATFORM(WIN) && !OS(WINCE) #include "AccessibilityObjectWrapperWin.h" #include "COMPtr.h" -#elif PLATFORM(CHROMIUM) -#include "AccessibilityObjectWrapper.h" #endif #if PLATFORM(MAC) @@ -65,6 +63,8 @@ typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper; #elif PLATFORM(GTK) typedef struct _AtkObject AtkObject; typedef struct _AtkObject AccessibilityObjectWrapper; +#elif PLATFORM(CHROMIUM) +// Chromium does not use a wrapper. #else class AccessibilityObjectWrapper; #endif @@ -313,7 +313,7 @@ protected: public: virtual ~AccessibilityObject(); virtual void detach(); - virtual bool isDetached() const { return true; } + virtual bool isDetached() const; typedef Vector<RefPtr<AccessibilityObject> > AccessibilityChildrenVector; @@ -669,7 +669,7 @@ public: #if PLATFORM(GTK) AccessibilityObjectWrapper* wrapper() const; void setWrapper(AccessibilityObjectWrapper*); -#else +#elif !PLATFORM(CHROMIUM) AccessibilityObjectWrapper* wrapper() const { return m_wrapper.get(); } void setWrapper(AccessibilityObjectWrapper* wrapper) { @@ -727,7 +727,7 @@ protected: #elif PLATFORM(GTK) AtkObject* m_wrapper; #elif PLATFORM(CHROMIUM) - RefPtr<AccessibilityObjectWrapper> m_wrapper; + bool m_detached; #endif }; diff --git a/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp b/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp index b483058a1..f8afecf62 100644 --- a/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp +++ b/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp @@ -42,16 +42,15 @@ namespace WebCore { + void AXObjectCache::detachWrapper(AccessibilityObject* obj) { - // In Chromium, AccessibilityObjects are wrapped lazily. - if (AccessibilityObjectWrapper* wrapper = obj->wrapper()) - wrapper->detach(); + // In Chromium, AccessibilityObjects are not wrapped. } void AXObjectCache::attachWrapper(AccessibilityObject*) { - // In Chromium, AccessibilityObjects are wrapped lazily. + // In Chromium, AccessibilityObjects are not wrapped. } void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification) diff --git a/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp b/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp index b8d0a514d..e2622b373 100644 --- a/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp +++ b/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp @@ -46,7 +46,7 @@ bool ContextEnabledFeatures::shadowDOMEnabled(DOMWindow* window) if (!window) return false; if (Frame* frame = window->frame()) - return frame->loader()->client()->shadowDOMAllowed(RuntimeEnabledFeatures::shadowDOMEnabled()); + return frame->loader()->client()->allowShadowDOM(RuntimeEnabledFeatures::shadowDOMEnabled()); return false; } #endif diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index b5a03b959..a1d286a74 100644 --- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -184,6 +184,8 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec) UString displayName = function->displayName(exec); if (!displayName.isEmpty()) result->putDirect(exec->globalData(), Identifier(exec, "displayName"), jsString(exec, displayName)); + // FIXME: provide function scope data in "scopesRaw" property when JSC supports it. + // https://bugs.webkit.org/show_bug.cgi?id=87192 return result; } diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp index 249993f27..1576d346d 100644 --- a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp +++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp @@ -49,7 +49,7 @@ using namespace JSC; namespace WebCore { -ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ScriptState* scriptState, long id) +ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ScriptState* scriptState, int id) { JSLock lock(SilenceAssertionsOnly); @@ -95,7 +95,7 @@ InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* scriptState if (!m_inspectedStateAccessCheck(scriptState)) return InjectedScript(); - pair<long, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState); + pair<int, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState); globalObject->setInjectedScript(injectedScriptObject.second.jsObject()); InjectedScript result(injectedScriptObject.second, m_inspectedStateAccessCheck); m_idToInjectedScript.set(injectedScriptObject.first, result); diff --git a/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp b/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp index 02ea9d636..dca498347 100644 --- a/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp +++ b/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp @@ -48,7 +48,7 @@ JSValue JSSVGLength::value(ExecState* exec) const void JSSVGLength::setValue(ExecState* exec, JSValue value) { - if (impl()->role() == AnimValRole) { + if (impl()->isReadOnly()) { setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR); return; } @@ -73,7 +73,7 @@ void JSSVGLength::setValue(ExecState* exec, JSValue value) JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec) { - if (impl()->role() == AnimValRole) { + if (impl()->isReadOnly()) { setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR); return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp index 7dd34ba15..fd80a467f 100644 --- a/Source/WebCore/bindings/js/ScriptController.cpp +++ b/Source/WebCore/bindings/js/ScriptController.cpp @@ -230,7 +230,7 @@ TextPosition ScriptController::eventHandlerPosition() const ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentParser(); if (parser) return parser->textPosition(); - return TextPosition::belowRangePosition(); + return TextPosition::minimumPosition(); } void ScriptController::disableEval() diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp index 970c8505f..c25f76834 100644 --- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp @@ -634,7 +634,9 @@ private: write(index->second); return true; } - return false; + // MessagePort object could not be found in transferred message ports + code = ValidationError; + return true; } if (obj->inherits(&JSArrayBuffer::s_info)) { RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(obj); diff --git a/Source/WebCore/bindings/objc/DOMSVG.h b/Source/WebCore/bindings/objc/DOMSVG.h index 86239da27..4611ef7b4 100644 --- a/Source/WebCore/bindings/objc/DOMSVG.h +++ b/Source/WebCore/bindings/objc/DOMSVG.h @@ -169,5 +169,6 @@ #import <WebCore/DOMSVGUnitTypes.h> #import <WebCore/DOMSVGUseElement.h> #import <WebCore/DOMSVGViewElement.h> +#import <WebCore/DOMSVGViewSpec.h> #import <WebCore/DOMSVGZoomAndPan.h> #import <WebCore/DOMSVGZoomEvent.h> diff --git a/Source/WebCore/bindings/objc/PublicDOMInterfaces.h b/Source/WebCore/bindings/objc/PublicDOMInterfaces.h index 9d6521e84..dc73dd4ab 100644 --- a/Source/WebCore/bindings/objc/PublicDOMInterfaces.h +++ b/Source/WebCore/bindings/objc/PublicDOMInterfaces.h @@ -622,7 +622,7 @@ @property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0; @property BOOL multiple AVAILABLE_IN_WEBKIT_VERSION_4_0; @property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0; -@property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; - (void)select; - (void)click; - (void)setSelectionRange:(int)start end:(int)end AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index ff8fb064b..37e4f1cd0 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -661,7 +661,11 @@ sub GenerateHeader } else { $headerIncludes{"JSDOMBinding.h"} = 1; $headerIncludes{"<runtime/JSGlobalObject.h>"} = 1; - $headerIncludes{"<runtime/ObjectPrototype.h>"} = 1; + if ($dataNode->isException) { + $headerIncludes{"<runtime/ErrorPrototype.h>"} = 1; + } else { + $headerIncludes{"<runtime/ObjectPrototype.h>"} = 1; + } } if ($dataNode->extendedAttributes->{"CustomCall"}) { @@ -1612,7 +1616,8 @@ sub GenerateImplementation if ($hasParent && $parentClassName ne "JSC::DOMNodeFilter") { push(@implContent, " return ${className}Prototype::create(exec->globalData(), globalObject, ${className}Prototype::createStructure(exec->globalData(), globalObject, ${parentClassName}Prototype::self(exec, globalObject)));\n"); } else { - push(@implContent, " return ${className}Prototype::create(exec->globalData(), globalObject, ${className}Prototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));\n"); + my $prototype = $dataNode->isException ? "errorPrototype" : "objectPrototype"; + push(@implContent, " return ${className}Prototype::create(exec->globalData(), globalObject, ${className}Prototype::createStructure(globalObject->globalData(), globalObject, globalObject->${prototype}()));\n"); } push(@implContent, "}\n\n"); } @@ -1956,7 +1961,7 @@ sub GenerateImplementation my $nativeValue = JSValueToNative($attribute->signature, "value"); if ($svgPropertyOrListPropertyType) { if ($svgPropertyType) { - push(@implContent, " if (impl->role() == AnimValRole) {\n"); + push(@implContent, " if (impl->isReadOnly()) {\n"); push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n"); push(@implContent, " return;\n"); push(@implContent, " }\n"); @@ -2129,7 +2134,7 @@ sub GenerateImplementation } else { push(@implContent, " $implType* impl = static_cast<$implType*>(castedThis->impl());\n"); if ($svgPropertyType) { - push(@implContent, " if (impl->role() == AnimValRole) {\n"); + push(@implContent, " if (impl->isReadOnly()) {\n"); push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n"); push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " }\n"); @@ -3099,7 +3104,7 @@ sub NativeToJSValue return "toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))"; } - if ($codeGenerator->IsSVGAnimatedType($implClassName)) { + if ($codeGenerator->IsSVGAnimatedType($implClassName) or $implClassName eq "SVGViewSpec") { # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked. $value = "static_cast<" . GetNativeType($type) . ">($value)"; } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) { diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 0a964893e..3087cbb75 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -1328,7 +1328,7 @@ sub GenerateImplementation $getterContentTail = "))"; } } - } elsif ($codeGenerator->IsSVGAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($idlType)) { + } elsif (($codeGenerator->IsSVGAnimatedType($implClassName) or $implClassName eq "SVGViewSpec") and $codeGenerator->IsSVGTypeNeedingTearOff($idlType)) { my $idlTypeWithNamespace = GetSVGTypeWithNamespace($idlType); $getterContentHead = "kit(static_cast<$idlTypeWithNamespace*>($getterContentHead)"; $getterContentTail .= ")"; @@ -1436,7 +1436,7 @@ sub GenerateImplementation if ($svgPropertyType) { $implIncludes{"ExceptionCode.h"} = 1; $getterContentHead = "$getterExpressionPrefix"; - push(@implContent, " if (IMPL->role() == WebCore::AnimValRole) {\n"); + push(@implContent, " if (IMPL->isReadOnly()) {\n"); push(@implContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n"); push(@implContent, " return;\n"); push(@implContent, " }\n"); @@ -1636,7 +1636,7 @@ sub GenerateImplementation $content = "${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; } elsif ($svgPropertyType) { $implIncludes{"ExceptionCode.h"} = 1; - push(@functionContent, " if (IMPL->role() == WebCore::AnimValRole) {\n"); + push(@functionContent, " if (IMPL->isReadOnly()) {\n"); push(@functionContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n"); if ($returnType eq "void") { push(@functionContent, " return;\n"); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index e045ebdd3..4d9bf3401 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -249,6 +249,7 @@ sub GenerateHeader $headerIncludes{"wtf/text/StringHash.h"} = 1; $headerIncludes{"WrapperTypeInfo.h"} = 1; + $headerIncludes{"V8Binding.h"} = 1; $headerIncludes{"V8DOMWrapper.h"} = 1; $headerIncludes{"wtf/HashMap.h"} = 1; $headerIncludes{"v8.h"} = 1; @@ -455,7 +456,7 @@ END inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Isolate* isolate = 0${forceNewObjectParameter}) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return ${className}::wrap(impl, isolate${forceNewObjectCall}); } END @@ -472,7 +473,7 @@ v8::Handle<v8::Value> toV8Slow(Node*, v8::Isolate*, bool); inline v8::Handle<v8::Value> toV8(Node* impl, v8::Isolate* isolate = 0, bool forceNewObject = false) { if (UNLIKELY(!impl)) - return v8::Null(); + return v8NullWithCheck(isolate); if (UNLIKELY(forceNewObject)) return toV8Slow(impl, isolate, forceNewObject); v8::Handle<v8::Value> wrapper = V8DOMWrapper::getCachedWrapper(impl); @@ -821,7 +822,8 @@ END my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attrName : $reflect; my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); AddToImplIncludes("${namespace}.h"); - push(@implContentDecls, " return getElementStringAttr(info, ${namespace}::${contentAttributeName}Attr);\n"); + push(@implContentDecls, " Element* imp = V8Element::toNative(info.Holder());\n"); + push(@implContentDecls, " return v8ExternalString(imp->getAttribute(${namespace}::${contentAttributeName}Attr), info.GetIsolate());\n"); push(@implContentDecls, "}\n\n"); push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; return; @@ -842,7 +844,7 @@ END # Generate security checks if necessary if ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) { - push(@implContentDecls, " if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->" . $attribute->signature->name . "()))\n return v8::Handle<v8::Value>(v8::Null());\n\n"); + push(@implContentDecls, " if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->" . $attribute->signature->name . "()))\n return v8::Handle<v8::Value>(v8::Null(info.GetIsolate()));\n\n"); } my $useExceptions = 1 if @{$attribute->getterExceptions}; @@ -944,7 +946,7 @@ END return; } - if ($codeGenerator->IsSVGAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($attrType)) { + if (($codeGenerator->IsSVGAnimatedType($implClassName) or $implClassName eq "SVGViewSpec") and $codeGenerator->IsSVGTypeNeedingTearOff($attrType)) { AddToImplIncludes("V8$attrType.h"); my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType); # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked. @@ -1004,7 +1006,7 @@ END my $getterFunc = $codeGenerator->WK_lcfirst($attribute->signature->name); push(@implContentDecls, <<END); SerializedScriptValue* serialized = imp->${getterFunc}(); - value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); info.Holder()->SetHiddenValue(propertyName, value); return value; END @@ -1060,7 +1062,7 @@ END } else { AddToImplIncludes("ExceptionCode.h"); push(@implContentDecls, " $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());\n"); - push(@implContentDecls, " if (wrapper->role() == AnimValRole) {\n"); + push(@implContentDecls, " if (wrapper->isReadOnly()) {\n"); push(@implContentDecls, " V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.GetIsolate());\n"); push(@implContentDecls, " return;\n"); push(@implContentDecls, " }\n"); @@ -1091,7 +1093,9 @@ END my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attrName : $reflect; my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); AddToImplIncludes("${namespace}.h"); - push(@implContentDecls, " setElementStringAttr(info, ${namespace}::${contentAttributeName}Attr, value);\n"); + push(@implContentDecls, " Element* imp = V8Element::toNative(info.Holder());\n"); + push(@implContentDecls, " AtomicString v = toAtomicWebCoreStringWithNullCheck(value);\n"); + push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, v);\n"); push(@implContentDecls, "}\n\n"); push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; return; @@ -1394,7 +1398,7 @@ END } else { AddToImplIncludes("ExceptionCode.h"); push(@implContentDecls, " $nativeClassName wrapper = V8${implClassName}::toNative(args.Holder());\n"); - push(@implContentDecls, " if (wrapper->role() == AnimValRole)\n"); + push(@implContentDecls, " if (wrapper->isReadOnly())\n"); push(@implContentDecls, " return V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate());\n"); my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName); push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n"); @@ -1437,7 +1441,7 @@ END if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) { push(@implContentDecls, " if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->" . $function->signature->name . "(ec)))\n"); - push(@implContentDecls, " return v8::Handle<v8::Value>(v8::Null());\n"); + push(@implContentDecls, " return v8::Handle<v8::Value>(v8::Null(args.GetIsolate()));\n"); END } @@ -1864,12 +1868,12 @@ sub GenerateNamedConstructorCallback if ($dataNode->extendedAttributes->{"ActiveDOMObject"}) { push(@implContent, <<END); -WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, V8${implClassName}::derefObject, V8${implClassName}::toActiveDOMObject, 0 }; +WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, V8${implClassName}::derefObject, V8${implClassName}::toActiveDOMObject, 0, WrapperTypeObjectPrototype }; END } else { push(@implContent, <<END); -WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, 0, 0, 0 }; +WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, 0, 0, 0, WrapperTypeObjectPrototype }; END } @@ -2437,8 +2441,12 @@ sub GenerateImplementation } push(@implContentDecls, "namespace WebCore {\n\n"); my $parentClassInfo = $parentClass ? "&${parentClass}::info" : "0"; - push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, ${toActive}, ${parentClassInfo} };\n\n"); + + my $WrapperTypePrototype = $dataNode->isException ? "WrapperTypeErrorPrototype" : "WrapperTypeObjectPrototype"; + + push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, $toActive, $parentClassInfo, $WrapperTypePrototype };\n\n"); push(@implContentDecls, "namespace ${interfaceName}V8Internal {\n\n"); + push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n"); my $hasConstructors = 0; @@ -3098,7 +3106,7 @@ END @args = (); foreach my $param (@params) { my $paramName = $param->name; - push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = " . NativeToJSValue($param, $paramName, "0") . ";\n"); + push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = " . NativeToJSValue($param, $paramName) . ";\n"); push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n"); push(@implContent, " if (!isScriptControllerTerminating())\n"); push(@implContent, " CRASH();\n"); @@ -3798,9 +3806,10 @@ sub NativeToJSValue my $signature = shift; my $value = shift; my $getIsolate = shift; + my $getIsolateArg = $getIsolate ? ", $getIsolate" : ""; my $type = GetTypeFromSignature($signature); - return "v8Boolean($value)" if $type eq "boolean"; + return ($getIsolate ? "v8Boolean($value, $getIsolate)" : "v8Boolean($value)") if $type eq "boolean"; return "v8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined() # HTML5 says that unsigned reflected attributes should be in the range @@ -3817,7 +3826,7 @@ sub NativeToJSValue return "v8::Integer::New($value)" if $nativeType eq "int"; return "v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned"; - return "v8DateOrNull($value)" if $type eq "Date"; + return "v8DateOrNull($value$getIsolateArg)" if $type eq "Date"; # long long and unsigned long long are not representable in ECMAScript. return "v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp"; return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type); @@ -3829,13 +3838,13 @@ sub NativeToJSValue if ($codeGenerator->IsStringType($type)) { my $conv = $signature->extendedAttributes->{"TreatReturnedNullStringAs"}; if (defined $conv) { - return "v8StringOrNull($value, $getIsolate)" if $conv eq "Null"; - return "v8StringOrUndefined($value, $getIsolate)" if $conv eq "Undefined"; - return "v8StringOrFalse($value, $getIsolate)" if $conv eq "False"; + return "v8StringOrNull($value$getIsolateArg)" if $conv eq "Null"; + return "v8StringOrUndefined($value$getIsolateArg)" if $conv eq "Undefined"; + return "v8StringOrFalse($value$getIsolateArg)" if $conv eq "False"; die "Unknown value for TreatReturnedNullStringAs extended attribute"; } - return "v8String($value, $getIsolate)"; + return "v8String($value$getIsolateArg)"; } my $arrayType = $codeGenerator->GetArrayType($type); @@ -3844,35 +3853,35 @@ sub NativeToJSValue AddToImplIncludes("V8$arrayType.h"); AddToImplIncludes("$arrayType.h"); } - return "v8Array($value, $getIsolate)"; + return "v8Array($value$getIsolateArg)"; } AddIncludesForType($type); # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnNewObject"} ? ", $getIsolate, true)" : ", $getIsolate)"); + return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnNewObject"} ? "$getIsolateArg, true)" : "$getIsolateArg)"); } if ($type eq "EventTarget") { - return "V8DOMWrapper::convertEventTargetToV8Object($value, $getIsolate)"; + return "V8DOMWrapper::convertEventTargetToV8Object($value$getIsolateArg)"; } if ($type eq "EventListener") { AddToImplIncludes("V8AbstractEventListener.h"); - return "${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null())"; + return "${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(" . ($getIsolate ? "v8::Null($getIsolate)" : "v8::Null()") . ")"; } if ($type eq "SerializedScriptValue") { AddToImplIncludes("$type.h"); - return "$value ? $value->deserialize() : v8::Handle<v8::Value>(v8::Null())"; + return "$value ? $value->deserialize() : v8::Handle<v8::Value>(" . ($getIsolate ? "v8::Null($getIsolate)" : "v8::Null()") . ")"; } AddToImplIncludes("wtf/RefCounted.h"); AddToImplIncludes("wtf/RefPtr.h"); AddToImplIncludes("wtf/GetPtr.h"); - return "toV8($value, $getIsolate)"; + return "toV8($value$getIsolateArg)"; } sub ReturnNativeToJSValue diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp index 3401c6453..c495501fe 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp @@ -229,7 +229,7 @@ bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unk void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestActiveDOMObject* jsTestActiveDOMObject = static_cast<JSTestActiveDOMObject*>(handle.get().asCell()); + JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestActiveDOMObject->impl(), jsTestActiveDOMObject); jsTestActiveDOMObject->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp index e76553ad2..96f87ab04 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp @@ -202,7 +202,7 @@ bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::U void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestCustomNamedGetter* jsTestCustomNamedGetter = static_cast<JSTestCustomNamedGetter*>(handle.get().asCell()); + JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter); jsTestCustomNamedGetter->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp index ff7f83383..d8da35868 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp @@ -229,7 +229,7 @@ bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Un void JSTestEventConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestEventConstructor* jsTestEventConstructor = static_cast<JSTestEventConstructor*>(handle.get().asCell()); + JSTestEventConstructor* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestEventConstructor->impl(), jsTestEventConstructor); jsTestEventConstructor->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp index 1a708d05e..8474b1ab6 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -330,7 +330,7 @@ bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown void JSTestEventTargetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestEventTarget* jsTestEventTarget = static_cast<JSTestEventTarget*>(handle.get().asCell()); + JSTestEventTarget* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestEventTarget->impl(), jsTestEventTarget); jsTestEventTarget->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp index cf27cb734..4582aca1f 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp @@ -104,7 +104,7 @@ void JSTestException::finishCreation(JSGlobalData& globalData) JSObject* JSTestException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - return JSTestExceptionPrototype::create(exec->globalData(), globalObject, JSTestExceptionPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); + return JSTestExceptionPrototype::create(exec->globalData(), globalObject, JSTestExceptionPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->errorPrototype())); } void JSTestException::destroy(JSC::JSCell* cell) @@ -171,7 +171,7 @@ bool JSTestExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> void JSTestExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestException* jsTestException = static_cast<JSTestException*>(handle.get().asCell()); + JSTestException* jsTestException = jsCast<JSTestException*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestException->impl(), jsTestException); jsTestException->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestException.h b/Source/WebCore/bindings/scripts/test/JS/JSTestException.h index 175e6cbfd..3b8822492 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestException.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestException.h @@ -23,9 +23,9 @@ #include "JSDOMBinding.h" #include "TestException.h" +#include <runtime/ErrorPrototype.h> #include <runtime/JSGlobalObject.h> #include <runtime/JSObject.h> -#include <runtime/ObjectPrototype.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 184ab33c5..afdb3b1ff 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -435,7 +435,7 @@ bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> void JSTestInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestInterface* jsTestInterface = static_cast<JSTestInterface*>(handle.get().asCell()); + JSTestInterface* jsTestInterface = jsCast<JSTestInterface*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestInterface->impl(), jsTestInterface); jsTestInterface->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp index 20e216c2c..1ea08d012 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp @@ -192,7 +192,7 @@ bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<J void JSTestMediaQueryListListenerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestMediaQueryListListener* jsTestMediaQueryListListener = static_cast<JSTestMediaQueryListListener*>(handle.get().asCell()); + JSTestMediaQueryListListener* jsTestMediaQueryListListener = jsCast<JSTestMediaQueryListListener*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestMediaQueryListListener->impl(), jsTestMediaQueryListListener); jsTestMediaQueryListListener->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp index 9afe4aef4..eeef66a44 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp @@ -206,7 +206,7 @@ bool JSTestNamedConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Un void JSTestNamedConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestNamedConstructor* jsTestNamedConstructor = static_cast<JSTestNamedConstructor*>(handle.get().asCell()); + JSTestNamedConstructor* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestNamedConstructor->impl(), jsTestNamedConstructor); jsTestNamedConstructor->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 1479314b8..a8a602319 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -2810,7 +2810,7 @@ bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle void JSTestObjOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestObj* jsTestObj = static_cast<JSTestObj*>(handle.get().asCell()); + JSTestObj* jsTestObj = jsCast<JSTestObj*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestObj->impl(), jsTestObj); jsTestObj->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp index e495d1ed3..8ab796700 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp @@ -380,7 +380,7 @@ bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC:: void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = static_cast<JSTestSerializedScriptValueInterface*>(handle.get().asCell()); + JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = jsCast<JSTestSerializedScriptValueInterface*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestSerializedScriptValueInterface->impl(), jsTestSerializedScriptValueInterface); jsTestSerializedScriptValueInterface->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp index 87fef5536..2bf1e14d0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp @@ -43,7 +43,7 @@ namespace WebCore { -WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, &V8ArrayBufferView::info }; +WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, &V8ArrayBufferView::info, WrapperTypeObjectPrototype }; namespace Float64ArrayV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h index 368fceba8..b0dfd559b 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h @@ -22,6 +22,7 @@ #define V8Float64Array_h #include "V8ArrayBufferView.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp index f06370b57..c8a4c612d 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -35,7 +35,7 @@ namespace WebCore { -WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0 }; +WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestActiveDOMObjectV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h index c55202831..b91adbd11 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h @@ -22,6 +22,7 @@ #define V8TestActiveDOMObject_h #include "TestActiveDOMObject.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -61,7 +62,7 @@ v8::Handle<v8::Object> V8TestActiveDOMObject::wrap(TestActiveDOMObject* impl, v8 inline v8::Handle<v8::Value> toV8(TestActiveDOMObject* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestActiveDOMObject::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestActiveDOMObject > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index 628d5a8b7..6afa83029 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -87,7 +87,7 @@ bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) v8::Context::Scope scope(v8Context); - v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param, 0); + v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param); if (class1ParamHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); @@ -115,13 +115,13 @@ bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& v8::Context::Scope scope(v8Context); - v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param, 0); + v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param); if (class2ParamHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); return true; } - v8::Handle<v8::Value> strArgHandle = v8String(strArg, 0); + v8::Handle<v8::Value> strArgHandle = v8String(strArg); if (strArgHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); @@ -150,7 +150,7 @@ bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam) v8::Context::Scope scope(v8Context); - v8::Handle<v8::Value> listParamHandle = toV8(listParam, 0); + v8::Handle<v8::Value> listParamHandle = toV8(listParam); if (listParamHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); @@ -208,13 +208,13 @@ bool V8TestCallback::callbackRequiresThisToPass(Class8* class8Param, ThisClass* v8::Context::Scope scope(v8Context); - v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param, 0); + v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param); if (class8ParamHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); return true; } - v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam, 0); + v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam); if (thisClassParamHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp index fc8b7dd85..2ec3e5aad 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp @@ -34,7 +34,7 @@ namespace WebCore { -WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0 }; +WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestCustomNamedGetterV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h index 99472b755..36d9196c3 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h @@ -22,6 +22,7 @@ #define V8TestCustomNamedGetter_h #include "TestCustomNamedGetter.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -60,7 +61,7 @@ v8::Handle<v8::Object> V8TestCustomNamedGetter::wrap(TestCustomNamedGetter* impl inline v8::Handle<v8::Value> toV8(TestCustomNamedGetter* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestCustomNamedGetter::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomNamedGetter > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index 0d0d345a8..ff3ac1f75 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -34,7 +34,7 @@ namespace WebCore { -WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0 }; +WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestEventConstructorV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h index 119310be3..f3c6dc486 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h @@ -22,6 +22,7 @@ #define V8TestEventConstructor_h #include "TestEventConstructor.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -61,7 +62,7 @@ v8::Handle<v8::Object> V8TestEventConstructor::wrap(TestEventConstructor* impl, inline v8::Handle<v8::Value> toV8(TestEventConstructor* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestEventConstructor::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventConstructor > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp index 4a1512736..d97355ef8 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp @@ -37,7 +37,7 @@ namespace WebCore { -WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0 }; +WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestEventTargetV8Internal { @@ -96,7 +96,7 @@ static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args) bool result = imp->dispatchEvent(evt, ec); if (UNLIKELY(ec)) goto fail; - return v8Boolean(result); + return v8Boolean(result, args.GetIsolate()); } fail: return V8Proxy::setDOMException(ec, args.GetIsolate()); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h index d577c98d8..115c5ae8c 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h @@ -22,6 +22,7 @@ #define V8TestEventTarget_h #include "TestEventTarget.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -62,7 +63,7 @@ v8::Handle<v8::Object> V8TestEventTarget::wrap(TestEventTarget* impl, v8::Isolat inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestEventTarget::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventTarget > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp index 41a6ce94f..9c0b8e42a 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp @@ -32,7 +32,7 @@ namespace WebCore { -WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0 }; +WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, WrapperTypeErrorPrototype }; namespace TestExceptionV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.h b/Source/WebCore/bindings/scripts/test/V8/V8TestException.h index 7a2f584e8..403c0e3b0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.h @@ -22,6 +22,7 @@ #define V8TestException_h #include "TestException.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -59,7 +60,7 @@ v8::Handle<v8::Object> V8TestException::wrap(TestException* impl, v8::Isolate* i inline v8::Handle<v8::Value> toV8(TestException* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestException::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestException > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index 05758858e..f012d6cd8 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -42,7 +42,7 @@ namespace WebCore { -WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0 }; +WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, WrapperTypeObjectPrototype }; namespace TestInterfaceV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h index 82064154c..0f32963ef 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -24,6 +24,7 @@ #define V8TestInterface_h #include "TestInterface.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -64,7 +65,7 @@ v8::Handle<v8::Object> V8TestInterface::wrap(TestInterface* impl, v8::Isolate* i inline v8::Handle<v8::Value> toV8(TestInterface* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestInterface::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestInterface > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp index fb42a831a..140758799 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp @@ -35,7 +35,7 @@ namespace WebCore { -WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0 }; +WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestMediaQueryListListenerV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h index 0fe71799d..f53598c1d 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h @@ -22,6 +22,7 @@ #define V8TestMediaQueryListListener_h #include "TestMediaQueryListListener.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -59,7 +60,7 @@ v8::Handle<v8::Object> V8TestMediaQueryListListener::wrap(TestMediaQueryListList inline v8::Handle<v8::Value> toV8(TestMediaQueryListListener* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestMediaQueryListListener::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestMediaQueryListListener > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp index 98f3cbcd0..1fa37dd3a 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp @@ -34,7 +34,7 @@ namespace WebCore { -WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0 }; +WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, WrapperTypeObjectPrototype }; namespace TestNamedConstructorV8Internal { @@ -42,7 +42,7 @@ template <typename T> void V8_USE(T) { } } // namespace TestNamedConstructorV8Internal -WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0 }; +WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, WrapperTypeObjectPrototype }; static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args) { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h index c6e2625bf..9375ae076 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h @@ -22,6 +22,7 @@ #define V8TestNamedConstructor_h #include "TestNamedConstructor.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -66,7 +67,7 @@ v8::Handle<v8::Object> V8TestNamedConstructor::wrap(TestNamedConstructor* impl, inline v8::Handle<v8::Value> toV8(TestNamedConstructor* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestNamedConstructor::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestNamedConstructor > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp index d6729c9f5..51ef3fc38 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp @@ -33,7 +33,7 @@ namespace WebCore { -WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, &V8Node::info }; +WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, &V8Node::info, WrapperTypeObjectPrototype }; namespace TestNodeV8Internal { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h index 57e5026dc..cc20fe9e5 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h @@ -22,6 +22,7 @@ #define V8TestNode_h #include "TestNode.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -60,7 +61,7 @@ v8::Handle<v8::Object> V8TestNode::wrap(TestNode* impl, v8::Isolate* isolate) inline v8::Handle<v8::Value> toV8(TestNode* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestNode::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestNode > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 22bb57a40..f44040dd0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -74,7 +74,7 @@ namespace WebCore { -WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0 }; +WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestObjV8Internal { @@ -464,7 +464,7 @@ static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const { INC_STATS("DOM.TestObj.create._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Boolean(imp->isCreate()); + return v8Boolean(imp->isCreate(), info.GetIsolate()); } static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -528,7 +528,7 @@ static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String { INC_STATS("DOM.TestObj.reflectedBooleanAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr)); + return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr), info.GetIsolate()); } static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -592,7 +592,7 @@ static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8:: { INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr)); + return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr), info.GetIsolate()); } static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -1134,7 +1134,7 @@ static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> nam INC_STATS("DOM.TestObj.contentDocument._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->contentDocument())) - return v8::Handle<v8::Value>(v8::Null()); + return v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); return toV8(imp->contentDocument(), info.GetIsolate()); } @@ -1904,7 +1904,7 @@ static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args) ExceptionCode ec = 0; { if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) - return v8::Handle<v8::Value>(v8::Null()); + return v8::Handle<v8::Value>(v8::Null(args.GetIsolate())); RefPtr<SVGDocument> result = imp->getSVGDocument(ec); if (UNLIKELY(ec)) goto fail; @@ -2405,6 +2405,8 @@ bool V8TestObj::HasInstance(v8::Handle<v8::Value> value) void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, TestObj* impl) { v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype()); + // When building QtWebkit with V8 this variable is unused when none of the features are enabled. + UNUSED_PARAM(proto); if (ContextEnabledFeatures::enabledAtContextAttr1Enabled(impl)) { static const BatchedAttribute attrData =\ // Attribute 'enabledAtContextAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext') diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h index e1bb813b5..2133bcef4 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h @@ -22,6 +22,7 @@ #define V8TestObj_h #include "TestObj.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -66,7 +67,7 @@ v8::Handle<v8::Object> V8TestObj::wrap(TestObj* impl, v8::Isolate* isolate) inline v8::Handle<v8::Value> toV8(TestObj* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestObj::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestObj > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index 452ba3776..5055410cb 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -40,7 +40,7 @@ namespace WebCore { -WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0 }; +WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, WrapperTypeObjectPrototype }; namespace TestSerializedScriptValueInterfaceV8Internal { @@ -50,7 +50,7 @@ static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> name, const v { INC_STATS("DOM.TestSerializedScriptValueInterface.value._get"); TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); - return imp->value() ? imp->value()->deserialize() : v8::Handle<v8::Value>(v8::Null()); + return imp->value() ? imp->value()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); } static void valueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -66,7 +66,7 @@ static v8::Handle<v8::Value> readonlyValueAttrGetter(v8::Local<v8::String> name, { INC_STATS("DOM.TestSerializedScriptValueInterface.readonlyValue._get"); TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); - return imp->readonlyValue() ? imp->readonlyValue()->deserialize() : v8::Handle<v8::Value>(v8::Null()); + return imp->readonlyValue() ? imp->readonlyValue()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); } static v8::Handle<v8::Value> cachedValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -78,7 +78,7 @@ static v8::Handle<v8::Value> cachedValueAttrGetter(v8::Local<v8::String> name, c return value; TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); SerializedScriptValue* serialized = imp->cachedValue(); - value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); info.Holder()->SetHiddenValue(propertyName, value); return value; } @@ -116,7 +116,7 @@ static v8::Handle<v8::Value> cachedReadonlyValueAttrGetter(v8::Local<v8::String> return value; TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); SerializedScriptValue* serialized = imp->cachedReadonlyValue(); - value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); info.Holder()->SetHiddenValue(propertyName, value); return value; } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h index bd6d9e612..1290b85ac 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h @@ -24,6 +24,7 @@ #define V8TestSerializedScriptValueInterface_h #include "TestSerializedScriptValueInterface.h" +#include "V8Binding.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -62,7 +63,7 @@ v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrap(TestSerialized inline v8::Handle<v8::Value> toV8(TestSerializedScriptValueInterface* impl, v8::Isolate* isolate = 0) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8TestSerializedScriptValueInterface::wrap(impl, isolate); } inline v8::Handle<v8::Value> toV8(PassRefPtr< TestSerializedScriptValueInterface > impl, v8::Isolate* isolate = 0) diff --git a/Source/WebCore/bindings/v8/DebuggerScript.js b/Source/WebCore/bindings/v8/DebuggerScript.js index 5370d1523..774f64606 100644 --- a/Source/WebCore/bindings/v8/DebuggerScript.js +++ b/Source/WebCore/bindings/v8/DebuggerScript.js @@ -62,6 +62,23 @@ DebuggerScript.getWorkerScripts = function() return result; } +DebuggerScript.getFunctionScopes = function(fun) +{ + var mirror = MakeMirror(fun); + var count = mirror.scopeCount(); + if (count == 0) + return null; + var result = []; + for (var i = 0; i < count; i++) { + var scopeMirror = mirror.scope(i); + result[i] = { + type: scopeMirror.scopeType(), + object: DebuggerScript._buildScopeObject(scopeMirror) + }; + } + return result; +} + DebuggerScript.getScripts = function(contextData) { var result = []; @@ -233,35 +250,8 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var scopeType = []; for (var i = 0; i < frameMirror.scopeCount(); i++) { var scopeMirror = frameMirror.scope(i); - var scopeObjectMirror = scopeMirror.scopeObject(); - - var scopeObject; - switch (scopeMirror.scopeType()) { - case ScopeType.Local: - case ScopeType.Closure: - case ScopeType.Catch: - // For transient objects we create a "persistent" copy that contains - // the same properties. - scopeObject = {}; - // Reset scope object prototype to null so that the proto properties - // don't appear in the local scope section. - scopeObject.__proto__ = null; - var properties = scopeObjectMirror.properties(); - for (var j = 0; j < properties.length; j++) { - var name = properties[j].name(); - if (name.charAt(0) === ".") - continue; // Skip internal variables like ".arguments" - scopeObject[name] = properties[j].value_; - } - break; - case ScopeType.Global: - case ScopeType.With: - scopeObject = scopeMirror.details_.object(); - break; - } - scopeType.push(scopeMirror.scopeType()); - scopeChain.push(scopeObject); + scopeChain.push(DebuggerScript._buildScopeObject(scopeMirror)); } function evaluate(expression) { @@ -281,5 +271,37 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) }; } +DebuggerScript._buildScopeObject = function(scopeMirror) { + var scopeObject; + switch (scopeMirror.scopeType()) { + case ScopeType.Local: + case ScopeType.Closure: + case ScopeType.Catch: + // For transient objects we create a "persistent" copy that contains + // the same properties. + scopeObject = {}; + // Reset scope object prototype to null so that the proto properties + // don't appear in the local scope section. + scopeObject.__proto__ = null; + var scopeObjectMirror = scopeMirror.scopeObject(); + var properties = scopeObjectMirror.properties(); + for (var j = 0; j < properties.length; j++) { + var name = properties[j].name(); + if (name.charAt(0) === ".") + continue; // Skip internal variables like ".arguments" + scopeObject[name] = properties[j].value_; + } + break; + case ScopeType.Global: + case ScopeType.With: + scopeObject = scopeMirror.details_.object(); + break; + case ScopeType.Block: + // Unsupported yet. Mustn't be reachable. + break; + } + return scopeObject; +} + return DebuggerScript; })(); diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index 0d7cff6a8..ad188eeaa 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -53,7 +53,7 @@ namespace WebCore { WrapperTypeInfo* npObjectTypeInfo() { - static WrapperTypeInfo typeInfo = { 0, 0, 0, 0 }; + static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, WrapperTypeObjectPrototype }; return &typeInfo; } diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp index cd30c64ae..865d47f21 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -396,6 +396,14 @@ void ScriptDebugServer::ensureDebuggerScriptCompiled() } } +v8::Local<v8::Value> ScriptDebugServer::functionScopes(v8::Handle<v8::Function> function) +{ + ensureDebuggerScriptCompiled(); + + v8::Handle<v8::Value> argv[] = { function }; + return callDebuggerMethod("getFunctionScopes", 1, argv); +} + bool ScriptDebugServer::isPaused() { return !m_executionState.get().IsEmpty(); diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.h b/Source/WebCore/bindings/v8/ScriptDebugServer.h index a4fb6129d..7e80e7f87 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.h +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.h @@ -94,6 +94,8 @@ public: bool isPaused(); + v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); + protected: ScriptDebugServer(); ~ScriptDebugServer() { } diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index 7b7996248..60d053b42 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -1263,13 +1263,13 @@ public: *value = v8::Undefined(); break; case NullTag: - *value = v8::Null(); + *value = v8NullWithCheck(m_isolate); break; case TrueTag: - *value = v8::True(); + *value = v8BooleanWithCheck(true, m_isolate); break; case FalseTag: - *value = v8::False(); + *value = v8BooleanWithCheck(false, m_isolate); break; case TrueObjectTag: *value = v8::BooleanObject::New(true); @@ -1828,15 +1828,15 @@ public: v8::Handle<v8::Value> deserialize() { if (!m_reader.readVersion(m_version) || m_version > wireFormatVersion) - return v8::Null(); + return v8NullWithCheck(m_reader.getIsolate()); m_reader.setVersion(m_version); v8::HandleScope scope; while (!m_reader.isEof()) { if (!doDeserialize()) - return v8::Null(); + return v8NullWithCheck(m_reader.getIsolate()); } if (stackDepth() != 1 || m_openCompositeReferenceStack.size()) - return v8::Null(); + return v8NullWithCheck(m_reader.getIsolate()); v8::Handle<v8::Value> result = scope.Close(element(0)); return result; } @@ -2245,7 +2245,7 @@ SerializedScriptValue::SerializedScriptValue(const String& wireData) v8::Handle<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messagePorts, v8::Isolate* isolate) { if (!m_data.impl()) - return v8::Null(); + return v8NullWithCheck(isolate); COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes); Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters()), 2 * m_data.length(), isolate); Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.get()); diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index 2db76a8b8..6e036ace7 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -448,10 +448,10 @@ void StringCache::remove(StringImpl* stringImpl) m_stringCache.remove(stringImpl); } -v8::Local<v8::String> StringCache::v8ExternalStringSlow(StringImpl* stringImpl) +v8::Local<v8::String> StringCache::v8ExternalStringSlow(StringImpl* stringImpl, v8::Isolate* isolate) { if (!stringImpl->length()) - return v8::String::Empty(); + return isolate ? v8::String::Empty(isolate) : v8::String::Empty(); v8::String* cachedV8String = m_stringCache.get(stringImpl); if (cachedV8String) { @@ -547,22 +547,6 @@ v8::Persistent<v8::FunctionTemplate> getToStringTemplate() return toStringTemplate; } -v8::Handle<v8::Value> getElementStringAttr(const v8::AccessorInfo& info, - const QualifiedName& name) -{ - Element* imp = V8Element::toNative(info.Holder()); - return v8ExternalString(imp->getAttribute(name), info.GetIsolate()); -} - -void setElementStringAttr(const v8::AccessorInfo& info, - const QualifiedName& name, - v8::Local<v8::Value> value) -{ - Element* imp = V8Element::toNative(info.Holder()); - AtomicString v = toAtomicWebCoreStringWithNullCheck(value); - imp->setAttribute(name, v); -} - PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value) { v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index 3ee692da0..3f34249b4 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -59,7 +59,7 @@ namespace WebCore { public: StringCache() { } - v8::Local<v8::String> v8ExternalString(StringImpl* stringImpl) + v8::Local<v8::String> v8ExternalString(StringImpl* stringImpl, v8::Isolate* isolate) { if (m_lastStringImpl.get() == stringImpl) { ASSERT(!m_lastV8String.IsNearDeath()); @@ -67,7 +67,7 @@ namespace WebCore { return v8::Local<v8::String>::New(m_lastV8String); } - return v8ExternalStringSlow(stringImpl); + return v8ExternalStringSlow(stringImpl, isolate); } void clearOnGC() @@ -79,7 +79,7 @@ namespace WebCore { void remove(StringImpl*); private: - v8::Local<v8::String> v8ExternalStringSlow(StringImpl*); + v8::Local<v8::String> v8ExternalStringSlow(StringImpl*, v8::Isolate*); HashMap<StringImpl*, v8::String*> m_stringCache; v8::Persistent<v8::String> m_lastV8String; @@ -247,6 +247,15 @@ namespace WebCore { template <typename StringType> StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external); + // Since v8::Null(isolate) crashes if we pass a null isolate, + // we need to use v8NullWithCheck(isolate) if an isolate can be null. + // + // FIXME: Remove all null isolates from V8 bindings, and remove v8NullWithCheck(isolate). + inline v8::Handle<v8::Value> v8NullWithCheck(v8::Isolate* isolate) + { + return isolate ? v8::Null(isolate) : v8::Null(); + } + // Convert v8 types to a WTF::String. If the V8 string is not already // an external string then it is transformed into an external string at this // point to avoid repeated conversions. @@ -272,10 +281,10 @@ namespace WebCore { { StringImpl* stringImpl = string.impl(); if (!stringImpl) - return v8::String::Empty(); + return isolate ? v8::String::Empty(isolate) : v8::String::Empty(); V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(isolate); - return data->stringCache()->v8ExternalString(stringImpl); + return data->stringCache()->v8ExternalString(stringImpl, isolate); } // Convert a string to a V8 string. @@ -399,6 +408,20 @@ namespace WebCore { return value ? v8::True() : v8::False(); } + inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) + { + return value ? v8::True(isolate) : v8::False(isolate); + } + + // Since v8Boolean(value, isolate) crashes if we pass a null isolate, + // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be null. + // + // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWithCheck(value, isolate). + inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* isolate) + { + return isolate ? v8Boolean(value, isolate) : v8Boolean(value); + } + inline String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value) { return value->IsNull() ? String() : v8ValueToWebCoreString(value); @@ -431,7 +454,7 @@ namespace WebCore { inline v8::Handle<v8::Value> v8StringOrFalse(const String& str, v8::Isolate* isolate = 0) { - return str.isNull() ? v8::Handle<v8::Value>(v8::False()) : v8::Handle<v8::Value>(v8String(str, isolate)); + return str.isNull() ? v8::Handle<v8::Value>(v8Boolean(false)) : v8::Handle<v8::Value>(v8String(str, isolate)); } template <class T> v8::Handle<v8::Value> v8NumberArray(const Vector<T>& values) @@ -448,9 +471,9 @@ namespace WebCore { return (object->IsDate() || object->IsNumber()) ? object->NumberValue() : std::numeric_limits<double>::quiet_NaN(); } - inline v8::Handle<v8::Value> v8DateOrNull(double value) + inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate = 0) { - return isfinite(value) ? v8::Date::New(value) : v8::Handle<v8::Value>(v8::Null()); + return isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(isolate); } v8::Persistent<v8::FunctionTemplate> createRawTemplate(); @@ -467,13 +490,6 @@ namespace WebCore { const BatchedCallback*, size_t callbackCount); - v8::Handle<v8::Value> getElementStringAttr(const v8::AccessorInfo&, - const QualifiedName&); - void setElementStringAttr(const v8::AccessorInfo&, - const QualifiedName&, - v8::Local<v8::Value>); - - v8::Persistent<v8::String> getToStringName(); v8::Persistent<v8::FunctionTemplate> getToStringTemplate(); diff --git a/Source/WebCore/bindings/v8/V8BindingPerContextData.cpp b/Source/WebCore/bindings/v8/V8BindingPerContextData.cpp index a010efa78..ffcaf4cac 100644 --- a/Source/WebCore/bindings/v8/V8BindingPerContextData.cpp +++ b/Source/WebCore/bindings/v8/V8BindingPerContextData.cpp @@ -56,28 +56,38 @@ void V8BindingPerContextData::dispose() } } +#define V8_STORE_PRIMORDIAL(name, Name) \ +{ \ + ASSERT(m_##name##Prototype.get().IsEmpty()); \ + v8::Handle<v8::String> symbol = v8::String::NewSymbol(#Name); \ + if (symbol.IsEmpty()) \ + return false; \ + v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(m_context->Global()->Get(symbol)); \ + if (object.IsEmpty()) \ + return false; \ + v8::Handle<v8::Value> prototypeValue = object->Get(prototypeString); \ + if (prototypeValue.IsEmpty()) \ + return false; \ + m_##name##Prototype.set(prototypeValue); \ +} + bool V8BindingPerContextData::init() { - ASSERT(m_objectPrototype.get().IsEmpty()); - - v8::Handle<v8::String> objectString = v8::String::New("Object"); - v8::Handle<v8::String> prototypeString = v8::String::New("prototype"); - if (objectString.IsEmpty() || prototypeString.IsEmpty()) + v8::Handle<v8::String> prototypeString = v8::String::NewSymbol("prototype"); + if (prototypeString.IsEmpty()) return false; - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(m_context->Global()->Get(objectString)); - if (object.IsEmpty()) - return false; - v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString); - if (objectPrototype.IsEmpty()) - return false; + V8_STORE_PRIMORDIAL(error, Error); + V8_STORE_PRIMORDIAL(object, Object); - m_objectPrototype.set(objectPrototype); return true; } +#undef V8_STORE_PRIMORDIAL + v8::Local<v8::Object> V8BindingPerContextData::createWrapperFromCacheSlowCase(WrapperTypeInfo* type) { + ASSERT(!m_errorPrototype.get().IsEmpty()); ASSERT(!m_objectPrototype.get().IsEmpty()); v8::Context::Scope scope(m_context); @@ -92,6 +102,7 @@ v8::Local<v8::Object> V8BindingPerContextData::createWrapperFromCacheSlowCase(Wr v8::Local<v8::Function> V8BindingPerContextData::constructorForTypeSlowCase(WrapperTypeInfo* type) { + ASSERT(!m_errorPrototype.get().IsEmpty()); ASSERT(!m_objectPrototype.get().IsEmpty()); v8::Context::Scope scope(m_context); @@ -104,6 +115,12 @@ v8::Local<v8::Function> V8BindingPerContextData::constructorForTypeSlowCase(Wrap function->SetPrototype(m_objectPrototype.get()); + if (type->wrapperTypePrototype == WrapperTypeErrorPrototype) { + v8::Local<v8::Value> prototypeValue = function->Get(v8::String::NewSymbol("prototype")); + if (prototypeValue->IsObject()) + v8::Local<v8::Object>::Cast(prototypeValue)->SetPrototype(m_errorPrototype.get()); + } + m_constructorMap.set(type, v8::Persistent<v8::Function>::New(function)); return function; diff --git a/Source/WebCore/bindings/v8/V8BindingPerContextData.h b/Source/WebCore/bindings/v8/V8BindingPerContextData.h index 1a94a038b..5e9354b12 100644 --- a/Source/WebCore/bindings/v8/V8BindingPerContextData.h +++ b/Source/WebCore/bindings/v8/V8BindingPerContextData.h @@ -90,6 +90,7 @@ private: ConstructorMap m_constructorMap; v8::Handle<v8::Context> m_context; + OwnHandle<v8::Value> m_errorPrototype; OwnHandle<v8::Value> m_objectPrototype; }; diff --git a/Source/WebCore/bindings/v8/V8Collection.h b/Source/WebCore/bindings/v8/V8Collection.h index 6eade960e..b50ba899c 100644 --- a/Source/WebCore/bindings/v8/V8Collection.h +++ b/Source/WebCore/bindings/v8/V8Collection.h @@ -135,7 +135,7 @@ template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIn ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); Collection* collection = toNativeCollection<Collection>(info.Holder()); String result = collection->item(index); - return v8StringOrNull(result); + return v8StringOrNull(result, info.GetIsolate()); } @@ -146,7 +146,7 @@ template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedP ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); Collection* collection = toNativeCollection<Collection>(info.Holder()); String result = collection->item(index); - return v8String(result); + return v8String(result, info.GetIsolate()); } diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp index 2c4b9ff24..05c17ab03 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -54,10 +54,12 @@ #include "V8Proxy.h" #include "V8StyleSheet.h" #include "V8WorkerContextEventListener.h" +#include "V8XPathNSResolver.h" #include "WebGLContextAttributes.h" #include "WebGLUniformLocation.h" #include "WorkerContextExecutionProxy.h" #include "WrapperTypeInfo.h" +#include "XPathNSResolver.h" #include <algorithm> #include <utility> #include <v8-debug.h> @@ -259,7 +261,7 @@ bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, WrapperTypeInfo* v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* target, v8::Isolate* isolate) { if (!target) - return v8::Null(); + return v8NullWithCheck(isolate); AtomicString desiredInterface = target->interfaceName(); DOM_EVENT_TARGET_INTERFACES_FOR_EACH(TRY_TO_WRAP_WITH_INTERFACE) diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.h b/Source/WebCore/bindings/v8/V8DOMWrapper.h index 7059f51b8..d0048c4af 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.h +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.h @@ -39,12 +39,9 @@ #include "PlatformString.h" #include "V8CustomXPathNSResolver.h" #include "V8DOMMap.h" -#include "V8Event.h" #include "V8IsolatedContext.h" #include "V8Utilities.h" -#include "V8XPathNSResolver.h" #include "WrapperTypeInfo.h" -#include "XPathNSResolver.h" #include <v8.h> #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> @@ -58,6 +55,7 @@ namespace WebCore { class V8BindingPerContextData; class V8Proxy; class WorkerContext; + class XPathResolver; enum ListenerLookupType { ListenerFindOnly, diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 18fecc261..093c644a5 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -306,10 +306,9 @@ static GroupId calculateGroupId(Node* node) // because it'll always be a group of 1. if (!root) return GroupId(); - } else { - while (Node* parent = root->parentOrHostNode()) - root = parent; } + while (Node* parent = root->parentOrHostNode()) + root = parent; return GroupId(root); } diff --git a/Source/WebCore/bindings/v8/V8HiddenPropertyName.h b/Source/WebCore/bindings/v8/V8HiddenPropertyName.h index ef025d39f..18362cb19 100644 --- a/Source/WebCore/bindings/v8/V8HiddenPropertyName.h +++ b/Source/WebCore/bindings/v8/V8HiddenPropertyName.h @@ -36,7 +36,6 @@ namespace WebCore { #define V8_HIDDEN_PROPERTIES(V) \ - V(objectPrototype) \ V(listener) \ V(attributeListener) \ V(scriptState) \ diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp index ef4592e1a..83b1a1403 100644 --- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp @@ -141,7 +141,6 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) // By calling the function with 4 arguments, we create a setter on arguments object // which would shadow property "3" on the prototype. String code = "(function() {" \ - "arguments[3] = function() {" \ "with (this[2]) {" \ "with (this[1]) {" \ "with (this[0]) {"; @@ -150,8 +149,7 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) code.append(") {"); code.append(m_code); // Insert '\n' otherwise //-style comments could break the handler. - code.append("\n};}}}};"); - code.append("return arguments[3]();})"); + code.append("\n};}}}})"); v8::Handle<v8::String> codeExternalString = v8ExternalString(code); v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_position); @@ -179,13 +177,21 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) v8::Handle<v8::Object> formWrapper = toObjectWrapper<HTMLFormElement>(formElement); v8::Handle<v8::Object> documentWrapper = toObjectWrapper<Document>(m_node ? m_node->ownerDocument() : 0); - v8::Handle<v8::Value> parameters[4] = { nodeWrapper, formWrapper, documentWrapper, v8::Handle<v8::Value>(v8::Null()) }; + v8::Local<v8::Object> thisObject = v8::Object::New(); + if (thisObject.IsEmpty()) + return; + if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(0), nodeWrapper)) + return; + if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(1), formWrapper)) + return; + if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(2), documentWrapper)) + return; // FIXME: Remove this code when we stop doing the 'with' hack above. v8::Local<v8::Value> innerValue; { V8RecursionScope::MicrotaskSuppression scope; - innerValue = intermediateFunction->Call(v8Context->Global(), 3, parameters); + innerValue = intermediateFunction->Call(thisObject, 0, 0); } if (innerValue.IsEmpty() || !innerValue->IsFunction()) return; diff --git a/Source/WebCore/bindings/v8/V8NPUtils.cpp b/Source/WebCore/bindings/v8/V8NPUtils.cpp index c653825ff..ca9e1ea70 100644 --- a/Source/WebCore/bindings/v8/V8NPUtils.cpp +++ b/Source/WebCore/bindings/v8/V8NPUtils.cpp @@ -37,6 +37,7 @@ #include "npruntime_impl.h" #include "npruntime_priv.h" #include "NPV8Object.h" +#include "V8Binding.h" #include "V8NPObject.h" #include "V8Proxy.h" @@ -86,7 +87,7 @@ v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj case NPVariantType_Double: return v8::Number::New(NPVARIANT_TO_DOUBLE(*variant)); case NPVariantType_Bool: - return NPVARIANT_TO_BOOLEAN(*variant) ? v8::True() : v8::False(); + return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant)); case NPVariantType_Null: return v8::Null(); case NPVariantType_Void: diff --git a/Source/WebCore/bindings/v8/WrapperTypeInfo.h b/Source/WebCore/bindings/v8/WrapperTypeInfo.h index c2684d66b..9e5f04fed 100644 --- a/Source/WebCore/bindings/v8/WrapperTypeInfo.h +++ b/Source/WebCore/bindings/v8/WrapperTypeInfo.h @@ -46,12 +46,17 @@ namespace WebCore { typedef v8::Persistent<v8::FunctionTemplate> (*GetTemplateFunction)(); typedef void (*DerefObjectFunction)(void*); typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>); - + + enum WrapperTypePrototype { + WrapperTypeObjectPrototype, + WrapperTypeErrorPrototype + }; + // This struct provides a way to store a bunch of information that is helpful when unwrapping // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo member, so // comparing pointers is a safe way to determine if types match. struct WrapperTypeInfo { - + static WrapperTypeInfo* unwrap(v8::Handle<v8::Value> typeInfoWrapper) { return reinterpret_cast<WrapperTypeInfo*>(v8::External::Unwrap(typeInfoWrapper)); @@ -92,6 +97,7 @@ namespace WebCore { const DerefObjectFunction derefObjectFunction; const ToActiveDOMObjectFunction toActiveDOMObjectFunction; const WrapperTypeInfo* parentClass; + const WrapperTypePrototype wrapperTypePrototype; }; } diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp index 245726217..8c73f4888 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp @@ -27,51 +27,51 @@ #include "V8ArrayBufferViewCustom.h" #include "V8ArrayBufferViewCustomScript.h" + #include <v8.h> namespace WebCore { // The random suffix helps to avoid name collision. -const char fastSetFlagName[] = "TypedArray::FastSet::8NkZVq"; +const char hiddenCopyMethodName[] = "TypedArray::HiddenCopy::8NkZVq"; -bool fastSetInstalled(v8::Handle<v8::Object> array) +v8::Handle<v8::Value> getHiddenCopyMethod(v8::Handle<v8::Object> prototype) { - // Use a hidden flag in the global object an indicator of whether the fast - // 'set' is installed or not. - v8::Handle<v8::Object> global = array->CreationContext()->Global(); - v8::Handle<v8::String> key = v8::String::New(fastSetFlagName); - v8::Handle<v8::Value> fastSetFlag = global->GetHiddenValue(key); - return !fastSetFlag.IsEmpty(); + v8::Handle<v8::String> key = v8::String::New(hiddenCopyMethodName); + return prototype->GetHiddenValue(key); } -void installFastSet(v8::Handle<v8::Object> array) -{ +v8::Handle<v8::Value> installHiddenCopyMethod(v8::Handle<v8::Object> prototype) { v8::TryCatch tryCatch; tryCatch.SetVerbose(true); - v8::Handle<v8::Object> global = array->CreationContext()->Global(); - v8::Handle<v8::String> key = v8::String::New(fastSetFlagName); - global->SetHiddenValue(key, v8::Boolean::New(true)); - String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js), sizeof(V8ArrayBufferViewCustomScript_js)); v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source)); - script->Run(); + v8::Handle<v8::Value> value = script->Run(); + v8::Handle<v8::String> key = v8::String::New(hiddenCopyMethodName); + prototype->SetHiddenValue(key, value); + return value; } - -void copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t offset) +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate) { - v8::Handle<v8::String> key = v8::String::New("set"); - v8::Handle<v8::Function> set = destArray->Get(key).As<v8::Function>(); - v8::Handle<v8::Value> arguments[2]; - int numberOfArguments = 1; + v8::Handle<v8::Value> prototype_value = destArray->GetPrototype(); + if (prototype_value.IsEmpty() || !prototype_value->IsObject()) + return false; + v8::Handle<v8::Object> prototype = prototype_value.As<v8::Object>(); + v8::Handle<v8::Value> value = getHiddenCopyMethod(prototype); + if (value.IsEmpty()) + value = installHiddenCopyMethod(prototype); + if (value.IsEmpty() || !value->IsFunction()) + return false; + v8::Handle<v8::Function> copy_method = value.As<v8::Function>(); + v8::Handle<v8::Value> arguments[3]; arguments[0] = srcArray; - if (offset) { - arguments[1] = v8::Uint32::New(offset); - numberOfArguments = 2; - } - set->Call(destArray, numberOfArguments, arguments); + arguments[1] = v8::Uint32::New(length); + arguments[2] = v8::Uint32::New(offset); + copy_method->Call(destArray, 3, arguments); + return true; } } diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h index 712d03651..e4ac3544b 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -40,18 +40,9 @@ namespace WebCore { - -// Check if the JavaScript 'set' method was already installed -// on the prototype of the given typed array. -bool fastSetInstalled(v8::Handle<v8::Object> array); - -// Install the JavaScript 'set' method on the prototype of -// the given typed array. -void installFastSet(v8::Handle<v8::Object> array); - -// Copy the elements from the source array to the typed destination array by -// invoking the 'set' method of the destination array in JS. -void copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t offset); +// Copy the elements from the source array to the typed destination array. +// Returns true if it succeeded, otherwise returns false. +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate*); // Template function used by the ArrayBufferView*Constructor callbacks. @@ -173,8 +164,13 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get()); args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); - if (!srcArray.IsEmpty()) - copyElements(args.Holder(), srcArray, 0); + if (!srcArray.IsEmpty()) { + bool copied = copyElements(args.Holder(), srcArray, len, 0, args.GetIsolate()); + if (!copied) { + for (unsigned i = 0; i < len; i++) + array->set(i, srcArray->Get(i)->NumberValue()); + } + } v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::New(args.Holder()); wrapper.MarkIndependent(); @@ -214,11 +210,8 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args) // Out of range offset or overflow return V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate()); } - - if (!fastSetInstalled(args.Holder())) { - installFastSet(args.Holder()); - copyElements(args.Holder(), array, offset); - } else { + bool copied = copyElements(args.Holder(), array, length, offset, args.GetIsolate()); + if (!copied) { for (uint32_t i = 0; i < length; i++) impl->set(offset + i, array->Get(i)->NumberValue()); } diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js index b6e098445..d3448599a 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js @@ -23,42 +23,14 @@ */ (function() { - -var optimizeSetMethod = function(type) -{ - if (typeof type === 'function' && - typeof type.prototype !== 'undefined' && - typeof type.prototype.set === 'function') { - type.prototype.set = (function() { - var nativeSet = type.prototype.set; - var f = function(source, offset) - { - if (source.constructor === Array) { - var length = source.length; - offset = offset || 0; - if (offset < 0 || offset + length > this.length) { - return nativeSet.call(this, source, offset); - } - for (var i = 0; i < length; i++) - this[i + offset] = source[i]; - } else - return nativeSet.call(this, source, offset); - } - f.name = "set"; - return f; - })(); + return function(source, length, offset) { + if (offset == 0) { + for (var i = 0; i < length; i++) + this[i] = source[i]; + } else { + for (var i = 0; i < length; i++) + this[i + offset] = source[i]; + } } -}; - -optimizeSetMethod(Float32Array); -optimizeSetMethod(Float64Array); -optimizeSetMethod(Int8Array); -optimizeSetMethod(Int16Array); -optimizeSetMethod(Int32Array); -optimizeSetMethod(Uint8Array); -optimizeSetMethod(Uint8ClampedArray); -optimizeSetMethod(Uint16Array); -optimizeSetMethod(Uint32Array); - })(); diff --git a/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp b/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp index b6de34c1e..c969b033a 100644 --- a/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp @@ -47,7 +47,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(Blob* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isFile()) return toV8(toFile(impl), isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp index a025ecb38..7207a3dc0 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp @@ -46,7 +46,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(CSSRule* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); switch (impl->type()) { case CSSRule::UNKNOWN_RULE: // CSSUnknownRule.idl is explicitly excluded as it doesn't add anything diff --git a/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp index a677d4ba6..62fc8ecad 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp @@ -174,7 +174,7 @@ v8::Handle<v8::Array> V8CSSStyleDeclaration::namedPropertyEnumerator(const v8::A for (unsigned i = 0; i < propertyNamesLength; ++i) { String key = propertyNames.at(i); ASSERT(!key.isNull()); - properties->Set(v8::Integer::New(i), v8String(key)); + properties->Set(v8::Integer::New(i), v8String(key, info.GetIsolate())); } return properties; @@ -212,14 +212,14 @@ v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertyGetter(v8::Local<v8::S return v8::Number::New(static_cast<CSSPrimitiveValue*>( cssValue.get())->getFloatValue(CSSPrimitiveValue::CSS_PX)); } - return v8StringOrNull(cssValue->cssText()); + return v8StringOrNull(cssValue->cssText(), info.GetIsolate()); } String result = imp->getPropertyValueInternal(static_cast<CSSPropertyID>(propInfo->propID)); if (result.isNull()) result = ""; // convert null to empty string. - return v8String(result); + return v8String(result, info.GetIsolate()); } v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp index a81beb541..c63a2d2f2 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp @@ -39,7 +39,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(CSSStyleSheet* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8CSSStyleSheet::wrap(impl, isolate); // Add a hidden reference from stylesheet object to its owner node. Node* ownerNode = impl->ownerNode(); diff --git a/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp index 81912a89a..cb5d2febf 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp @@ -45,7 +45,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(CSSValue* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isWebKitCSSTransformValue()) return toV8(static_cast<WebKitCSSTransformValue*>(impl), isolate); if (impl->isValueList()) diff --git a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp index 79a60552f..a27fd01e7 100644 --- a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp @@ -57,7 +57,7 @@ static v8::Handle<v8::Value> toV8Object(CanvasStyle* style, v8::Isolate* isolate if (style->canvasPattern()) return toV8(style->canvasPattern(), isolate); - return v8String(style->color()); + return v8String(style->color(), isolate); } static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value) diff --git a/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp index cea10af1c..3063459e7 100644 --- a/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp @@ -51,13 +51,13 @@ v8::Handle<v8::Value> V8Clipboard::typesAccessorGetter(v8::Local<v8::String> nam HashSet<String> types = clipboard->types(); if (types.isEmpty()) - return v8::Null(); + return v8::Null(info.GetIsolate()); v8::Local<v8::Array> result = v8::Array::New(types.size()); HashSet<String>::const_iterator end = types.end(); int index = 0; for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index) - result->Set(v8::Integer::New(index), v8String(*it)); + result->Set(v8::Integer::New(index), v8String(*it, info.GetIsolate())); return result; } diff --git a/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp index fc5c750b3..8289eb2b2 100644 --- a/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp @@ -38,7 +38,7 @@ v8::Handle<v8::Value> V8Coordinates::altitudeAccessorGetter(v8::Local<v8::String v8::Handle<v8::Object> holder = info.Holder(); Coordinates* imp = V8Coordinates::toNative(holder); if (!imp->canProvideAltitude()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->altitude()); } @@ -48,7 +48,7 @@ v8::Handle<v8::Value> V8Coordinates::altitudeAccuracyAccessorGetter(v8::Local<v8 v8::Handle<v8::Object> holder = info.Holder(); Coordinates* imp = V8Coordinates::toNative(holder); if (!imp->canProvideAltitudeAccuracy()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->altitudeAccuracy()); } @@ -58,7 +58,7 @@ v8::Handle<v8::Value> V8Coordinates::headingAccessorGetter(v8::Local<v8::String> v8::Handle<v8::Object> holder = info.Holder(); Coordinates* imp = V8Coordinates::toNative(holder); if (!imp->canProvideHeading()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->heading()); } @@ -68,7 +68,7 @@ v8::Handle<v8::Value> V8Coordinates::speedAccessorGetter(v8::Local<v8::String> n v8::Handle<v8::Object> holder = info.Holder(); Coordinates* imp = V8Coordinates::toNative(holder); if (!imp->canProvideSpeed()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->speed()); } diff --git a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index c07986b76..9ee27fb72 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -56,8 +56,8 @@ bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLEr v8::Context::Scope scope(v8Context); - v8::Handle<v8::Value> transactionHandle = toV8(transaction, 0); - v8::Handle<v8::Value> errorHandle = toV8(error, 0); + v8::Handle<v8::Value> transactionHandle = toV8(transaction); + v8::Handle<v8::Value> errorHandle = toV8(error); if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); diff --git a/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp index 851d9e0d8..db045a844 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp @@ -52,7 +52,7 @@ v8::Handle<v8::Value> V8DOMStringMap::namedPropertyGetter(v8::Local<v8::String> String value = V8DOMStringMap::toNative(info.Holder())->item(toWebCoreString(name)); if (value.isNull()) return v8::Handle<v8::Value>(); - return v8StringOrUndefined(value); + return v8StringOrUndefined(value, info.GetIsolate()); } v8::Handle<v8::Array> V8DOMStringMap::namedPropertyEnumerator(const v8::AccessorInfo& info) @@ -62,7 +62,7 @@ v8::Handle<v8::Array> V8DOMStringMap::namedPropertyEnumerator(const v8::Accessor V8DOMStringMap::toNative(info.Holder())->getNames(names); v8::Handle<v8::Array> properties = v8::Array::New(names.size()); for (size_t i = 0; i < names.size(); ++i) - properties->Set(v8::Integer::New(i), v8String(names[i])); + properties->Set(v8::Integer::New(i), v8String(names[i], info.GetIsolate())); return properties; } @@ -71,7 +71,7 @@ v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::Strin INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter"); ExceptionCode ec = 0; V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), ec); - return ec ? v8::False() : v8::True(); + return v8Boolean(!ec, info.GetIsolate()); } v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -87,7 +87,7 @@ v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> v8::Handle<v8::Value> toV8(DOMStringMap* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl, isolate); // Add a hidden reference from the element to the DOMStringMap. Element* element = impl->element(); diff --git a/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp index 090a2179e..6dd8ecfcf 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp @@ -41,7 +41,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(DOMTokenList* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl, isolate); // Add a hidden reference from the element to the DOMTokenList. Element* element = impl->element(); diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index cd646cd24..5bedb8e29 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -603,7 +603,7 @@ bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t inde v8::Handle<v8::Value> toV8(DOMWindow* window, v8::Isolate* isolate) { if (!window) - return v8::Null(); + return v8NullWithCheck(isolate); // Initializes environment of a frame, and return the global object // of the frame. Frame* frame = window->frame(); diff --git a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp index 4c7329326..34110a0b6 100755 --- a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp @@ -60,7 +60,7 @@ v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(DataView* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return V8DataView::wrap(impl, isolate); } diff --git a/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp index f7a03f9b8..e3e290161 100644 --- a/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp @@ -39,21 +39,21 @@ namespace WebCore { namespace { -v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration) +static v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, v8::Isolate* isolate) { v8::Local<v8::Object> object = v8::Object::New(); - object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null()); - object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null()); - object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null()); + object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null(isolate)); + object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null(isolate)); + object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null(isolate)); return object; } -v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate) +static v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, v8::Isolate* isolate) { v8::Local<v8::Object> object = v8::Object::New(); - object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null()); - object->Set(v8::String::New("beta"), rotationRate->canProvideBeta() ? v8::Number::New(rotationRate->beta()) : v8::Null()); - object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null()); + object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null(isolate)); + object->Set(v8::String::New("beta"), rotationRate->canProvideBeta() ? v8::Number::New(rotationRate->beta()) : v8::Null(isolate)); + object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null(isolate)); return object; } @@ -129,8 +129,8 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationAccessorGetter(v8::Local< v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); if (!imp->deviceMotionData()->acceleration()) - return v8::Null(); - return createAccelerationObject(imp->deviceMotionData()->acceleration()); + return v8::Null(info.GetIsolate()); + return createAccelerationObject(imp->deviceMotionData()->acceleration(), info.GetIsolate()); } v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -139,8 +139,8 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationIncludingGravityAccessorG v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); if (!imp->deviceMotionData()->accelerationIncludingGravity()) - return v8::Null(); - return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity()); + return v8::Null(info.GetIsolate()); + return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity(), info.GetIsolate()); } v8::Handle<v8::Value> V8DeviceMotionEvent::rotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -149,8 +149,8 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::rotationRateAccessorGetter(v8::Local< v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); if (!imp->deviceMotionData()->rotationRate()) - return v8::Null(); - return createRotationRateObject(imp->deviceMotionData()->rotationRate()); + return v8::Null(info.GetIsolate()); + return createRotationRateObject(imp->deviceMotionData()->rotationRate(), info.GetIsolate()); } v8::Handle<v8::Value> V8DeviceMotionEvent::intervalAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -159,7 +159,7 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::intervalAccessorGetter(v8::Local<v8:: v8::Handle<v8::Object> holder = info.Holder(); DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder); if (!imp->deviceMotionData()->canProvideInterval()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->deviceMotionData()->interval()); } diff --git a/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp index 911a93824..fc3fc2026 100644 --- a/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp @@ -43,7 +43,7 @@ v8::Handle<v8::Value> V8DeviceOrientationEvent::alphaAccessorGetter(v8::Local<v8 v8::Handle<v8::Object> holder = info.Holder(); DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder); if (!imp->orientation()->canProvideAlpha()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->orientation()->alpha()); } @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8DeviceOrientationEvent::betaAccessorGetter(v8::Local<v8: v8::Handle<v8::Object> holder = info.Holder(); DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder); if (!imp->orientation()->canProvideBeta()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->orientation()->beta()); } @@ -63,7 +63,7 @@ v8::Handle<v8::Value> V8DeviceOrientationEvent::gammaAccessorGetter(v8::Local<v8 v8::Handle<v8::Object> holder = info.Holder(); DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder); if (!imp->orientation()->canProvideGamma()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Number::New(imp->orientation()->gamma()); } @@ -73,7 +73,7 @@ v8::Handle<v8::Value> V8DeviceOrientationEvent::absoluteAccessorGetter(v8::Local v8::Handle<v8::Object> holder = info.Holder(); DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder); if (!imp->orientation()->canProvideAbsolute()) - return v8::Null(); + return v8::Null(info.GetIsolate()); return v8::Boolean::New(imp->orientation()->absolute()); } diff --git a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp index 8831489bb..42d77fcbb 100644 --- a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp @@ -43,6 +43,7 @@ #include "V8CanvasRenderingContext2D.h" #include "V8CustomXPathNSResolver.h" #include "V8DOMImplementation.h" +#include "V8DOMWrapper.h" #include "V8HTMLDocument.h" #include "V8IsolatedContext.h" #include "V8Node.h" @@ -119,7 +120,7 @@ v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Argument v8::Handle<v8::Value> toV8(Document* impl, v8::Isolate* isolate, bool forceNewObject) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isHTMLDocument()) return toV8(static_cast<HTMLDocument*>(impl), isolate, forceNewObject); #if ENABLE(SVG) @@ -142,9 +143,8 @@ v8::Handle<v8::Value> V8Document::createTouchListCallback(const v8::Arguments& a RefPtr<TouchList> touchList = TouchList::create(); for (int i = 0; i < args.Length(); i++) { - if (!args[i]->IsObject()) - return v8::Undefined(); - touchList->append(V8Touch::toNative(args[i]->ToObject())); + Touch* touch = V8DOMWrapper::isWrapperOfType(args[i], &V8Touch::info) ? V8Touch::toNative(args[i]->ToObject()) : 0; + touchList->append(touch); } return toV8(touchList.release(), args.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp index b45377c61..4ebb78384 100644 --- a/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp @@ -38,7 +38,7 @@ v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> n { Document* document = V8Document::toNative(info.Holder()); if (!document->frame()) - return v8::Null(); + return v8::Null(info.GetIsolate()); DOMWindow* window = document->frame()->domWindow(); return toV8(window->location(), info.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp index dc3a53fb9..e6cd8234c 100644 --- a/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp @@ -47,7 +47,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(Entry* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isFile()) return toV8(static_cast<FileEntry*>(impl), isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp index 13ae6d811..129af7a6b 100644 --- a/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp @@ -47,7 +47,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(EntrySync* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isFile()) return toV8(static_cast<FileEntrySync*>(impl), isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp index e305c9a03..9da52c74f 100644 --- a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp @@ -76,7 +76,7 @@ v8::Handle<v8::Value> V8Event::clipboardDataAccessorGetter(v8::Local<v8::String> v8::Handle<v8::Value> toV8(Event* event, v8::Isolate *isolate) { if (!event) - return v8::Null(); + return v8NullWithCheck(isolate); String desiredInterface = event->interfaceName(); diff --git a/Source/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp b/Source/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp index 0cffe6d83..fc9b70caa 100755 --- a/Source/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp @@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8FileReader::resultAccessorGetter(v8::Local<v8::String> n FileReader* imp = V8FileReader::toNative(holder); if (imp->readType() == FileReaderLoader::ReadAsArrayBuffer) return toV8(imp->arrayBufferResult(), info.GetIsolate()); - return v8StringOrNull(imp->stringResult()); + return v8StringOrNull(imp->stringResult(), info.GetIsolate()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp index 06360615b..b536bbfc6 100644 --- a/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp @@ -57,7 +57,7 @@ v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Float32Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Float32Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Float64ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Float64ArrayCustom.cpp index 8987b4faa..889bd323b 100644 --- a/Source/WebCore/bindings/v8/custom/V8Float64ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Float64ArrayCustom.cpp @@ -52,7 +52,7 @@ v8::Handle<v8::Value> V8Float64Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Float64Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Float64Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalDoubleArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index 01c54db46..20db53d64 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -84,7 +84,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument #endif CanvasRenderingContext* result = imp->getContext(contextId, attrs.get()); if (!result) - return v8::Null(); + return v8::Null(args.GetIsolate()); if (result->is2d()) return toV8(static_cast<CanvasRenderingContext2D*>(result), args.GetIsolate()); #if ENABLE(WEBGL) @@ -92,7 +92,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument return toV8(static_cast<WebGLRenderingContext*>(result), args.GetIsolate()); #endif ASSERT_NOT_REACHED(); - return v8::Null(); + return v8::Null(args.GetIsolate()); } v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments& args) @@ -111,7 +111,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments String result = canvas->toDataURL(type, qualityPtr, ec); V8Proxy::setDOMException(ec, args.GetIsolate()); - return v8StringOrUndefined(result); + return v8StringOrUndefined(result, args.GetIsolate()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index b1a7b2b3e..6b9d0b327 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -187,7 +187,7 @@ void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8: v8::Handle<v8::Value> toV8(HTMLDocument* impl, v8::Isolate* isolate, bool forceNewObject) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, isolate, forceNewObject); if (wrapper.IsEmpty()) return wrapper; diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp index 19286124f..695cb052e 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp @@ -40,27 +40,25 @@ namespace WebCore { +v8::Handle<v8::Value> toV8(HTMLElement* impl, v8::Isolate* isolate, bool forceNewObject) +{ + if (!impl) + return v8NullWithCheck(isolate); + return createV8HTMLWrapper(impl, isolate, forceNewObject); +} + #if ENABLE(MICRODATA) static v8::Handle<v8::Value> toV8Object(MicroDataItemValue* itemValue, v8::Isolate* isolate) { if (!itemValue) - return v8::Null(); + return v8::Null(isolate); if (itemValue->isNode()) return toV8(itemValue->getNode(), isolate); - return v8String(itemValue->getString()); -} -#endif - -v8::Handle<v8::Value> toV8(HTMLElement* impl, v8::Isolate* isolate, bool forceNewObject) -{ - if (!impl) - return v8::Null(); - return createV8HTMLWrapper(impl, isolate, forceNewObject); + return v8String(itemValue->getString(), isolate); } -#if ENABLE(MICRODATA) v8::Handle<v8::Value> V8HTMLElement::itemValueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { HTMLElement* impl = V8HTMLElement::toNative(info.Holder()); diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp index c1f559cf7..e78c95a08 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp @@ -44,7 +44,7 @@ namespace WebCore { -WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0, 0 }; +WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0, 0, WrapperTypeObjectPrototype }; static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args) { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp index e1bb5942e..7a6fff47f 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp @@ -100,7 +100,7 @@ v8::Handle<v8::Value> V8HTMLInputElement::selectionDirectionAccessorGetter(v8::L if (!imp->canHaveSelection()) return V8Proxy::throwTypeError("Accessing selectionDirection on an input element that cannot have a selection.", info.GetIsolate()); - return v8String(imp->selectionDirection()); + return v8String(imp->selectionDirection(), info.GetIsolate()); } void V8HTMLInputElement::selectionDirectionAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp index 4e30db514..bccda0c9e 100644 --- a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8History::stateAccessorGetter(v8::Local<v8::String> name, return value; SerializedScriptValue* serialized = history->state(); - value = serialized ? serialized->deserialize(0, info.GetIsolate()) : v8::Handle<v8::Value>(v8::Null()); + value = serialized ? serialized->deserialize(0, info.GetIsolate()) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); info.Holder()->SetHiddenValue(V8HiddenPropertyName::state(), value); return value; diff --git a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index 1e37cdfbf..98baab96e 100644 --- a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -48,13 +48,13 @@ namespace WebCore { v8::Handle<v8::Value> toV8(IDBAny* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); switch (impl->type()) { case IDBAny::UndefinedType: return v8::Undefined(); case IDBAny::NullType: - return v8::Null(); + return v8NullWithCheck(isolate); case IDBAny::DOMStringListType: return toV8(impl->domStringList(), isolate); case IDBAny::IDBCursorType: @@ -76,7 +76,7 @@ v8::Handle<v8::Value> toV8(IDBAny* impl, v8::Isolate* isolate) case IDBAny::SerializedScriptValueType: return impl->serializedScriptValue()->deserialize(0, isolate); case IDBAny::StringType: - return v8String(impl->string()); + return v8String(impl->string(), isolate); } ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp b/Source/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp index 9b0e65414..84a4b0c69 100644 --- a/Source/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp @@ -41,7 +41,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(IDBKey* key, v8::Isolate* isolate) { if (!key) - return v8::Null(); + return v8NullWithCheck(isolate); switch (key->type()) { case IDBKey::InvalidType: @@ -51,7 +51,7 @@ v8::Handle<v8::Value> toV8(IDBKey* key, v8::Isolate* isolate) case IDBKey::NumberType: return v8::Number::New(key->number()); case IDBKey::StringType: - return v8String(key->string()); + return v8String(key->string(), isolate); case IDBKey::DateType: return v8::Date::New(key->date()); case IDBKey::ArrayType: diff --git a/Source/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp index 7a8544dd9..aeaf30f81 100644 --- a/Source/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp @@ -38,7 +38,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(ImageData* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8ImageData::wrap(impl, isolate); if (!wrapper.IsEmpty()) { // Create a V8 Uint8ClampedArray object. diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 898a0f455..9a42dee90 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -37,6 +37,7 @@ #include "InjectedScriptHost.h" #include "InspectorDOMAgent.h" #include "InspectorValues.h" +#include "ScriptDebugServer.h" #include "ScriptValue.h" #include "V8Binding.h" #include "V8BindingState.h" @@ -109,7 +110,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::isHTMLAllCollectionCallback(const v8 return v8::Undefined(); if (!args[0]->IsObject()) - return v8::False(); + return v8Boolean(false, args.GetIsolate()); v8::HandleScope handleScope; return v8::Boolean::New(V8HTMLAllCollection::HasInstance(args[0])); @@ -181,6 +182,13 @@ v8::Handle<v8::Value> V8InjectedScriptHost::functionDetailsCallback(const v8::Ar v8::Handle<v8::Value> inferredName = function->GetInferredName(); if (inferredName->IsString() && v8::Handle<v8::String>::Cast(inferredName)->Length()) result->Set(v8::String::New("inferredName"), inferredName); + + InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); + ScriptDebugServer& debugServer = host->scriptDebugServer(); + v8::Handle<v8::Value> scopes = debugServer.functionScopes(function); + if (!scopes.IsEmpty() && scopes->IsArray()) + result->Set(v8::String::New("rawScopes"), scopes); + return result; } @@ -266,7 +274,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::databaseIdCallback(const v8::Argumen InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0])); if (database) - return v8StringOrUndefined(host->databaseIdImpl(database)); + return v8StringOrUndefined(host->databaseIdImpl(database), args.GetIsolate()); #endif return v8::Undefined(); } @@ -279,7 +287,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::storageIdCallback(const v8::Argument InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0])); if (storage) - return v8StringOrUndefined(host->storageIdImpl(storage)); + return v8StringOrUndefined(host->storageIdImpl(storage), args.GetIsolate()); return v8::Undefined(); } diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp index 45559fc6e..333fe575c 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp @@ -76,7 +76,7 @@ static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHos return instance; } -ScriptObject InjectedScriptManager::createInjectedScript(const String& scriptSource, ScriptState* inspectedScriptState, long id) +ScriptObject InjectedScriptManager::createInjectedScript(const String& scriptSource, ScriptState* inspectedScriptState, int id) { v8::HandleScope scope; @@ -148,7 +148,7 @@ InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* inspectedSc if (!m_inspectedStateAccessCheck(inspectedScriptState)) return InjectedScript(); - pair<long, ScriptObject> injectedScript = injectScript(injectedScriptSource(), inspectedScriptState); + pair<int, ScriptObject> injectedScript = injectScript(injectedScriptSource(), inspectedScriptState); InjectedScript result(injectedScript.second, m_inspectedStateAccessCheck); m_idToInjectedScript.set(injectedScript.first, result); global->SetHiddenValue(key, injectedScript.second.v8Object()); diff --git a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp index f8b5e350d..62ee6bd11 100644 --- a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp @@ -44,22 +44,22 @@ namespace WebCore { -v8::Handle<v8::Value> V8InspectorFrontendHost::platformCallback(const v8::Arguments&) +v8::Handle<v8::Value> V8InspectorFrontendHost::platformCallback(const v8::Arguments& args) { #if defined(OS_MACOSX) - return v8String("mac"); + return v8String("mac", args.GetIsolate()); #elif defined(OS_LINUX) - return v8String("linux"); + return v8String("linux", args.GetIsolate()); #elif defined(OS_FREEBSD) - return v8String("freebsd"); + return v8String("freebsd", args.GetIsolate()); #elif defined(OS_OPENBSD) - return v8String("openbsd"); + return v8String("openbsd", args.GetIsolate()); #elif defined(OS_SOLARIS) - return v8String("solaris"); + return v8String("solaris", args.GetIsolate()); #elif defined(OS_WIN) - return v8String("windows"); + return v8String("windows", args.GetIsolate()); #else - return v8String("unknown"); + return v8String("unknown", args.GetIsolate()); #endif } diff --git a/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp index 3199dd0a6..f5bed3f3b 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Int16Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Int16Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Int16Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalShortArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp index 42945c077..0270f7e89 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Int32Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Int32Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Int32Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalIntArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp index a88a7e76c..246704a23 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Int8Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Int8Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Int8Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalByteArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp index e2a691db1..210ef1029 100644 --- a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp @@ -71,7 +71,7 @@ v8::Handle<v8::Value> V8JavaScriptCallFrame::thisObjectAccessorGetter(v8::Local< v8::Handle<v8::Value> V8JavaScriptCallFrame::typeAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("V8JavaScriptCallFrame.typeAccessorGetter()"); - return v8String("function"); + return v8String("function", info.GetIsolate()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp index f40344bcc..2b4c46baf 100644 --- a/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp @@ -255,7 +255,7 @@ v8::Handle<v8::Value> V8Location::toStringCallback(const v8::Arguments& args) if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) return v8::Undefined(); String result = imp->href(); - return v8String(result); + return v8String(result, args.GetIsolate()); } bool V8Location::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>) @@ -275,7 +275,7 @@ bool V8Location::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Va v8::Handle<v8::Value> toV8(Location* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); if (wrapper.IsEmpty()) { wrapper = V8Location::wrap(impl, isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp index 5bb0187ae..77ba3f266 100644 --- a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8MessageEvent::dataAccessorGetter(v8::Local<v8::String> n case MessageEvent::DataTypeScriptValue: { ScriptValue scriptValue = event->dataAsScriptValue(); if (scriptValue.hasNoValue()) - result = v8::Null(); + result = v8::Null(info.GetIsolate()); else result = v8::Local<v8::Value>::New(scriptValue.v8Value()); break; @@ -63,7 +63,7 @@ v8::Handle<v8::Value> V8MessageEvent::dataAccessorGetter(v8::Local<v8::String> n if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue()) result = serializedValue->deserialize(event->ports(), info.GetIsolate()); else - result = v8::Null(); + result = v8::Null(info.GetIsolate()); break; case MessageEvent::DataTypeString: { diff --git a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp index 45e8dc8c3..bffbe7400 100644 --- a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp @@ -66,9 +66,9 @@ bool V8MutationCallback::handleEvent(MutationRecordArray* mutations, WebKitMutat v8::Local<v8::Array> mutationsArray = v8::Array::New(mutations->size()); for (size_t i = 0; i < mutations->size(); ++i) - mutationsArray->Set(v8::Integer::New(i), toV8(mutations->at(i).get(), 0)); + mutationsArray->Set(v8::Integer::New(i), toV8(mutations->at(i).get())); - v8::Handle<v8::Value> observerHandle = toV8(observer, 0); + v8::Handle<v8::Value> observerHandle = toV8(observer); if (observerHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); diff --git a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp index 47feb0435..739e8d2eb 100644 --- a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp @@ -74,7 +74,7 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> v8::Handle<v8::Value> toV8(NamedNodeMap* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl, isolate); // Add a hidden reference from named node map to its owner node. Element* element = impl->element(); diff --git a/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp index 3848d5c9c..24ccc07b1 100644 --- a/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp @@ -77,7 +77,7 @@ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) return V8Proxy::setDOMException(ec, args.GetIsolate()); if (success) return args[0]; - return v8::Null(); + return v8::Null(args.GetIsolate()); } // This function is customized to take advantage of the optional 4th argument: shouldLazyAttach @@ -94,7 +94,7 @@ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) return V8Proxy::setDOMException(ec, args.GetIsolate()); if (success) return args[1]; - return v8::Null(); + return v8::Null(args.GetIsolate()); } v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) @@ -109,7 +109,7 @@ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) return V8Proxy::setDOMException(ec, args.GetIsolate()); if (success) return args[0]; - return v8::Null(); + return v8::Null(args.GetIsolate()); } // This function is customized to take advantage of the optional 4th argument: shouldLazyAttach @@ -125,13 +125,13 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) return V8Proxy::setDOMException(ec, args.GetIsolate()); if (success) return args[0]; - return v8::Null(); + return v8::Null(args.GetIsolate()); } v8::Handle<v8::Value> toV8Slow(Node* impl, v8::Isolate* isolate, bool forceNewObject) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (!forceNewObject) { v8::Handle<v8::Value> wrapper = V8DOMWrapper::getCachedWrapper(impl); diff --git a/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp index b3d90f4d2..0abf0c043 100644 --- a/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp @@ -62,7 +62,7 @@ v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> History* history = event->history(); if (!history || !event->serializedState()) - return cacheState(info.Holder(), v8::Null()); + return cacheState(info.Holder(), v8::Null(info.GetIsolate())); // There's no cached value from a previous invocation, nor a state value was provided by the // event, but there is a history object, so first we need to see if the state object has been diff --git a/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp index a4f80d0a1..743956958 100644 --- a/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp @@ -64,10 +64,10 @@ v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& a v8::Handle<v8::Value> value; switch(sqlValue.type()) { case SQLValue::StringValue: - value = v8String(sqlValue.string()); + value = v8String(sqlValue.string(), args.GetIsolate()); break; case SQLValue::NullValue: - value = v8::Null(); + value = v8::Null(args.GetIsolate()); break; case SQLValue::NumberValue: value = v8::Number::New(sqlValue.number()); @@ -76,7 +76,7 @@ v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& a ASSERT_NOT_REACHED(); } - item->Set(v8String(rowList->columnNames()[i]), value, static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::ReadOnly)); + item->Set(v8String(rowList->columnNames()[i], args.GetIsolate()), value, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)); } return item; diff --git a/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp index f54b8b7de..6db61bf01 100644 --- a/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp @@ -41,7 +41,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(SVGDocument* impl, v8::Isolate* isolate, bool forceNewObject) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8SVGDocument::wrap(impl, isolate, forceNewObject); if (wrapper.IsEmpty()) return wrapper; diff --git a/Source/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp index 257f42dbb..4379d4171 100644 --- a/Source/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp @@ -40,7 +40,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(SVGElement* impl, v8::Isolate* isolate, bool forceNewObject) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); return createV8SVGWrapper(impl, isolate, forceNewObject); } diff --git a/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp index fc7ade760..292bc0ddc 100644 --- a/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp @@ -58,7 +58,7 @@ void V8SVGLength::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:: { INC_STATS("DOM.SVGLength.value._set"); SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()); - if (wrapper->role() == AnimValRole) { + if (wrapper->isReadOnly()) { V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.GetIsolate()); return; } @@ -82,7 +82,7 @@ v8::Handle<v8::Value> V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arg { INC_STATS("DOM.SVGLength.convertToSpecifiedUnits"); SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(args.Holder()); - if (wrapper->role() == AnimValRole) + if (wrapper->isReadOnly()) return V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate()); if (args.Length() < 1) diff --git a/Source/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp index 5527d1246..173cbf631 100644 --- a/Source/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp @@ -60,7 +60,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(SVGPathSeg* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); switch (impl->pathSegType()) { case SVGPathSeg::PATHSEG_CLOSEPATH: return toV8(static_cast<SVGPathSegClosePath*>(impl), isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp index 7bab46bb8..841f2a83f 100644 --- a/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp @@ -44,7 +44,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(ScriptProfile* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Local<v8::Function> function = V8ScriptProfile::GetTemplate()->GetFunction(); if (function.IsEmpty()) { // Return if allocation failed. diff --git a/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp index 3ee8f8fe2..eadb5e6f6 100644 --- a/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp @@ -51,7 +51,7 @@ v8::Handle<v8::Value> V8ScriptProfileNode::callUIDAccessorGetter(v8::Local<v8::S v8::Handle<v8::Value> toV8(ScriptProfileNode* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Local<v8::Function> function = V8ScriptProfileNode::GetTemplate()->GetFunction(); if (function.IsEmpty()) { // Return if allocation failed. diff --git a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp index f5257b9a9..1bdadb5d9 100644 --- a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp @@ -47,7 +47,7 @@ v8::Handle<v8::Array> V8Storage::namedPropertyEnumerator(const v8::AccessorInfo& String key = storage->key(i); ASSERT(!key.isNull()); String val = storage->getItem(key); - properties->Set(v8::Integer::New(i), v8String(key)); + properties->Set(v8::Integer::New(i), v8String(key, info.GetIsolate())); } return properties; @@ -59,7 +59,7 @@ static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v String name = toWebCoreString(v8Name); if (name != "length" && storage->contains(name)) - return v8String(storage->getItem(name)); + return v8String(storage->getItem(name), info.GetIsolate()); return v8::Handle<v8::Value>(); } @@ -133,7 +133,7 @@ static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, cons if (storage->contains(name)) { storage->removeItem(name); - return v8::True(); + return v8Boolean(true, info.GetIsolate()); } return v8::Handle<v8::Boolean>(); diff --git a/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp index 6a03cefbe..a58b69909 100644 --- a/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp @@ -40,7 +40,7 @@ namespace WebCore { v8::Handle<v8::Value> toV8(StyleSheet* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); if (impl->isCSSStyleSheet()) return toV8(static_cast<CSSStyleSheet*>(impl), isolate); v8::Handle<v8::Object> wrapper = V8StyleSheet::wrap(impl, isolate); diff --git a/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp index 5942f5c4d..c7c517528 100644 --- a/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp @@ -48,7 +48,7 @@ v8::Handle<v8::Value> V8TrackEvent::trackAccessorGetter(v8::Local<v8::String> na TrackBase* track = trackEvent->track(); if (!track) - return v8::Null(); + return v8::Null(info.GetIsolate()); switch (track->type()) { case TrackBase::BaseTrack: @@ -67,7 +67,7 @@ v8::Handle<v8::Value> V8TrackEvent::trackAccessorGetter(v8::Local<v8::String> na break; } - return v8::Null(); + return v8::Null(info.GetIsolate()); } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp index d0fc02060..0b5af2059 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Uint16Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Uint16Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Uint16Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedShortArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp index 6c9073a25..a6eb2d449 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Uint32Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Uint32Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Uint32Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedIntArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp index f7c70d484..3cf926cbb 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8Uint8Array::setCallback(const v8::Arguments& args) v8::Handle<v8::Value> toV8(Uint8Array* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Uint8Array::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedByteArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp index aecb493db..59d2d09c3 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint8ClampedArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8Uint8ClampedArray::setCallback(const v8::Arguments& args v8::Handle<v8::Value> toV8(Uint8ClampedArray* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> wrapper = V8Uint8ClampedArray::wrap(impl, isolate); if (!wrapper.IsEmpty()) wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalPixelArray, impl->length()); diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 8c75c64ba..8527bc21b 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -132,7 +132,7 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info, v8::Isolate* i case WebGLGetInfo::kTypeInt: return v8::Integer::New(info.getInt()); case WebGLGetInfo::kTypeNull: - return v8::Null(); + return v8::Null(isolate); case WebGLGetInfo::kTypeString: return v8::String::New(fromWebCoreString(info.getString()), info.getString().length()); case WebGLGetInfo::kTypeUnsignedInt: @@ -168,7 +168,7 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info, v8::Isolate* i static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject, v8::Isolate* isolate) { if (!extension) - return v8::Null(); + return v8::Null(isolate); v8::Handle<v8::Value> extensionObject; const char* referenceName = 0; switch (extension->getName()) { @@ -278,10 +278,10 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getAttachedShadersCallback(const bool succeed = context->getAttachedShaders(program, shaders, ec); if (ec) { V8Proxy::setDOMException(ec, args.GetIsolate()); - return v8::Null(); + return v8::Null(args.GetIsolate()); } if (!succeed) - return v8::Null(); + return v8::Null(args.GetIsolate()); v8::Local<v8::Array> array = v8::Array::New(shaders.size()); for (size_t ii = 0; ii < shaders.size(); ++ii) array->Set(v8::Integer::New(ii), toV8(shaders[ii].get(), args.GetIsolate())); @@ -388,7 +388,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(co INC_STATS("DOM.WebGLRenderingContext.getSupportedExtensionsCallback()"); WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder()); if (imp->isContextLost()) - return v8::Null(); + return v8::Null(args.GetIsolate()); Vector<String> value = imp->getSupportedExtensions(); v8::Local<v8::Array> array = v8::Array::New(value.size()); diff --git a/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp index 81a4cdcb8..f0109c7e1 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp @@ -141,7 +141,7 @@ v8::Handle<v8::Value> V8WebSocket::sendCallback(const v8::Arguments& args) if (ec) return throwError(ec, args.GetIsolate()); - return v8Boolean(result); + return v8Boolean(result, args.GetIsolate()); } v8::Handle<v8::Value> V8WebSocket::closeCallback(const v8::Arguments& args) diff --git a/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp index 78d94a402..17c9f1bbf 100644 --- a/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp @@ -127,11 +127,11 @@ v8::Handle<v8::Value> V8WorkerContext::setIntervalCallback(const v8::Arguments& v8::Handle<v8::Value> toV8(WorkerContext* impl, v8::Isolate* isolate) { if (!impl) - return v8::Null(); + return v8NullWithCheck(isolate); WorkerContextExecutionProxy* proxy = impl->script()->proxy(); if (!proxy) - return v8::Null(); + return v8NullWithCheck(isolate); v8::Handle<v8::Object> global = proxy->context()->Global(); ASSERT(!global.IsEmpty()); diff --git a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 587fe3e23..b5414b8ab 100644 --- a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -57,7 +57,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8: const String& text = xmlHttpRequest->responseText(ec); if (ec) return throwError(ec, info.GetIsolate()); - return v8String(text); + return v8String(text, info.GetIsolate()); } v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) diff --git a/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp index e9f951754..3dc9ef570 100644 --- a/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp @@ -130,7 +130,7 @@ v8::Handle<v8::Value> V8XSLTProcessor::getParameterCallback(const v8::Arguments& if (result.isNull()) return v8::Undefined(); - return v8String(result); + return v8String(result, args.GetIsolate()); } v8::Handle<v8::Value> V8XSLTProcessor::removeParameterCallback(const v8::Arguments& args) diff --git a/Source/WebCore/bridge/qt/qt_class.cpp b/Source/WebCore/bridge/qt/qt_class.cpp index 105898e47..3803d4787 100644 --- a/Source/WebCore/bridge/qt/qt_class.cpp +++ b/Source/WebCore/bridge/qt/qt_class.cpp @@ -99,7 +99,7 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, PropertyName id if (m.access() == QMetaMethod::Private) continue; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) int iter = 0; const char* signature = m.signature(); while (signature[iter] && signature[iter] != '(') diff --git a/Source/WebCore/bridge/qt/qt_instance.cpp b/Source/WebCore/bridge/qt/qt_instance.cpp index d49892111..c79096d5a 100644 --- a/Source/WebCore/bridge/qt/qt_instance.cpp +++ b/Source/WebCore/bridge/qt/qt_instance.cpp @@ -237,7 +237,7 @@ void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array) for (i = 0; i < methodCount; i++) { QMetaMethod method = meta->method(i); if (method.access() != QMetaMethod::Private) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QString sig = QString::fromLatin1(method.methodSignature()); array.add(Identifier(exec, UString(sig.utf16(), sig.length()))); #else @@ -289,7 +289,7 @@ JSValue QtInstance::stringValue(ExecState* exec) const // Check to see how much we can call it if (m.access() != QMetaMethod::Private && m.methodType() != QMetaMethod::Signal -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) && m.parameterCount() == 0 && m.returnType() != QMetaType::Void) { QVariant ret(m.returnType(), (void*)0); @@ -403,7 +403,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue if (obj) { QMetaType::Type argtype = QMetaType::Void; if (m_type == MetaProperty) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) argtype = (QMetaType::Type) m_property.userType(); #else argtype = (QMetaType::Type) QMetaType::type(m_property.typeName()); diff --git a/Source/WebCore/bridge/qt/qt_runtime.h b/Source/WebCore/bridge/qt/qt_runtime.h index 737247acd..4d9afa443 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.h +++ b/Source/WebCore/bridge/qt/qt_runtime.h @@ -238,14 +238,14 @@ private: // with the appropriate signal of 'sender'. When execute() is called, it will call JS 'receiverFunction'. class QtConnectionObject : public QObject { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) Q_OBJECT_FAKE #endif public: QtConnectionObject(JSContextRef, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction); ~QtConnectionObject(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) // Explicitly define these because want a custom qt_metacall(), so we can't use Q_OBJECT macro. static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp index 618c39c12..54247e035 100755 --- a/Source/WebCore/css/CSSCalculationValue.cpp +++ b/Source/WebCore/css/CSSCalculationValue.cpp @@ -74,7 +74,17 @@ static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type) String CSSCalcValue::customCssText() const { - return ""; + StringBuilder result; + + result.append("-webkit-calc"); + String expression = m_expression->customCssText(); + bool expressionHasSingleTerm = expression[0] != '('; + if (expressionHasSingleTerm) + result.append('('); + result.append(expression); + if (expressionHasSingleTerm) + result.append(')'); + return result.toString(); } double CSSCalcValue::clampToPermittedRange(double value) const @@ -109,7 +119,7 @@ public: return !m_value->getDoubleValue(); } - virtual String cssText() const + virtual String customCssText() const { return m_value->cssText(); } @@ -250,6 +260,20 @@ public: return evaluate(leftValue, rightValue); } + virtual String customCssText() const + { + StringBuilder result; + result.append('('); + result.append(m_leftSide->customCssText()); + result.append(' '); + result.append(static_cast<char>(m_operator)); + result.append(' '); + result.append(m_rightSide->customCssText()); + result.append(')'); + + return result.toString(); + } + private: CSSCalcBinaryOperation(PassRefPtr<CSSCalcExpressionNode> leftSide, PassRefPtr<CSSCalcExpressionNode> rightSide, CalcOperator op, CalculationCategory category) : CSSCalcExpressionNode(category, leftSide->isInteger() && rightSide->isInteger()) diff --git a/Source/WebCore/css/CSSCalculationValue.h b/Source/WebCore/css/CSSCalculationValue.h index ac9be46d3..57a249f89 100755 --- a/Source/WebCore/css/CSSCalculationValue.h +++ b/Source/WebCore/css/CSSCalculationValue.h @@ -63,6 +63,7 @@ public: virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0; virtual double doubleValue() const = 0; virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0; + virtual String customCssText() const = 0; CalculationCategory category() const { return m_category; } bool isInteger() const { return m_isInteger; } diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 596fa7cde..589cc2f35 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -199,6 +199,7 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyWebkitBorderImage, CSSPropertyWebkitBorderVerticalSpacing, CSSPropertyWebkitBoxAlign, + CSSPropertyWebkitBoxDecorationBreak, CSSPropertyWebkitBoxDirection, CSSPropertyWebkitBoxFlex, CSSPropertyWebkitBoxFlexGroup, @@ -227,11 +228,11 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyWebkitFilter, #endif #if ENABLE(CSS3_FLEXBOX) + CSSPropertyWebkitAlignItems, + CSSPropertyWebkitAlignSelf, CSSPropertyWebkitFlex, CSSPropertyWebkitFlexOrder, CSSPropertyWebkitFlexPack, - CSSPropertyWebkitFlexAlign, - CSSPropertyWebkitFlexItemAlign, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexFlow, CSSPropertyWebkitFlexLinePack, @@ -1540,6 +1541,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document()->renderView()); case CSSPropertyWebkitBoxAlign: return cssValuePool().createValue(style->boxAlign()); + case CSSPropertyWebkitBoxDecorationBreak: + if (style->boxDecorationBreak() == DSLICE) + return cssValuePool().createIdentifierValue(CSSValueSlice); + return cssValuePool().createIdentifierValue(CSSValueClone); case CSSPropertyWebkitBoxDirection: return cssValuePool().createValue(style->boxDirection()); case CSSPropertyWebkitBoxFlex: @@ -1649,15 +1654,15 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return cssValuePool().createValue(style->flexOrder(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyWebkitFlexPack: return cssValuePool().createValue(style->flexPack()); - case CSSPropertyWebkitFlexAlign: - return cssValuePool().createValue(style->flexAlign()); - case CSSPropertyWebkitFlexItemAlign: - if (style->flexItemAlign() == AlignAuto) { + case CSSPropertyWebkitAlignItems: + return cssValuePool().createValue(style->alignItems()); + case CSSPropertyWebkitAlignSelf: + if (style->alignSelf() == AlignAuto) { if (m_node && m_node->parentNode() && m_node->parentNode()->computedStyle()) - return cssValuePool().createValue(m_node->parentNode()->computedStyle()->flexAlign()); + return cssValuePool().createValue(m_node->parentNode()->computedStyle()->alignItems()); return cssValuePool().createValue(AlignStretch); } - return cssValuePool().createValue(style->flexItemAlign()); + return cssValuePool().createValue(style->alignSelf()); case CSSPropertyWebkitFlexDirection: return cssValuePool().createValue(style->flexDirection()); case CSSPropertyWebkitFlexWrap: @@ -2634,14 +2639,14 @@ PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSid PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const { - StylePropertyVector list; + Vector<CSSProperty, 256> list; list.reserveInitialCapacity(length); for (unsigned i = 0; i < length; ++i) { RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); if (value) list.append(CSSProperty(set[i], value.release(), false)); } - return StylePropertySet::adopt(list); + return StylePropertySet::create(list.data(), list.size()); } CSSRule* CSSComputedStyleDeclaration::parentRule() const diff --git a/Source/WebCore/css/CSSFontFaceRule.cpp b/Source/WebCore/css/CSSFontFaceRule.cpp index 8bb94db63..bcc8639ed 100644 --- a/Source/WebCore/css/CSSFontFaceRule.cpp +++ b/Source/WebCore/css/CSSFontFaceRule.cpp @@ -42,7 +42,7 @@ CSSFontFaceRule::~CSSFontFaceRule() CSSStyleDeclaration* CSSFontFaceRule::style() const { if (!m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->properties(), const_cast<CSSFontFaceRule*>(this)); + m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->mutableProperties(), const_cast<CSSFontFaceRule*>(this)); return m_propertiesCSSOMWrapper.get(); } @@ -60,7 +60,7 @@ void CSSFontFaceRule::reattach(StyleRuleFontFace* rule) ASSERT(rule); m_fontFaceRule = rule; if (m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper->reattach(m_fontFaceRule->properties()); + m_propertiesCSSOMWrapper->reattach(m_fontFaceRule->mutableProperties()); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.cpp b/Source/WebCore/css/CSSFontFaceSrcValue.cpp index 08518a763..79ae0e741 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/Source/WebCore/css/CSSFontFaceSrcValue.cpp @@ -73,7 +73,7 @@ String CSSFontFaceSrcValue::customCssText() const return result; } -void CSSFontFaceSrcValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) +void CSSFontFaceSrcValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const { if (!isLocal()) addSubresourceURL(urls, styleSheet->completeURL(m_resource)); diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.h b/Source/WebCore/css/CSSFontFaceSrcValue.h index a529c1644..94607fed0 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.h +++ b/Source/WebCore/css/CSSFontFaceSrcValue.h @@ -65,7 +65,7 @@ public: String customCssText() const; - void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*); + void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; CachedFont* cachedFont(Document*); diff --git a/Source/WebCore/css/CSSGrammar.y b/Source/WebCore/css/CSSGrammar.y index b6168858e..9eddc17a1 100644 --- a/Source/WebCore/css/CSSGrammar.y +++ b/Source/WebCore/css/CSSGrammar.y @@ -954,14 +954,9 @@ simple_selector: static_cast<CSSParser*>(parser)->updateSpecifiersWithElementName(nullAtom, starAtom, $$); } | namespace_selector element_name { - AtomicString namespacePrefix = $1; CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); - if (p->m_styleSheet) - $$->setTag(QualifiedName(namespacePrefix, $2, - p->m_styleSheet->determineNamespace(namespacePrefix))); - else // FIXME: Shouldn't this case be an error? - $$->setTag(QualifiedName(nullAtom, $2, p->m_defaultNamespace)); + $$->setTag(p->determineNameInNamespace($1, $2)); } | namespace_selector element_name specifier_list { $$ = $3; @@ -1087,19 +1082,15 @@ attrib: $$->setValue($6); } | '[' maybe_space namespace_selector attr_name ']' { - AtomicString namespacePrefix = $3; CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); - $$->setAttribute(QualifiedName(namespacePrefix, $4, - p->m_styleSheet->determineNamespace(namespacePrefix))); + $$->setAttribute(p->determineNameInNamespace($3, $4)); $$->setMatch(CSSSelector::Set); } | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space ']' { - AtomicString namespacePrefix = $3; CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); - $$->setAttribute(QualifiedName(namespacePrefix, $4, - p->m_styleSheet->determineNamespace(namespacePrefix))); + $$->setAttribute(p->determineNameInNamespace($3, $4)); $$->setMatch((CSSSelector::Match)$5); $$->setValue($7); } diff --git a/Source/WebCore/css/CSSPageRule.cpp b/Source/WebCore/css/CSSPageRule.cpp index 70bbab7ba..42859aa2a 100644 --- a/Source/WebCore/css/CSSPageRule.cpp +++ b/Source/WebCore/css/CSSPageRule.cpp @@ -48,7 +48,7 @@ CSSPageRule::~CSSPageRule() CSSStyleDeclaration* CSSPageRule::style() const { if (!m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_pageRule->properties(), const_cast<CSSPageRule*>(this)); + m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_pageRule->mutableProperties(), const_cast<CSSPageRule*>(this)); return m_propertiesCSSOMWrapper.get(); } @@ -92,7 +92,7 @@ void CSSPageRule::reattach(StyleRulePage* rule) ASSERT(rule); m_pageRule = rule; if (m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper->reattach(m_pageRule->properties()); + m_propertiesCSSOMWrapper->reattach(m_pageRule->mutableProperties()); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 725bc245e..695dee916 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -664,6 +664,10 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueStretch || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline) return true; break; + case CSSPropertyWebkitBoxDecorationBreak: + if (valueID == CSSValueClone || valueID == CSSValueSlice) + return true; + break; case CSSPropertyWebkitBoxDirection: if (valueID == CSSValueNormal || valueID == CSSValueReverse) return true; @@ -685,24 +689,24 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int return true; break; #if ENABLE(CSS3_FLEXBOX) - case CSSPropertyWebkitFlexAlign: + case CSSPropertyWebkitAlignItems: if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) return true; break; + case CSSPropertyWebkitAlignSelf: + if (valueID == CSSValueAuto || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) + return true; + break; case CSSPropertyWebkitFlexDirection: if (valueID == CSSValueRow || valueID == CSSValueRowReverse || valueID == CSSValueColumn || valueID == CSSValueColumnReverse) return true; break; - case CSSPropertyWebkitFlexItemAlign: - if (valueID == CSSValueAuto || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) - return true; - break; case CSSPropertyWebkitFlexLinePack: - if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueJustify || valueID == CSSValueDistribute || valueID == CSSValueStretch) + if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch) return true; break; case CSSPropertyWebkitFlexPack: - if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueJustify || valueID == CSSValueDistribute) + if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround) return true; break; case CSSPropertyWebkitFlexWrap: @@ -905,6 +909,7 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyWebkitBorderFit: case CSSPropertyWebkitBorderStartStyle: case CSSPropertyWebkitBoxAlign: + case CSSPropertyWebkitBoxDecorationBreak: case CSSPropertyWebkitBoxDirection: case CSSPropertyWebkitBoxLines: case CSSPropertyWebkitBoxOrient: @@ -915,9 +920,9 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyWebkitColumnBreakInside: case CSSPropertyWebkitColumnRuleStyle: #if ENABLE(CSS3_FLEXBOX) - case CSSPropertyWebkitFlexAlign: + case CSSPropertyWebkitAlignItems: + case CSSPropertyWebkitAlignSelf: case CSSPropertyWebkitFlexDirection: - case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexPack: case CSSPropertyWebkitFlexWrap: @@ -1105,8 +1110,6 @@ bool CSSParser::parseSystemColor(RGBA32& color, const String& string, Document* void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorList) { - RefPtr<StyleSheetContents> dummyStyleSheet = StyleSheetContents::create(); - setStyleSheet(dummyStyleSheet.get()); m_selectorListForParseSelector = &selectorList; setupParser("@-webkit-selector{", string, "}"); @@ -1114,9 +1117,6 @@ void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorLis cssyyparse(this); m_selectorListForParseSelector = 0; - - // The style sheet will be deleted right away, so it won't outlive the document. - ASSERT(dummyStyleSheet->hasOneRef()); } bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, StyleSheetContents* contextStyleSheet) @@ -1177,40 +1177,35 @@ PassOwnPtr<MediaQuery> CSSParser::parseMediaQuery(const String& string) return m_mediaQuery.release(); } -PassRefPtr<StylePropertySet> CSSParser::createStylePropertySet() +static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties) { - BitArray<numCSSProperties> seenProperties; - BitArray<numCSSProperties> seenImportantProperties; - - StylePropertyVector results; - results.reserveInitialCapacity(m_parsedProperties.size()); - - for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { - const CSSProperty& property = m_parsedProperties[i]; + // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. + for (int i = input.size() - 1; i >= 0; --i) { + const CSSProperty& property = input[i]; + if (property.isImportant() != important) + continue; const unsigned propertyIDIndex = property.id() - firstCSSProperty; - - // Ignore non-important properties if we already have an important property with the same ID. - if (!property.isImportant() && seenImportantProperties.get(propertyIDIndex)) + if (seenProperties.get(propertyIDIndex)) continue; + seenProperties.set(propertyIDIndex); + output[--unusedEntries] = property; + } +} - // If we already had this property, this new one takes precedence, so wipe out the old one. - if (seenProperties.get(propertyIDIndex)) { - for (unsigned i = 0; i < results.size(); ++i) { - if (results[i].id() == property.id()) { - results.remove(i); - break; - } - } - } +PassRefPtr<StylePropertySet> CSSParser::createStylePropertySet() +{ + BitArray<numCSSProperties> seenProperties; + size_t unusedEntries = m_parsedProperties.size(); + Vector<CSSProperty, 256> results(unusedEntries); - if (property.isImportant()) - seenImportantProperties.set(propertyIDIndex); - seenProperties.set(propertyIDIndex); + // Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found. + filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties); + filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties); - results.uncheckedAppend(property); - } + if (unusedEntries) + results.remove(0, unusedEntries); - return StylePropertySet::adopt(results, m_context.mode); + return StylePropertySet::createImmutable(results.data(), results.size(), m_context.mode); } void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit) @@ -2548,6 +2543,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyWebkitBorderFit: case CSSPropertyWebkitBorderStartStyle: case CSSPropertyWebkitBoxAlign: + case CSSPropertyWebkitBoxDecorationBreak: case CSSPropertyWebkitBoxDirection: case CSSPropertyWebkitBoxLines: case CSSPropertyWebkitBoxOrient: @@ -2558,9 +2554,9 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyWebkitColumnBreakInside: case CSSPropertyWebkitColumnRuleStyle: #if ENABLE(CSS3_FLEXBOX) - case CSSPropertyWebkitFlexAlign: + case CSSPropertyWebkitAlignItems: + case CSSPropertyWebkitAlignSelf: case CSSPropertyWebkitFlexDirection: - case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexPack: case CSSPropertyWebkitFlexWrap: @@ -5601,7 +5597,7 @@ PassRefPtr<CSSValue> CSSParser::parseFlex(CSSParserValueList* args) if (positiveFlex == unsetValue) positiveFlex = 1; if (negativeFlex == unsetValue) - negativeFlex = 0; + negativeFlex = positiveFlex ? 1 : 0; if (!preferredSize) preferredSize = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); @@ -7369,9 +7365,6 @@ bool CSSParser::cssGridLayoutEnabled() const #if ENABLE(CSS_REGIONS) bool CSSParser::parseFlowThread(const String& flowName) { - RefPtr<StyleSheetContents> dummyStyleSheet = StyleSheetContents::create(); - setStyleSheet(dummyStyleSheet.get()); - setupParser("@-webkit-decls{-webkit-flow-into:", flowName, "}"); cssyyparse(this); @@ -9200,6 +9193,13 @@ void CSSParser::addNamespace(const AtomicString& prefix, const AtomicString& uri m_defaultNamespace = uri; } +QualifiedName CSSParser::determineNameInNamespace(const AtomicString& prefix, const AtomicString& localName) +{ + if (!m_styleSheet) + return QualifiedName(prefix, localName, m_defaultNamespace); + return QualifiedName(prefix, localName, m_styleSheet->determineNamespace(prefix)); +} + void CSSParser::updateSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector* specifiers) { AtomicString determinedNamespace = namespacePrefix != nullAtom && m_styleSheet ? m_styleSheet->determineNamespace(namespacePrefix) : m_defaultNamespace; diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index f52394413..7c5a62377 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -267,6 +267,7 @@ public: PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*); void addNamespace(const AtomicString& prefix, const AtomicString& uri); + QualifiedName determineNameInNamespace(const AtomicString& prefix, const AtomicString& localName); void updateSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*); CSSParserSelector* updateSpecifiers(CSSParserSelector*, CSSParserSelector*); @@ -293,7 +294,8 @@ public: RefPtr<StyleKeyframe> m_keyframe; OwnPtr<MediaQuery> m_mediaQuery; OwnPtr<CSSParserValueList> m_valueList; - Vector<CSSProperty, 256> m_parsedProperties; + typedef Vector<CSSProperty, 256> ParsedPropertyVector; + ParsedPropertyVector m_parsedProperties; CSSSelectorList* m_selectorListForParseSelector; unsigned m_numParsedPropertiesBeforeMarginBox; diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp index 0bf66ad96..592494a0e 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.cpp +++ b/Source/WebCore/css/CSSPrimitiveValue.cpp @@ -1064,7 +1064,7 @@ String CSSPrimitiveValue::customCssText() const return text; } -void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) +void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const { if (m_primitiveUnitType == CSS_URI) addSubresourceURL(urls, styleSheet->completeURL(m_value.string)); diff --git a/Source/WebCore/css/CSSPrimitiveValue.h b/Source/WebCore/css/CSSPrimitiveValue.h index a8a0bbcd9..ccd187be7 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.h +++ b/Source/WebCore/css/CSSPrimitiveValue.h @@ -283,7 +283,7 @@ public: bool isQuirkValue() { return m_isQuirkValue; } - void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*); + void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; Length viewportPercentageLength(); diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index 24a7d445c..f206b3f35 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -743,6 +743,33 @@ template<> inline CSSPrimitiveValue::operator EBoxAlignment() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDecorationBreak e) + : CSSValue(PrimitiveClass) +{ + m_primitiveUnitType = CSS_IDENT; + switch (e) { + case DSLICE: + m_value.ident = CSSValueSlice; + break; + case DCLONE: + m_value.ident = CSSValueClone; + break; + } +} + +template<> inline CSSPrimitiveValue::operator EBoxDecorationBreak() const +{ + switch (m_value.ident) { + case CSSValueSlice: + return DSLICE; + case CSSValueClone: + return DCLONE; + default: + ASSERT_NOT_REACHED(); + return DSLICE; + } +} + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e) : CSSValue(PrimitiveClass) { @@ -1170,7 +1197,7 @@ template<> inline CSSPrimitiveValue::operator EEmptyCell() const #if ENABLE(CSS3_FLEXBOX) -template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e) +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignItems e) : CSSValue(PrimitiveClass) { m_primitiveUnitType = CSS_IDENT; @@ -1196,7 +1223,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e) } } -template<> inline CSSPrimitiveValue::operator EFlexAlign() const +template<> inline CSSPrimitiveValue::operator EAlignItems() const { switch (m_value.ident) { case CSSValueAuto: @@ -1231,11 +1258,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexPack e) case PackCenter: m_value.ident = CSSValueCenter; break; - case PackJustify: - m_value.ident = CSSValueJustify; + case PackSpaceBetween: + m_value.ident = CSSValueSpaceBetween; break; - case PackDistribute: - m_value.ident = CSSValueDistribute; + case PackSpaceAround: + m_value.ident = CSSValueSpaceAround; break; } } @@ -1249,10 +1276,10 @@ template<> inline CSSPrimitiveValue::operator EFlexPack() const return PackEnd; case CSSValueCenter: return PackCenter; - case CSSValueJustify: - return PackJustify; - case CSSValueDistribute: - return PackDistribute; + case CSSValueSpaceBetween: + return PackSpaceBetween; + case CSSValueSpaceAround: + return PackSpaceAround; default: ASSERT_NOT_REACHED(); return PackStart; @@ -1310,11 +1337,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexLinePack e) case LinePackCenter: m_value.ident = CSSValueCenter; break; - case LinePackJustify: - m_value.ident = CSSValueJustify; + case LinePackSpaceBetween: + m_value.ident = CSSValueSpaceBetween; break; - case LinePackDistribute: - m_value.ident = CSSValueDistribute; + case LinePackSpaceAround: + m_value.ident = CSSValueSpaceAround; break; case LinePackStretch: m_value.ident = CSSValueStretch; @@ -1331,10 +1358,10 @@ template<> inline CSSPrimitiveValue::operator EFlexLinePack() const return LinePackEnd; case CSSValueCenter: return LinePackCenter; - case CSSValueJustify: - return LinePackJustify; - case CSSValueDistribute: - return LinePackDistribute; + case CSSValueSpaceBetween: + return LinePackSpaceBetween; + case CSSValueSpaceAround: + return LinePackSpaceAround; case CSSValueStretch: return LinePackStretch; default: diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index 319b02614..29eb85033 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -513,6 +513,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWebkitBorderStartStyle: case CSSPropertyWebkitBorderStartWidth: case CSSPropertyWebkitBoxAlign: + case CSSPropertyWebkitBoxDecorationBreak: case CSSPropertyWebkitBoxFlex: case CSSPropertyWebkitBoxFlexGroup: case CSSPropertyWebkitBoxLines: @@ -538,11 +539,11 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWebkitFilter: #endif #if ENABLE(CSS3_FLEXBOX) + case CSSPropertyWebkitAlignItems: + case CSSPropertyWebkitAlignSelf: case CSSPropertyWebkitFlex: case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: - case CSSPropertyWebkitFlexAlign: - case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexFlow: case CSSPropertyWebkitFlexLinePack: diff --git a/Source/WebCore/css/CSSProperty.h b/Source/WebCore/css/CSSProperty.h index 0f99e677f..b746d80b9 100644 --- a/Source/WebCore/css/CSSProperty.h +++ b/Source/WebCore/css/CSSProperty.h @@ -71,4 +71,11 @@ private: } // namespace WebCore +namespace WTF { +template <> struct VectorTraits<WebCore::CSSProperty> : VectorTraitsBase<false, WebCore::CSSProperty> { + static const bool canInitializeWithMemset = true; + static const bool canMoveWithMemcpy = true; +}; +} + #endif // CSSProperty_h diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index 2739dbafc..34985f255 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -253,15 +253,16 @@ z-index -webkit-column-span -webkit-column-width -webkit-columns +-webkit-box-decoration-break #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS -webkit-filter #endif #if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX +-webkit-align-items +-webkit-align-self -webkit-flex --webkit-flex-align -webkit-flex-direction -webkit-flex-flow --webkit-flex-item-align -webkit-flex-line-pack -webkit-flex-order -webkit-flex-pack diff --git a/Source/WebCore/css/CSSReflectValue.cpp b/Source/WebCore/css/CSSReflectValue.cpp index f5d658e18..b36c3ad7b 100644 --- a/Source/WebCore/css/CSSReflectValue.cpp +++ b/Source/WebCore/css/CSSReflectValue.cpp @@ -59,7 +59,7 @@ String CSSReflectValue::customCssText() const return result; } -void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) +void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const { if (m_mask) m_mask->addSubresourceStyleURLs(urls, styleSheet); diff --git a/Source/WebCore/css/CSSReflectValue.h b/Source/WebCore/css/CSSReflectValue.h index 9a844259e..5cfb20e27 100644 --- a/Source/WebCore/css/CSSReflectValue.h +++ b/Source/WebCore/css/CSSReflectValue.h @@ -49,7 +49,7 @@ public: String customCssText() const; - void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*); + void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; private: CSSReflectValue(CSSReflectionDirection direction, PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask) diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp index 5bc0ee378..13479b640 100644 --- a/Source/WebCore/css/CSSSelector.cpp +++ b/Source/WebCore/css/CSSSelector.cpp @@ -81,10 +81,9 @@ inline unsigned CSSSelector::specificityForOneSelector() const case End: // FIXME: PsuedoAny should base the specificity on the sub-selectors. // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html - if (pseudoType() == PseudoNot) { - ASSERT(selectorList()); + if (pseudoType() == PseudoNot && selectorList()) s += selectorList()->first()->specificityForOneSelector(); - } else + else s += 0x100; case None: break; @@ -544,8 +543,8 @@ String CSSSelector::selectorText() const switch (cs->pseudoType()) { case PseudoNot: - ASSERT(cs->selectorList()); - str += cs->selectorList()->first()->selectorText(); + if (CSSSelectorList* selectorList = cs->selectorList()) + str += selectorList->first()->selectorText(); str += ")"; break; case PseudoLang: diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp index 5a780264a..1eeb32d42 100644 --- a/Source/WebCore/css/CSSStyleRule.cpp +++ b/Source/WebCore/css/CSSStyleRule.cpp @@ -59,8 +59,9 @@ CSSStyleRule::~CSSStyleRule() CSSStyleDeclaration* CSSStyleRule::style() const { - if (!m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleRule->properties(), const_cast<CSSStyleRule*>(this)); + if (!m_propertiesCSSOMWrapper) { + m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleRule->mutableProperties(), const_cast<CSSStyleRule*>(this)); + } return m_propertiesCSSOMWrapper.get(); } @@ -123,7 +124,7 @@ void CSSStyleRule::reattach(StyleRule* rule) { m_styleRule = rule; if (m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper->reattach(m_styleRule->properties()); + m_propertiesCSSOMWrapper->reattach(m_styleRule->mutableProperties()); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSValue.cpp b/Source/WebCore/css/CSSValue.cpp index 1151959e0..f568cc5f4 100644 --- a/Source/WebCore/css/CSSValue.cpp +++ b/Source/WebCore/css/CSSValue.cpp @@ -99,19 +99,19 @@ CSSValue::Type CSSValue::cssValueType() const return CSS_CUSTOM; } -void CSSValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) +void CSSValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const { // This should get called for internal instances only. ASSERT(!isCSSOMSafe()); if (isPrimitiveValue()) - static_cast<CSSPrimitiveValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); + static_cast<const CSSPrimitiveValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); else if (isValueList()) - static_cast<CSSValueList*>(this)->addSubresourceStyleURLs(urls, styleSheet); + static_cast<const CSSValueList*>(this)->addSubresourceStyleURLs(urls, styleSheet); else if (classType() == FontFaceSrcClass) - static_cast<CSSFontFaceSrcValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); + static_cast<const CSSFontFaceSrcValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); else if (classType() == ReflectClass) - static_cast<CSSReflectValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); + static_cast<const CSSReflectValue*>(this)->addSubresourceStyleURLs(urls, styleSheet); } String CSSValue::cssText() const diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h index d5c023105..fe56428a1 100644 --- a/Source/WebCore/css/CSSValue.h +++ b/Source/WebCore/css/CSSValue.h @@ -107,7 +107,7 @@ public: PassRefPtr<CSSValue> cloneForCSSOM() const; - void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*); + void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; protected: diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 28e14cf4a..e39b0166d 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -463,6 +463,10 @@ end //center //baseline +// CSS_PROP_BOX_DECORATION_BREAK +clone +slice + // CSS_PROP_BOX_DIRECTION // normal reverse @@ -495,8 +499,8 @@ multiple // start // end // center -// justify -distribute +space-between +space-around // CSS_PROP_FLEX_FLOW row @@ -511,8 +515,8 @@ wrap-reverse // start // end // center -// justify -// distribute +// space-between +// space-around // stretch #endif @@ -901,6 +905,11 @@ wrap // -webkit-line-align edges +// (pointer:) media feature +// none +coarse +fine + #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS // -webkit-filter #if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS diff --git a/Source/WebCore/css/CSSValueList.cpp b/Source/WebCore/css/CSSValueList.cpp index 537f135da..3ab7f9411 100644 --- a/Source/WebCore/css/CSSValueList.cpp +++ b/Source/WebCore/css/CSSValueList.cpp @@ -136,7 +136,7 @@ String CSSValueList::customCssText() const return result.toString(); } -void CSSValueList::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) +void CSSValueList::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const { size_t size = m_values.size(); for (size_t i = 0; i < size; ++i) diff --git a/Source/WebCore/css/CSSValueList.h b/Source/WebCore/css/CSSValueList.h index a80152112..a4c59b4b0 100644 --- a/Source/WebCore/css/CSSValueList.h +++ b/Source/WebCore/css/CSSValueList.h @@ -60,7 +60,7 @@ public: String customCssText() const; - void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*); + void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; PassRefPtr<CSSValueList> cloneForCSSOM() const; diff --git a/Source/WebCore/css/MediaFeatureNames.h b/Source/WebCore/css/MediaFeatureNames.h index 1daa4e9e1..b08439e4a 100644 --- a/Source/WebCore/css/MediaFeatureNames.h +++ b/Source/WebCore/css/MediaFeatureNames.h @@ -30,6 +30,7 @@ namespace WebCore { macro(grid, "grid") \ macro(monochrome, "monochrome") \ macro(height, "height") \ + macro(hover, "hover") \ macro(width, "width") \ macro(orientation, "orientation") \ macro(aspect_ratio, "aspect-ratio") \ @@ -55,6 +56,7 @@ namespace WebCore { macro(min_height, "min-height") \ macro(min_monochrome, "min-monochrome") \ macro(min_width, "min-width") \ + macro(pointer, "pointer") \ macro(transform_2d, "-webkit-transform-2d") \ macro(transform_3d, "-webkit-transform-3d") \ macro(transition, "-webkit-transition") \ diff --git a/Source/WebCore/css/MediaQueryEvaluator.cpp b/Source/WebCore/css/MediaQueryEvaluator.cpp index 4f045c67a..90c9df286 100644 --- a/Source/WebCore/css/MediaQueryEvaluator.cpp +++ b/Source/WebCore/css/MediaQueryEvaluator.cpp @@ -45,6 +45,7 @@ #include "PlatformScreen.h" #include "RenderView.h" #include "RenderStyle.h" +#include "Settings.h" #include "StyleResolver.h" #include <wtf/HashMap.h> @@ -536,6 +537,66 @@ static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fram return Page::stringToViewMode(static_cast<CSSPrimitiveValue*>(value)->getStringValue()) == frame->page()->viewMode(); } +enum PointerDeviceType { TouchPointer, MousePointer, NoPointer, UnknownPointer }; + +static PointerDeviceType leastCapablePrimaryPointerDeviceType(Frame* frame) +{ + if (frame->settings()->deviceSupportsTouch()) + return TouchPointer; + + // FIXME: We should also try to determine if we know we have a mouse. + // When we do this, we'll also need to differentiate between known not to + // have mouse or touch screen (NoPointer) and unknown (UnknownPointer). + // We could also take into account other preferences like accessibility + // settings to decide which of the available pointers should be considered + // "primary". + + return UnknownPointer; +} + +static bool hoverMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix) +{ + PointerDeviceType pointer = leastCapablePrimaryPointerDeviceType(frame); + + // If we're on a port that hasn't explicitly opted into providing pointer device information + // (or otherwise can't be confident in the pointer hardware available), then behave exactly + // as if this feature feature isn't supported. + if (pointer == UnknownPointer) + return false; + + float number = 1; + if (value) { + if (!numberValue(value, number)) + return false; + } + + return (pointer == NoPointer && !number) + || (pointer == TouchPointer && !number) + || (pointer == MousePointer && number == 1); +} + +static bool pointerMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix) +{ + PointerDeviceType pointer = leastCapablePrimaryPointerDeviceType(frame); + + // If we're on a port that hasn't explicitly opted into providing pointer device information + // (or otherwise can't be confident in the pointer hardware available), then behave exactly + // as if this feature feature isn't supported. + if (pointer == UnknownPointer) + return false; + + if (!value) + return pointer != NoPointer; + + if (!value->isPrimitiveValue()) + return false; + + String str = static_cast<CSSPrimitiveValue*>(value)->getStringValue(); + return (pointer == NoPointer && str == "none") + || (pointer == TouchPointer && str == "coarse") + || (pointer == MousePointer && str == "fine"); +} + static void createFunctionMap() { // Create the table. diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp index 55af512ea..50fed4808 100644 --- a/Source/WebCore/css/SelectorChecker.cpp +++ b/Source/WebCore/css/SelectorChecker.cpp @@ -403,10 +403,13 @@ static inline bool isFastCheckableRelation(CSSSelector::Relation relation) static inline bool isFastCheckableMatch(const CSSSelector* selector) { - if (selector->m_match == CSSSelector::Set) - return true; + if (selector->m_match == CSSSelector::Set) { + // Style attribute is generated lazily but the fast path doesn't trigger it. + // Disallow them here rather than making the fast path more branchy. + return selector->attribute() != styleAttr; + } if (selector->m_match == CSSSelector::Exact) - return !htmlAttributeHasCaseInsensitiveValue(selector->attribute()); + return selector->attribute() != styleAttr && !htmlAttributeHasCaseInsensitiveValue(selector->attribute()); return selector->m_match == CSSSelector::None || selector->m_match == CSSSelector::Id || selector->m_match == CSSSelector::Class; } @@ -729,10 +732,15 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P if (selector->m_match == CSSSelector::PseudoClass) { // Handle :not up front. if (selector->pseudoType() == CSSSelector::PseudoNot) { - ASSERT(selector->selectorList()); + CSSSelectorList* selectorList = selector->selectorList(); + + // FIXME: We probably should fix the parser and make it never produce :not rules with missing selector list. + if (!selectorList) + return false; + SelectorCheckingContext subContext(context); subContext.isSubSelector = true; - for (subContext.selector = selector->selectorList()->first(); subContext.selector; subContext.selector = subContext.selector->tagHistory()) { + for (subContext.selector = selectorList->first(); subContext.selector; subContext.selector = subContext.selector->tagHistory()) { // :not cannot nest. I don't really know why this is a // restriction in CSS3, but it is, so let's honor it. // the parser enforces that this never occurs @@ -1043,7 +1051,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P } break; case CSSSelector::PseudoEnabled: - if (element && element->isFormControlElement()) + if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag))) return element->isEnabledFormControl(); break; case CSSSelector::PseudoFullPageMedia: @@ -1052,7 +1060,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P case CSSSelector::PseudoDefault: return element && element->isDefaultButtonForForm(); case CSSSelector::PseudoDisabled: - if (element && (element->isFormControlElement() || element->hasTagName(optionTag))) + if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag))) return !element->isEnabledFormControl(); break; case CSSSelector::PseudoReadOnly: @@ -1321,13 +1329,19 @@ unsigned SelectorChecker::determineLinkMatchType(const CSSSelector* selector) for (; selector; selector = selector->tagHistory()) { switch (selector->pseudoType()) { case CSSSelector::PseudoNot: - // :not(:visited) is equivalent to :link. Parser enforces that :not can't nest. - for (CSSSelector* subSelector = selector->selectorList()->first(); subSelector; subSelector = subSelector->tagHistory()) { - CSSSelector::PseudoType subType = subSelector->pseudoType(); - if (subType == CSSSelector::PseudoVisited) - linkMatchType &= ~SelectorChecker::MatchVisited; - else if (subType == CSSSelector::PseudoLink) - linkMatchType &= ~SelectorChecker::MatchLink; + { + // :not(:visited) is equivalent to :link. Parser enforces that :not can't nest. + CSSSelectorList* selectorList = selector->selectorList(); + if (!selectorList) + break; + + for (CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = subSelector->tagHistory()) { + CSSSelector::PseudoType subType = subSelector->pseudoType(); + if (subType == CSSSelector::PseudoVisited) + linkMatchType &= ~SelectorChecker::MatchVisited; + else if (subType == CSSSelector::PseudoLink) + linkMatchType &= ~SelectorChecker::MatchLink; + } } break; case CSSSelector::PseudoLink: diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index 4c5bae6e5..7c974dc27 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -1723,8 +1723,11 @@ public: { if (value->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueNone) - applyInitialValue(styleResolver); + if (primitiveValue->getIdent() == CSSValueNone) { + styleResolver->style()->setPositiveFlex(0); + styleResolver->style()->setNegativeFlex(0); + styleResolver->style()->setFlexPreferredSize(Length(Auto)); + } return; } @@ -1911,6 +1914,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius); setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault<EBoxAlignment, &RenderStyle::boxAlign, EBoxAlignment, &RenderStyle::setBoxAlign, EBoxAlignment, &RenderStyle::initialBoxAlign>::createHandler()); + setPropertyHandler(CSSPropertyWebkitBoxDecorationBreak, ApplyPropertyDefault<EBoxDecorationBreak, &RenderStyle::boxDecorationBreak, EBoxDecorationBreak, &RenderStyle::setBoxDecorationBreak, EBoxDecorationBreak, &RenderStyle::initialBoxDecorationBreak>::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault<EBoxDirection, &RenderStyle::boxDirection, EBoxDirection, &RenderStyle::setBoxDirection, EBoxDirection, &RenderStyle::initialBoxDirection>::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault<float, &RenderStyle::boxFlex, float, &RenderStyle::setBoxFlex, float, &RenderStyle::initialBoxFlex>::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxFlexGroup, unsigned int, &RenderStyle::setBoxFlexGroup, unsigned int, &RenderStyle::initialBoxFlexGroup>::createHandler()); @@ -1932,11 +1936,11 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler()); #if ENABLE(CSS3_FLEXBOX) + setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlex, ApplyPropertyFlex::createHandler()); - setPropertyHandler(CSSPropertyWebkitFlexAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexAlign, EFlexAlign, &RenderStyle::setFlexAlign, EFlexAlign, &RenderStyle::initialFlexAlign>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap>::createHandler()); - setPropertyHandler(CSSPropertyWebkitFlexItemAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexItemAlign, EFlexAlign, &RenderStyle::setFlexItemAlign, EFlexAlign, &RenderStyle::initialFlexItemAlign>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexLinePack, ApplyPropertyDefault<EFlexLinePack, &RenderStyle::flexLinePack, EFlexLinePack, &RenderStyle::setFlexLinePack, EFlexLinePack, &RenderStyle::initialFlexLinePack>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault<int, &RenderStyle::flexOrder, int, &RenderStyle::setFlexOrder, int, &RenderStyle::initialFlexOrder>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault<EFlexPack, &RenderStyle::flexPack, EFlexPack, &RenderStyle::setFlexPack, EFlexPack, &RenderStyle::initialFlexPack>::createHandler()); diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp index 4ec31996a..cbe92c4b5 100644 --- a/Source/WebCore/css/StylePropertySet.cpp +++ b/Source/WebCore/css/StylePropertySet.cpp @@ -50,28 +50,47 @@ static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap() return propertySetCSSOMWrapperMapInstance; } +PassRefPtr<StylePropertySet> StylePropertySet::createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode) +{ + void* slot = WTF::fastMalloc(sizeof(StylePropertySet) - sizeof(void*) + sizeof(CSSProperty) * count); + return adoptRef(new (slot) StylePropertySet(properties, count, cssParserMode, /* makeMutable */ false)); +} + StylePropertySet::StylePropertySet(CSSParserMode cssParserMode) : m_cssParserMode(cssParserMode) , m_ownsCSSOMWrapper(false) + , m_isMutable(true) + , m_arraySize(0) + , m_mutablePropertyVector(new Vector<CSSProperty>) { } -StylePropertySet::StylePropertySet(StylePropertyVector& properties, CSSParserMode cssParserMode) +StylePropertySet::StylePropertySet(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode, bool makeMutable) : m_cssParserMode(cssParserMode) , m_ownsCSSOMWrapper(false) + , m_isMutable(makeMutable) { - m_properties.swap(properties); - - // This shrinkToFit() will be a no-op in the typical case (no duplicate properties were eliminated after parsing.) - m_properties.shrinkToFit(); + if (makeMutable) { + m_mutablePropertyVector = new Vector<CSSProperty>; + m_mutablePropertyVector->reserveInitialCapacity(count); + for (unsigned i = 0; i < count; ++i) + m_mutablePropertyVector->uncheckedAppend(properties[i]); + } else { + m_arraySize = count; + for (unsigned i = 0; i < m_arraySize; ++i) + new (&array()[i]) CSSProperty(properties[i]); + } } StylePropertySet::StylePropertySet(const StylePropertySet& o) : RefCounted<StylePropertySet>() - , m_properties(o.m_properties) , m_cssParserMode(o.m_cssParserMode) , m_ownsCSSOMWrapper(false) + , m_isMutable(true) + , m_arraySize(0) + , m_mutablePropertyVector(new Vector<CSSProperty>) { + copyPropertiesFrom(o); } StylePropertySet::~StylePropertySet() @@ -79,11 +98,33 @@ StylePropertySet::~StylePropertySet() ASSERT(!m_ownsCSSOMWrapper || propertySetCSSOMWrapperMap().contains(this)); if (m_ownsCSSOMWrapper) propertySetCSSOMWrapperMap().remove(this); + if (isMutable()) + delete m_mutablePropertyVector; + else { + for (unsigned i = 0; i < m_arraySize; ++i) + array()[i].~CSSProperty(); + } +} + +void StylePropertySet::setCSSParserMode(CSSParserMode cssParserMode) +{ + ASSERT(isMutable()); + m_cssParserMode = cssParserMode; } void StylePropertySet::copyPropertiesFrom(const StylePropertySet& other) { - m_properties = other.m_properties; + ASSERT(isMutable()); + + if (other.isMutable()) { + *m_mutablePropertyVector = *other.m_mutablePropertyVector; + return; + } + + ASSERT(m_mutablePropertyVector->isEmpty()); + m_mutablePropertyVector->reserveInitialCapacity(other.m_arraySize); + for (unsigned i = 0; i < other.m_arraySize; ++i) + m_mutablePropertyVector->uncheckedAppend(other.array()[i]); } String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const @@ -453,6 +494,7 @@ PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propert bool StylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) { + ASSERT(isMutable()); StylePropertyShorthand shorthand = shorthandForProperty(propertyID); if (!shorthand.length()) return false; @@ -461,6 +503,7 @@ bool StylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText) { + ASSERT(isMutable()); if (removeShorthandProperty(propertyID)) { // FIXME: Return an equivalent shorthand when possible. if (returnText) @@ -480,7 +523,7 @@ bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnTe // A more efficient removal strategy would involve marking entries as empty // and sweeping them when the vector grows too big. - m_properties.remove(foundProperty - m_properties.data()); + m_mutablePropertyVector->remove(foundProperty - m_mutablePropertyVector->data()); return true; } @@ -516,6 +559,7 @@ bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const bool StylePropertySet::setProperty(CSSPropertyID propertyID, const String& value, bool important, StyleSheetContents* contextStyleSheet) { + ASSERT(isMutable()); // Setting the value to an empty string just removes the property in both IE and Gecko. // Setting it to null seems to produce less consistent results, but we treat it just the same. if (value.isEmpty()) { @@ -530,6 +574,7 @@ bool StylePropertySet::setProperty(CSSPropertyID propertyID, const String& value void StylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> prpValue, bool important) { + ASSERT(isMutable()); StylePropertyShorthand shorthand = shorthandForProperty(propertyID); if (!shorthand.length()) { setProperty(CSSProperty(propertyID, prpValue, important)); @@ -540,11 +585,12 @@ void StylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue RefPtr<CSSValue> value = prpValue; for (unsigned i = 0; i < shorthand.length(); ++i) - m_properties.append(CSSProperty(shorthand.properties()[i], value, important)); + append(CSSProperty(shorthand.properties()[i], value, important)); } void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot) { + ASSERT(isMutable()); if (!removeShorthandProperty(property.id())) { CSSProperty* toReplace = slot ? slot : findPropertyWithId(property.id()); if (toReplace) { @@ -552,18 +598,21 @@ void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slo return; } } - m_properties.append(property); + append(property); } bool StylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, bool important) { + ASSERT(isMutable()); setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important)); return true; } void StylePropertySet::parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet) { - m_properties.clear(); + ASSERT(isMutable()); + + m_mutablePropertyVector->clear(); CSSParserContext context(cssParserMode()); if (contextStyleSheet) { @@ -576,13 +625,15 @@ void StylePropertySet::parseDeclaration(const String& styleDeclaration, StyleShe void StylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties) { - m_properties.reserveCapacity(m_properties.size() + properties.size()); + ASSERT(isMutable()); + m_mutablePropertyVector->reserveCapacity(m_mutablePropertyVector->size() + properties.size()); for (unsigned i = 0; i < properties.size(); ++i) addParsedProperty(properties[i]); } void StylePropertySet::addParsedProperty(const CSSProperty& property) { + ASSERT(isMutable()); // Only add properties that have no !important counterpart present if (!propertyIsImportant(property.id()) || property.isImportant()) setProperty(property); @@ -600,9 +651,9 @@ String StylePropertySet::asText() const BitArray<numCSSProperties> shorthandPropertyUsed; BitArray<numCSSProperties> shorthandPropertyAppeared; - unsigned size = m_properties.size(); + unsigned size = propertyCount(); for (unsigned n = 0; n < size; ++n) { - const CSSProperty& prop = m_properties[n]; + const CSSProperty& prop = propertyAt(n); CSSPropertyID propertyID = prop.id(); CSSPropertyID shorthandPropertyID = CSSPropertyInvalid; CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid; @@ -812,24 +863,25 @@ String StylePropertySet::asText() const void StylePropertySet::merge(const StylePropertySet* other, bool argOverridesOnConflict) { - unsigned size = other->m_properties.size(); + ASSERT(isMutable()); + unsigned size = other->propertyCount(); for (unsigned n = 0; n < size; ++n) { - const CSSProperty& toMerge = other->m_properties[n]; + const CSSProperty& toMerge = other->propertyAt(n); CSSProperty* old = findPropertyWithId(toMerge.id()); if (old) { if (!argOverridesOnConflict && old->value()) continue; setProperty(toMerge, old); } else - m_properties.append(toMerge); + append(toMerge); } } -void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls, StyleSheetContents* contextStyleSheet) +void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls, StyleSheetContents* contextStyleSheet) const { - size_t size = m_properties.size(); - for (size_t i = 0; i < size; ++i) - m_properties[i].value()->addSubresourceStyleURLs(urls, contextStyleSheet); + unsigned size = propertyCount(); + for (unsigned i = 0; i < size; ++i) + propertyAt(i).value()->addSubresourceStyleURLs(urls, contextStyleSheet); } // This is the list of properties we want to copy in the copyBlockProperties() function. @@ -874,7 +926,8 @@ void StylePropertySet::removeBlockProperties() bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned length) { - if (m_properties.isEmpty()) + ASSERT(isMutable()); + if (m_mutablePropertyVector->isEmpty()) return false; // FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless. @@ -882,12 +935,12 @@ bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned for (unsigned i = 0; i < length; ++i) toRemove.add(set[i]); - StylePropertyVector newProperties; - newProperties.reserveInitialCapacity(m_properties.size()); + Vector<CSSProperty> newProperties; + newProperties.reserveInitialCapacity(m_mutablePropertyVector->size()); - unsigned size = m_properties.size(); + unsigned size = m_mutablePropertyVector->size(); for (unsigned n = 0; n < size; ++n) { - const CSSProperty& property = m_properties[n]; + const CSSProperty& property = m_mutablePropertyVector->at(n); // Not quite sure if the isImportant test is needed but it matches the existing behavior. if (!property.isImportant()) { if (toRemove.contains(property.id())) @@ -896,25 +949,26 @@ bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned newProperties.append(property); } - bool changed = newProperties.size() != m_properties.size(); - m_properties = newProperties; + bool changed = newProperties.size() != m_mutablePropertyVector->size(); + *m_mutablePropertyVector = newProperties; return changed; } const CSSProperty* StylePropertySet::findPropertyWithId(CSSPropertyID propertyID) const { - for (int n = m_properties.size() - 1 ; n >= 0; --n) { - if (propertyID == m_properties[n].id()) - return &m_properties[n]; + for (int n = propertyCount() - 1 ; n >= 0; --n) { + if (propertyID == propertyAt(n).id()) + return &propertyAt(n); } return 0; } CSSProperty* StylePropertySet::findPropertyWithId(CSSPropertyID propertyID) { - for (int n = m_properties.size() - 1 ; n >= 0; --n) { - if (propertyID == m_properties[n].id()) - return &m_properties[n]; + ASSERT(isMutable()); + for (int n = propertyCount() - 1 ; n >= 0; --n) { + if (propertyID == propertyAt(n).id()) + return &propertyAt(n); } return 0; } @@ -927,10 +981,11 @@ bool StylePropertySet::propertyMatches(const CSSProperty* property) const void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style) { + ASSERT(isMutable()); Vector<CSSPropertyID> propertiesToRemove; - size_t size = m_properties.size(); - for (size_t i = 0; i < size; ++i) { - const CSSProperty& property = m_properties[i]; + unsigned size = m_mutablePropertyVector->size(); + for (unsigned i = 0; i < size; ++i) { + const CSSProperty& property = m_mutablePropertyVector->at(i); if (style->propertyMatches(&property)) propertiesToRemove.append(property.id()); } @@ -941,10 +996,11 @@ void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style) void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style) { + ASSERT(isMutable()); Vector<CSSPropertyID> propertiesToRemove; - size_t size = m_properties.size(); - for (size_t i = 0; i < size; ++i) { - const CSSProperty& property = m_properties[i]; + unsigned size = m_mutablePropertyVector->size(); + for (unsigned i = 0; i < size; ++i) { + const CSSProperty& property = m_mutablePropertyVector->at(i); if (style->cssPropertyMatches(&property)) propertiesToRemove.append(property.id()); } @@ -960,14 +1016,14 @@ PassRefPtr<StylePropertySet> StylePropertySet::copy() const PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const { - StylePropertyVector list; + Vector<CSSProperty, 256> list; list.reserveInitialCapacity(length); for (unsigned i = 0; i < length; ++i) { RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); if (value) list.append(CSSProperty(set[i], value.release(), false)); } - return StylePropertySet::adopt(list); + return StylePropertySet::create(list.data(), list.size()); } CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() const @@ -1006,13 +1062,13 @@ void StylePropertySet::clearParentElement(StyledElement* element) unsigned StylePropertySet::averageSizeInBytes() { // Please update this if the storage scheme changes so that this longer reflects the actual size. - return sizeof(StylePropertySet); + return sizeof(StylePropertySet) + sizeof(CSSProperty) * 2; } // See the function above if you need to update this. class SameSizeAsStylePropertySet : public RefCounted<SameSizeAsStylePropertySet> { - StylePropertyVector properties; unsigned bitfield; + void* properties; }; COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), style_property_set_should_stay_small); @@ -1023,4 +1079,10 @@ void StylePropertySet::showStyle() } #endif +inline void StylePropertySet::append(const CSSProperty& property) +{ + ASSERT(isMutable()); + m_mutablePropertyVector->append(property); +} + } // namespace WebCore diff --git a/Source/WebCore/css/StylePropertySet.h b/Source/WebCore/css/StylePropertySet.h index e14f89c3f..e7992ed35 100644 --- a/Source/WebCore/css/StylePropertySet.h +++ b/Source/WebCore/css/StylePropertySet.h @@ -39,8 +39,6 @@ class StyledElement; class StylePropertyShorthand; class StyleSheetContents; -typedef Vector<CSSProperty, 4> StylePropertyVector; - class StylePropertySet : public RefCounted<StylePropertySet> { public: ~StylePropertySet(); @@ -49,16 +47,16 @@ public: { return adoptRef(new StylePropertySet(cssParserMode)); } - static PassRefPtr<StylePropertySet> adopt(StylePropertyVector& properties, CSSParserMode cssParserMode = CSSStrictMode) + static PassRefPtr<StylePropertySet> create(const CSSProperty* properties, unsigned count) { - return adoptRef(new StylePropertySet(properties, cssParserMode)); + return adoptRef(new StylePropertySet(properties, count, CSSStrictMode, /* makeMutable */ true)); } + static PassRefPtr<StylePropertySet> createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode); - unsigned propertyCount() const { return m_properties.size(); } - bool isEmpty() const { return m_properties.isEmpty(); } - const CSSProperty& propertyAt(unsigned index) const { return m_properties[index]; } - - void shrinkToFit() { m_properties.shrinkToFit(); } + unsigned propertyCount() const; + bool isEmpty() const; + const CSSProperty& propertyAt(unsigned index) const; + CSSProperty& propertyAt(unsigned index); PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const; String getPropertyValue(CSSPropertyID) const; @@ -87,12 +85,13 @@ public: void merge(const StylePropertySet*, bool argOverridesOnConflict = true); - void setCSSParserMode(CSSParserMode cssParserMode) { m_cssParserMode = cssParserMode; } + void setCSSParserMode(CSSParserMode); CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); } - void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* contextStyleSheet); + void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* contextStyleSheet) const; PassRefPtr<StylePropertySet> copy() const; + // Used by StyledElement::copyNonAttributeProperties(). void copyPropertiesFrom(const StylePropertySet&); @@ -107,9 +106,8 @@ public: CSSStyleDeclaration* ensureCSSStyleDeclaration() const; CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement) const; - - // FIXME: Expand the concept of mutable/immutable StylePropertySet. - bool isMutable() const { return m_ownsCSSOMWrapper; } + + bool isMutable() const { return m_isMutable; } static unsigned averageSizeInBytes(); @@ -119,7 +117,7 @@ public: private: StylePropertySet(CSSParserMode); - StylePropertySet(StylePropertyVector&, CSSParserMode); + StylePropertySet(const CSSProperty* properties, unsigned count, CSSParserMode, bool makeMutable); StylePropertySet(const StylePropertySet&); void setNeedsStyleRecalc(); @@ -140,14 +138,61 @@ private: const CSSProperty* findPropertyWithId(CSSPropertyID) const; CSSProperty* findPropertyWithId(CSSPropertyID); - StylePropertyVector m_properties; + void append(const CSSProperty&); + CSSProperty* array(); + const CSSProperty* array() const; unsigned m_cssParserMode : 2; mutable unsigned m_ownsCSSOMWrapper : 1; + mutable unsigned m_isMutable : 1; + unsigned m_arraySize : 28; + + union { + Vector<CSSProperty>* m_mutablePropertyVector; + void* m_properties; + }; friend class PropertySetCSSStyleDeclaration; }; +inline CSSProperty& StylePropertySet::propertyAt(unsigned index) +{ + if (isMutable()) + return m_mutablePropertyVector->at(index); + return array()[index]; +} + +inline const CSSProperty& StylePropertySet::propertyAt(unsigned index) const +{ + if (isMutable()) + return m_mutablePropertyVector->at(index); + return array()[index]; +} + +inline unsigned StylePropertySet::propertyCount() const +{ + if (isMutable()) + return m_mutablePropertyVector->size(); + return m_arraySize; +} + +inline bool StylePropertySet::isEmpty() const +{ + return !propertyCount(); +} + +inline CSSProperty* StylePropertySet::array() +{ + ASSERT(!isMutable()); + return reinterpret_cast<CSSProperty*>(&m_properties); +} + +inline const CSSProperty* StylePropertySet::array() const +{ + ASSERT(!isMutable()); + return reinterpret_cast<const CSSProperty*>(&m_properties); +} + } // namespace WebCore #endif // StylePropertySet_h diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 06b41a8ac..1f023d2bd 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -816,11 +816,11 @@ static void ensureDefaultStyleSheetsForElement(Element* element) ASSERT(mathMLStyleSheet || defaultStyle->features().siblingRules.isEmpty()); } -void StyleResolver::addMatchedProperties(MatchResult& matchResult, StylePropertySet* properties, StyleRule* rule, unsigned linkMatchType, bool inRegionRule) +void StyleResolver::addMatchedProperties(MatchResult& matchResult, const StylePropertySet* properties, StyleRule* rule, unsigned linkMatchType, bool inRegionRule) { matchResult.matchedProperties.grow(matchResult.matchedProperties.size() + 1); MatchedProperties& newProperties = matchResult.matchedProperties.last(); - newProperties.properties = properties; + newProperties.properties = const_cast<StylePropertySet*>(properties); newProperties.linkMatchType = linkMatchType; newProperties.isInRegionRule = inRegionRule; matchResult.matchedRules.append(rule); @@ -1051,7 +1051,7 @@ void StyleResolver::collectMatchingRulesForList(const Vector<RuleData>* rules, i continue; } // If the rule has no properties to apply, then ignore it in the non-debug mode. - StylePropertySet* properties = rule->properties(); + const StylePropertySet* properties = rule->properties(); if (!properties || (properties->isEmpty() && !options.includeEmptyRules)) { InspectorInstrumentation::didMatchRule(cookie, false); continue; @@ -1392,6 +1392,9 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const if (element->hasTagName(optionTag)) return false; + if (element->hasTagName(optgroupTag) && m_element->disabled() != element->disabled()) + return false; + bool isControl = element->isFormControlElement(); if (isControl != m_element->isFormControlElement()) @@ -1957,6 +1960,16 @@ static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool s return BLOCK; } +// CSS requires text-decoration to be reset at each DOM element for tables, +// inline blocks, inline tables, run-ins, shadow DOM crossings, floating elements, +// and absolute or relatively positioned elements. +static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) +{ + return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN + || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) + || style->isFloating() || style->isPositioned(); +} + void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { // Cache our original display. @@ -2069,10 +2082,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY()); } - // Finally update our text decorations in effect, but don't allow text-decoration to percolate through - // tables, inline blocks, inline tables, run-ins, or shadow DOM. - if (style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN - || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)) + if (doesNotInheritTextDecoration(style, e)) style->setTextDecorationsInEffect(style->textDecoration()); else style->addToTextDecorationsInEffect(style->textDecoration()); @@ -2911,7 +2921,7 @@ void StyleResolver::matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, continue; // If the rule has no properties to apply, then ignore it. - StylePropertySet* properties = rule->properties(); + const StylePropertySet* properties = rule->properties(); if (!properties || properties->isEmpty()) continue; @@ -4089,6 +4099,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue *value) case CSSPropertyWebkitBorderRadius: case CSSPropertyWebkitBorderVerticalSpacing: case CSSPropertyWebkitBoxAlign: + case CSSPropertyWebkitBoxDecorationBreak: case CSSPropertyWebkitBoxDirection: case CSSPropertyWebkitBoxFlex: case CSSPropertyWebkitBoxFlexGroup: @@ -4110,11 +4121,11 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue *value) case CSSPropertyWebkitColumnSpan: case CSSPropertyWebkitColumnWidth: #if ENABLE(CSS3_FLEXBOX) + case CSSPropertyWebkitAlignItems: + case CSSPropertyWebkitAlignSelf: case CSSPropertyWebkitFlex: - case CSSPropertyWebkitFlexAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexFlow: - case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index f382d5f8a..539dd6356 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -334,7 +334,7 @@ private: bool includeEmptyRules; }; - static void addMatchedProperties(MatchResult&, StylePropertySet* properties, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, bool inRegionRule = false); + static void addMatchedProperties(MatchResult&, const StylePropertySet* properties, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, bool inRegionRule = false); void addElementStyleProperties(MatchResult&, StylePropertySet*, bool isCacheable = true); void matchAllRules(MatchResult&, bool includeSMILProperties); diff --git a/Source/WebCore/css/StyleRule.cpp b/Source/WebCore/css/StyleRule.cpp index 400f41b23..3387fc964 100644 --- a/Source/WebCore/css/StyleRule.cpp +++ b/Source/WebCore/css/StyleRule.cpp @@ -180,6 +180,13 @@ StyleRule::~StyleRule() { } +StylePropertySet* StyleRule::mutableProperties() +{ + if (!m_properties->isMutable()) + m_properties = m_properties->copy(); + return m_properties.get(); +} + void StyleRule::setProperties(PassRefPtr<StylePropertySet> properties) { m_properties = properties; @@ -201,6 +208,13 @@ StyleRulePage::~StyleRulePage() { } +StylePropertySet* StyleRulePage::mutableProperties() +{ + if (!m_properties->isMutable()) + m_properties = m_properties->copy(); + return m_properties.get(); +} + void StyleRulePage::setProperties(PassRefPtr<StylePropertySet> properties) { m_properties = properties; @@ -221,6 +235,13 @@ StyleRuleFontFace::~StyleRuleFontFace() { } +StylePropertySet* StyleRuleFontFace::mutableProperties() +{ + if (!m_properties->isMutable()) + m_properties = m_properties->copy(); + return m_properties.get(); +} + void StyleRuleFontFace::setProperties(PassRefPtr<StylePropertySet> properties) { m_properties = properties; diff --git a/Source/WebCore/css/StyleRule.h b/Source/WebCore/css/StyleRule.h index f3989e0b2..c7be54902 100644 --- a/Source/WebCore/css/StyleRule.h +++ b/Source/WebCore/css/StyleRule.h @@ -94,7 +94,8 @@ public: ~StyleRule(); const CSSSelectorList& selectorList() const { return m_selectorList; } - StylePropertySet* properties() const { return m_properties.get(); } + const StylePropertySet* properties() const { return m_properties.get(); } + StylePropertySet* mutableProperties(); void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); } void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); } @@ -118,7 +119,8 @@ public: ~StyleRuleFontFace(); - StylePropertySet* properties() const { return m_properties.get(); } + const StylePropertySet* properties() const { return m_properties.get(); } + StylePropertySet* mutableProperties(); void setProperties(PassRefPtr<StylePropertySet>); @@ -138,7 +140,8 @@ public: ~StyleRulePage(); const CSSSelector* selector() const { return m_selectorList.first(); } - StylePropertySet* properties() const { return m_properties.get(); } + const StylePropertySet* properties() const { return m_properties.get(); } + StylePropertySet* mutableProperties(); void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); } void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); } diff --git a/Source/WebCore/css/WebKitCSSTransformValue.cpp b/Source/WebCore/css/WebKitCSSTransformValue.cpp index dfdd71e36..f85319015 100644 --- a/Source/WebCore/css/WebKitCSSTransformValue.cpp +++ b/Source/WebCore/css/WebKitCSSTransformValue.cpp @@ -29,9 +29,36 @@ #include "CSSValueList.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { +// These names must be kept in sync with TransformOperationType. +const char* const transformName[] = { + 0, + "translate", + "translateX", + "translateY", + "rotate", + "scale", + "scaleX", + "scaleY", + "skew", + "skewX", + "skewY", + "matrix", + "translateZ", + "translate3d", + "rotateX", + "rotateY", + "rotateZ", + "rotate3d", + "scaleZ", + "scale3d", + "perspective", + "matrix3d" +}; + WebKitCSSTransformValue::WebKitCSSTransformValue(TransformOperationType op) : CSSValueList(WebKitCSSTransformClass, CommaSeparator) , m_type(op) @@ -40,79 +67,15 @@ WebKitCSSTransformValue::WebKitCSSTransformValue(TransformOperationType op) String WebKitCSSTransformValue::customCssText() const { - String result; - switch (m_type) { - case TranslateTransformOperation: - result += "translate("; - break; - case TranslateXTransformOperation: - result += "translateX("; - break; - case TranslateYTransformOperation: - result += "translateY("; - break; - case RotateTransformOperation: - result += "rotate("; - break; - case ScaleTransformOperation: - result += "scale("; - break; - case ScaleXTransformOperation: - result += "scaleX("; - break; - case ScaleYTransformOperation: - result += "scaleY("; - break; - case SkewTransformOperation: - result += "skew("; - break; - case SkewXTransformOperation: - result += "skewX("; - break; - case SkewYTransformOperation: - result += "skewY("; - break; - case MatrixTransformOperation: - result += "matrix("; - break; - case TranslateZTransformOperation: - result += "translateZ("; - break; - case Translate3DTransformOperation: - result += "translate3d("; - break; - case RotateXTransformOperation: - result += "rotateX("; - break; - case RotateYTransformOperation: - result += "rotateY("; - break; - case RotateZTransformOperation: - result += "rotateZ("; - break; - case Rotate3DTransformOperation: - result += "rotate3d("; - break; - case ScaleZTransformOperation: - result += "scaleZ("; - break; - case Scale3DTransformOperation: - result += "scale3d("; - break; - case PerspectiveTransformOperation: - result += "perspective("; - break; - case Matrix3DTransformOperation: - result += "matrix3d("; - break; - default: - break; + StringBuilder result; + if (m_type != UnknownTransformOperation) { + ASSERT(static_cast<size_t>(m_type) < WTF_ARRAY_LENGTH(transformName)); + result.append(transformName[m_type]); + result.append('('); + result.append(CSSValueList::customCssText()); + result.append(')'); } - - result += CSSValueList::customCssText(); - - result += ")"; - return result; + return result.toString(); } WebKitCSSTransformValue::WebKitCSSTransformValue(const WebKitCSSTransformValue& cloneFrom) diff --git a/Source/WebCore/css/mathml.css b/Source/WebCore/css/mathml.css index cf178e3cf..a96e3fa4b 100644 --- a/Source/WebCore/css/mathml.css +++ b/Source/WebCore/css/mathml.css @@ -170,7 +170,7 @@ mroot > * + mrow, mroot > * + mfenced { /* FIXME: eliminate */ mtable { display: inline-table; text-align: center; - vertical-align: -40%; + vertical-align: middle; } mtr { diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index d9889ab98..eed853f52 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -52,8 +52,10 @@ ComposedShadowTreeWalker::ComposedShadowTreeWalker(const Node* node, Policy poli : m_node(node) , m_policy(policy) { - // FIXME: Refactor ComposedShadowTreeWalker so that we can assert node here. - // https://bugs.webkit.org/show_bug.cgi?id=87004 +#ifndef NDEBUG + if (m_node) + assertPrecondition(); +#endif } ComposedShadowTreeWalker ComposedShadowTreeWalker::fromFirstChild(const Node* node, Policy policy) @@ -198,28 +200,6 @@ void ComposedShadowTreeWalker::parent() assertPostcondition(); } -void ComposedShadowTreeWalker::parentIncludingInsertionPointAndShadowRoot() -{ - ASSERT(m_node); - m_node = traverseParentIncludingInsertionPointAndShadowRoot(m_node); -} - -Node* ComposedShadowTreeWalker::traverseParentIncludingInsertionPointAndShadowRoot(const Node* node) const -{ - if (ElementShadow* shadow = shadowOfParent(node)) { - if (InsertionPoint* insertionPoint = shadow->insertionPointFor(node)) - return insertionPoint; - } - if (!node->isShadowRoot()) - return node->parentNode(); - const ShadowRoot* shadowRoot = toShadowRoot(node); - if (shadowRoot->isYoungest()) - return shadowRoot->host(); - InsertionPoint* assignedInsertionPoint = shadowRoot->assignedTo(); - ASSERT(assignedInsertionPoint); - return assignedInsertionPoint; -} - Node* ComposedShadowTreeWalker::traverseParent(const Node* node) const { if (!canCrossUpperBoundary() && node->isShadowRoot()) { @@ -249,8 +229,7 @@ Node* ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost(cons return const_cast<ShadowRoot*>(shadowRoot); } InsertionPoint* assignedInsertionPoint = shadowRoot->assignedTo(); - ASSERT(assignedInsertionPoint); - return traverseParent(assignedInsertionPoint); + return assignedInsertionPoint ? traverseParent(assignedInsertionPoint) : 0; } Node* ComposedShadowTreeWalker::traverseNextSibling(const Node* node) @@ -293,4 +272,31 @@ void ComposedShadowTreeWalker::previous() assertPostcondition(); } +ComposedShadowTreeParentWalker::ComposedShadowTreeParentWalker(const Node* node) + : m_node(node) +{ +} + +void ComposedShadowTreeParentWalker::parentIncludingInsertionPointAndShadowRoot() +{ + ASSERT(m_node); + m_node = traverseParentIncludingInsertionPointAndShadowRoot(m_node); +} + +Node* ComposedShadowTreeParentWalker::traverseParentIncludingInsertionPointAndShadowRoot(const Node* node) const +{ + if (ElementShadow* shadow = shadowOfParent(node)) { + if (InsertionPoint* insertionPoint = shadow->insertionPointFor(node)) + return insertionPoint; + } + if (!node->isShadowRoot()) + return node->parentNode(); + const ShadowRoot* shadowRoot = toShadowRoot(node); + if (shadowRoot->isYoungest()) + return shadowRoot->host(); + InsertionPoint* assignedInsertionPoint = shadowRoot->assignedTo(); + ASSERT(assignedInsertionPoint); + return assignedInsertionPoint; +} + } // namespace diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.h b/Source/WebCore/dom/ComposedShadowTreeWalker.h index 831b82c69..bb9f41671 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.h +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.h @@ -59,8 +59,6 @@ public: void previousSibling(); void parent(); - // This function ignores policy and always crosses an upper boundary. - void parentIncludingInsertionPointAndShadowRoot(); void next(); void previous(); @@ -81,7 +79,7 @@ private: ASSERT(!m_node->isShadowRoot()); else ASSERT(!m_node->isShadowRoot() || toShadowRoot(m_node)->isYoungest()); - ASSERT(!isInsertionPoint(m_node) || !toInsertionPoint(m_node)->isActive()); + ASSERT(!isActiveInsertionPoint(m_node)); #endif } @@ -100,7 +98,6 @@ private: Node* traverseLastChild(const Node*) const; Node* traverseChild(const Node*, TraversalDirection) const; Node* traverseParent(const Node*) const; - Node* traverseParentIncludingInsertionPointAndShadowRoot(const Node*) const; static Node* traverseNextSibling(const Node*); static Node* traversePreviousSibling(const Node*); @@ -119,6 +116,18 @@ private: Policy m_policy; }; +// A special walker class which is only used for traversing a parent node, including +// insertion points and shadow roots. +class ComposedShadowTreeParentWalker { +public: + ComposedShadowTreeParentWalker(const Node*); + void parentIncludingInsertionPointAndShadowRoot(); + Node* get() const { return const_cast<Node*>(m_node); } +private: + Node* traverseParentIncludingInsertionPointAndShadowRoot(const Node*) const; + const Node* m_node; +}; + } // namespace #endif diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index 6a6c488bf..c23a0b9e9 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -584,10 +584,8 @@ void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) allowEventDispatch(); - // FIXME: Why doesn't this use notify(newChild.get()) instead? - if (inDocument()) - ChildNodeInsertionNotifier(this).notifyInsertedIntoDocument(newChild.get()); childrenChanged(true, last, 0, 1); + ChildNodeInsertionNotifier(this).notify(newChild.get()); } void ContainerNode::suspendPostAttachCallbacks() diff --git a/Source/WebCore/dom/DOMError.idl b/Source/WebCore/dom/DOMError.idl index 0ab255f50..ee059d4b2 100644 --- a/Source/WebCore/dom/DOMError.idl +++ b/Source/WebCore/dom/DOMError.idl @@ -32,4 +32,4 @@ module core { readonly attribute DOMString name; }; -}
\ No newline at end of file +} diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 94478a873..af40173c7 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -5869,15 +5869,9 @@ PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html // when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819 - // Ditto for the createTouchList method below. Frame* frame = window ? window->frame() : this->frame(); return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force); } - -PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const -{ - return TouchList::create(); -} #endif static void wheelEventHandlerCountChanged(Document* document) diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 43c5f5774..72edf436a 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -1123,7 +1123,6 @@ public: #if ENABLE(TOUCH_EVENTS) PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const; - PassRefPtr<TouchList> createTouchList(ExceptionCode&) const; #endif const DocumentTiming* timing() const { return &m_documentTiming; } diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 8431cbba0..222ca9098 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -132,8 +132,10 @@ Element::~Element() } #endif - if (shadow()) + if (ElementShadow* elementShadow = shadow()) { + elementShadow->removeAllShadowRoots(); rareData()->m_shadow.clear(); + } if (hasAttrList()) { ASSERT(m_attributeData); @@ -914,6 +916,14 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio return InsertionDone; } +static inline TreeScope* treeScopeOfParent(Node* node, ContainerNode* insertionPoint) +{ + if (Node* parent = node->parentNode()) + parent->treeScope(); + return insertionPoint->treeScope(); +} + + void Element::removedFrom(ContainerNode* insertionPoint) { #if ENABLE(FULLSCREEN_API) @@ -925,8 +935,8 @@ void Element::removedFrom(ContainerNode* insertionPoint) if (insertionPoint->inDocument()) { const AtomicString& idValue = getIdAttribute(); - if (!idValue.isNull()) - updateId(idValue, nullAtom); + if (!idValue.isNull() && inDocument()) + updateId(treeScopeOfParent(this, insertionPoint), idValue, nullAtom); const AtomicString& nameValue = getNameAttribute(); if (!nameValue.isNull()) @@ -947,7 +957,9 @@ void Element::attach() // When a shadow root exists, it does the work of attaching the children. if (ElementShadow* shadow = this->shadow()) { parentPusher.push(); - shadow->attachHost(this); + shadow->attach(); + attachChildrenIfNeeded(); + attachAsNode(); } else { if (firstChild()) parentPusher.push(); @@ -983,9 +995,11 @@ void Element::detach() if (hasRareData()) rareData()->resetComputedStyle(); - if (ElementShadow* shadow = this->shadow()) - shadow->detachHost(this); - else + if (ElementShadow* shadow = this->shadow()) { + detachChildrenIfNeeded(); + shadow->detach(); + detachAsNode(); + } else ContainerNode::detach(); RenderWidget::resumeWidgetHierarchyUpdates(); @@ -1318,7 +1332,7 @@ void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta); if (ElementShadow * shadow = this->shadow()) - shadow->hostChildrenChanged(); + shadow->invalidateDistribution(); } void Element::beginParsingChildren() diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index ffb7b2df2..fa39a187b 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -303,6 +303,7 @@ public: virtual String title() const; void updateId(const AtomicString& oldId, const AtomicString& newId); + void updateId(TreeScope*, const AtomicString& oldId, const AtomicString& newId); void updateName(const AtomicString& oldName, const AtomicString& newName); void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue); @@ -587,7 +588,14 @@ inline void Element::updateId(const AtomicString& oldId, const AtomicString& new if (oldId == newId) return; - TreeScope* scope = treeScope(); + updateId(treeScope(), oldId, newId); +} + +inline void Element::updateId(TreeScope* scope, const AtomicString& oldId, const AtomicString& newId) +{ + ASSERT(inDocument()); + ASSERT(oldId != newId); + if (!oldId.isEmpty()) scope->removeElementById(oldId, this); if (!newId.isEmpty()) diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index cd61d7bbd..0722cc838 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -136,8 +136,7 @@ StylePropertySet* ElementAttributeData::ensureInlineStyle(StyledElement* element { if (!m_inlineStyleDecl) { ASSERT(element->isStyledElement()); - m_inlineStyleDecl = StylePropertySet::create(); - m_inlineStyleDecl->setCSSParserMode(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); + m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); } return m_inlineStyleDecl.get(); } @@ -157,10 +156,8 @@ void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* elem // This makes wrapperless property sets immutable and so cacheable. if (m_inlineStyleDecl && !m_inlineStyleDecl->isMutable()) m_inlineStyleDecl.clear(); - if (!m_inlineStyleDecl) { - m_inlineStyleDecl = StylePropertySet::create(); - m_inlineStyleDecl->setCSSParserMode(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); - } + if (!m_inlineStyleDecl) + m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); } diff --git a/Source/WebCore/dom/ElementShadow.cpp b/Source/WebCore/dom/ElementShadow.cpp index d5efef6af..5ae789ce5 100644 --- a/Source/WebCore/dom/ElementShadow.cpp +++ b/Source/WebCore/dom/ElementShadow.cpp @@ -44,7 +44,7 @@ ElementShadow::ElementShadow() ElementShadow::~ElementShadow() { - removeAllShadowRoots(); + ASSERT(m_shadowRoots.isEmpty()); } static bool validateShadowRoot(Document* document, ShadowRoot* shadowRoot, ExceptionCode& ec) @@ -74,15 +74,13 @@ void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> sh return; shadowRoot->setHost(shadowHost); + m_shadowRoots.push(shadowRoot.get()); + invalidateDistribution(shadowHost); ChildNodeInsertionNotifier(shadowHost).notify(shadowRoot.get()); - if (shadowHost->attached()) { - shadowRoot->lazyAttach(); - detach(); - shadowHost->detachChildren(); - } + if (shadowHost->attached() && !shadowRoot->attached()) + shadowRoot->attach(); - m_shadowRoots.push(shadowRoot.get()); InspectorInstrumentation::didPushShadowRoot(shadowHost, shadowRoot.get()); } @@ -91,13 +89,14 @@ void ElementShadow::removeAllShadowRoots() // Dont protect this ref count. Element* shadowHost = host(); - while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.removeHead()) { + while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); shadowHost->document()->removeFocusedNodeOfSubtree(oldRoot.get()); if (oldRoot->attached()) oldRoot->detach(); + m_shadowRoots.removeHead(); oldRoot->setHost(0); oldRoot->setPrev(0); oldRoot->setNext(0); @@ -105,29 +104,16 @@ void ElementShadow::removeAllShadowRoots() ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get()); } - if (shadowHost->attached()) - shadowHost->attachChildrenLazily(); + invalidateDistribution(shadowHost); } void ElementShadow::attach() { - // The pool nodes are populated lazily in - // ensureDistributor(), and here we just ensure that it is in clean state. - ASSERT(!distributor().poolIsReady()); - - distributor().willDistribute(); + ensureDistribution(); for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) { if (!root->attached()) root->attach(); } - distributor().didDistribute(); -} - -void ElementShadow::attachHost(Element* host) -{ - attach(); - host->attachChildrenIfNeeded(); - host->attachAsNode(); } void ElementShadow::detach() @@ -138,13 +124,6 @@ void ElementShadow::detach() } } -void ElementShadow::detachHost(Element* host) -{ - host->detachChildrenIfNeeded(); - detach(); - host->detachAsNode(); -} - InsertionPoint* ElementShadow::insertionPointFor(const Node* node) const { ASSERT(node && node->parentNode()); @@ -159,12 +138,6 @@ InsertionPoint* ElementShadow::insertionPointFor(const Node* node) const return distributor().findInsertionPointFor(node); } -void ElementShadow::reattach() -{ - detach(); - attach(); -} - bool ElementShadow::childNeedsStyleRecalc() { ASSERT(youngestShadowRoot()); @@ -187,62 +160,46 @@ bool ElementShadow::needsStyleRecalc() void ElementShadow::recalcStyle(Node::StyleChange change) { - ShadowRoot* youngest = youngestShadowRoot(); - if (!youngest) - return; - - if (needsRedistributing()) - reattachHostChildrenAndShadow(); - else { - StyleResolver* styleResolver = youngest->document()->styleResolver(); + for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) { + StyleResolver* styleResolver = root->document()->styleResolver(); + styleResolver->pushParentShadowRoot(root); - styleResolver->pushParentShadowRoot(youngest); - for (Node* n = youngest->firstChild(); n; n = n->nextSibling()) { + for (Node* n = root->firstChild(); n; n = n->nextSibling()) { if (n->isElementNode()) static_cast<Element*>(n)->recalcStyle(change); else if (n->isTextNode()) toText(n)->recalcTextStyle(change); } - styleResolver->popParentShadowRoot(youngest); - } - m_distributor.clearNeedsRedistributing(); - for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) { + styleResolver->popParentShadowRoot(root); root->clearNeedsStyleRecalc(); root->clearChildNeedsStyleRecalc(); } } -bool ElementShadow::needsRedistributing() -{ - return m_distributor.needsRedistributing() || (youngestShadowRoot() && youngestShadowRoot()->hasInsertionPoint()); -} - -void ElementShadow::hostChildrenChanged() +void ElementShadow::ensureDistribution() { - ASSERT(youngestShadowRoot()); - - if (!youngestShadowRoot()->hasInsertionPoint()) + if (!m_distributor.needsDistribution()) return; - - // This results in forced detaching/attaching of the shadow render tree. See ShadowRoot::recalcStyle(). - setNeedsRedistributing(); + m_distributor.distribute(host()); } -void ElementShadow::setNeedsRedistributing() +void ElementShadow::invalidateDistribution() { - m_distributor.setNeedsRedistributing(); - host()->setNeedsStyleRecalc(); + invalidateDistribution(host()); } -void ElementShadow::reattachHostChildrenAndShadow() +void ElementShadow::invalidateDistribution(Element* host) { - ASSERT(youngestShadowRoot()); + if (!m_distributor.needsInvalidation()) + return; + bool needsReattach = m_distributor.invalidate(host); + if (needsReattach && host->attached()) { + host->detach(); + host->lazyAttach(Node::DoNotSetAttached); + } - Element* hostNode = youngestShadowRoot()->host(); - hostNode->detachChildrenIfNeeded(); - reattach(); - hostNode->attachChildrenIfNeeded(); + m_distributor.finishInivalidation(); } } // namespace diff --git a/Source/WebCore/dom/ElementShadow.h b/Source/WebCore/dom/ElementShadow.h index 856c46c31..13de1c021 100644 --- a/Source/WebCore/dom/ElementShadow.h +++ b/Source/WebCore/dom/ElementShadow.h @@ -52,29 +52,26 @@ public: ShadowRoot* youngestShadowRoot() const; ShadowRoot* oldestShadowRoot() const; + void removeAllShadowRoots(); void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&); void attach(); void detach(); - void reattach(); - void attachHost(Element*); - void detachHost(Element*); bool childNeedsStyleRecalc(); bool needsStyleRecalc(); void recalcStyle(Node::StyleChange); - void setNeedsRedistributing(); - bool needsRedistributing(); - void hostChildrenChanged(); + void ensureDistribution(); + void invalidateDistribution(); + InsertionPoint* insertionPointFor(const Node*) const; ContentDistributor& distributor(); const ContentDistributor& distributor() const; private: - void removeAllShadowRoots(); - void reattachHostChildrenAndShadow(); + void invalidateDistribution(Element* host); DoublyLinkedList<ShadowRoot> m_shadowRoots; ContentDistributor m_distributor; diff --git a/Source/WebCore/dom/EventContext.cpp b/Source/WebCore/dom/EventContext.cpp index 8094ba0bb..bffb592a0 100644 --- a/Source/WebCore/dom/EventContext.cpp +++ b/Source/WebCore/dom/EventContext.cpp @@ -41,6 +41,8 @@ EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> curren , m_target(target) , m_relatedTarget(0) { + ASSERT(m_node); + ASSERT(!m_target || m_target->toNode() || accessible(m_target->toNode())); } void EventContext::handleLocalEvents(Event* event) const diff --git a/Source/WebCore/dom/EventContext.h b/Source/WebCore/dom/EventContext.h index 632581009..12c815695 100644 --- a/Source/WebCore/dom/EventContext.h +++ b/Source/WebCore/dom/EventContext.h @@ -27,13 +27,14 @@ #ifndef EventContext_h #define EventContext_h +#include "EventTarget.h" +#include "Node.h" +#include "TreeScope.h" #include <wtf/RefPtr.h> namespace WebCore { -class EventTarget; class Event; -class Node; class EventContext { public: @@ -48,6 +49,9 @@ public: void setRelatedTarget(PassRefPtr<EventTarget>); private: +#ifndef NDEBUG + bool accessible(Node*); +#endif RefPtr<Node> m_node; RefPtr<EventTarget> m_currentTarget; RefPtr<EventTarget> m_target; @@ -76,9 +80,23 @@ inline EventTarget* EventContext::relatedTarget() const inline void EventContext::setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { + ASSERT(!relatedTarget || !relatedTarget->toNode() || accessible(relatedTarget->toNode())); m_relatedTarget = relatedTarget; } +#ifndef NDEBUG +inline bool EventContext::accessible(Node* target) +{ + ASSERT(target); + TreeScope* targetScope = target->treeScope(); + for (TreeScope* scope = m_node->treeScope(); scope; scope = scope->parentTreeScope()) { + if (scope == targetScope) + return true; + } + return false; +} +#endif + } #endif // EventContext_h diff --git a/Source/WebCore/dom/EventDispatcher.cpp b/Source/WebCore/dom/EventDispatcher.cpp index 4e921dd78..b54bbbee6 100644 --- a/Source/WebCore/dom/EventDispatcher.cpp +++ b/Source/WebCore/dom/EventDispatcher.cpp @@ -62,7 +62,7 @@ EventRelatedTargetAdjuster::EventRelatedTargetAdjuster(PassRefPtr<Node> node, Pa void EventRelatedTargetAdjuster::adjust(Vector<EventContext>& ancestors) { TreeScope* lastTreeScope = 0; - for (ComposedShadowTreeWalker walker(m_relatedTarget.get()); walker.get(); walker.parentIncludingInsertionPointAndShadowRoot()) { + for (ComposedShadowTreeParentWalker walker(m_relatedTarget.get()); walker.get(); walker.parentIncludingInsertionPointAndShadowRoot()) { TreeScope* scope = walker.get()->treeScope(); // Skips adding a node to the map if treeScope does not change. if (scope != lastTreeScope) @@ -199,37 +199,23 @@ void EventDispatcher::ensureEventAncestors(Event* event) { if (m_ancestorsInitialized) return; - - ComposedShadowTreeWalker ancestorWalker(m_node.get()); - EventTarget* originalTarget = eventTargetRespectingSVGTargetRules(ancestorWalker.get()); - m_ancestors.append(EventContext(m_node.get(), originalTarget, originalTarget)); m_ancestorsInitialized = true; - - if (!m_node->inDocument()) - return; - + bool inDocument = m_node->inDocument(); + bool isSVGElement = m_node->isSVGElement(); Vector<EventTarget*> targetStack; - targetStack.append(originalTarget); - while (true) { - if (ancestorWalker.get()->isShadowRoot()) { - if (determineDispatchBehavior(event, toShadowRoot(ancestorWalker.get())) == StayInsideShadowDOM) - return; - ancestorWalker.parentIncludingInsertionPointAndShadowRoot(); - if (!ancestorWalker.get()) - return; - if (!m_node->isSVGElement()) { - targetStack.removeLast(); - if (targetStack.isEmpty()) - targetStack.append(ancestorWalker.get()); - } - } else { - ancestorWalker.parentIncludingInsertionPointAndShadowRoot(); - if (!ancestorWalker.get()) - return; - if (isInsertionPoint(ancestorWalker.get()) && toInsertionPoint(ancestorWalker.get())->isActive()) - targetStack.append(ancestorWalker.get()); - } - m_ancestors.append(EventContext(ancestorWalker.get(), eventTargetRespectingSVGTargetRules(ancestorWalker.get()), targetStack.last())); + for (ComposedShadowTreeParentWalker walker(m_node.get()); walker.get(); walker.parentIncludingInsertionPointAndShadowRoot()) { + Node* node = walker.get(); + if (isActiveInsertionPoint(node) || targetStack.isEmpty()) + targetStack.append(eventTargetRespectingSVGTargetRules(node)); + m_ancestors.append(EventContext(node, eventTargetRespectingSVGTargetRules(node), targetStack.last())); + if (!inDocument) + return; + if (!node->isShadowRoot()) + continue; + if (determineDispatchBehavior(event, toShadowRoot(node)) == StayInsideShadowDOM) + return; + if (!isSVGElement && !targetStack.isEmpty()) + targetStack.removeLast(); } } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 9a1f5c0b0..79450c5b5 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -1693,8 +1693,8 @@ PassRefPtr<Element> Node::querySelector(const String& selectors, ExceptionCode& return 0; } - SelectorQuery selectorQuery(this, querySelectorList); - return selectorQuery.queryFirst(); + SelectorQuery selectorQuery(querySelectorList); + return selectorQuery.queryFirst(this); } PassRefPtr<NodeList> Node::querySelectorAll(const String& selectors, ExceptionCode& ec) @@ -1718,8 +1718,8 @@ PassRefPtr<NodeList> Node::querySelectorAll(const String& selectors, ExceptionCo return 0; } - SelectorQuery selectorQuery(this, querySelectorList); - return selectorQuery.queryAll(); + SelectorQuery selectorQuery(querySelectorList); + return selectorQuery.queryAll(this); } Document *Node::ownerDocument() const @@ -2931,7 +2931,7 @@ void NodeRareData::clearChildNodeListCache() PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name) { - ASSERT(hasTagName(formTag)); + ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); NodeListsNodeData* nodeLists = ensureRareData()->ensureNodeLists(this); diff --git a/Source/WebCore/dom/NodeRenderingContext.cpp b/Source/WebCore/dom/NodeRenderingContext.cpp index cbaba4838..7f70e7c0f 100644 --- a/Source/WebCore/dom/NodeRenderingContext.cpp +++ b/Source/WebCore/dom/NodeRenderingContext.cpp @@ -77,6 +77,8 @@ NodeRenderingContext::NodeRenderingContext(Node* node) m_visualParentShadow = toShadowRoot(parent)->owner(); if (m_visualParentShadow) { + m_visualParentShadow->ensureDistribution(); + if ((m_insertionPoint = m_visualParentShadow->insertionPointFor(m_node))) { if (m_insertionPoint->shadowRoot()->isUsedForRendering()) { m_phase = AttachingDistributed; @@ -91,7 +93,10 @@ NodeRenderingContext::NodeRenderingContext(Node* node) } if (isShadowBoundary(parent)) { - if (!parent->shadowRoot()->isUsedForRendering()) { + ShadowRoot* parentShadowRoot = parent->shadowRoot(); + parentShadowRoot->owner()->ensureDistribution(); + + if (!parentShadowRoot->isUsedForRendering()) { m_phase = AttachingNotDistributed; m_parentNodeForRenderingAndStyle = parent; return; @@ -285,12 +290,6 @@ RenderObject* NodeRenderingContext::parentRenderer() const return m_parentNodeForRenderingAndStyle ? m_parentNodeForRenderingAndStyle->renderer() : 0; } -void NodeRenderingContext::hostChildrenChanged() -{ - if (m_phase == AttachingNotDistributed && m_visualParentShadow) - m_visualParentShadow->hostChildrenChanged(); -} - bool NodeRenderingContext::shouldCreateRenderer() const { ASSERT(m_phase != Calculating); @@ -366,9 +365,6 @@ void NodeRendererFactory::createRendererIfNeeded() ASSERT(!node->renderer()); ASSERT(document->shouldCreateRenderers()); - // FIXME: This side effect should be visible from attach() code. - m_context.hostChildrenChanged(); - if (!m_context.shouldCreateRenderer()) return; diff --git a/Source/WebCore/dom/NodeRenderingContext.h b/Source/WebCore/dom/NodeRenderingContext.h index 1d3daf3fc..7b14e03ed 100644 --- a/Source/WebCore/dom/NodeRenderingContext.h +++ b/Source/WebCore/dom/NodeRenderingContext.h @@ -60,8 +60,6 @@ public: bool shouldCreateRenderer() const; - void hostChildrenChanged(); - bool isOnUpperEncapsulationBoundary() const; bool isOnEncapsulationBoundary() const; bool hasFlowThreadParent() const { return m_parentFlowRenderer; } diff --git a/Source/WebCore/dom/ProgressEvent.idl b/Source/WebCore/dom/ProgressEvent.idl index f8d0b5baf..525fa4ae9 100644 --- a/Source/WebCore/dom/ProgressEvent.idl +++ b/Source/WebCore/dom/ProgressEvent.idl @@ -26,7 +26,8 @@ module events { interface [ - ConstructorTemplate=Event + ConstructorTemplate=Event, + JSNoStaticTables ] ProgressEvent : Event { readonly attribute [InitializedByEventConstructor] boolean lengthComputable; readonly attribute [InitializedByEventConstructor] unsigned long long loaded; diff --git a/Source/WebCore/dom/SecurityContext.h b/Source/WebCore/dom/SecurityContext.h index febd12261..7b4746d13 100644 --- a/Source/WebCore/dom/SecurityContext.h +++ b/Source/WebCore/dom/SecurityContext.h @@ -67,8 +67,6 @@ public: static SandboxFlags parseSandboxPolicy(const String& policy); - bool mayDisplaySeamlessWithParent() const { return m_mayDisplaySeamlessWithParent; } - protected: SecurityContext(); ~SecurityContext(); diff --git a/Source/WebCore/dom/SelectorQuery.cpp b/Source/WebCore/dom/SelectorQuery.cpp index c43fd4afa..877fe795b 100644 --- a/Source/WebCore/dom/SelectorQuery.cpp +++ b/Source/WebCore/dom/SelectorQuery.cpp @@ -146,22 +146,24 @@ void SelectorDataList::execute(const SelectorChecker& selectorChecker, Node* roo } } -SelectorQuery::SelectorQuery(Node* rootNode, const CSSSelectorList& selectorList) - : m_rootNode(rootNode) - , m_selectorChecker(rootNode->document(), !rootNode->document()->inQuirksMode()) - , m_selectors(selectorList) +SelectorQuery::SelectorQuery(const CSSSelectorList& selectorList) + : m_selectors(selectorList) { - m_selectorChecker.setMode(SelectorChecker::QueryingRules); } -PassRefPtr<NodeList> SelectorQuery::queryAll() const + +PassRefPtr<NodeList> SelectorQuery::queryAll(Node* rootNode) const { - return m_selectors.queryAll(m_selectorChecker, m_rootNode); + SelectorChecker selectorChecker(rootNode->document(), !rootNode->document()->inQuirksMode()); + selectorChecker.setMode(SelectorChecker::QueryingRules); + return m_selectors.queryAll(selectorChecker, rootNode); } -PassRefPtr<Element> SelectorQuery::queryFirst() const +PassRefPtr<Element> SelectorQuery::queryFirst(Node* rootNode) const { - return m_selectors.queryFirst(m_selectorChecker, m_rootNode); + SelectorChecker selectorChecker(rootNode->document(), !rootNode->document()->inQuirksMode()); + selectorChecker.setMode(SelectorChecker::QueryingRules); + return m_selectors.queryFirst(selectorChecker, rootNode); } } diff --git a/Source/WebCore/dom/SelectorQuery.h b/Source/WebCore/dom/SelectorQuery.h index 0f10678ad..5d767b5ce 100644 --- a/Source/WebCore/dom/SelectorQuery.h +++ b/Source/WebCore/dom/SelectorQuery.h @@ -67,13 +67,11 @@ private: class SelectorQuery { WTF_MAKE_NONCOPYABLE(SelectorQuery); public: - SelectorQuery(Node* rootNode, const CSSSelectorList&); + SelectorQuery(const CSSSelectorList&); - PassRefPtr<NodeList> queryAll() const; - PassRefPtr<Element> queryFirst() const; + PassRefPtr<NodeList> queryAll(Node* rootNode) const; + PassRefPtr<Element> queryFirst(Node* rootNode) const; private: - Node* m_rootNode; - SelectorChecker m_selectorChecker; SelectorDataList m_selectors; }; diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 3eba812fc..6723a0f6d 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -189,8 +189,7 @@ void ShadowRoot::setApplyAuthorStyles(bool value) { if (m_applyAuthorStyles != value) { m_applyAuthorStyles = value; - if (attached() && owner()) - owner()->setNeedsRedistributing(); + host()->setNeedsStyleRecalc(); } } @@ -198,8 +197,15 @@ void ShadowRoot::attach() { StyleResolver* styleResolver = document()->styleResolver(); styleResolver->pushParentShadowRoot(this); - DocumentFragment::attach(); + attachChildrenIfNeeded(); + attachAsNode(); styleResolver->popParentShadowRoot(this); } +void ShadowRoot::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) +{ + ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + owner()->invalidateDistribution(); +} + } diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h index 1411fa52a..0b7ffa5f2 100644 --- a/Source/WebCore/dom/ShadowRoot.h +++ b/Source/WebCore/dom/ShadowRoot.h @@ -60,7 +60,6 @@ public: void recalcShadowTreeStyle(StyleChange); InsertionPoint* insertionPointFor(Node*) const; - void hostChildrenChanged(); virtual bool applyAuthorStyles() const OVERRIDE; void setApplyAuthorStyles(bool); @@ -91,10 +90,10 @@ public: private: ShadowRoot(Document*); virtual ~ShadowRoot(); - virtual String nodeName() const; virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool childTypeAllowed(NodeType) const; + virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE; ShadowRoot* m_prev; ShadowRoot* m_next; diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index 43747b806..a2bed3f45 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -317,12 +317,7 @@ void StyledElement::updateAttributeStyle() } clearAttributeStyleDirty(); - if (style->isEmpty()) - attributeData()->setAttributeStyle(0); - else { - style->shrinkToFit(); - attributeData()->setAttributeStyle(style); - } + attributeData()->setAttributeStyle(style->isEmpty() ? 0 : style); if (!cacheHash || cacheIterator->second) return; diff --git a/Source/WebCore/dom/Text.cpp b/Source/WebCore/dom/Text.cpp index f173fca3c..9ec7d0bbd 100644 --- a/Source/WebCore/dom/Text.cpp +++ b/Source/WebCore/dom/Text.cpp @@ -198,8 +198,8 @@ bool Text::rendererIsNeeded(const NodeRenderingContext& context) if (!onlyWS) return true; - RenderObject* par = context.parentRenderer(); - if (par->isTable() || par->isTableRow() || par->isTableSection() || par->isTableCol() || par->isFrameSet()) + RenderObject* parent = context.parentRenderer(); + if (parent->isTable() || parent->isTableRow() || parent->isTableSection() || parent->isRenderTableCol() || parent->isFrameSet()) return false; if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers. @@ -209,15 +209,15 @@ bool Text::rendererIsNeeded(const NodeRenderingContext& context) if (prev && prev->isBR()) // <span><br/> <br/></span> return false; - if (par->isRenderInline()) { + if (parent->isRenderInline()) { // <span><div/> <div/></span> if (prev && !prev->isInline()) return false; } else { - if (par->isRenderBlock() && !par->childrenInline() && (!prev || !prev->isInline())) + if (parent->isRenderBlock() && !parent->childrenInline() && (!prev || !prev->isInline())) return false; - RenderObject* first = par->firstChild(); + RenderObject* first = parent->firstChild(); while (first && first->isFloatingOrPositioned()) first = first->nextSibling(); RenderObject* next = context.nextRenderer(); diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index 2f6f8bd9e..d70b90059 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -41,6 +41,7 @@ #include "Page.h" #include "ShadowRoot.h" #include "TreeScopeAdopter.h" +#include <wtf/Vector.h> #include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> @@ -231,5 +232,38 @@ Node* TreeScope::focusedNode() return node; } +static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes) +{ + while (true) { + treeScopes.append(node->treeScope()); + Node* ancestor = node->shadowAncestorNode(); + if (node == ancestor) + break; + node = ancestor; + } +} + +TreeScope* commonTreeScope(Node* nodeA, Node* nodeB) +{ + if (!nodeA || !nodeB) + return 0; + + if (nodeA->treeScope() == nodeB->treeScope()) + return nodeA->treeScope(); + + Vector<TreeScope*, 5> treeScopesA; + listTreeScopes(nodeA, treeScopesA); + + Vector<TreeScope*, 5> treeScopesB; + listTreeScopes(nodeB, treeScopesB); + + size_t indexA = treeScopesA.size(); + size_t indexB = treeScopesB.size(); + + for (; indexA > 0 && indexB > 0 && treeScopesA[indexA - 1] == treeScopesB[indexB - 1]; --indexA, --indexB) { } + + return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0; +} + } // namespace WebCore diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index e4c4ef3b2..0d1dceb43 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -110,6 +110,8 @@ inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co return m_elementsById.containsMultiple(id.impl()); } +TreeScope* commonTreeScope(Node*, Node*); + } // namespace WebCore #endif // TreeScope_h diff --git a/Source/WebCore/dom/WebKitNamedFlow.cpp b/Source/WebCore/dom/WebKitNamedFlow.cpp index 9a27164dc..19e122922 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.cpp +++ b/Source/WebCore/dom/WebKitNamedFlow.cpp @@ -50,10 +50,10 @@ String WebKitNamedFlow::name() const return m_parentFlowThread->flowThreadName(); } -bool WebKitNamedFlow::overflow() const +bool WebKitNamedFlow::overset() const { m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); - return m_parentFlowThread->overflow(); + return m_parentFlowThread->overset(); } PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode) diff --git a/Source/WebCore/dom/WebKitNamedFlow.h b/Source/WebCore/dom/WebKitNamedFlow.h index 5d1e6a74d..b81e5a4b0 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.h +++ b/Source/WebCore/dom/WebKitNamedFlow.h @@ -50,7 +50,7 @@ public: ~WebKitNamedFlow(); String name() const; - bool overflow() const; + bool overset() const; PassRefPtr<NodeList> getRegionsByContentNode(Node*); PassRefPtr<NodeList> contentNodes() const; diff --git a/Source/WebCore/dom/WebKitNamedFlow.idl b/Source/WebCore/dom/WebKitNamedFlow.idl index 6b3066ca9..0da90e00c 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.idl +++ b/Source/WebCore/dom/WebKitNamedFlow.idl @@ -32,7 +32,7 @@ module core { JSGenerateToJSObject ] WebKitNamedFlow { readonly attribute DOMString name; - readonly attribute boolean overflow; + readonly attribute boolean overset; NodeList getRegionsByContentNode(in Node contentNode); readonly attribute NodeList contentNodes; }; diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp index 3bbdbf1c7..d14a903fe 100644 --- a/Source/WebCore/editing/EditingStyle.cpp +++ b/Source/WebCore/editing/EditingStyle.cpp @@ -1033,10 +1033,8 @@ static PassRefPtr<StylePropertySet> styleFromMatchedRulesForElement(Element* ele RefPtr<CSSRuleList> matchedRules = element->document()->styleResolver()->styleRulesForElement(element, rulesToInclude); if (matchedRules) { for (unsigned i = 0; i < matchedRules->length(); i++) { - if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) { - RefPtr<StylePropertySet> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->styleRule()->properties(); - style->merge(s.get(), true); - } + if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) + style->merge(static_cast<CSSStyleRule*>(matchedRules->item(i))->styleRule()->properties(), true); } } diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index 6f4548163..c454996cc 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -674,8 +674,8 @@ Node* Editor::findEventTargetFrom(const VisibleSelection& selection) const target = m_frame->document()->body(); if (!target) return 0; - return target->shadowAncestorNode(); + return target; } Node* Editor::findEventTargetFromSelection() const @@ -1116,7 +1116,7 @@ int Editor::spellCheckerDocumentTag() return client() ? client()->spellCheckerDocumentTag() : 0; } -#if USE(AUTOMATIC_TEXT_REPLACEMENT) +#if PLATFORM(MAC) void Editor::uppercaseWord() { @@ -1135,6 +1135,10 @@ void Editor::capitalizeWord() if (client()) client()->capitalizeWord(); } + +#endif + +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void Editor::showSubstitutionsPanel() { diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h index ec6d9753a..27b4fadea 100644 --- a/Source/WebCore/editing/Editor.h +++ b/Source/WebCore/editing/Editor.h @@ -233,10 +233,12 @@ public: void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection); void markAndReplaceFor(PassRefPtr<SpellCheckRequest>, const Vector<TextCheckingResult>&); -#if USE(AUTOMATIC_TEXT_REPLACEMENT) +#if PLATFORM(MAC) void uppercaseWord(); void lowercaseWord(); void capitalizeWord(); +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void showSubstitutionsPanel(); bool substitutionsPanelIsShowing(); void toggleSmartInsertDelete(); diff --git a/Source/WebCore/editing/SpellChecker.cpp b/Source/WebCore/editing/SpellChecker.cpp index 8107fdbaa..800720f75 100644 --- a/Source/WebCore/editing/SpellChecker.cpp +++ b/Source/WebCore/editing/SpellChecker.cpp @@ -47,11 +47,9 @@ namespace WebCore { static const int unrequestedSequence = -1; -SpellCheckRequest::SpellCheckRequest(int sequence, PassRefPtr<Range> checkingRange, PassRefPtr<Range> paragraphRange, const String& text, TextCheckingTypeMask mask, TextCheckingProcessType processType) - : m_sequence(sequence) - , m_text(text) - , m_mask(mask) - , m_processType(processType) +SpellCheckRequest::SpellCheckRequest(PassRefPtr<Range> checkingRange, PassRefPtr<Range> paragraphRange, const String& text, TextCheckingTypeMask mask, TextCheckingProcessType processType) + : TextCheckingRequest(unrequestedSequence, text, mask, processType) + , m_checker(0) , m_checkingRange(checkingRange) , m_paragraphRange(paragraphRange) , m_rootEditableElement(m_checkingRange->startContainer()->rootEditableElement()) @@ -72,10 +70,37 @@ PassRefPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask tex if (!text.length()) return PassRefPtr<SpellCheckRequest>(); - return adoptRef(new SpellCheckRequest(unrequestedSequence, checkingRange, paragraphRange, text, textCheckingOptions, processType)); + return adoptRef(new SpellCheckRequest(checkingRange, paragraphRange, text, textCheckingOptions, processType)); } +void SpellCheckRequest::didSucceed(const Vector<TextCheckingResult>& results) +{ + if (!m_checker) + return; + m_checker->didCheckSucceed(m_sequence, results); + m_checker = 0; +} + +void SpellCheckRequest::didCancel() +{ + if (!m_checker) + return; + m_checker->didCheckCancel(m_sequence); + m_checker = 0; +} + +void SpellCheckRequest::setCheckerAndSequence(SpellChecker* requester, int sequence) +{ + ASSERT(!m_checker); + ASSERT(m_sequence == unrequestedSequence); + m_checker = requester; + m_sequence = sequence; +} +void SpellCheckRequest::requesterDestroyed() +{ + m_checker = 0; +} SpellChecker::SpellChecker(Frame* frame) : m_frame(frame) @@ -87,6 +112,10 @@ SpellChecker::SpellChecker(Frame* frame) SpellChecker::~SpellChecker() { + if (m_processingRequest) + m_processingRequest->requesterDestroyed(); + for (RequestQueue::iterator i = m_requestQueue.begin(); i != m_requestQueue.end(); ++i) + (*i)->requesterDestroyed(); } TextCheckerClient* SpellChecker::client() const @@ -136,7 +165,7 @@ void SpellChecker::requestCheckingFor(PassRefPtr<SpellCheckRequest> request) if (sequence == unrequestedSequence) sequence = ++m_lastRequestSequence; - request->setSequence(sequence); + request->setCheckerAndSequence(this, sequence); if (m_timerToProcessQueuedRequest.isActive() || m_processingRequest) { enqueueRequest(request); @@ -151,7 +180,7 @@ void SpellChecker::invokeRequest(PassRefPtr<SpellCheckRequest> request) ASSERT(!m_processingRequest); m_processingRequest = request; - client()->requestCheckingOfString(this, m_processingRequest->textCheckingRequest()); + client()->requestCheckingOfString(m_processingRequest); } void SpellChecker::enqueueRequest(PassRefPtr<SpellCheckRequest> request) @@ -188,7 +217,7 @@ void SpellChecker::didCheck(int sequence, const Vector<TextCheckingResult>& resu m_timerToProcessQueuedRequest.startOneShot(0); } -void SpellChecker::didCheckSucceeded(int sequence, const Vector<TextCheckingResult>& results) +void SpellChecker::didCheckSucceed(int sequence, const Vector<TextCheckingResult>& results) { if (m_processingRequest->sequence() == sequence) { unsigned markers = 0; @@ -202,7 +231,7 @@ void SpellChecker::didCheckSucceeded(int sequence, const Vector<TextCheckingResu didCheck(sequence, results); } -void SpellChecker::didCheckCanceled(int sequence) +void SpellChecker::didCheckCancel(int sequence) { Vector<TextCheckingResult> results; didCheck(sequence, results); diff --git a/Source/WebCore/editing/SpellChecker.h b/Source/WebCore/editing/SpellChecker.h index 835a57c55..37c181cfd 100644 --- a/Source/WebCore/editing/SpellChecker.h +++ b/Source/WebCore/editing/SpellChecker.h @@ -42,30 +42,28 @@ namespace WebCore { class Frame; class Node; class TextCheckerClient; -struct TextCheckingResult; +class SpellChecker; -class SpellCheckRequest : public RefCounted<SpellCheckRequest> { +class SpellCheckRequest : public TextCheckingRequest { public: - SpellCheckRequest(int sequence, PassRefPtr<Range> checkingRange, PassRefPtr<Range> paragraphRange, const String&, TextCheckingTypeMask, TextCheckingProcessType); - ~SpellCheckRequest(); + SpellCheckRequest(PassRefPtr<Range> checkingRange, PassRefPtr<Range> paragraphRange, const String&, TextCheckingTypeMask, TextCheckingProcessType); + virtual ~SpellCheckRequest(); static PassRefPtr<SpellCheckRequest> create(TextCheckingTypeMask, TextCheckingProcessType, PassRefPtr<Range> checkingRange, PassRefPtr<Range> paragraphRange); - TextCheckingRequest textCheckingRequest() const; - - void setSequence(int sequence) { m_sequence = sequence; } - int sequence() const { return m_sequence; } PassRefPtr<Range> checkingRange() const { return m_checkingRange; } PassRefPtr<Range> paragraphRange() const { return m_paragraphRange; } - const String& text() const { return m_text; } - TextCheckingTypeMask mask() const { return m_mask; } - TextCheckingProcessType processType() const { return m_processType; } PassRefPtr<Element> rootEditableElement() const { return m_rootEditableElement; } + + void setCheckerAndSequence(SpellChecker*, int sequence); + void requesterDestroyed(); + bool isStarted() const { return m_checker; } + + virtual void didSucceed(const Vector<TextCheckingResult>&) OVERRIDE; + virtual void didCancel() OVERRIDE; + private: - int m_sequence; - String m_text; - TextCheckingTypeMask m_mask; - TextCheckingProcessType m_processType; + SpellChecker* m_checker; RefPtr<Range> m_checkingRange; RefPtr<Range> m_paragraphRange; RefPtr<Element> m_rootEditableElement; @@ -74,6 +72,8 @@ private: class SpellChecker { WTF_MAKE_NONCOPYABLE(SpellChecker); public: + friend class SpellCheckRequest; + explicit SpellChecker(Frame*); ~SpellChecker(); @@ -81,8 +81,6 @@ public: bool isCheckable(Range*) const; void requestCheckingFor(PassRefPtr<SpellCheckRequest>); - void didCheckSucceeded(int sequence, const Vector<TextCheckingResult>&); - void didCheckCanceled(int sequence); int lastRequestSequence() const { @@ -102,6 +100,8 @@ private: void timerFiredToProcessQueuedRequest(Timer<SpellChecker>*); void invokeRequest(PassRefPtr<SpellCheckRequest>); void enqueueRequest(PassRefPtr<SpellCheckRequest>); + void didCheckSucceed(int sequence, const Vector<TextCheckingResult>&); + void didCheckCancel(int sequence); void didCheck(int sequence, const Vector<TextCheckingResult>&); Frame* m_frame; @@ -114,11 +114,6 @@ private: RequestQueue m_requestQueue; }; -inline TextCheckingRequest SpellCheckRequest::textCheckingRequest() const -{ - return TextCheckingRequest(m_sequence, m_text, m_mask, m_processType); -} - } // namespace WebCore #endif // SpellChecker_h diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp index 6674fa167..e180ccabd 100644 --- a/Source/WebCore/editing/htmlediting.cpp +++ b/Source/WebCore/editing/htmlediting.cpp @@ -72,32 +72,28 @@ bool isAtomicNode(const Node *node) // could be inside a shadow tree. Only works for non-null values. int comparePositions(const Position& a, const Position& b) { - Node* nodeA = a.deprecatedNode(); + TreeScope* commonScope = commonTreeScope(a.containerNode(), b.containerNode()); + + ASSERT(commonScope); + if (!commonScope) + return 0; + + Node* nodeA = commonScope->ancestorInThisScope(a.deprecatedNode()); ASSERT(nodeA); - Node* nodeB = b.deprecatedNode(); - ASSERT(nodeB); - int offsetA = a.deprecatedEditingOffset(); - int offsetB = b.deprecatedEditingOffset(); + bool hasDescendentA = nodeA != a.deprecatedNode(); + int offsetA = hasDescendentA ? 0 : a.deprecatedEditingOffset(); - Node* shadowAncestorA = nodeA->shadowAncestorNode(); - if (shadowAncestorA == nodeA) - shadowAncestorA = 0; - Node* shadowAncestorB = nodeB->shadowAncestorNode(); - if (shadowAncestorB == nodeB) - shadowAncestorB = 0; + Node* nodeB = commonScope->ancestorInThisScope(b.deprecatedNode()); + ASSERT(nodeB); + bool hasDescendentB = nodeB != b.deprecatedNode(); + int offsetB = hasDescendentB ? 0 : b.deprecatedEditingOffset(); int bias = 0; - if (shadowAncestorA != shadowAncestorB) { - if (shadowAncestorA) { - nodeA = shadowAncestorA; - offsetA = 0; - bias = 1; - } - if (shadowAncestorB) { - nodeB = shadowAncestorB; - offsetB = 0; + if (nodeA == nodeB) { + if (hasDescendentA) bias = -1; - } + else if (hasDescendentB) + bias = 1; } ExceptionCode ec; @@ -375,8 +371,8 @@ String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfP bool isTableStructureNode(const Node *node) { - RenderObject *r = node->renderer(); - return (r && (r->isTableCell() || r->isTableRow() || r->isTableSection() || r->isTableCol())); + RenderObject* renderer = node->renderer(); + return (renderer && (renderer->isTableCell() || renderer->isTableRow() || renderer->isTableSection() || renderer->isRenderTableCol())); } const String& nonBreakingSpaceString() diff --git a/Source/WebCore/fileapi/File.cpp b/Source/WebCore/fileapi/File.cpp index 098084807..86d59894f 100644 --- a/Source/WebCore/fileapi/File.cpp +++ b/Source/WebCore/fileapi/File.cpp @@ -130,7 +130,7 @@ File::File(const String& name, const FileMetadata& metadata) double File::lastModifiedDate() const { #if ENABLE(FILE_SYSTEM) - if (m_snapshotSize >= 0 && m_snapshotModificationTime) + if (hasValidSnapshotMetadata()) return m_snapshotModificationTime * 1000.0; #endif @@ -142,10 +142,16 @@ double File::lastModifiedDate() const return modificationTime * 1000.0; } +double File::lastModifiedDateForBinding() const +{ + double value = lastModifiedDate(); + return (!value) ? std::numeric_limits<double>::quiet_NaN() : value; +} + unsigned long long File::size() const { #if ENABLE(FILE_SYSTEM) - if (m_snapshotSize >= 0 && m_snapshotModificationTime) + if (hasValidSnapshotMetadata()) return m_snapshotSize; #endif @@ -160,7 +166,7 @@ unsigned long long File::size() const void File::captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const { #if ENABLE(FILE_SYSTEM) - if (m_snapshotSize >= 0 && m_snapshotModificationTime) { + if (hasValidSnapshotMetadata()) { snapshotSize = m_snapshotSize; snapshotModificationTime = m_snapshotModificationTime; return; diff --git a/Source/WebCore/fileapi/File.h b/Source/WebCore/fileapi/File.h index e852c6adf..67f31f6a7 100644 --- a/Source/WebCore/fileapi/File.h +++ b/Source/WebCore/fileapi/File.h @@ -54,7 +54,7 @@ public: #endif #if ENABLE(FILE_SYSTEM) - // If filesystem files live in the remote filesystem, the port might pass the valid metadata (non-zero modificationTime and non-negative file size) and cache in the File object. + // If filesystem files live in the remote filesystem, the port might pass the valid metadata (whose length field is non-negative) and cache in the File object. // // Otherwise calling size(), lastModifiedTime() and webkitSlice() will synchronously query the file metadata. static PassRefPtr<File> createForFileSystemFile(const String& name, const FileMetadata& metadata) @@ -76,7 +76,13 @@ public: const String& path() const { return m_path; } const String& name() const { return m_name; } + + // This may return zero if getFileModificationTime() platform call has failed or zero snapshot lastModifiedTime is given at construction time. double lastModifiedDate() const; + + // For binding. We want to return null Date if we get the value 0 Date (which is used to indicate the information is unavailable). + double lastModifiedDateForBinding() const; + #if ENABLE(DIRECTORY_UPLOAD) // Returns the relative path of this file in the context of a directory selection. const String& webkitRelativePath() const { return m_relativePath; } @@ -94,14 +100,17 @@ private: # if ENABLE(FILE_SYSTEM) File(const String& name, const FileMetadata&); + + // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >= 0). + bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } #endif String m_path; String m_name; #if ENABLE(FILE_SYSTEM) - // If non-zero modificationTime and non-negative file size are given at construction time we use them in size(), lastModifiedTime() and webkitSlice(). - // By default we initialize m_snapshotSize to -1 and m_snapshotModificationTime to 0 (so that we don't use them unless they are given). + // If m_snapshotSize is negative (initialized to -1 by default), the snapshot metadata is invalid and we retrieve the latest metadata synchronously in size(), lastModifiedTime() and webkitSlice(). + // Otherwise, the snapshot metadata are used directly in those methods. const long long m_snapshotSize; const double m_snapshotModificationTime; #endif diff --git a/Source/WebCore/fileapi/File.idl b/Source/WebCore/fileapi/File.idl index 7c0de4309..00bdde6f5 100644 --- a/Source/WebCore/fileapi/File.idl +++ b/Source/WebCore/fileapi/File.idl @@ -32,7 +32,7 @@ module html { ] File : Blob { readonly attribute DOMString name; #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT - readonly attribute Date lastModifiedDate; + readonly attribute [ImplementedAs=lastModifiedDateForBinding] Date lastModifiedDate; #endif #if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD readonly attribute DOMString webkitRelativePath; diff --git a/Source/WebCore/fileapi/FileReader.cpp b/Source/WebCore/fileapi/FileReader.cpp index ab7c2b3b2..bdae05942 100644 --- a/Source/WebCore/fileapi/FileReader.cpp +++ b/Source/WebCore/fileapi/FileReader.cpp @@ -250,15 +250,16 @@ void FileReader::fireEvent(const AtomicString& type) PassRefPtr<ArrayBuffer> FileReader::arrayBufferResult() const { - return m_loader ? m_loader->arrayBufferResult() : 0; + if (!m_loader || m_error) + return 0; + return m_loader->arrayBufferResult(); } String FileReader::stringResult() { - String ret = m_loader ? m_loader->stringResult() : ""; - if (ret.isEmpty()) + if (!m_loader || m_error) return String(); - return ret; + return m_loader->stringResult(); } } // namespace WebCore diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.cpp b/Source/WebCore/html/BaseDateAndTimeInputType.cpp index 782e66199..4c7309191 100644 --- a/Source/WebCore/html/BaseDateAndTimeInputType.cpp +++ b/Source/WebCore/html/BaseDateAndTimeInputType.cpp @@ -155,15 +155,19 @@ String BaseDateAndTimeInputType::serializeWithMilliseconds(double value) const return serialize(value); } -String BaseDateAndTimeInputType::visibleValue() const +String BaseDateAndTimeInputType::localizeValue(const String& proposedValue) const { - String currentValue = element()->value(); DateComponents date; - if (!parseToDateComponents(currentValue, &date)) - return currentValue; + if (!parseToDateComponents(proposedValue, &date)) + return proposedValue; String localized = formatLocalizedDate(date); - return localized.isEmpty() ? currentValue : localized; + return localized.isEmpty() ? proposedValue : localized; +} + +String BaseDateAndTimeInputType::visibleValue() const +{ + return localizeValue(element()->value()); } String BaseDateAndTimeInputType::convertFromVisibleValue(const String& visibleValue) const diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.h b/Source/WebCore/html/BaseDateAndTimeInputType.h index e91cf6088..da9519101 100644 --- a/Source/WebCore/html/BaseDateAndTimeInputType.h +++ b/Source/WebCore/html/BaseDateAndTimeInputType.h @@ -61,6 +61,7 @@ private: virtual void handleWheelEvent(WheelEvent*) OVERRIDE; virtual String serialize(double) const OVERRIDE; virtual String serializeWithMilliseconds(double) const; + virtual String localizeValue(const String&) const OVERRIDE; virtual String visibleValue() const OVERRIDE; virtual String convertFromVisibleValue(const String&) const OVERRIDE; virtual String sanitizeValue(const String&) const OVERRIDE; diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp index 2bac03015..72b675691 100644 --- a/Source/WebCore/html/FileInputType.cpp +++ b/Source/WebCore/html/FileInputType.cpp @@ -320,6 +320,9 @@ void FileInputType::requestIcon(const Vector<String>& paths) void FileInputType::setFiles(PassRefPtr<FileList> files) { + if (!files) + return; + RefPtr<HTMLInputElement> input = element(); bool pathsChanged = false; diff --git a/Source/WebCore/html/FileInputType.h b/Source/WebCore/html/FileInputType.h index 31d09b4d1..1f9fbce39 100644 --- a/Source/WebCore/html/FileInputType.h +++ b/Source/WebCore/html/FileInputType.h @@ -58,6 +58,7 @@ private: virtual bool canSetStringValue() const OVERRIDE; virtual bool canChangeFromAnotherType() const OVERRIDE; virtual FileList* files() OVERRIDE; + virtual void setFiles(PassRefPtr<FileList>) OVERRIDE; virtual bool canSetValue(const String&) OVERRIDE; virtual bool getTypeSpecificValue(String&) OVERRIDE; // Checked first, before internal storage or the value attribute. virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE; @@ -74,7 +75,6 @@ private: // FileIconLoaderClient implementation. virtual void updateRendering(PassRefPtr<Icon>) OVERRIDE; - void setFiles(PassRefPtr<FileList>); PassRefPtr<FileList> createFileList(const Vector<FileChooserFileInfo>& files) const; #if ENABLE(DIRECTORY_UPLOAD) void receiveDropForDirectoryUpload(const Vector<String>&); diff --git a/Source/WebCore/html/HTMLFieldSetElement.cpp b/Source/WebCore/html/HTMLFieldSetElement.cpp index 8a240c024..c0b07e867 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.cpp +++ b/Source/WebCore/html/HTMLFieldSetElement.cpp @@ -24,9 +24,11 @@ #include "config.h" #include "HTMLFieldSetElement.h" -#include "HTMLLegendElement.h" +#include "HTMLFormCollection.h" +#include "HTMLLegendElement.h" #include "HTMLNames.h" +#include "HTMLObjectElement.h" #include "RenderFieldset.h" #include <wtf/StdLibExtras.h> @@ -45,14 +47,27 @@ PassRefPtr<HTMLFieldSetElement> HTMLFieldSetElement::create(const QualifiedName& return adoptRef(new HTMLFieldSetElement(tagName, document, form)); } +void HTMLFieldSetElement::invalidateDisabledStateUnder(Element* base) +{ + for (Node* node = base->firstChild(); node; node = node->traverseNextNode(base)) { + if (node->isElementNode() && toElement(node)->isFormControlElement()) + static_cast<HTMLFormControlElement*>(node)->ancestorDisabledStateWasChanged(); + } +} + void HTMLFieldSetElement::disabledAttributeChanged() { // This element must be updated before the style of nodes in its subtree gets recalculated. HTMLFormControlElement::disabledAttributeChanged(); + invalidateDisabledStateUnder(this); +} - for (Node* currentNode = this; currentNode; currentNode = currentNode->traverseNextNode(this)) { - if (currentNode && currentNode->isElementNode() && toElement(currentNode)->isFormControlElement()) - static_cast<HTMLFormControlElement*>(currentNode)->setNeedsStyleRecalc(); +void HTMLFieldSetElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) +{ + HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + for (Element* element = firstElementChild(); element; element = element->nextElementSibling()) { + if (element->hasTagName(legendTag)) + invalidateDisabledStateUnder(element); } } @@ -81,4 +96,53 @@ HTMLLegendElement* HTMLFieldSetElement::legend() const return 0; } +HTMLCollection* HTMLFieldSetElement::elements() +{ + if (!m_elementsCollection) + m_elementsCollection = HTMLFormCollection::create(this); + return m_elementsCollection.get(); +} + +void HTMLFieldSetElement::refreshElementsIfNeeded() const +{ + uint64_t docVersion = document()->domTreeVersion(); + if (m_documentVersion == docVersion) + return; + + m_documentVersion = docVersion; + + m_associatedElements.clear(); + + for (Node* node = firstChild(); node; node = node->traverseNextNode(this)) { + if (!node->isElementNode()) + continue; + + if (node->hasTagName(objectTag)) { + m_associatedElements.append(static_cast<HTMLObjectElement*>(node)); + continue; + } + + if (!toElement(node)->isFormControlElement()) + continue; + + m_associatedElements.append(static_cast<HTMLFormControlElement*>(node)); + } +} + +const Vector<FormAssociatedElement*>& HTMLFieldSetElement::associatedElements() const +{ + refreshElementsIfNeeded(); + return m_associatedElements; +} + +unsigned HTMLFieldSetElement::length() const +{ + refreshElementsIfNeeded(); + unsigned len = 0; + for (unsigned i = 0; i < m_associatedElements.size(); ++i) + if (m_associatedElements[i]->isEnumeratable()) + ++len; + return len; +} + } // namespace diff --git a/Source/WebCore/html/HTMLFieldSetElement.h b/Source/WebCore/html/HTMLFieldSetElement.h index 9e93599fa..ea56a1c9a 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.h +++ b/Source/WebCore/html/HTMLFieldSetElement.h @@ -25,14 +25,24 @@ #define HTMLFieldSetElement_h #include "HTMLFormControlElement.h" +#include <wtf/OwnPtr.h> namespace WebCore { +class FormAssociatedElement; +class HTMLCollection; +class HTMLFormCollection; + class HTMLFieldSetElement : public HTMLFormControlElement { public: static PassRefPtr<HTMLFieldSetElement> create(const QualifiedName&, Document*, HTMLFormElement*); HTMLLegendElement* legend() const; + HTMLCollection* elements(); + + const Vector<FormAssociatedElement*>& associatedElements() const; + unsigned length() const; + protected: virtual void disabledAttributeChanged() OVERRIDE; @@ -44,6 +54,15 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual const AtomicString& formControlType() const; virtual bool recalcWillValidate() const { return false; } + virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE; + + static void invalidateDisabledStateUnder(Element*); + void refreshElementsIfNeeded() const; + + OwnPtr<HTMLFormCollection> m_elementsCollection; + mutable Vector<FormAssociatedElement*> m_associatedElements; + // When dom tree is modified, we have to refresh the m_associatedElements array. + mutable uint64_t m_documentVersion; }; } // namespace diff --git a/Source/WebCore/html/HTMLFieldSetElement.idl b/Source/WebCore/html/HTMLFieldSetElement.idl index 6006ad704..d67b3f647 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.idl +++ b/Source/WebCore/html/HTMLFieldSetElement.idl @@ -26,6 +26,8 @@ module html { readonly attribute DOMString type; + readonly attribute HTMLCollection elements; + readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index c51fae4a5..cb3cca954 100644 --- a/Source/WebCore/html/HTMLFormCollection.cpp +++ b/Source/WebCore/html/HTMLFormCollection.cpp @@ -23,6 +23,7 @@ #include "config.h" #include "HTMLFormCollection.h" +#include "HTMLFieldSetElement.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" #include "HTMLImageElement.h" @@ -53,8 +54,10 @@ HTMLFormCollection::~HTMLFormCollection() const Vector<FormAssociatedElement*>& HTMLFormCollection::formControlElements() const { ASSERT(base()); - ASSERT(base()->hasTagName(formTag)); - return static_cast<HTMLFormElement*>(base())->associatedElements(); + ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag)); + if (base()->hasTagName(formTag)) + return static_cast<HTMLFormElement*>(base())->associatedElements(); + return static_cast<HTMLFieldSetElement*>(base())->associatedElements(); } const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const @@ -67,8 +70,10 @@ const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const unsigned HTMLFormCollection::numberOfFormControlElements() const { ASSERT(base()); - ASSERT(base()->hasTagName(formTag)); - return static_cast<HTMLFormElement*>(base())->length(); + ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag)); + if (base()->hasTagName(formTag)) + return static_cast<HTMLFormElement*>(base())->length(); + return static_cast<HTMLFieldSetElement*>(base())->length(); } unsigned HTMLFormCollection::calcLength() const @@ -134,6 +139,9 @@ Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, con } } + if (base()->hasTagName(fieldsetTag)) + return 0; + const Vector<HTMLImageElement*>& imageElementsArray = formImageElements(); if (!foundInputElements) { for (unsigned i = 0; i < imageElementsArray.size(); ++i) { @@ -195,15 +203,17 @@ void HTMLFormCollection::updateNameCache() const } } - const Vector<HTMLImageElement*>& imageElementsArray = formImageElements(); - for (unsigned i = 0; i < imageElementsArray.size(); ++i) { - HTMLImageElement* element = imageElementsArray[i]; - const AtomicString& idAttrVal = element->getIdAttribute(); - const AtomicString& nameAttrVal = element->getNameAttribute(); - if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl())) - append(m_cache.idCache, idAttrVal, element); - if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInputElements.contains(nameAttrVal.impl())) - append(m_cache.nameCache, nameAttrVal, element); + if (base()->hasTagName(formTag)) { + const Vector<HTMLImageElement*>& imageElementsArray = formImageElements(); + for (unsigned i = 0; i < imageElementsArray.size(); ++i) { + HTMLImageElement* element = imageElementsArray[i]; + const AtomicString& idAttrVal = element->getIdAttribute(); + const AtomicString& nameAttrVal = element->getNameAttribute(); + if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl())) + append(m_cache.idCache, idAttrVal, element); + if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInputElements.contains(nameAttrVal.impl())) + append(m_cache.nameCache, nameAttrVal, element); + } } m_cache.hasNameCache = true; diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index abb3610b5..0a51392e1 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -26,6 +26,7 @@ #include "HTMLFormControlElement.h" #include "Attribute.h" +#include "ElementShadow.h" #include "Event.h" #include "EventHandler.h" #include "EventNames.h" @@ -48,13 +49,11 @@ using namespace std; HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : LabelableElement(tagName, document) - , m_fieldSetAncestor(0) - , m_legendAncestor(0) - , m_fieldSetAncestorValid(false) , m_disabled(false) , m_readOnly(false) , m_required(false) , m_valueMatchesRenderer(false) + , m_ancestorDisabledState(AncestorDisabledStateUnknown) , m_dataListAncestorState(Unknown) , m_willValidateInitialized(false) , m_willValidate(true) @@ -70,12 +69,6 @@ HTMLFormControlElement::~HTMLFormControlElement() { } -void HTMLFormControlElement::detach() -{ - m_validationMessage = nullptr; - HTMLElement::detach(); -} - String HTMLFormControlElement::formEnctype() const { return FormSubmission::Attributes::parseEncodingType(fastGetAttribute(formenctypeAttr)); @@ -101,19 +94,25 @@ bool HTMLFormControlElement::formNoValidate() const return fastHasAttribute(formnovalidateAttr); } -void HTMLFormControlElement::updateFieldSetAndLegendAncestor() const +void HTMLFormControlElement::updateAncestorDisabledState() const { - m_fieldSetAncestor = 0; - m_legendAncestor = 0; + HTMLFieldSetElement* fieldSetAncestor = 0; + ContainerNode* legendAncestor = 0; for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) { - if (!m_legendAncestor && ancestor->hasTagName(legendTag)) - m_legendAncestor = static_cast<HTMLLegendElement*>(ancestor); + if (!legendAncestor && ancestor->hasTagName(legendTag)) + legendAncestor = ancestor; if (ancestor->hasTagName(fieldsetTag)) { - m_fieldSetAncestor = static_cast<HTMLFieldSetElement*>(ancestor); + fieldSetAncestor = static_cast<HTMLFieldSetElement*>(ancestor); break; } } - m_fieldSetAncestorValid = true; + m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->disabled() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled; +} + +void HTMLFormControlElement::ancestorDisabledStateWasChanged() +{ + m_ancestorDisabledState = AncestorDisabledStateUnknown; + disabledAttributeChanged(); } void HTMLFormControlElement::parseAttribute(const Attribute& attribute) @@ -129,6 +128,7 @@ void HTMLFormControlElement::parseAttribute(const Attribute& attribute) bool oldReadOnly = m_readOnly; m_readOnly = !attribute.isNull(); if (oldReadOnly != m_readOnly) { + setNeedsWillValidateCheck(); setNeedsStyleRecalc(); if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), ReadOnlyState); @@ -140,11 +140,11 @@ void HTMLFormControlElement::parseAttribute(const Attribute& attribute) requiredAttributeChanged(); } else HTMLElement::parseAttribute(attribute); - setNeedsWillValidateCheck(); } void HTMLFormControlElement::disabledAttributeChanged() { + setNeedsWillValidateCheck(); setNeedsStyleRecalc(); if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), EnabledState); @@ -224,6 +224,7 @@ void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument) Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(ContainerNode* insertionPoint) { + m_ancestorDisabledState = AncestorDisabledStateUnknown; m_dataListAncestorState = Unknown; setNeedsWillValidateCheck(); HTMLElement::insertedInto(insertionPoint); @@ -233,7 +234,8 @@ Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) { - m_fieldSetAncestorValid = false; + m_validationMessage = nullptr; + m_ancestorDisabledState = AncestorDisabledStateUnknown; m_dataListAncestorState = Unknown; HTMLElement::removedFrom(insertionPoint); FormAssociatedElement::removedFrom(insertionPoint); @@ -277,13 +279,9 @@ bool HTMLFormControlElement::disabled() const if (m_disabled) return true; - if (!m_fieldSetAncestorValid) - updateFieldSetAndLegendAncestor(); - - // Form controls in the first legend element inside a fieldset are not affected by fieldset.disabled. - if (m_fieldSetAncestor && m_fieldSetAncestor->disabled()) - return !(m_legendAncestor && m_legendAncestor == m_fieldSetAncestor->legend()); - return false; + if (m_ancestorDisabledState == AncestorDisabledStateUnknown) + updateAncestorDisabledState(); + return m_ancestorDisabledState == AncestorDisabledStateDisabled; } void HTMLFormControlElement::setDisabled(bool b) @@ -320,7 +318,7 @@ void HTMLFormControlElement::didRecalcStyle(StyleChange) bool HTMLFormControlElement::supportsFocus() const { - return !m_disabled; + return !disabled(); } bool HTMLFormControlElement::isFocusable() const @@ -359,7 +357,7 @@ bool HTMLFormControlElement::recalcWillValidate() const { if (m_dataListAncestorState == Unknown) { for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) { - if (!m_legendAncestor && ancestor->hasTagName(datalistTag)) { + if (ancestor->hasTagName(datalistTag)) { m_dataListAncestorState = InsideDataList; break; } @@ -367,7 +365,7 @@ bool HTMLFormControlElement::recalcWillValidate() const if (m_dataListAncestorState == Unknown) m_dataListAncestorState = NotInsideDataList; } - return m_dataListAncestorState == NotInsideDataList && !m_disabled && !m_readOnly; + return m_dataListAncestorState == NotInsideDataList && !disabled() && !m_readOnly; } bool HTMLFormControlElement::willValidate() const diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index 859c0f081..5fac956b4 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -51,7 +51,7 @@ public: void setFormMethod(const String&); bool formNoValidate() const; - void updateFieldSetAndLegendAncestor() const; + void ancestorDisabledStateWasChanged(); virtual void reset() { } @@ -130,7 +130,6 @@ protected: virtual void didRecalcStyle(StyleChange) OVERRIDE; virtual void dispatchBlurEvent(PassRefPtr<Node> newFocusedNode); - virtual void detach(); // This must be called any time the result of willValidate() has changed. void setNeedsWillValidateCheck(); @@ -148,16 +147,16 @@ private: virtual bool isDefaultButtonForForm() const; virtual bool isValidFormControlElement(); String visibleValidationMessage() const; + void updateAncestorDisabledState() const; - mutable HTMLFieldSetElement* m_fieldSetAncestor; - mutable HTMLLegendElement* m_legendAncestor; OwnPtr<ValidationMessage> m_validationMessage; - mutable bool m_fieldSetAncestorValid : 1; bool m_disabled : 1; bool m_readOnly : 1; bool m_required : 1; bool m_valueMatchesRenderer : 1; + enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledStateEnabled, AncestorDisabledStateDisabled }; + mutable AncestorDisabledState m_ancestorDisabledState; enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; mutable enum DataListAncestorState m_dataListAncestorState; diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index f5d9b9449..ea54b93ba 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -112,10 +112,11 @@ bool HTMLFormElement::rendererIsNeeded(const NodeRenderingContext& context) ContainerNode* node = parentNode(); RenderObject* parentRenderer = node->renderer(); + // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| below). bool parentIsTableElementPart = (parentRenderer->isTable() && node->hasTagName(tableTag)) || (parentRenderer->isTableRow() && node->hasTagName(trTag)) || (parentRenderer->isTableSection() && node->hasTagName(tbodyTag)) - || (parentRenderer->isTableCol() && node->hasTagName(colTag)) + || (parentRenderer->isRenderTableCol() && node->hasTagName(colTag)) || (parentRenderer->isTableCell() && node->hasTagName(trTag)); if (!parentIsTableElementPart) diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp index dc4d43586..0ebe09469 100644 --- a/Source/WebCore/html/HTMLIFrameElement.cpp +++ b/Source/WebCore/html/HTMLIFrameElement.cpp @@ -122,7 +122,7 @@ void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint) bool HTMLIFrameElement::shouldDisplaySeamlessly() const { - return contentDocument() && contentDocument()->mayDisplaySeamlessWithParent() && hasAttribute(seamlessAttr); + return contentDocument() && contentDocument()->shouldDisplaySeamlesslyWithParent(); } void HTMLIFrameElement::didRecalcStyle(StyleChange styleChange) diff --git a/Source/WebCore/html/HTMLIFrameElement.idl b/Source/WebCore/html/HTMLIFrameElement.idl index 809074ce2..2dbf38dbe 100644 --- a/Source/WebCore/html/HTMLIFrameElement.idl +++ b/Source/WebCore/html/HTMLIFrameElement.idl @@ -29,6 +29,7 @@ module html { attribute [Reflect] DOMString marginWidth; attribute [Reflect] DOMString name; attribute [Reflect] DOMString sandbox; + attribute [Reflect, Conditional=IFRAME_SEAMLESS] boolean seamless; attribute [Reflect] DOMString scrolling; attribute [Reflect, URL] DOMString src; attribute [Reflect] DOMString srcdoc; diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 732cab41d..9248f0bc2 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1220,6 +1220,11 @@ FileList* HTMLInputElement::files() return m_inputType->files(); } +void HTMLInputElement::setFiles(PassRefPtr<FileList> files) +{ + m_inputType->setFiles(files); +} + void HTMLInputElement::receiveDroppedFiles(const Vector<String>& filenames) { m_inputType->receiveDroppedFiles(filenames); @@ -1266,6 +1271,13 @@ String HTMLInputElement::sanitizeValue(const String& proposedValue) const return m_inputType->sanitizeValue(proposedValue); } +String HTMLInputElement::localizeValue(const String& proposedValue) const +{ + if (proposedValue.isNull()) + return proposedValue; + return m_inputType->localizeValue(proposedValue); +} + bool HTMLInputElement::hasUnacceptableValue() const { return m_inputType->hasUnacceptableValue(); diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 561334e23..9756e4fc4 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -147,6 +147,8 @@ public: String sanitizeValue(const String&) const; + String localizeValue(const String&) const; + void updateInnerTextValue(); // The value which is drawn by a renderer. @@ -209,6 +211,7 @@ public: void setAutofilled(bool = true); FileList* files(); + void setFiles(PassRefPtr<FileList>); void receiveDroppedFiles(const Vector<String>&); Icon* icon() const; // These functions are used for rendering the input active during a diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index cca40365f..e326ce7be 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -31,7 +31,7 @@ module html { attribute [Reflect] DOMString dirName; attribute [Reflect] boolean disabled; readonly attribute HTMLFormElement form; - readonly attribute FileList files; + attribute FileList files; attribute [Reflect, URL] DOMString formAction; attribute [TreatNullAs=NullString] DOMString formEnctype; attribute [TreatNullAs=NullString] DOMString formMethod; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 465298ce1..0af609ff8 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -210,7 +210,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum , m_readyStateMaximum(HAVE_NOTHING) , m_volume(1.0f) , m_lastSeekTime(0) - , m_previousProgress(0) , m_previousProgressTime(numeric_limits<double>::max()) , m_lastTimeUpdateEventWallTime(0) , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max()) @@ -1141,11 +1140,18 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) eventTasks.append(std::make_pair(missedCues[i].data()->startTime(), missedCues[i].data())); - // 10 - For each text track in missed cues, prepare an event - // named exit for the TextTrackCue object with the text track cue end - // time. - eventTasks.append(std::make_pair(missedCues[i].data()->endTime(), - missedCues[i].data())); + // 10 - For each text track [...] in missed cues, prepare an event + // named exit for the TextTrackCue object with the with the later of + // the text track cue end time and the text track cue start time. + + // Note: An explicit task is added only if the cue is NOT a zero or + // negative length cue. Otherwise, the need for an exit event is + // checked when these tasks are actually queued below. This doesn't + // affect sorting events before dispatch either, because the exit + // event has the same time as the enter event. + if (missedCues[i].data()->startTime() < missedCues[i].data()->endTime()) + eventTasks.append(std::make_pair(missedCues[i].data()->endTime(), + missedCues[i].data())); } for (size_t i = 0; i < previousCuesSize; ++i) { @@ -1179,15 +1185,25 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) // Each event in eventTasks may be either an enterEvent or an exitEvent, // depending on the time that is associated with the event. This - // correctly identifies the type of the event, since the startTime is - // always less than the endTime. - if (eventTasks[i].first == eventTasks[i].second->startTime()) + // correctly identifies the type of the event, if the startTime is + // less than the endTime in the cue. + if (eventTasks[i].second->startTime() >= eventTasks[i].second->endTime()) { event = Event::create(eventNames().enterEvent, false, false); - else + event->setTarget(eventTasks[i].second); + m_asyncEventQueue->enqueueEvent(event.release()); + event = Event::create(eventNames().exitEvent, false, false); + event->setTarget(eventTasks[i].second); + m_asyncEventQueue->enqueueEvent(event.release()); + } else { + if (eventTasks[i].first == eventTasks[i].second->startTime()) + event = Event::create(eventNames().enterEvent, false, false); + else + event = Event::create(eventNames().exitEvent, false, false); - event->setTarget(eventTasks[i].second); - m_asyncEventQueue->enqueueEvent(event.release()); + event->setTarget(eventTasks[i].second); + m_asyncEventQueue->enqueueEvent(event.release()); + } } // 14 - Sort affected tracks in the same order as the text tracks appear in @@ -1311,13 +1327,21 @@ void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue) { - m_cueTree.add(m_cueTree.createInterval(cue->startTime(), cue->endTime(), cue.get())); + // Negative duration cues need be treated in the interval tree as + // zero-length cues. + double endTime = max(cue->startTime(), cue->endTime()); + + m_cueTree.add(m_cueTree.createInterval(cue->startTime(), endTime, cue.get())); updateActiveTextTrackCues(currentTime()); } void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> cue) { - m_cueTree.remove(m_cueTree.createInterval(cue->startTime(), cue->endTime(), cue.get())); + // Negative duration cues need to be treated in the interval tree as + // zero-length cues. + double endTime = max(cue->startTime(), cue->endTime()); + + m_cueTree.remove(m_cueTree.createInterval(cue->startTime(), endTime, cue.get())); updateActiveTextTrackCues(currentTime()); } @@ -1352,7 +1376,6 @@ void HTMLMediaElement::startProgressEventTimer() return; m_previousProgressTime = WTF::currentTime(); - m_previousProgress = 0; // 350ms is not magic, it is in the spec! m_progressEventTimer.startRepeating(0.350); } @@ -1559,7 +1582,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() { m_progressEventTimer.stop(); - if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress) + if (hasMediaControls() && m_player->didLoadingProgress()) mediaControls()->bufferingProgressed(); // Schedule one last progress event so we guarantee that at least one is fired @@ -1812,25 +1835,21 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) if (m_networkState != NETWORK_LOADING) return; - unsigned progress = m_player->bytesLoaded(); double time = WTF::currentTime(); double timedelta = time - m_previousProgressTime; - if (progress == m_previousProgress) { - if (timedelta > 3.0 && !m_sentStalledEvent) { - scheduleEvent(eventNames().stalledEvent); - m_sentStalledEvent = true; - setShouldDelayLoadEvent(false); - } - } else { + if (m_player->didLoadingProgress()) { scheduleEvent(eventNames().progressEvent); - m_previousProgress = progress; m_previousProgressTime = time; m_sentStalledEvent = false; if (renderer()) renderer()->updateFromElement(); if (hasMediaControls()) mediaControls()->bufferingProgressed(); + } else if (timedelta > 3.0 && !m_sentStalledEvent) { + scheduleEvent(eventNames().stalledEvent); + m_sentStalledEvent = true; + setShouldDelayLoadEvent(false); } } @@ -2698,7 +2717,6 @@ void HTMLMediaElement::startPlaybackProgressTimer() return; m_previousProgressTime = WTF::currentTime(); - m_previousProgress = 0; m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency); } diff --git a/Source/WebCore/html/HTMLOptGroupElement.cpp b/Source/WebCore/html/HTMLOptGroupElement.cpp index 6daa35df3..1ff6a7d22 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.cpp +++ b/Source/WebCore/html/HTMLOptGroupElement.cpp @@ -49,6 +49,11 @@ PassRefPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(const QualifiedName& return adoptRef(new HTMLOptGroupElement(tagName, document)); } +bool HTMLOptGroupElement::disabled() const +{ + return fastHasAttribute(disabledAttr); +} + bool HTMLOptGroupElement::supportsFocus() const { return HTMLElement::supportsFocus(); diff --git a/Source/WebCore/html/HTMLOptGroupElement.h b/Source/WebCore/html/HTMLOptGroupElement.h index 81a244e7d..0b4387306 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.h +++ b/Source/WebCore/html/HTMLOptGroupElement.h @@ -34,6 +34,7 @@ class HTMLOptGroupElement : public HTMLElement { public: static PassRefPtr<HTMLOptGroupElement> create(const QualifiedName&, Document*); + virtual bool disabled() const OVERRIDE; HTMLSelectElement* ownerSelectElement() const; String groupLabelText() const; @@ -44,6 +45,7 @@ private: virtual const AtomicString& formControlType() const; virtual bool supportsFocus() const; virtual bool isFocusable() const; + virtual bool isEnabledFormControl() const OVERRIDE { return !disabled(); } virtual void parseAttribute(const Attribute&) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } virtual void attach(); diff --git a/Source/WebCore/html/HTMLTableColElement.cpp b/Source/WebCore/html/HTMLTableColElement.cpp index d769b0424..651a3bc71 100644 --- a/Source/WebCore/html/HTMLTableColElement.cpp +++ b/Source/WebCore/html/HTMLTableColElement.cpp @@ -66,11 +66,11 @@ void HTMLTableColElement::parseAttribute(const Attribute& attribute) { if (attribute.name() == spanAttr) { m_span = !attribute.isNull() ? attribute.value().toInt() : 1; - if (renderer() && renderer()->isTableCol()) + if (renderer() && renderer()->isRenderTableCol()) renderer()->updateFromElement(); } else if (attribute.name() == widthAttr) { if (!attribute.isEmpty()) { - if (renderer() && renderer()->isTableCol()) { + if (renderer() && renderer()->isRenderTableCol()) { RenderTableCol* col = toRenderTableCol(renderer()); int newWidth = width().toInt(); if (newWidth != col->width()) diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index bc44e7b7b..643725708 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -496,6 +496,12 @@ HTMLElement* HTMLTextAreaElement::placeholderElement() const return m_placeholder.get(); } +void HTMLTextAreaElement::attach() +{ + HTMLTextFormControlElement::attach(); + fixPlaceholderRenderer(m_placeholder.get(), innerTextElement()); +} + void HTMLTextAreaElement::updatePlaceholderText() { ExceptionCode ec = 0; @@ -511,11 +517,12 @@ void HTMLTextAreaElement::updatePlaceholderText() if (!m_placeholder) { m_placeholder = HTMLDivElement::create(document()); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); - shadow()->oldestShadowRoot()->insertBefore(m_placeholder, shadow()->oldestShadowRoot()->firstChild()->nextSibling(), ec); + shadow()->oldestShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); ASSERT(!ec); + fixPlaceholderRenderer(m_placeholder.get(), innerTextElement()); } } diff --git a/Source/WebCore/html/HTMLTextAreaElement.h b/Source/WebCore/html/HTMLTextAreaElement.h index c475c717e..63ce9ea77 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.h +++ b/Source/WebCore/html/HTMLTextAreaElement.h @@ -109,6 +109,7 @@ private: virtual void accessKeyAction(bool sendMouseEvents); virtual bool shouldUseInputMethod(); + virtual void attach() OVERRIDE; bool valueMissing(const String& value) const { return isRequiredFormControl() && !disabled() && !readOnly() && value.isEmpty(); } bool tooLong(const String&, NeedsToCheckDirtyFlag) const; diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp index e00f1d43b..9092de709 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp @@ -166,6 +166,23 @@ void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderVal ASSERT(!ec); } +void HTMLTextFormControlElement::fixPlaceholderRenderer(HTMLElement* placeholder, HTMLElement* siblingElement) +{ + // FIXME: We should change the order of DOM nodes. But it makes an assertion + // failure in editing code. + if (!placeholder || !placeholder->renderer()) + return; + RenderObject* placeholderRenderer = placeholder->renderer(); + RenderObject* siblingRenderer = siblingElement->renderer(); + ASSERT(siblingRenderer); + if (placeholderRenderer->nextSibling() == siblingRenderer) + return; + RenderObject* parentRenderer = placeholderRenderer->parent(); + ASSERT(parentRenderer == siblingRenderer->parent()); + parentRenderer->removeChild(placeholderRenderer); + parentRenderer->addChild(placeholderRenderer, siblingRenderer); +} + RenderTextControl* HTMLTextFormControlElement::textRendererAfterUpdateLayout() { if (!isTextFormControl()) diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h index 3fee3c4f5..8ebe66ac6 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.h +++ b/Source/WebCore/html/HTMLTextFormControlElement.h @@ -54,6 +54,7 @@ public: bool placeholderShouldBeVisible() const; virtual HTMLElement* placeholderElement() const = 0; void updatePlaceholderVisibility(bool); + static void fixPlaceholderRenderer(HTMLElement* placeholder, HTMLElement* siblingElement); int indexForVisiblePosition(const VisiblePosition&) const; int selectionStart() const; diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 56a7aa137..e91960d40 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -41,6 +41,7 @@ #include "EmailInputType.h" #include "ExceptionCode.h" #include "FileInputType.h" +#include "FileList.h" #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLInputElement.h" @@ -577,6 +578,10 @@ FileList* InputType::files() return 0; } +void InputType::setFiles(PassRefPtr<FileList>) +{ +} + bool InputType::getTypeSpecificValue(String&) { return false; @@ -629,6 +634,11 @@ void InputType::didDispatchClick(Event*, const ClickHandlingState&) { } +String InputType::localizeValue(const String& proposedValue) const +{ + return proposedValue; +} + String InputType::visibleValue() const { return element()->value(); diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 54167f3e4..83efbdebe 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -167,6 +167,7 @@ public: virtual String typeMismatchText() const; virtual String valueMissingText() const; virtual bool canSetStringValue() const; + virtual String localizeValue(const String&) const; virtual String visibleValue() const; virtual String convertFromVisibleValue(const String&) const; virtual bool isAcceptableValue(const String&); @@ -228,6 +229,7 @@ public: virtual void willMoveToNewOwnerDocument(); virtual bool shouldRespectAlignAttribute(); virtual FileList* files(); + virtual void setFiles(PassRefPtr<FileList>); virtual void receiveDroppedFiles(const Vector<String>&); virtual Icon* icon() const; // Should return true if the corresponding renderer for a type can display a suggested value. diff --git a/Source/WebCore/html/MediaFragmentURIParser.cpp b/Source/WebCore/html/MediaFragmentURIParser.cpp index 5c8647bef..9842f60f7 100644 --- a/Source/WebCore/html/MediaFragmentURIParser.cpp +++ b/Source/WebCore/html/MediaFragmentURIParser.cpp @@ -151,7 +151,7 @@ void MediaFragmentURIParser::parseFragments() } if (validUTF8) - m_fragments.append(make_pair(name, value)); + m_fragments.append(std::make_pair(name, value)); offset = parameterEnd + 1; } diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index 941d252d4..cfdc7d497 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -218,21 +218,25 @@ static bool isE(UChar ch) return ch == 'e' || ch == 'E'; } -String NumberInputType::visibleValue() const +String NumberInputType::localizeValue(const String& proposedValue) const { - String currentValue = element()->value(); - if (currentValue.isEmpty()) - return currentValue; + if (proposedValue.isEmpty()) + return proposedValue; // We don't localize scientific notations. - if (currentValue.find(isE) != notFound) - return currentValue; + if (proposedValue.find(isE) != notFound) + return proposedValue; // FIXME: The following three lines should be removed when we // remove the second argument of convertToLocalizedNumber(). // Note: parseToDoubleForNumberTypeWithDecimalPlaces set zero to decimalPlaces // if currentValue isn't valid floating pointer number. unsigned decimalPlace; - parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &decimalPlace); - return convertToLocalizedNumber(currentValue, decimalPlace); + parseToDoubleForNumberTypeWithDecimalPlaces(proposedValue, &decimalPlace); + return convertToLocalizedNumber(proposedValue, decimalPlace); +} + +String NumberInputType::visibleValue() const +{ + return localizeValue(element()->value()); } String NumberInputType::convertFromVisibleValue(const String& visibleValue) const diff --git a/Source/WebCore/html/NumberInputType.h b/Source/WebCore/html/NumberInputType.h index 01bddee48..ce4177bfc 100644 --- a/Source/WebCore/html/NumberInputType.h +++ b/Source/WebCore/html/NumberInputType.h @@ -55,6 +55,7 @@ private: virtual double parseToDoubleWithDecimalPlaces(const String&, double, unsigned*) const OVERRIDE; virtual String serialize(double) const OVERRIDE; virtual void handleBlurEvent() OVERRIDE; + virtual String localizeValue(const String&) const OVERRIDE; virtual String visibleValue() const OVERRIDE; virtual String convertFromVisibleValue(const String&) const OVERRIDE; virtual bool isAcceptableValue(const String&) OVERRIDE; diff --git a/Source/WebCore/html/RadioNodeList.cpp b/Source/WebCore/html/RadioNodeList.cpp index b34a6c964..40929bca3 100644 --- a/Source/WebCore/html/RadioNodeList.cpp +++ b/Source/WebCore/html/RadioNodeList.cpp @@ -36,18 +36,18 @@ namespace WebCore { using namespace HTMLNames; -RadioNodeList::RadioNodeList(const AtomicString& name, Element* formElement) - : DynamicSubtreeNodeList(formElement->document()) +RadioNodeList::RadioNodeList(const AtomicString& name, Element* baseElement) + : DynamicSubtreeNodeList(baseElement->hasTagName(formTag) ? static_cast<Node*>(baseElement->document()) : baseElement) , m_name(name) - , m_formElement(formElement) + , m_baseElement(baseElement) { - m_formElement->document()->registerDynamicSubtreeNodeList(this); + m_baseElement->document()->registerDynamicSubtreeNodeList(this); } RadioNodeList::~RadioNodeList() { - m_formElement->removeCachedRadioNodeList(this, m_name); - m_formElement->document()->unregisterDynamicSubtreeNodeList(this); + m_baseElement->removeCachedRadioNodeList(this, m_name); + m_baseElement->document()->unregisterDynamicSubtreeNodeList(this); } static inline HTMLInputElement* toRadioButtonInputElement(Node* node) @@ -86,13 +86,15 @@ void RadioNodeList::setValue(const String& value) bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const { ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlElement()); - HTMLFormElement* formElement = 0; - if (testElement->hasTagName(objectTag)) - formElement = static_cast<HTMLObjectElement*>(testElement)->form(); - else - formElement = static_cast<HTMLFormControlElement*>(testElement)->form(); - if (!formElement || formElement != m_formElement) - return false; + if (m_baseElement->hasTagName(formTag)) { + HTMLFormElement* formElement = 0; + if (testElement->hasTagName(objectTag)) + formElement = static_cast<HTMLObjectElement*>(testElement)->form(); + else + formElement = static_cast<HTMLFormControlElement*>(testElement)->form(); + if (!formElement || formElement != m_baseElement) + return false; + } return testElement->getIdAttribute() == m_name || testElement->getNameAttribute() == m_name; } diff --git a/Source/WebCore/html/RadioNodeList.h b/Source/WebCore/html/RadioNodeList.h index becb52ead..7782e4802 100644 --- a/Source/WebCore/html/RadioNodeList.h +++ b/Source/WebCore/html/RadioNodeList.h @@ -36,9 +36,9 @@ namespace WebCore { class RadioNodeList : public DynamicSubtreeNodeList { public: - static PassRefPtr<RadioNodeList> create(const AtomicString& name, Element* formElement) + static PassRefPtr<RadioNodeList> create(const AtomicString& name, Element* baseElement) { - return adoptRef(new RadioNodeList(name, formElement)); + return adoptRef(new RadioNodeList(name, baseElement)); } ~RadioNodeList(); @@ -54,7 +54,7 @@ private: bool checkElementMatchesRadioNodeListFilter(Element*) const; AtomicString m_name; - RefPtr<Element> m_formElement; + RefPtr<Element> m_baseElement; }; } // namepsace diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp index 9a3b25aba..8189144a9 100644 --- a/Source/WebCore/html/TextFieldInputType.cpp +++ b/Source/WebCore/html/TextFieldInputType.cpp @@ -410,6 +410,13 @@ void TextFieldInputType::updatePlaceholderText() } m_placeholder->setInnerText(placeholderText, ec); ASSERT(!ec); + element()->fixPlaceholderRenderer(m_placeholder.get(), m_container ? m_container.get() : m_innerText.get()); +} + +void TextFieldInputType::attach() +{ + InputType::attach(); + element()->fixPlaceholderRenderer(m_placeholder.get(), m_container ? m_container.get() : m_innerText.get()); } bool TextFieldInputType::appendFormData(FormDataList& list, bool multipart) const diff --git a/Source/WebCore/html/TextFieldInputType.h b/Source/WebCore/html/TextFieldInputType.h index 26b436e4c..559be25e7 100644 --- a/Source/WebCore/html/TextFieldInputType.h +++ b/Source/WebCore/html/TextFieldInputType.h @@ -80,6 +80,7 @@ private: virtual HTMLElement* placeholderElement() const OVERRIDE; virtual void updatePlaceholderText() OVERRIDE; virtual bool appendFormData(FormDataList&, bool multipart) const OVERRIDE; + virtual void attach() OVERRIDE; RefPtr<HTMLElement> m_container; RefPtr<HTMLElement> m_innerBlock; diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index a144bab59..42bcedd2b 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -132,6 +132,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*) { HTMLElement* host = toHTMLElement(m_element); + Document* doc = host->document(); m_bubble = HTMLDivElement::create(doc); m_bubble->setShadowPseudoId("-webkit-validation-bubble"); @@ -141,6 +142,7 @@ void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*) ExceptionCode ec = 0; host->ensureShadowRoot()->appendChild(m_bubble.get(), ec); ASSERT(!ec); + host->document()->updateLayout(); adjustBubblePosition(host->getRect(), m_bubble.get()); RefPtr<HTMLDivElement> clipper = HTMLDivElement::create(doc); diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 543221bfb..c65af248b 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -120,7 +120,6 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bo #if ENABLE(DASHBOARD_SUPPORT) , m_usesDashboardCompatibilityMode(usesDashboardCompatibilityMode) #endif - , m_imageSmoothingEnabled(true) { #if !ENABLE(DASHBOARD_SUPPORT) ASSERT_UNUSED(usesDashboardCompatibilityMode, !usesDashboardCompatibilityMode); @@ -181,6 +180,7 @@ CanvasRenderingContext2D::State::State() , m_globalComposite(CompositeSourceOver) , m_invertibleCTM(true) , m_lineDashOffset(0) + , m_imageSmoothingEnabled(true) , m_textAlign(StartTextAlign) , m_textBaseline(AlphabeticTextBaseline) , m_unparsedFont(defaultFont) @@ -206,6 +206,7 @@ CanvasRenderingContext2D::State::State(const State& other) , m_transform(other.m_transform) , m_invertibleCTM(other.m_invertibleCTM) , m_lineDashOffset(other.m_lineDashOffset) + , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) , m_textAlign(other.m_textAlign) , m_textBaseline(other.m_textBaseline) , m_unparsedFont(other.m_unparsedFont) @@ -239,6 +240,7 @@ CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons m_globalComposite = other.m_globalComposite; m_transform = other.m_transform; m_invertibleCTM = other.m_invertibleCTM; + m_imageSmoothingEnabled = other.m_imageSmoothingEnabled; m_textAlign = other.m_textAlign; m_textBaseline = other.m_textBaseline; m_unparsedFont = other.m_unparsedFont; @@ -2268,16 +2270,17 @@ PlatformLayer* CanvasRenderingContext2D::platformLayer() const bool CanvasRenderingContext2D::webkitImageSmoothingEnabled() const { - return m_imageSmoothingEnabled; + return state().m_imageSmoothingEnabled; } void CanvasRenderingContext2D::setWebkitImageSmoothingEnabled(bool enabled) { - if (enabled == m_imageSmoothingEnabled) + if (enabled == state().m_imageSmoothingEnabled) return; + realizeSaves(); + modifiableState().m_imageSmoothingEnabled = enabled; drawingContext()->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone); - m_imageSmoothingEnabled = enabled; } } // namespace WebCore diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h index c109ae7d2..bfa9a88b9 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -252,6 +252,7 @@ private: bool m_invertibleCTM; DashArray m_lineDash; float m_lineDashOffset; + bool m_imageSmoothingEnabled; // Text state. TextAlign m_textAlign; @@ -336,7 +337,6 @@ private: #if ENABLE(DASHBOARD_SUPPORT) bool m_usesDashboardCompatibilityMode; #endif - bool m_imageSmoothingEnabled; }; } // namespace WebCore diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index e9b281688..038edc22c 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -2401,6 +2401,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& UNUSED_PARAM(ec); if (isContextLost()) return WebGLGetInfo(); + const int intZero = 0; WebGLStateRestorer(this, false); switch (pname) { case GraphicsContext3D::ACTIVE_TEXTURE: @@ -2444,6 +2445,8 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& case GraphicsContext3D::CURRENT_PROGRAM: return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram)); case GraphicsContext3D::DEPTH_BITS: + if (!m_attributes.depth) + return WebGLGetInfo(intZero); return getIntParameter(pname); case GraphicsContext3D::DEPTH_CLEAR_VALUE: return getFloatParameter(pname); @@ -2537,6 +2540,8 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& case GraphicsContext3D::STENCIL_BACK_WRITEMASK: return getUnsignedIntParameter(pname); case GraphicsContext3D::STENCIL_BITS: + if (!m_attributes.stencil) + return WebGLGetInfo(intZero); return getIntParameter(pname); case GraphicsContext3D::STENCIL_CLEAR_VALUE: return getIntParameter(pname); @@ -3291,7 +3296,7 @@ void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC #if OS(DARWIN) // FIXME: remove this section when GL driver bug on Mac is fixed, i.e., // when alpha is off, readPixels should set alpha to 255 instead of 0. - if (!m_context->getContextAttributes().alpha) { + if (!m_framebufferBinding && !m_context->getContextAttributes().alpha) { unsigned char* pixels = reinterpret_cast<unsigned char*>(data); for (GC3Dsizei iy = 0; iy < height; ++iy) { for (GC3Dsizei ix = 0; ix < width; ++ix) { diff --git a/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp b/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp index 9ceaae9af..75b189234 100644 --- a/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp +++ b/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp @@ -107,7 +107,7 @@ bool HTMLMetaCharsetParser::processMeta() for (HTMLToken::AttributeList::const_iterator iter = tokenAttributes.begin(); iter != tokenAttributes.end(); ++iter) { String attributeName(iter->m_name.data(), iter->m_name.size()); String attributeValue(iter->m_value.data(), iter->m_value.size()); - attributes.append(make_pair(attributeName, attributeValue)); + attributes.append(std::make_pair(attributeName, attributeValue)); } m_encoding = encodingFromMetaAttributes(attributes); diff --git a/Source/WebCore/html/parser/XSSAuditor.cpp b/Source/WebCore/html/parser/XSSAuditor.cpp index 09ff0431f..3350574c8 100644 --- a/Source/WebCore/html/parser/XSSAuditor.cpp +++ b/Source/WebCore/html/parser/XSSAuditor.cpp @@ -557,7 +557,7 @@ String XSSAuditor::decodedSnippetForJavaScript(const HTMLToken& token) while (startPosition < endPosition && !isJSNewline(string[startPosition])) startPosition++; } else if (startsMultiLineCommentAt(string, startPosition)) { - if ((foundPosition = string.find("*/", startPosition)) != notFound) + if (startPosition + 2 < endPosition && (foundPosition = string.find("*/", startPosition + 2)) != notFound) startPosition = foundPosition + 2; else startPosition = endPosition; diff --git a/Source/WebCore/html/parser/create-html-entity-table b/Source/WebCore/html/parser/create-html-entity-table index a99a35bae..28a880e88 100755 --- a/Source/WebCore/html/parser/create-html-entity-table +++ b/Source/WebCore/html/parser/create-html-entity-table @@ -124,7 +124,7 @@ index = {} offset = 0 for entry in entries: letter = entry[ENTITY][0] - if not index.get(letter): + if letter not in index: index[letter] = offset values = entry[VALUE].split(' ') assert len(values) <= 2, values diff --git a/Source/WebCore/html/shadow/ContentDistributor.cpp b/Source/WebCore/html/shadow/ContentDistributor.cpp index af650a3bf..b3fdd32ad 100644 --- a/Source/WebCore/html/shadow/ContentDistributor.cpp +++ b/Source/WebCore/html/shadow/ContentDistributor.cpp @@ -28,6 +28,7 @@ #include "ContentDistributor.h" #include "ContentSelectorQuery.h" +#include "ElementShadow.h" #include "HTMLContentElement.h" #include "ShadowRoot.h" @@ -35,72 +36,113 @@ namespace WebCore { ContentDistributor::ContentDistributor() - : m_phase(Prevented) - , m_needsRedistributing(false) + : m_validity(Undetermined) { } ContentDistributor::~ContentDistributor() { - ASSERT(m_pool.isEmpty()); } -void ContentDistributor::distribute(InsertionPoint* insertionPoint, ContentDistribution* distribution) +InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const { - ASSERT(m_phase == Prepared); - ASSERT(distribution->isEmpty()); - - ContentSelectorQuery query(insertionPoint); + return m_nodeToInsertionPoint.get(key); +} - for (size_t i = 0; i < m_pool.size(); ++i) { - Node* child = m_pool[i].get(); - if (!child) - continue; - if (!query.matches(child)) - continue; - distribution->append(child); - m_nodeToInsertionPoint.add(child, insertionPoint); - m_pool[i] = 0; +void ContentDistributor::distribute(Element* host) +{ + ASSERT(needsDistribution()); + ASSERT(m_nodeToInsertionPoint.isEmpty()); + + m_validity = Valid; + + ContentDistribution pool; + for (Node* node = host->firstChild(); node; node = node->nextSibling()) + pool.append(node); + + for (ShadowRoot* root = host->youngestShadowRoot(); root; root = root->olderShadowRoot()) { + for (Node* node = root; node; node = node->traverseNextNode(root)) { + if (!isInsertionPoint(node)) + continue; + InsertionPoint* point = toInsertionPoint(node); + if (!point->isActive()) + continue; + ShadowRoot* older = root->olderShadowRoot(); + if (point->doesSelectFromHostChildren()) + distributeSelectionsTo(point, pool); + else if (older && !older->assignedTo()) { + distributeShadowChildrenTo(point, older); + older->setAssignedTo(point); + } + } } } -void ContentDistributor::clearDistribution(ContentDistribution* list) +bool ContentDistributor::invalidate(Element* host) { - for (size_t i = 0; i < list->size(); ++i) - m_nodeToInsertionPoint.remove(list->at(i).get()); - list->clear(); -} + ASSERT(needsInvalidation()); + bool needsReattach = (m_validity == Undetermined) || !m_nodeToInsertionPoint.isEmpty(); + + for (ShadowRoot* root = host->youngestShadowRoot(); root; root = root->olderShadowRoot()) { + root->setAssignedTo(0); + + for (Node* node = root; node; node = node->traverseNextNode(root)) { + if (!isInsertionPoint(node)) + continue; + needsReattach = needsReattach || true; + InsertionPoint* point = toInsertionPoint(node); + point->clearDistribution(); + } + } -InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const -{ - return m_nodeToInsertionPoint.get(key); + m_validity = Invalidating; + m_nodeToInsertionPoint.clear(); + return needsReattach; } -void ContentDistributor::willDistribute() +void ContentDistributor::finishInivalidation() { - m_phase = Started; + ASSERT(m_validity == Invalidating); + m_validity = Invalidated; } -void ContentDistributor::didDistribute() +void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, ContentDistribution& pool) { - ASSERT(m_phase != Prevented); - m_phase = Prevented; - m_pool.clear(); + ContentDistribution distribution; + ContentSelectorQuery query(insertionPoint); + + for (size_t i = 0; i < pool.size(); ++i) { + Node* child = pool[i].get(); + if (!child) + continue; + if (!query.matches(child)) + continue; + + distribution.append(child); + m_nodeToInsertionPoint.add(child, insertionPoint); + pool[i] = 0; + } + + insertionPoint->setDistribution(distribution); } -void ContentDistributor::preparePoolFor(Element* shadowHost) +void ContentDistributor::distributeShadowChildrenTo(InsertionPoint* insertionPoint, ShadowRoot* root) { - if (poolIsReady()) - return; + ContentDistribution distribution; + for (Node* node = root->firstChild(); node; node = node->nextSibling()) { + distribution.append(node); + m_nodeToInsertionPoint.add(node, insertionPoint); + } - ASSERT(m_pool.isEmpty()); - ASSERT(shadowHost); - ASSERT(m_phase == Started); + insertionPoint->setDistribution(distribution); +} - m_phase = Prepared; - for (Node* node = shadowHost->firstChild(); node; node = node->nextSibling()) - m_pool.append(node); +void ContentDistributor::invalidateDistributionIn(ContentDistribution* list) +{ + for (size_t i = 0; i < list->size(); ++i) + m_nodeToInsertionPoint.remove(list->at(i).get()); + list->clear(); } } diff --git a/Source/WebCore/html/shadow/ContentDistributor.h b/Source/WebCore/html/shadow/ContentDistributor.h index a209854ce..3077cff41 100644 --- a/Source/WebCore/html/shadow/ContentDistributor.h +++ b/Source/WebCore/html/shadow/ContentDistributor.h @@ -48,43 +48,37 @@ typedef Vector<RefPtr<Node> > ContentDistribution; class ContentDistributor { WTF_MAKE_NONCOPYABLE(ContentDistributor); public: + enum Validity { + Valid = 0, + Invalidated = 1, + Invalidating = 2, + Undetermined = 3 + }; + ContentDistributor(); ~ContentDistributor(); - void distribute(InsertionPoint*, ContentDistribution*); - void clearDistribution(ContentDistribution*); InsertionPoint* findInsertionPointFor(const Node* key) const; - void willDistribute(); - bool inDistribution() const; - void didDistribute(); + void distribute(Element* host); + bool invalidate(Element* host); + void finishInivalidation(); + bool needsDistribution() const; + bool needsInvalidation() const { return m_validity != Invalidated; } - void preparePoolFor(Element* shadowHost); - bool poolIsReady() const; - bool needsRedistributing() const { return m_needsRedistributing; } - void setNeedsRedistributing() { m_needsRedistributing = true; } - void clearNeedsRedistributing() { m_needsRedistributing = false; } -private: - enum DistributionPhase { - Prevented, - Started, - Prepared, - }; + void distributeSelectionsTo(InsertionPoint*, ContentDistribution& pool); + void distributeShadowChildrenTo(InsertionPoint*, ShadowRoot*); + void invalidateDistributionIn(ContentDistribution*); - Vector<RefPtr<Node> > m_pool; - DistributionPhase m_phase; +private: HashMap<const Node*, InsertionPoint*> m_nodeToInsertionPoint; - bool m_needsRedistributing : 1; + unsigned m_validity : 2; }; -inline bool ContentDistributor::inDistribution() const -{ - return m_phase != Prevented; -} - -inline bool ContentDistributor::poolIsReady() const +inline bool ContentDistributor::needsDistribution() const { - return m_phase == Prepared; + // During the invalidation, re-distribution should be supressed. + return m_validity != Valid && m_validity != Invalidating; } } diff --git a/Source/WebCore/html/shadow/HTMLContentElement.cpp b/Source/WebCore/html/shadow/HTMLContentElement.cpp index c7706cc16..08b45d4ab 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.cpp +++ b/Source/WebCore/html/shadow/HTMLContentElement.cpp @@ -91,7 +91,7 @@ void HTMLContentElement::parseAttribute(const Attribute& attribute) { if (attribute.name() == selectAttr) { if (ShadowRoot* root = shadowRoot()) - root->owner()->setNeedsRedistributing(); + root->owner()->invalidateDistribution(); } else InsertionPoint::parseAttribute(attribute); } diff --git a/Source/WebCore/html/shadow/InsertionPoint.cpp b/Source/WebCore/html/shadow/InsertionPoint.cpp index cb423bad2..1ca1e3101 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.cpp +++ b/Source/WebCore/html/shadow/InsertionPoint.cpp @@ -47,53 +47,22 @@ InsertionPoint::~InsertionPoint() void InsertionPoint::attach() { - if (isShadowBoundary()) { - ShadowRoot* root = toShadowRoot(treeScope()->rootNode()); - if (doesSelectFromHostChildren()) { - distributeHostChildren(root->owner()); - attachDistributedNode(); - } else if (!root->olderShadowRoot()->assignedTo()) { - ASSERT(!root->olderShadowRoot()->attached()); - assignShadowRoot(root->olderShadowRoot()); - root->olderShadowRoot()->attach(); - } - } - + if (ShadowRoot* root = shadowRoot()) + root->owner()->ensureDistribution(); + for (size_t i = 0; i < m_distribution.size(); ++i) + m_distribution.at(i)->attach(); HTMLElement::attach(); } void InsertionPoint::detach() { - ShadowRoot* root = shadowRoot(); - if (root && isActive()) { - ElementShadow* shadow = root->owner(); - - if (doesSelectFromHostChildren()) - clearDistribution(shadow); - else if (ShadowRoot* assignedShadowRoot = assignedFrom()) - clearAssignment(assignedShadowRoot); - - // When shadow element is detached, shadow tree should be recreated to re-calculate selector for - // other insertion points. - shadow->setNeedsRedistributing(); - } - - ASSERT(m_distribution.isEmpty()); + if (ShadowRoot* root = shadowRoot()) + root->owner()->ensureDistribution(); + for (size_t i = 0; i < m_distribution.size(); ++i) + m_distribution.at(i)->detach(); HTMLElement::detach(); } -ShadowRoot* InsertionPoint::assignedFrom() const -{ - Node* treeScopeRoot = treeScope()->rootNode(); - if (!treeScopeRoot->isShadowRoot()) - return 0; - - ShadowRoot* olderShadowRoot = toShadowRoot(treeScopeRoot)->olderShadowRoot(); - if (olderShadowRoot && olderShadowRoot->assignedTo() == this) - return olderShadowRoot; - return 0; -} - bool InsertionPoint::isShadowBoundary() const { return treeScope()->rootNode()->isShadowRoot() && isActive(); @@ -118,59 +87,57 @@ bool InsertionPoint::rendererIsNeeded(const NodeRenderingContext& context) return !isShadowBoundary() && HTMLElement::rendererIsNeeded(context); } -inline void InsertionPoint::distributeHostChildren(ElementShadow* shadow) +Node* InsertionPoint::nextTo(const Node* node) const { - if (!shadow->distributor().inDistribution()) { - // If ContentDistributor is not int selecting phase, it means InsertionPoint is attached from - // non-ElementShadow node. To run distribute algorithm, we have to reattach ElementShadow. - shadow->setNeedsRedistributing(); - return; - } - - shadow->distributor().preparePoolFor(shadow->host()); - shadow->distributor().clearDistribution(&m_distribution); - shadow->distributor().distribute(this, &m_distribution); + size_t index = m_distribution.find(node); + if (index == notFound || index + 1 == m_distribution.size()) + return 0; + return m_distribution.at(index + 1).get(); } -inline void InsertionPoint::clearDistribution(ElementShadow* shadow) +Node* InsertionPoint::previousTo(const Node* node) const { - shadow->distributor().clearDistribution(&m_distribution); + size_t index = m_distribution.find(node); + if (index == notFound || !index) + return 0; + return m_distribution.at(index - 1).get(); } -inline void InsertionPoint::attachDistributedNode() +void InsertionPoint::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { - for (size_t i = 0; i < m_distribution.size(); ++i) - m_distribution.at(i)->attach(); + HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + if (ShadowRoot* root = shadowRoot()) + root->owner()->invalidateDistribution(); } -inline void InsertionPoint::assignShadowRoot(ShadowRoot* shadowRoot) +Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* insertionPoint) { - shadowRoot->setAssignedTo(this); - m_distribution.clear(); - for (Node* node = shadowRoot->firstChild(); node; node = node->nextSibling()) - m_distribution.append(node); -} + HTMLElement::insertedInto(insertionPoint); + if (insertionPoint->inDocument()) { + if (ShadowRoot* root = shadowRoot()) + root->owner()->invalidateDistribution(); + } -inline void InsertionPoint::clearAssignment(ShadowRoot* shadowRoot) -{ - shadowRoot->setAssignedTo(0); - m_distribution.clear(); + return InsertionDone; } -Node* InsertionPoint::nextTo(const Node* node) const +void InsertionPoint::removedFrom(ContainerNode* insertionPoint) { - size_t index = m_distribution.find(node); - if (index == notFound || index + 1 == m_distribution.size()) - return 0; - return m_distribution.at(index + 1).get(); -} + if (insertionPoint->inDocument()) { + Node* parent = parentNode(); + if (!parent) + parent = insertionPoint; + if (ShadowRoot* root = parent->shadowRoot()) { + // host can be null when removedFrom() is called from ElementShadow destructor. + if (root->host()) + root->owner()->invalidateDistribution(); + } -Node* InsertionPoint::previousTo(const Node* node) const -{ - size_t index = m_distribution.find(node); - if (index == notFound || !index) - return 0; - return m_distribution.at(index - 1).get(); + // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. + clearDistribution(); + } + + HTMLElement::removedFrom(insertionPoint); } diff --git a/Source/WebCore/html/shadow/InsertionPoint.h b/Source/WebCore/html/shadow/InsertionPoint.h index 296f0b253..f46d3d482 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.h +++ b/Source/WebCore/html/shadow/InsertionPoint.h @@ -43,6 +43,8 @@ public: virtual ~InsertionPoint(); bool hasDistribution() const { return !m_distribution.isEmpty(); } + void setDistribution(ContentDistribution& distribution) { m_distribution.swap(distribution); } + void clearDistribution() { m_distribution.clear(); } bool isShadowBoundary() const; bool isActive() const; @@ -52,9 +54,7 @@ public: virtual void attach(); virtual void detach(); - virtual bool isInsertionPoint() const OVERRIDE { return true; } - ShadowRoot* assignedFrom() const; size_t indexOf(Node* node) const { return m_distribution.find(node); } size_t size() const { return m_distribution.size(); } @@ -67,15 +67,11 @@ public: protected: InsertionPoint(const QualifiedName&, Document*); virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE; + virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE; + virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; + virtual void removedFrom(ContainerNode*) OVERRIDE; private: - void distributeHostChildren(ElementShadow*); - void clearDistribution(ElementShadow*); - void attachDistributedNode(); - - void assignShadowRoot(ShadowRoot*); - void clearAssignment(ShadowRoot*); - ContentDistribution m_distribution; }; diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index b56b1d265..212048ab2 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -256,6 +256,7 @@ void MediaControlPanelElement::makeTransparent() setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER); m_opaque = false; + startTimer(); } void MediaControlPanelElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.cpp b/Source/WebCore/html/shadow/MediaControlRootElement.cpp index e5c8bc2c2..0ebd0ae3c 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElement.cpp @@ -301,6 +301,7 @@ void MediaControlRootElement::hide() { m_panel->setIsDisplayed(false); m_panel->hide(); + m_volumeSliderContainer->hide(); } void MediaControlRootElement::makeOpaque() @@ -311,6 +312,7 @@ void MediaControlRootElement::makeOpaque() void MediaControlRootElement::makeTransparent() { m_panel->makeTransparent(); + m_volumeSliderContainer->hide(); } void MediaControlRootElement::reset() diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp index 9fd47a35f..bdcd9164d 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp @@ -178,6 +178,7 @@ void MediaControlRootElementChromium::hide() { m_panel->setIsDisplayed(false); m_panel->hide(); + m_volumeSliderContainer->hide(); } void MediaControlRootElementChromium::makeOpaque() @@ -188,6 +189,7 @@ void MediaControlRootElementChromium::makeOpaque() void MediaControlRootElementChromium::makeTransparent() { m_panel->makeTransparent(); + m_volumeSliderContainer->hide(); } void MediaControlRootElementChromium::reset() diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp index 7763e23da..a67a4bafb 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp @@ -40,6 +40,7 @@ #include "NodeRenderStyle.h" #include "RenderImage.h" #include "ShadowRoot.h" +#include "StyleResolver.h" namespace WebCore { @@ -143,7 +144,8 @@ void TextFieldDecorationElement::updateImage() PassRefPtr<RenderStyle> TextFieldDecorationElement::customStyleForRenderer() { - RefPtr<RenderStyle> style = RenderStyle::create(); + RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); + RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); RenderStyle* inputStyle = hostInput()->renderStyle(); ASSERT(inputStyle); style->setWidth(Length(inputStyle->fontSize(), Fixed)); diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index ddae7a290..e9d373b01 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -67,6 +67,8 @@ TYPES_WITH_OPEN_FIELD_LIST_SET = frozenset(["Timeline.TimelineEvent", # InspectorResourceAgent needs to update mime-type. "Network.Response"]) +EXACTLY_INT_SUPPORTED = False + cmdline_parser = optparse.OptionParser() cmdline_parser.add_option("--output_h_dir") cmdline_parser.add_option("--output_cpp_dir") @@ -622,7 +624,7 @@ class CommandReturnPassModel: class TypeModel: - class RefPtrBased: + class RefPtrBased(object): def __init__(self, class_name): self.class_name = class_name self.optional = False @@ -646,7 +648,7 @@ class TypeModel: def get_event_setter_expression_pattern(): return "%s" - class Enum: + class Enum(object): def __init__(self, base_type_name): self.type_name = base_type_name + "::Enum" @@ -679,7 +681,7 @@ class TypeModel: def get_event_setter_expression_pattern(): return "%s" - class ValueType: + class ValueType(object): def __init__(self, type_name, is_heavy): self.type_name = type_name self.is_heavy = is_heavy @@ -696,6 +698,9 @@ class TypeModel: else: return self.type_name + def get_opt_output_type_(self): + return self.type_name + @staticmethod def get_event_setter_expression_pattern(): return "%s" @@ -708,7 +713,7 @@ class TypeModel: return self def get_command_return_pass_model(self): - return CommandReturnPassModel.OptOutput(self.base.type_name) + return CommandReturnPassModel.OptOutput(self.base.get_opt_output_type_()) def get_input_param_type_text(self): return "const %s* const" % self.base.type_name @@ -717,12 +722,25 @@ class TypeModel: def get_event_setter_expression_pattern(): return "*%s" + class ExactlyInt(ValueType): + def __init__(self): + TypeModel.ValueType.__init__(self, "int", False) + + def get_input_param_type_text(self): + return "TypeBuilder::ExactlyInt" + + def get_opt_output_type_(self): + return "TypeBuilder::ExactlyInt" + @classmethod def init_class(cls): cls.Bool = cls.ValueType("bool", False) - cls.Int = cls.ValueType("int", False) + if EXACTLY_INT_SUPPORTED: + cls.Int = cls.ExactlyInt() + else: + cls.Int = cls.ValueType("int", False) cls.Number = cls.ValueType("double", False) - cls.String = cls.ValueType("String", True) + cls.String = cls.ValueType("String", True,) cls.Object = cls.RefPtrBased("InspectorObject") cls.Array = cls.RefPtrBased("InspectorArray") cls.Any = cls.RefPtrBased("InspectorValue") @@ -2224,6 +2242,30 @@ private: }; +// A small transient wrapper around int type, that can be used as a funciton parameter type +// cleverly disallowing C++ implicit casts from float or double. +class ExactlyInt { +public: + template<typename T> + ExactlyInt(T t) : m_value(cast_to_int<T>(t)) {} + + ExactlyInt() {} + + operator int() { return m_value; } +private: + int m_value; + + template<typename T> + static int cast_to_int(T) { return T::default_case_cast_is_not_supported(); } +}; + +template<> +inline int ExactlyInt::cast_to_int<int>(int i) { return i; } + +template<> +inline int ExactlyInt::cast_to_int<unsigned int>(unsigned int i) { return i; } + + // This class provides "Traits" type for the input type T. It is programmed using C++ template specialization // technique. By default it simply takes "ItemTraits" type from T, but it doesn't work with the base types. template<typename T> diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp index 0b684680d..59858d977 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.cpp +++ b/Source/WebCore/inspector/InjectedScriptHost.cpp @@ -45,6 +45,7 @@ #include "InspectorDOMAgent.h" #include "InspectorDOMStorageAgent.h" #include "InspectorDatabaseAgent.h" +#include "InspectorDebuggerAgent.h" #include "InspectorFrontend.h" #include "InspectorValues.h" #include "Pasteboard.h" @@ -182,6 +183,14 @@ void InjectedScriptHost::didDestroyWorker(long id) } #endif // ENABLE(WORKERS) +#if ENABLE(JAVASCRIPT_DEBUGGER) +ScriptDebugServer& InjectedScriptHost::scriptDebugServer() +{ + return m_debuggerAgent->scriptDebugServer(); +} +#endif + + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h index c51863b31..4e9a82102 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.h +++ b/Source/WebCore/inspector/InjectedScriptHost.h @@ -45,10 +45,12 @@ class InspectorConsoleAgent; class InspectorDOMAgent; class InspectorDOMStorageAgent; class InspectorDatabaseAgent; +class InspectorDebuggerAgent; class InspectorFrontend; class InspectorObject; class InspectorValue; class Node; +class ScriptDebugServer; class ScriptObject; class ScriptValue; class Storage; @@ -67,6 +69,9 @@ public: #endif , InspectorDOMStorageAgent* domStorageAgent , InspectorDOMAgent* domAgent +#if ENABLE(JAVASCRIPT_DEBUGGER) + , InspectorDebuggerAgent* debuggerAgent +#endif ) { m_inspectorAgent = inspectorAgent; @@ -76,6 +81,9 @@ public: #endif m_domStorageAgent = domStorageAgent; m_domAgent = domAgent; +#if ENABLE(JAVASCRIPT_DEBUGGER) + m_debuggerAgent = debuggerAgent; +#endif } static Node* scriptValueAsNode(ScriptValue); @@ -107,6 +115,10 @@ public: void didDestroyWorker(long id); #endif +#if ENABLE(JAVASCRIPT_DEBUGGER) + ScriptDebugServer& scriptDebugServer(); +#endif + private: InjectedScriptHost(); @@ -117,6 +129,9 @@ private: #endif InspectorDOMStorageAgent* m_domStorageAgent; InspectorDOMAgent* m_domAgent; +#if ENABLE(JAVASCRIPT_DEBUGGER) + InspectorDebuggerAgent* m_debuggerAgent; +#endif long m_lastWorkerId; Vector<OwnPtr<InspectableObject> > m_inspectedObjects; OwnPtr<InspectableObject> m_defaultInspectableObject; diff --git a/Source/WebCore/inspector/InjectedScriptManager.cpp b/Source/WebCore/inspector/InjectedScriptManager.cpp index 8ee5a98cc..e406c4a8e 100644 --- a/Source/WebCore/inspector/InjectedScriptManager.cpp +++ b/Source/WebCore/inspector/InjectedScriptManager.cpp @@ -77,7 +77,7 @@ InjectedScriptHost* InjectedScriptManager::injectedScriptHost() return m_injectedScriptHost.get(); } -InjectedScript InjectedScriptManager::injectedScriptForId(long id) +InjectedScript InjectedScriptManager::injectedScriptForId(int id) { IdToInjectedScriptMap::iterator it = m_idToInjectedScript.find(id); if (it != m_idToInjectedScript.end()) @@ -89,12 +89,12 @@ InjectedScript InjectedScriptManager::injectedScriptForId(long id) return InjectedScript(); } -long InjectedScriptManager::injectedScriptIdFor(ScriptState* scriptState) +int InjectedScriptManager::injectedScriptIdFor(ScriptState* scriptState) { ScriptStateToId::iterator it = m_scriptStateToId.find(scriptState); if (it != m_scriptStateToId.end()) return it->second; - long id = m_nextInjectedScriptId++; + int id = m_nextInjectedScriptId++; m_scriptStateToId.set(scriptState, id); return id; } @@ -166,9 +166,9 @@ String InjectedScriptManager::injectedScriptSource() return String(reinterpret_cast<const char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js)); } -pair<long, ScriptObject> InjectedScriptManager::injectScript(const String& source, ScriptState* scriptState) +pair<int, ScriptObject> InjectedScriptManager::injectScript(const String& source, ScriptState* scriptState) { - long id = injectedScriptIdFor(scriptState); + int id = injectedScriptIdFor(scriptState); return std::make_pair(id, createInjectedScript(source, scriptState, id)); } diff --git a/Source/WebCore/inspector/InjectedScriptManager.h b/Source/WebCore/inspector/InjectedScriptManager.h index 4df3bd9e5..a9bdca52f 100644 --- a/Source/WebCore/inspector/InjectedScriptManager.h +++ b/Source/WebCore/inspector/InjectedScriptManager.h @@ -55,10 +55,10 @@ public: InjectedScriptHost* injectedScriptHost(); - pair<long, ScriptObject> injectScript(const String& source, ScriptState*); + pair<int, ScriptObject> injectScript(const String& source, ScriptState*); InjectedScript injectedScriptFor(ScriptState*); - InjectedScript injectedScriptForId(long); - long injectedScriptIdFor(ScriptState*); + InjectedScript injectedScriptForId(int); + int injectedScriptIdFor(ScriptState*); InjectedScript injectedScriptForObjectId(const String& objectId); void discardInjectedScripts(); void discardInjectedScriptsFor(DOMWindow*); @@ -70,18 +70,18 @@ private: explicit InjectedScriptManager(InspectedStateAccessCheck); String injectedScriptSource(); - ScriptObject createInjectedScript(const String& source, ScriptState*, long id); + ScriptObject createInjectedScript(const String& source, ScriptState*, int id); void discardInjectedScript(ScriptState*); static bool canAccessInspectedWindow(ScriptState*); static bool canAccessInspectedWorkerContext(ScriptState*); - long m_nextInjectedScriptId; - typedef HashMap<long, InjectedScript> IdToInjectedScriptMap; + int m_nextInjectedScriptId; + typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; IdToInjectedScriptMap m_idToInjectedScript; RefPtr<InjectedScriptHost> m_injectedScriptHost; InspectedStateAccessCheck m_inspectedStateAccessCheck; - typedef HashMap<ScriptState*, long> ScriptStateToId; + typedef HashMap<ScriptState*, int> ScriptStateToId; ScriptStateToId m_scriptStateToId; }; diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js index b03b8938a..31c80bd21 100644 --- a/Source/WebCore/inspector/InjectedScriptSource.js +++ b/Source/WebCore/inspector/InjectedScriptSource.js @@ -197,7 +197,17 @@ InjectedScript.prototype = { var func = this._objectForId(parsedFunctionId); if (typeof func !== "function") return "Cannot resolve function by id."; - return InjectedScriptHost.functionDetails(func); + var details = InjectedScriptHost.functionDetails(func); + if ("rawScopes" in details) { + var objectGroupName = this._idToObjectGroupName[parsedFunctionId.id]; + var rawScopes = details.rawScopes; + var scopes = []; + delete details.rawScopes; + for (var i = 0; i < rawScopes.length; i++) + scopes.push(InjectedScript.CallFrameProxy._createScopeJson(rawScopes[i].type, rawScopes[i].object, objectGroupName)); + details.scopeChain = scopes; + } + return details; }, releaseObject: function(objectId) @@ -522,34 +532,36 @@ InjectedScript.CallFrameProxy = function(ordinal, callFrame) InjectedScript.CallFrameProxy.prototype = { _wrapScopeChain: function(callFrame) { - const GLOBAL_SCOPE = 0; - const LOCAL_SCOPE = 1; - const WITH_SCOPE = 2; - const CLOSURE_SCOPE = 3; - const CATCH_SCOPE = 4; - - var scopeTypeNames = {}; - scopeTypeNames[GLOBAL_SCOPE] = "global"; - scopeTypeNames[LOCAL_SCOPE] = "local"; - scopeTypeNames[WITH_SCOPE] = "with"; - scopeTypeNames[CLOSURE_SCOPE] = "closure"; - scopeTypeNames[CATCH_SCOPE] = "catch"; - var scopeChain = callFrame.scopeChain; var scopeChainProxy = []; - var foundLocalScope = false; for (var i = 0; i < scopeChain.length; i++) { - var scope = {}; - scope.object = injectedScript._wrapObject(scopeChain[i], "backtrace"); - - var scopeType = callFrame.scopeType(i); - scope.type = scopeTypeNames[scopeType]; + var scope = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace"); scopeChainProxy.push(scope); } return scopeChainProxy; } } +InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) { + const GLOBAL_SCOPE = 0; + const LOCAL_SCOPE = 1; + const WITH_SCOPE = 2; + const CLOSURE_SCOPE = 3; + const CATCH_SCOPE = 4; + + var scopeTypeNames = {}; + scopeTypeNames[GLOBAL_SCOPE] = "global"; + scopeTypeNames[LOCAL_SCOPE] = "local"; + scopeTypeNames[WITH_SCOPE] = "with"; + scopeTypeNames[CLOSURE_SCOPE] = "closure"; + scopeTypeNames[CATCH_SCOPE] = "catch"; + + return { + object: injectedScript._wrapObject(scopeObject, groupId), + type: scopeTypeNames[scopeTypeCode] + }; +} + /** * @constructor */ diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index b2ee963f4..c9911608c 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -2272,7 +2272,8 @@ { "name": "location", "$ref": "Location", "description": "Location of the function." }, { "name": "name", "type": "string", "optional": true, "description": "Name of the function. Not present for anonymous functions." }, { "name": "displayName", "type": "string", "optional": true, "description": "Display name of the function(specified in 'displayName' property on the function object)." }, - { "name": "inferredName", "type": "string", "optional": true, "description": "Name of the function inferred from its initial assignment." } + { "name": "inferredName", "type": "string", "optional": true, "description": "Name of the function inferred from its initial assignment." }, + { "name": "scopeChain", "type": "array", "optional": true, "items": { "$ref": "Scope" }, "description": "Scope chain for this closure." } ], "description": "Information about the function." }, diff --git a/Source/WebCore/inspector/InspectorAgent.cpp b/Source/WebCore/inspector/InspectorAgent.cpp index 35e531439..b3aa3bcf6 100644 --- a/Source/WebCore/inspector/InspectorAgent.cpp +++ b/Source/WebCore/inspector/InspectorAgent.cpp @@ -126,7 +126,7 @@ void InspectorAgent::enable(ErrorString*) WorkersMap::iterator workersEnd = m_workers.end(); for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) { InspectorWorkerResource* worker = it->second.get(); - m_frontend->inspector()->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker()); + m_frontend->inspector()->didCreateWorker(static_cast<int>(worker->id()), worker->url(), worker->isSharedWorker()); } #endif @@ -134,7 +134,7 @@ void InspectorAgent::enable(ErrorString*) inspect(m_pendingInspectData.first, m_pendingInspectData.second); for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommands.begin(); m_frontend && it != m_pendingEvaluateTestCommands.end(); ++it) - m_frontend->inspector()->evaluateForTestInFrontend((*it).first, (*it).second); + m_frontend->inspector()->evaluateForTestInFrontend(static_cast<int>((*it).first), (*it).second); m_pendingEvaluateTestCommands.clear(); } @@ -163,7 +163,7 @@ void InspectorAgent::didCreateWorker(intptr_t id, const String& url, bool isShar m_workers.set(id, workerResource); #if ENABLE(JAVASCRIPT_DEBUGGER) if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didCreateWorker(id, url, isSharedWorker); + m_frontend->inspector()->didCreateWorker(static_cast<int>(id), url, isSharedWorker); #endif } @@ -177,7 +177,7 @@ void InspectorAgent::didDestroyWorker(intptr_t id) return; #if ENABLE(JAVASCRIPT_DEBUGGER) if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didDestroyWorker(id); + m_frontend->inspector()->didDestroyWorker(static_cast<int>(id)); #endif m_workers.remove(workerResource); } @@ -186,7 +186,7 @@ void InspectorAgent::didDestroyWorker(intptr_t id) void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script) { if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->evaluateForTestInFrontend(callId, script); + m_frontend->inspector()->evaluateForTestInFrontend(static_cast<int>(callId), script); else m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script)); } diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp index f70535fc8..2e7c7d9b8 100644 --- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp +++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp @@ -95,7 +95,7 @@ void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); String manifestURL = info.m_manifest.string(); - m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manifestURL, status); + m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manifestURL, static_cast<int>(status)); } void InspectorApplicationCacheAgent::networkStateChanged() @@ -121,7 +121,7 @@ void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr RefPtr<TypeBuilder::ApplicationCache::FrameWithManifest> value = TypeBuilder::ApplicationCache::FrameWithManifest::create() .setFrameId(m_pageAgent->frameId(frame)) .setManifestURL(manifestURL) - .setStatus(host->status()); + .setStatus(static_cast<int>(host->status())); result->addItem(value); } } diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 951733f5f..46e0c2b8c 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -152,6 +152,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC #endif , domStorageAgent , m_domAgent + , m_debuggerAgent ); #if ENABLE(JAVASCRIPT_DEBUGGER) @@ -339,21 +340,18 @@ Node* InspectorController::highlightedNode() const } #if ENABLE(JAVASCRIPT_DEBUGGER) -void InspectorController::enableProfiler() +bool InspectorController::profilerEnabled() { - ErrorString error; - m_profilerAgent->enable(&error); + return m_profilerAgent->enabled(); } -void InspectorController::disableProfiler() +void InspectorController::setProfilerEnabled(bool enable) { ErrorString error; - m_profilerAgent->disable(&error); -} - -bool InspectorController::profilerEnabled() -{ - return m_profilerAgent->enabled(); + if (enable) + m_profilerAgent->enable(&error); + else + m_profilerAgent->disable(&error); } void InspectorController::resume() diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h index 98aef7776..473bb8de2 100644 --- a/Source/WebCore/inspector/InspectorController.h +++ b/Source/WebCore/inspector/InspectorController.h @@ -100,8 +100,7 @@ public: #if ENABLE(JAVASCRIPT_DEBUGGER) bool profilerEnabled(); - void enableProfiler(); - void disableProfiler(); + void setProfilerEnabled(bool); void resume(); #endif diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 7ca046119..ac4df988a 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -1219,7 +1219,7 @@ PassRefPtr<TypeBuilder::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* n RefPtr<TypeBuilder::DOM::Node> value = TypeBuilder::DOM::Node::create() .setNodeId(id) - .setNodeType(node->nodeType()) + .setNodeType(static_cast<int>(node->nodeType())) .setNodeName(nodeName) .setLocalName(localName) .setNodeValue(nodeValue); diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp index d3fff5b7d..3afb26bf1 100644 --- a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp +++ b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp @@ -44,6 +44,35 @@ namespace FileSystemAgentState { static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled"; } +class InspectorFileSystemAgent::FrontendProvider : public RefCounted<FrontendProvider> { + public: + static PassRefPtr<FrontendProvider> create(InspectorFileSystemAgent* agent, InspectorFrontend::FileSystem* frontend) + { + return adoptRef(new FrontendProvider(agent, frontend)); + } + + InspectorFrontend::FileSystem* frontend() const + { + if (m_agent && m_agent->m_enabled) + return m_frontend; + return 0; + } + + void clear() + { + m_agent = 0; + m_frontend = 0; + } + + private: + FrontendProvider(InspectorFileSystemAgent* agent, InspectorFrontend::FileSystem* frontend) + : m_agent(agent) + , m_frontend(frontend) { } + + InspectorFileSystemAgent* m_agent; + InspectorFrontend::FileSystem* m_frontend; +}; + // static PassOwnPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* state) { @@ -52,6 +81,8 @@ PassOwnPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(Instrument InspectorFileSystemAgent::~InspectorFileSystemAgent() { + if (m_frontendProvider) + m_frontendProvider->clear(); m_instrumentingAgents->setInspectorFileSystemAgent(0); } @@ -74,12 +105,15 @@ void InspectorFileSystemAgent::disable(ErrorString*) void InspectorFileSystemAgent::setFrontend(InspectorFrontend* frontend) { ASSERT(frontend); - m_frontend = frontend->filesystem(); + m_frontendProvider = FrontendProvider::create(this, frontend->filesystem()); } void InspectorFileSystemAgent::clearFrontend() { - m_frontend = 0; + if (m_frontendProvider) { + m_frontendProvider->clear(); + m_frontendProvider = 0; + } m_enabled = false; m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled); } @@ -90,9 +124,8 @@ void InspectorFileSystemAgent::restore() } InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state) - : InspectorBaseAgent<InspectorFileSystemAgent>("FileSystem", instrumentingAgents, state), - m_frontend(0), - m_enabled(false) + : InspectorBaseAgent<InspectorFileSystemAgent>("FileSystem", instrumentingAgents, state) + , m_enabled(false) { ASSERT(instrumentingAgents); ASSERT(state); diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.h b/Source/WebCore/inspector/InspectorFileSystemAgent.h index 28a979aad..a637fa0e9 100644 --- a/Source/WebCore/inspector/InspectorFileSystemAgent.h +++ b/Source/WebCore/inspector/InspectorFileSystemAgent.h @@ -47,6 +47,8 @@ class InstrumentingAgents; class InspectorFileSystemAgent : public InspectorBaseAgent<InspectorFileSystemAgent>, public InspectorBackendDispatcher::FileSystemCommandHandler { public: + class FrontendProvider; + static PassOwnPtr<InspectorFileSystemAgent> create(InstrumentingAgents*, InspectorState*); virtual ~InspectorFileSystemAgent(); @@ -59,7 +61,7 @@ public: private: InspectorFileSystemAgent(InstrumentingAgents*, InspectorState*); - InspectorFrontend::FileSystem* m_frontend; + RefPtr<FrontendProvider> m_frontendProvider; bool m_enabled; }; diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.cpp b/Source/WebCore/inspector/InspectorMemoryAgent.cpp index cf05d9b63..922545843 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.cpp +++ b/Source/WebCore/inspector/InspectorMemoryAgent.cpp @@ -43,11 +43,9 @@ #include "InspectorState.h" #include "InspectorValues.h" #include "InstrumentingAgents.h" +#include "MemoryUsageSupport.h" #include "Node.h" #include "Page.h" -#if PLATFORM(CHROMIUM) -#include "PlatformSupport.h" -#endif #include "ScriptGCEvent.h" #include "ScriptProfiler.h" #include "StyledElement.h" @@ -62,9 +60,9 @@ using WebCore::TypeBuilder::Memory::StringStatistics; namespace WebCore { namespace MemoryBlockName { -static const char totalJsHeap[] = "TotalJSHeap"; +static const char jsHeapAllocated[] = "JSHeapAllocated"; +static const char jsHeapUsed[] = "JSHeapUsed"; static const char processPrivateMemory[] = "ProcessPrivateMemory"; -static const char usedJsHeap[] = "UsedJSHeap"; } namespace { @@ -324,27 +322,25 @@ static PassRefPtr<WebCore::TypeBuilder::Memory::MemoryBlock> jsHeapInfo() size_t jsHeapSizeLimit; ScriptGCEvent::getHeapSize(usedJSHeapSize, totalJSHeapSize, jsHeapSizeLimit); - RefPtr<WebCore::TypeBuilder::Memory::MemoryBlock> totalJsHeap = WebCore::TypeBuilder::Memory::MemoryBlock::create().setName(MemoryBlockName::totalJsHeap); - totalJsHeap->setSize(totalJSHeapSize); + RefPtr<WebCore::TypeBuilder::Memory::MemoryBlock> jsHeapAllocated = WebCore::TypeBuilder::Memory::MemoryBlock::create().setName(MemoryBlockName::jsHeapAllocated); + jsHeapAllocated->setSize(static_cast<int>(totalJSHeapSize)); RefPtr<TypeBuilder::Array<WebCore::TypeBuilder::Memory::MemoryBlock> > children = TypeBuilder::Array<WebCore::TypeBuilder::Memory::MemoryBlock>::create(); - RefPtr<WebCore::TypeBuilder::Memory::MemoryBlock> usedJsHeap = WebCore::TypeBuilder::Memory::MemoryBlock::create().setName(MemoryBlockName::usedJsHeap); - usedJsHeap->setSize(usedJSHeapSize); - children->addItem(usedJsHeap); + RefPtr<WebCore::TypeBuilder::Memory::MemoryBlock> jsHeapUsed = WebCore::TypeBuilder::Memory::MemoryBlock::create().setName(MemoryBlockName::jsHeapUsed); + jsHeapUsed->setSize(static_cast<int>(usedJSHeapSize)); + children->addItem(jsHeapUsed); - totalJsHeap->setChildren(children); - return totalJsHeap.release(); + jsHeapAllocated->setChildren(children); + return jsHeapAllocated.release(); } void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<WebCore::TypeBuilder::Memory::MemoryBlock>& processMemory) { size_t privateBytes = 0; -#if PLATFORM(CHROMIUM) size_t sharedBytes = 0; - PlatformSupport::getProcessMemorySize(&privateBytes, &sharedBytes); -#endif + MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes); processMemory = WebCore::TypeBuilder::Memory::MemoryBlock::create().setName(MemoryBlockName::processPrivateMemory); - processMemory->setSize(privateBytes); + processMemory->setSize(static_cast<int>(privateBytes)); RefPtr<TypeBuilder::Array<WebCore::TypeBuilder::Memory::MemoryBlock> > children = TypeBuilder::Array<WebCore::TypeBuilder::Memory::MemoryBlock>::create(); children->addItem(jsHeapInfo()); diff --git a/Source/WebCore/inspector/PageRuntimeAgent.cpp b/Source/WebCore/inspector/PageRuntimeAgent.cpp index 4e9f21a45..b2962bd83 100644 --- a/Source/WebCore/inspector/PageRuntimeAgent.cpp +++ b/Source/WebCore/inspector/PageRuntimeAgent.cpp @@ -151,7 +151,7 @@ void PageRuntimeAgent::unmuteConsole() void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) { ASSERT(securityOrigin || isPageContext); - long executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState); + int executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState); String name = securityOrigin ? securityOrigin->toString() : ""; m_frontend->isolatedContextCreated(ExecutionContextDescription::create() .setId(executionContextId) diff --git a/Source/WebCore/inspector/WorkerInspectorController.cpp b/Source/WebCore/inspector/WorkerInspectorController.cpp index 3c018b5c0..0d7a455a3 100644 --- a/Source/WebCore/inspector/WorkerInspectorController.cpp +++ b/Source/WebCore/inspector/WorkerInspectorController.cpp @@ -111,6 +111,7 @@ WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContex #endif , 0 , 0 + , 0 ); #if ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js index e50f1d218..007c4a3a9 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js @@ -438,7 +438,8 @@ WebInspector.HeapSnapshotContainmentDataGrid.prototype = { { this.snapshotView = snapshotView; this.snapshot = snapshot; - var fakeEdge = { nodeIndex: nodeIndex || this.snapshot.rootNodeIndex }; + var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex || snapshot.rootNodeIndex); + var fakeEdge = { node: node }; this.setRootNode(new WebInspector.HeapSnapshotObjectNode(this, false, fakeEdge, null)); this.rootNode().sort(); }, diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js b/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js index aeb5527cc..084ef9635 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js @@ -30,15 +30,35 @@ /** * @constructor + * @implements {WebInspector.HeapSnapshotReceiver} */ WebInspector.HeapSnapshotLoader = function() { - this._json = ""; - this._state = "find-snapshot-info"; - this._snapshot = {}; + this._reset(); } WebInspector.HeapSnapshotLoader.prototype = { + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback + * @return {boolean} + */ + startLoading: function(callback) + { + return true; + }, + + dispose: function() + { + this._reset(); + }, + + _reset: function() + { + this._json = ""; + this._state = "find-snapshot-info"; + this._snapshot = {}; + }, + _findBalancedCurlyBrackets: function() { var counter = 0; @@ -60,10 +80,8 @@ WebInspector.HeapSnapshotLoader.prototype = { if (!this._json) return null; this._parseStringsArray(); - this._json = ""; var result = new WebInspector.HeapSnapshot(this._snapshot); - this._json = ""; - this._snapshot = {}; + this._reset(); return result; }, @@ -114,6 +132,9 @@ WebInspector.HeapSnapshotLoader.prototype = { this._snapshot.strings = JSON.parse(this._json); }, + /** + * @param {string} chunk + */ pushJSONChunk: function(chunk) { this._json += chunk; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js b/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js index 765bae4da..1277da56b 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js @@ -65,11 +65,11 @@ WebInspector.HeapSnapshotRealWorker.prototype = { this.dispatchEventToListeners("message", message); else { if (message.object !== "console") { - console.log(WebInspector.UIString("Worker asks to call a method '%s' on unsupported object '%s'.", message.method, message.object)); + console.log(WebInspector.UIString("Worker asks to call a method '%s' on an unsupported object '%s'.", message.method, message.object)); return; } if (message.method !== "log" && message.method !== "info" && message.method !== "error") { - console.log(WebInspector.UIString("Worker asks to call unsuported method '%s' on console object.", message.method)); + console.log(WebInspector.UIString("Worker asks to call an unsupported method '%s' on the console object.", message.method)); return; } console[message.method].apply(window[message.object], message.arguments); @@ -245,6 +245,8 @@ WebInspector.HeapSnapshotWorker.prototype = { startCheckingForLongRunningCalls: function() { + if (this._interval) + return; this._checkLongRunningCalls(); this._interval = setInterval(this._checkLongRunningCalls.bind(this), 300); }, @@ -353,6 +355,7 @@ WebInspector.HeapSnapshotProxyObject.prototype = { /** * @constructor * @extends {WebInspector.HeapSnapshotProxyObject} + * @implements {WebInspector.HeapSnapshotReceiver} */ WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId) { @@ -363,6 +366,25 @@ WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId) WebInspector.HeapSnapshotLoaderProxy.prototype = { /** * @param {function(WebInspector.HeapSnapshotProxy)} callback + * @return {boolean} + */ + startLoading: function(callback) + { + var loadingHasJustStarted = !this._onLoadCallbacks.length; + this._onLoadCallbacks.push(callback); + return loadingHasJustStarted; + }, + + /** + * @param {string} chunk + */ + pushJSONChunk: function(chunk) + { + this.callMethod(null, "pushJSONChunk", chunk); + }, + + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback */ finishLoading: function(callback) { @@ -380,22 +402,6 @@ WebInspector.HeapSnapshotLoaderProxy.prototype = { this._onLoadCallbacks = null; } this.callFactoryMethod(updateStaticData.bind(this), "finishLoading", "WebInspector.HeapSnapshotProxy"); - }, - - /** - * @param {function(WebInspector.HeapSnapshotProxy)} callback - * @return {boolean} - */ - startLoading: function(callback) - { - var loadingHasJustStarted = !this._onLoadCallbacks.length; - this._onLoadCallbacks.push(callback); - return loadingHasJustStarted; - }, - - pushJSONChunk: function(chunk) - { - this.callMethod(null, "pushJSONChunk", chunk); } }; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotView.js b/Source/WebCore/inspector/front-end/HeapSnapshotView.js index 6c3dfdfa9..9a8dd08ed 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotView.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotView.js @@ -785,6 +785,42 @@ WebInspector.HeapSnapshotProfileType.prototype = { WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + +/** + * @interface + */ +WebInspector.HeapSnapshotReceiver = function() +{ +} + +WebInspector.HeapSnapshotReceiver.prototype = { + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback + * @return {boolean} + */ + startLoading: function(callback) + { + }, + + /** + * @param {string} chunk + */ + pushJSONChunk: function(chunk) + { + }, + + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback + */ + finishLoading: function(callback) + { + }, + + dispose: function() + { + } +}; + /** * @constructor * @extends {WebInspector.ProfileHeader} @@ -798,9 +834,9 @@ WebInspector.HeapProfileHeader = function(type, title, uid, maxJSObjectId) WebInspector.ProfileHeader.call(this, type, title, uid); this.maxJSObjectId = maxJSObjectId; /** - * @type {WebInspector.HeapSnapshotLoaderProxy} + * @type {WebInspector.HeapSnapshotReceiver} */ - this._loaderProxy = null; + this._receiver = null; /** * @type {WebInspector.HeapSnapshotProxy} */ @@ -841,10 +877,11 @@ WebInspector.HeapProfileHeader.prototype = { return; } - if (!this._loaderProxy) + if (!this._receiver) this._setupWorker(); - if (this._loaderProxy.startLoading(callback)) { + this._numberOfChunks = 0; + if (this._receiver.startLoading(callback)) { this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); this.sidebarElement.wait = true; ProfilerAgent.getProfile(this.profileType().id, this.uid); @@ -858,31 +895,28 @@ WebInspector.HeapProfileHeader.prototype = { } var worker = new WebInspector.HeapSnapshotWorker(); worker.addEventListener("wait", setProfileWait, this); - this._loaderProxy = worker.createObject("WebInspector.HeapSnapshotLoader"); + this._receiver = worker.createObject("WebInspector.HeapSnapshotLoader"); }, dispose: function() { - if (this._loaderProxy) - this._loaderProxy.dispose(); + if (this._receiver) + this._receiver.dispose(); else if (this._snapshotProxy) this._snapshotProxy.dispose(); }, /** - * @param {WebInspector.Event} event + * @param {number} savedChunksCount */ - _saveStatusUpdate: function(event) + _saveStatusUpdate: function(savedChunksCount) { - if (event.data !== this._fileName) - return; - if (++this._savedChunksCount === this._totalNumberOfChunks) { + if (savedChunksCount === this._totalNumberOfChunks) { this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.totalSize); this.sidebarElement.wait = false; this._savedChunksCount = 0; - WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._saveStatusUpdate, this); } else - this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", (this._savedChunksCount * 100 / this._totalNumberOfChunks).toFixed(2)); + this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", (savedChunksCount * 100 / this._totalNumberOfChunks).toFixed(2)); }, /** @@ -890,28 +924,26 @@ WebInspector.HeapProfileHeader.prototype = { */ pushJSONChunk: function(chunk) { - if (this._loaderProxy) { - ++this._totalNumberOfChunks; - this._loaderProxy.pushJSONChunk(chunk); - } else { - this.sidebarElement.wait = true; - WebInspector.fileManager.append(this._fileName, chunk); - } + ++this._numberOfChunks; + this._receiver.pushJSONChunk(chunk); }, - finishHeapSnapshot: function() + _parsed: function(snapshotProxy) { - function parsed(snapshotProxy) - { - this._loaderProxy = null; + this._receiver = null; + if (snapshotProxy) this._snapshotProxy = snapshotProxy; - this.sidebarElement.subtitle = Number.bytesToString(snapshotProxy.totalSize); - this.sidebarElement.wait = false; - var worker = /** @type {WebInspector.HeapSnapshotWorker} */ snapshotProxy.worker; - this.isTemporary = false; - worker.startCheckingForLongRunningCalls(); - } - if (this._loaderProxy.finishLoading(parsed.bind(this))) + this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.totalSize); + this.sidebarElement.wait = false; + var worker = /** @type {WebInspector.HeapSnapshotWorker} */ this._snapshotProxy.worker; + this.isTemporary = false; + worker.startCheckingForLongRunningCalls(); + }, + + finishHeapSnapshot: function() + { + this._totalNumberOfChunks = this._numberOfChunks; + if (this._receiver.finishLoading(this._parsed.bind(this))) this.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026"); }, @@ -929,24 +961,10 @@ WebInspector.HeapProfileHeader.prototype = { */ saveToFile: function() { - /** - * @param {WebInspector.Event} event - */ - function startSavingSnapshot(event) - { - if (event.data !== this._fileName) - return; - this.sidebarElement.wait = true; - this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", 0); - this._savedChunksCount = 0; - WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.SavedURL, startSavingSnapshot, this); - WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._saveStatusUpdate, this); - ProfilerAgent.getProfile(this.profileType().id, this.uid); - } - this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot"; - WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL, startSavingSnapshot, this); - WebInspector.fileManager.save(this._fileName, "", true); + this._receiver = new WebInspector.HeapSnapshotSaveToFileReceiver(this._fileName, this); + this._numberOfChunks = 0; + this._receiver.startLoading(function(snapshot) { }); }, /** @@ -983,15 +1001,8 @@ WebInspector.HeapProfileHeader.prototype = { this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); this.sidebarElement.wait = true; this._setupWorker(); - this._loaderProxy.startLoading(function(ignoredSnapshotProxy) { }); - - function loadNextChunk(file, reader, loadedSize) - { - var chunkSize = 10000000; - var size = file.size < loadedSize + chunkSize ? file.size - loadedSize : chunkSize; - var nextPart = file.webkitSlice(loadedSize, loadedSize + size); - reader.readAsText(nextPart); - } + this._numberOfChunks = 0; + this._receiver.startLoading(function(ignoredSnapshotProxy) { }); /** * @param {Event} event @@ -1000,25 +1011,122 @@ WebInspector.HeapProfileHeader.prototype = { { if (event.target.readyState !== FileReader.DONE) return; + this._nextChunkLoaded(event.target.result); + } - this._loadedSize += event.target.result.length; - this._loaderProxy.pushJSONChunk(event.target.result); - this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026 %d%", (this._loadedSize * 100 / file.size).toFixed(2)); + this._file = file; + this._expectedSize = file.size; + this._loadedSize = 0; + this._reader = this._createFileReader(); + this._reader.onload = onLoad.bind(this); + this._reader.onerror = onError; + this._loadNextChunk(); + }, - if (this._loadedSize === file.size) { - this.finishHeapSnapshot(); - return; - } + _loadNextChunk: function() + { + var loadedSize = this._loadedSize; + var chunkSize = 10000000; + var size = this._expectedSize < loadedSize + chunkSize ? this._expectedSize - loadedSize : chunkSize; + var nextPart = this._file.webkitSlice(loadedSize, loadedSize + size); + this._reader.readAsText(nextPart); + }, - loadNextChunk(file, reader, this._loadedSize); + _nextChunkLoaded: function(data) + { + this._loadedSize += data.length; + this._receiver.pushJSONChunk(data); + this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026 %d%", (this._loadedSize * 100 / this._expectedSize).toFixed(2)); + + if (this._loadedSize === this._expectedSize) { + this._file = null; + this._reader = null; + this.finishHeapSnapshot(); + return; } + this._loadNextChunk(); + }, - var reader = new FileReader(); - reader.onload = onLoad.bind(this); - reader.onerror = onError; - this._loadedSize = 0; - loadNextChunk(file, reader, this._loadedSize); + _createFileReader: function() + { + return new FileReader(); } } WebInspector.HeapProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; + + +/** + * @constructor + * @implements {WebInspector.HeapSnapshotReceiver} + */ +WebInspector.HeapSnapshotSaveToFileReceiver = function(fileName, snapshotHeader) +{ + this._fileName = fileName; + this._snapshotHeader = snapshotHeader; + this._savedChunks = 0; + this._finishLoadingCallbacks = []; +} + +WebInspector.HeapSnapshotSaveToFileReceiver.prototype = { + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback + * @return {boolean} + */ + startLoading: function(callback) + { + WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL, this._startSavingSnapshot, this); + WebInspector.fileManager.save(this._fileName, "", true); + if (callback) + this._finishLoadingCallbacks.push(callback); + return true; + }, + + /** + * @param {string} chunk + */ + pushJSONChunk: function(chunk) + { + WebInspector.fileManager.append(this._fileName, chunk); + }, + + /** + * @param {function(WebInspector.HeapSnapshotProxy)} callback + */ + finishLoading: function(callback) + { + this._finishLoadingCallbacks.push(callback); + for (var i = 0; i < this._finishLoadingCallbacks.length; ++i) + this._finishLoadingCallbacks[i](null); + }, + + dispose: function() + { + }, + + /** + * @param {WebInspector.Event} event + */ + _startSavingSnapshot: function(event) + { + if (event.data !== this._fileName) + return; + this._snapshotHeader._saveStatusUpdate(0); + WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.SavedURL, this._startSavingSnapshot, this); + WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._saveStatusUpdate, this); + ProfilerAgent.getProfile(this._snapshotHeader.profileType().id, this._snapshotHeader.uid); + }, + + /** + * @param {WebInspector.Event} event + */ + _saveStatusUpdate: function(event) + { + if (event.data !== this._fileName) + return; + this._snapshotHeader._saveStatusUpdate(++this._savedChunks); + if (this._savedChunks === this._snapshotHeader._totalNumberOfChunks) + WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._saveStatusUpdate, this); + } +}; + diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js b/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js index ce75eab2c..ccdb5c39b 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js @@ -64,6 +64,11 @@ WebInspector.WorkerConsole.prototype = { this._postMessage("info", Array.prototype.slice.call(arguments)); }, + trace: function() + { + this.log(new Error().stack); + }, + _postMessage: function(method, args) { var rawMessage = { diff --git a/Source/WebCore/inspector/front-end/HelpScreen.js b/Source/WebCore/inspector/front-end/HelpScreen.js index 01b72e2c5..52cd38cfc 100644 --- a/Source/WebCore/inspector/front-end/HelpScreen.js +++ b/Source/WebCore/inspector/front-end/HelpScreen.js @@ -30,6 +30,7 @@ /** * @constructor + * @param {string=} title * @extends {WebInspector.View} */ WebInspector.HelpScreen = function(title) @@ -42,14 +43,13 @@ WebInspector.HelpScreen = function(title) this.element.tabIndex = 0; this.element.addEventListener("focus", this._onBlur.bind(this), false); - var mainWindow = this.element.createChild("div", "help-window-main"); - var captionWindow = mainWindow.createChild("div", "help-window-caption"); - var closeButton = captionWindow.createChild("button", "help-close-button"); - this.contentElement = mainWindow.createChild("div", "help-content"); - captionWindow.createChild("h1", "help-window-title").textContent = title; - - closeButton.textContent = "\u2716"; // Code stands for HEAVY MULTIPLICATION X. - closeButton.addEventListener("click", this.hide.bind(this), false); + if (title) { + var mainWindow = this.element.createChild("div", "help-window-main"); + var captionWindow = mainWindow.createChild("div", "help-window-caption"); + captionWindow.appendChild(this._createCloseButton()); + this.contentElement = mainWindow.createChild("div", "help-content"); + captionWindow.createChild("h1", "help-window-title").textContent = title; + } } /** @@ -58,6 +58,15 @@ WebInspector.HelpScreen = function(title) WebInspector.HelpScreen._visibleScreen = null; WebInspector.HelpScreen.prototype = { + _createCloseButton: function() + { + var closeButton = document.createElement("button"); + closeButton.className = "help-close-button"; + closeButton.textContent = "\u2716"; // Code stands for HEAVY MULTIPLICATION X. + closeButton.addEventListener("click", this.hide.bind(this), false); + return closeButton; + }, + showModal: function() { var visibleHelpScreen = WebInspector.HelpScreen._visibleScreen; diff --git a/Source/WebCore/inspector/front-end/MemoryStatistics.js b/Source/WebCore/inspector/front-end/MemoryStatistics.js index 6b9a7bfa8..c915ce752 100644 --- a/Source/WebCore/inspector/front-end/MemoryStatistics.js +++ b/Source/WebCore/inspector/front-end/MemoryStatistics.js @@ -30,14 +30,18 @@ /** * @param {WebInspector.TimelinePanel} timelinePanel + * @param {WebInspector.TimelineModel} model * @param {number} sidebarWidth * @constructor */ -WebInspector.MemoryStatistics = function(timelinePanel, sidebarWidth) +WebInspector.MemoryStatistics = function(timelinePanel, model, sidebarWidth) { this._timelinePanel = timelinePanel; this._counters = []; + model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this); + model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, this._onRecordsCleared, this); + this._containerAnchor = timelinePanel.element.lastChild; this._memorySplitView = new WebInspector.SplitView(WebInspector.SplitView.SidebarPosition.Left, undefined, sidebarWidth); this._memorySplitView.sidebarElement.addStyleClass("sidebar"); @@ -207,7 +211,7 @@ WebInspector.CounterUI.prototype = { WebInspector.MemoryStatistics.prototype = { - reset: function() + _onRecordsCleared: function() { this._counters = []; }, @@ -251,9 +255,11 @@ WebInspector.MemoryStatistics.prototype = { this._canvas.height = height; }, - addTimlineEvent: function(event) + _onRecordAdded: function(event) { var counters = event.data["counters"]; + if (!counters) + return; this._counters.push({ time: event.data.endTime || event.data.startTime, documentCount: counters["documents"], diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index 2f709fe23..1dfb21aa4 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -35,9 +35,13 @@ WebInspector.NativeMemorySnapshotView = function(profile) { WebInspector.View.call(this); - this.element.addStyleClass("memory-chart-view"); - this.element.createChild("div").textContent = "Memory chart"; + this.registerRequiredCSS("nativeMemoryProfiler.css"); this._profile = profile; + this.element.addStyleClass("memory-chart-view"); + + var pieChart = new WebInspector.NativeMemoryPieChart(profile._memoryBlock); + pieChart.element.addStyleClass("fill"); + pieChart.show(this.element); } WebInspector.NativeMemorySnapshotView.prototype = { @@ -65,7 +69,7 @@ WebInspector.NativeMemorySnapshotView.prototype.__proto__ = WebInspector.View.pr WebInspector.NativeMemoryProfileType = function() { WebInspector.ProfileType.call(this, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Take Native Memory Snapshot")); - this._profileIndex = 1; + this._nextProfileUid = 1; } WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY"; @@ -83,8 +87,16 @@ WebInspector.NativeMemoryProfileType.prototype = { buttonClicked: function() { var profilesPanel = WebInspector.panels.profiles; - var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._profileIndex++), -1); + var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid); + ++this._nextProfileUid; + profileHeader.isTemporary = true; profilesPanel.addProfileHeader(profileHeader); + function didReceiveMemorySnapshot(error, memoryBlock) + { + profileHeader._memoryBlock = memoryBlock; + profileHeader.isTemporary = false; + } + MemoryAgent.getProcessMemoryDistribution(didReceiveMemorySnapshot.bind(this)); return false; }, @@ -132,6 +144,11 @@ WebInspector.NativeMemoryProfileType.prototype.__proto__ = WebInspector.ProfileT WebInspector.NativeMemoryProfileHeader = function(type, title, uid) { WebInspector.ProfileHeader.call(this, type, title, uid); + + /** + * @type {MemoryAgent.MemoryBlock} + */ + this._memoryBlock = null; } WebInspector.NativeMemoryProfileHeader.prototype = { @@ -153,3 +170,182 @@ WebInspector.NativeMemoryProfileHeader.prototype = { } WebInspector.NativeMemoryProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; + +/** + * @constructor + * @param {string} fillStyle + * @param {string} name + * @param {string} description + */ +WebInspector.MemoryBlockViewProperties = function(fillStyle, name, description) +{ + this._fillStyle = fillStyle; + this._name = name; + this._description = description; +} + +/** + * @type {Object.<string, WebInspector.MemoryBlockViewProperties>} + */ +WebInspector.MemoryBlockViewProperties._standardBlocks = null; + +WebInspector.MemoryBlockViewProperties._initialize = function() +{ + if (WebInspector.MemoryBlockViewProperties._standardBlocks) + return; + WebInspector.MemoryBlockViewProperties._standardBlocks = {}; + function addBlock(fillStyle, name, description) + { + WebInspector.MemoryBlockViewProperties._standardBlocks[name] = new WebInspector.MemoryBlockViewProperties(fillStyle, name, WebInspector.UIString(description)); + } + addBlock("rgba(240, 240, 250, 0.8)", "ProcessPrivateMemory", "Total"); + addBlock("rgba(250, 200, 200, 0.8)", "JSHeapAllocated", "JavaScript heap"); + addBlock("rgba(200, 250, 200, 0.8)", "JSHeapUsed", "Used JavaScript heap"); +} + +WebInspector.MemoryBlockViewProperties._forMemoryBlock = function(memoryBlock) +{ + WebInspector.MemoryBlockViewProperties._initialize(); + var result = WebInspector.MemoryBlockViewProperties._standardBlocks[memoryBlock.name]; + if (result) + return result; + return new WebInspector.MemoryBlockViewProperties("rgba(20, 200, 20, 0.8)", memoryBlock.name, memoryBlock.name); +} + + +/** + * @constructor + * @extends {WebInspector.View} + * @param {MemoryAgent.MemoryBlock} memorySnapshot + */ +WebInspector.NativeMemoryPieChart = function(memorySnapshot) +{ + WebInspector.View.call(this); + this._memorySnapshot = memorySnapshot; + this.element = document.createElement("div"); + this.element.addStyleClass("memory-pie-chart-container"); + this._memoryBlockList = this.element.createChild("div", "memory-blocks-list"); + + this._canvasContainer = this.element.createChild("div", "memory-pie-chart"); + this._canvas = this._canvasContainer.createChild("canvas"); + this._addBlockLabels(memorySnapshot, true); +} + +WebInspector.NativeMemoryPieChart.prototype = { + /** + * @override + */ + onResize: function() + { + this._updateSize(); + this._paint(); + }, + + _updateSize: function() + { + var width = this._canvasContainer.clientWidth - 5; + var height = this._canvasContainer.clientHeight - 5; + this._canvas.width = width; + this._canvas.height = height; + }, + + _addBlockLabels: function(memoryBlock, includeChildren) + { + var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(memoryBlock); + var title = viewProperties._description + ": " + Number.bytesToString(memoryBlock.size); + + var swatchElement = this._memoryBlockList.createChild("div", "item"); + swatchElement.createChild("div", "swatch").style.backgroundColor = viewProperties._fillStyle; + swatchElement.createChild("span", "title").textContent = WebInspector.UIString(title); + + if (!memoryBlock.children || !includeChildren) + return; + for (var i = 0; i < memoryBlock.children.length; i++) + this._addBlockLabels(memoryBlock.children[i], false); + }, + + _paint: function() + { + this._clear(); + var width = this._canvas.width; + var height = this._canvas.height; + + var x = width / 2; + var y = height / 2; + var radius = 200; + + var ctx = this._canvas.getContext("2d"); + ctx.beginPath(); + ctx.arc(x, y, radius, 0, Math.PI*2, false); + ctx.lineWidth = 1; + ctx.fillStyle = WebInspector.MemoryBlockViewProperties._forMemoryBlock(this._memorySnapshot)._fillStyle; + ctx.strokeStyle = "rgba(130, 130, 130, 0.8)"; + ctx.fill(); + ctx.stroke(); + ctx.closePath(); + + var startAngle = - Math.PI / 2; + var currentAngle = startAngle; + var memoryBlock = this._memorySnapshot; + + function paintPercentAndLabel(fraction, title, midAngle) + { + ctx.beginPath(); + ctx.font = "14px Arial"; + ctx.fillStyle = "rgba(10, 10, 10, 0.8)"; + + var textX = x + radius * Math.cos(midAngle) / 2; + var textY = y + radius * Math.sin(midAngle) / 2; + ctx.fillText((100 * fraction).toFixed(0) + "%", textX, textY); + + textX = x + radius * Math.cos(midAngle); + textY = y + radius * Math.sin(midAngle); + if (midAngle <= startAngle + Math.PI) { + textX += 10; + textY += 10; + } else { + var metrics = ctx.measureText(title); + textX -= metrics.width + 10; + } + ctx.fillText(title, textX, textY); + ctx.closePath(); + } + + if (memoryBlock.children) { + var total = memoryBlock.size; + for (var i = 0; i < memoryBlock.children.length; i++) { + var child = memoryBlock.children[i]; + if (!child.size) + continue; + var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child); + var angleSpan = Math.PI * 2 * (child.size / total); + ctx.beginPath(); + ctx.moveTo(x, y); + ctx.lineTo(x + radius * Math.cos(currentAngle), y + radius * Math.sin(currentAngle)); + ctx.arc(x, y, radius, currentAngle, currentAngle + angleSpan, false); + ctx.lineWidth = 0.5; + ctx.lineTo(x, y); + ctx.fillStyle = viewProperties._fillStyle; + ctx.strokeStyle = "rgba(100, 100, 100, 0.8)"; + ctx.fill(); + ctx.stroke(); + ctx.closePath(); + + paintPercentAndLabel(child.size / total, viewProperties._description, currentAngle + angleSpan / 2); + + currentAngle += angleSpan; + } + } + + var fraction = 1 - (currentAngle - startAngle) / (2 * Math.PI); + var midAngle = (currentAngle + startAngle + 2 * Math.PI) / 2; + paintPercentAndLabel(fraction, WebInspector.UIString("Unknown"), midAngle); + }, + + _clear: function() { + var ctx = this._canvas.getContext("2d"); + ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); + } +} + +WebInspector.NativeMemoryPieChart.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 19b033838..9d1c467c4 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -264,14 +264,16 @@ WebInspector.ProfilesPanel.prototype = { fileSelectorElement.type = "file"; fileSelectorElement.style.zIndex = -1; fileSelectorElement.style.position = "absolute"; - fileSelectorElement.onchange = this._loadFromFile.bind(this); + function onChange(event) { + this._loadFromFile(this._fileSelectorElement.files[0]); + } + fileSelectorElement.onchange = onChange.bind(this); this.element.appendChild(fileSelectorElement); this._fileSelectorElement = fileSelectorElement; }, - _loadFromFile: function(event) + _loadFromFile: function(file) { - var file = this._fileSelectorElement.files[0]; if (!file.name.endsWith(".heapsnapshot")) { WebInspector.log(WebInspector.UIString("Only heap snapshots from files with extension '.heapsnapshot' can be loaded.")); return; @@ -304,6 +306,8 @@ WebInspector.ProfilesPanel.prototype = { toggleRecordButton: function() { var isProfiling = this._selectedProfileType.buttonClicked(); + this.recordButton.toggled = isProfiling; + this.recordButton.title = this._selectedProfileType.buttonTooltip; if (isProfiling) this._launcherView.profileStarted(); else diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index b29d27bc6..aac212bf3 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -35,95 +35,138 @@ */ WebInspector.SettingsScreen = function(onHide) { - WebInspector.HelpScreen.call(this, WebInspector.UIString("Settings")); - this.contentElement.id = "settings"; + WebInspector.HelpScreen.call(this); + this.element.id = "settings-screen"; /** @type {!function()} */ this._onHide = onHide; +} - var container = document.createElement("div"); - container.className = "help-container"; +WebInspector.SettingsScreen.prototype = { /** - * @param {string} name - * @return {!Element} + * @return {!WebInspector.View} */ - function appendSection(name) { - var block = container.createChild("div", "help-block"); - block.createChild("div", "help-section-title").textContent = name; - return block; - } + _createSettingsTabView: function() + { + var view = new WebInspector.View(); - var p = appendSection(WebInspector.UIString("General")); - if (Preferences.showDockToRight) - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight)); - if (Preferences.exposeDisableCache) - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); - var disableJSElement = this._createCheckboxSetting(WebInspector.UIString("Disable JavaScript"), WebInspector.settings.javaScriptDisabled); - p.appendChild(disableJSElement); - WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged, this); - this._disableJSCheckbox = disableJSElement.getElementsByTagName("input")[0]; - this._updateScriptDisabledCheckbox(); - - p = appendSection(WebInspector.UIString("Rendering")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects)); - WebInspector.settings.showPaintRects.addChangeListener(this._showPaintRectsChanged, this); - - p = appendSection(WebInspector.UIString("Elements")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap)); - - p = appendSection(WebInspector.UIString("Styles")); - p.appendChild(this._createRadioSetting(WebInspector.UIString("Color format"), [ - [ WebInspector.StylesSidebarPane.ColorFormat.Original, WebInspector.UIString("As authored") ], - [ WebInspector.StylesSidebarPane.ColorFormat.HEX, "HEX: #DAC0DE" ], - [ WebInspector.StylesSidebarPane.ColorFormat.RGB, "RGB: rgb(128, 255, 255)" ], - [ WebInspector.StylesSidebarPane.ColorFormat.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat)); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show user agent styles"), WebInspector.settings.showUserAgentStyles)); - - p = appendSection(WebInspector.UIString("Text editor")); - p.appendChild(this._createSelectSetting(WebInspector.UIString("Indent"), [ - [ WebInspector.UIString("2 spaces"), WebInspector.TextEditorModel.Indent.TwoSpaces ], - [ WebInspector.UIString("4 spaces"), WebInspector.TextEditorModel.Indent.FourSpaces ], - [ WebInspector.UIString("8 spaces"), WebInspector.TextEditorModel.Indent.EightSpaces ], - [ WebInspector.UIString("Tab character"), WebInspector.TextEditorModel.Indent.TabCharacter ] - ], WebInspector.settings.textEditorIndent)); - - p = appendSection(WebInspector.UIString("User Agent")); - p.appendChild(this._createUserAgentControl()); - if (Capabilities.canOverrideDeviceMetrics) - p.appendChild(this._createDeviceMetricsControl()); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); - - p = appendSection(WebInspector.UIString("Scripts")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders)); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts)); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled)); - - p = appendSection(WebInspector.UIString("Profiler")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show objects' hidden properties"), WebInspector.settings.showHeapSnapshotObjectsHiddenProperties)); - - p = appendSection(WebInspector.UIString("Console")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Log XMLHttpRequests"), WebInspector.settings.monitoringXHREnabled)); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Preserve log upon navigation"), WebInspector.settings.preserveConsoleLog)); - - if (WebInspector.extensionServer.hasExtensions()) { - var handlerSelector = new WebInspector.HandlerSelector(WebInspector.openAnchorLocationRegistry); - p = appendSection(WebInspector.UIString("Extensions")); - p.appendChild(this._createCustomSetting(WebInspector.UIString("Open links in"), handlerSelector.element)); - } + var container = view.element; + container.id = "settings"; + container.className = "help-content help-container"; - var experiments = WebInspector.experimentsSettings.experiments; - if (WebInspector.experimentsSettings.experimentsEnabled && experiments.length) { - var experimentsSection = appendSection(WebInspector.UIString("Experiments")); - experimentsSection.appendChild(this._createExperimentsWarningSubsection()); - for (var i = 0; i < experiments.length; ++i) - experimentsSection.appendChild(this._createExperimentCheckbox(experiments[i])); - } + /** + * @param {string} name + * @return {!Element} + */ + function appendSection(name) + { + var block = container.createChild("div", "help-block"); + block.createChild("div", "help-section-title").textContent = name; + return block; + } - this.contentElement.appendChild(container); -} + var p = appendSection(WebInspector.UIString("General")); + if (Preferences.showDockToRight) + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight)); + if (Preferences.exposeDisableCache) + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); + var disableJSElement = this._createCheckboxSetting(WebInspector.UIString("Disable JavaScript"), WebInspector.settings.javaScriptDisabled); + p.appendChild(disableJSElement); + WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged, this); + this._disableJSCheckbox = disableJSElement.getElementsByTagName("input")[0]; + this._updateScriptDisabledCheckbox(); + + p = appendSection(WebInspector.UIString("Rendering")); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects)); + WebInspector.settings.showPaintRects.addChangeListener(this._showPaintRectsChanged, this); + + p = appendSection(WebInspector.UIString("Elements")); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap)); + + p = appendSection(WebInspector.UIString("Styles")); + p.appendChild(this._createRadioSetting(WebInspector.UIString("Color format"), [ + [ WebInspector.StylesSidebarPane.ColorFormat.Original, WebInspector.UIString("As authored") ], + [ WebInspector.StylesSidebarPane.ColorFormat.HEX, "HEX: #DAC0DE" ], + [ WebInspector.StylesSidebarPane.ColorFormat.RGB, "RGB: rgb(128, 255, 255)" ], + [ WebInspector.StylesSidebarPane.ColorFormat.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat)); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show user agent styles"), WebInspector.settings.showUserAgentStyles)); + + p = appendSection(WebInspector.UIString("Text editor")); + p.appendChild(this._createSelectSetting(WebInspector.UIString("Indent"), [ + [ WebInspector.UIString("2 spaces"), WebInspector.TextEditorModel.Indent.TwoSpaces ], + [ WebInspector.UIString("4 spaces"), WebInspector.TextEditorModel.Indent.FourSpaces ], + [ WebInspector.UIString("8 spaces"), WebInspector.TextEditorModel.Indent.EightSpaces ], + [ WebInspector.UIString("Tab character"), WebInspector.TextEditorModel.Indent.TabCharacter ] + ], WebInspector.settings.textEditorIndent)); + + p = appendSection(WebInspector.UIString("User Agent")); + p.appendChild(this._createUserAgentControl()); + if (Capabilities.canOverrideDeviceMetrics) + p.appendChild(this._createDeviceMetricsControl()); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); + + p = appendSection(WebInspector.UIString("Scripts")); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders)); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts)); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled)); + + p = appendSection(WebInspector.UIString("Profiler")); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show objects' hidden properties"), WebInspector.settings.showHeapSnapshotObjectsHiddenProperties)); + + p = appendSection(WebInspector.UIString("Console")); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Log XMLHttpRequests"), WebInspector.settings.monitoringXHREnabled)); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Preserve log upon navigation"), WebInspector.settings.preserveConsoleLog)); + + if (WebInspector.extensionServer.hasExtensions()) { + var handlerSelector = new WebInspector.HandlerSelector(WebInspector.openAnchorLocationRegistry); + p = appendSection(WebInspector.UIString("Extensions")); + p.appendChild(this._createCustomSetting(WebInspector.UIString("Open links in"), handlerSelector.element)); + } -WebInspector.SettingsScreen.prototype = { + var experiments = WebInspector.experimentsSettings.experiments; + if (WebInspector.experimentsSettings.experimentsEnabled && experiments.length) { + var experimentsSection = appendSection(WebInspector.UIString("Experiments")); + experimentsSection.appendChild(this._createExperimentsWarningSubsection()); + for (var i = 0; i < experiments.length; ++i) + experimentsSection.appendChild(this._createExperimentCheckbox(experiments[i])); + } + + return view; + }, + + /** + * return {!WebInspector.SettingsScreenTabbedPane} + */ + _getOrCreateTabbedPane: function() + { + if (this._tabbedPane) + return this._tabbedPane; + + var tabbedPane = new WebInspector.SettingsScreenTabbedPane(this._createCloseButton()); + tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Settings, WebInspector.UIString("Settings"), this._createSettingsTabView()); + tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebInspector.UIString("Keyboard Shortcuts"), WebInspector.shortcutsScreen._createShortcutsTabView()); + + this._tabbedPane = tabbedPane; + return tabbedPane; + }, + + /** + * @param {!string} tabId + */ + selectTab: function(tabId) + { + this._getOrCreateTabbedPane().selectTab(tabId); + }, + + /** + * @override + */ + wasShown: function() + { + this._getOrCreateTabbedPane().show(this.element); + WebInspector.HelpScreen.prototype.wasShown.call(this); + }, /** * @override @@ -592,6 +635,26 @@ WebInspector.SettingsScreen.prototype = { WebInspector.SettingsScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype; +WebInspector.SettingsScreen.Tabs = { + Settings: "Settings", + Shortcuts: "Shortcuts" +} + +/** + * @constructor + * @extends {WebInspector.TabbedPane} + * @param {!Element} closeButton + */ +WebInspector.SettingsScreenTabbedPane = function(closeButton) +{ + WebInspector.TabbedPane.call(this); + this.element.addStyleClass("help-window-main"); + + this._headerContentsElement.insertBefore(closeButton, this._headerContentsElement.firstChild); +} + +WebInspector.SettingsScreenTabbedPane.prototype.__proto__ = WebInspector.TabbedPane.prototype; + /** * @constructor */ @@ -616,20 +679,25 @@ WebInspector.SettingsController.prototype = if (this._statusBarButton.toggled) this._hideSettingsScreen(); else - this._showSettingsScreen(); + this.showSettingsScreen(); }, _onHideSettingsScreen: function() { this._statusBarButton.toggled = false; - delete this._settingsScreen; }, - _showSettingsScreen: function() + /** + * @param {string=} tabId + */ + showSettingsScreen: function(tabId) { if (!this._settingsScreen) this._settingsScreen = new WebInspector.SettingsScreen(this._onHideSettingsScreen.bind(this)); + if (tabId) + this._settingsScreen.selectTab(tabId); + this._settingsScreen.showModal(); this._statusBarButton.toggled = true; }, diff --git a/Source/WebCore/inspector/front-end/ShortcutsScreen.js b/Source/WebCore/inspector/front-end/ShortcutsScreen.js index 65a2a0ba7..bdcc532f0 100644 --- a/Source/WebCore/inspector/front-end/ShortcutsScreen.js +++ b/Source/WebCore/inspector/front-end/ShortcutsScreen.js @@ -30,13 +30,10 @@ /** * @constructor - * @extends {WebInspector.HelpScreen} */ WebInspector.ShortcutsScreen = function() { - WebInspector.HelpScreen.call(this, WebInspector.UIString("Keyboard Shortcuts")); this._sections = {}; - this._tableReady = false; } WebInspector.ShortcutsScreen.prototype = { @@ -48,24 +45,8 @@ WebInspector.ShortcutsScreen.prototype = { return section; }, - /** - * @override - */ - wasShown: function() - { - this._buildTable(this.contentElement); - WebInspector.HelpScreen.prototype.wasShown.call(this); - }, - - /** - * @param parent{Node} - */ - _buildTable: function(parent) + _createShortcutsTabView: function() { - if (this._tableReady) - return; - this._tableReady = true; - var orderedSections = []; for (var section in this._sections) orderedSections.push(this._sections[section]); @@ -75,16 +56,17 @@ WebInspector.ShortcutsScreen.prototype = { } orderedSections.sort(compareSections); - var container = document.createElement("div"); - container.className = "help-container"; + var view = new WebInspector.View(); + + var container = view.element; + container.className = "help-content help-container"; for (var i = 0; i < orderedSections.length; ++i) orderedSections[i].renderSection(container); - parent.appendChild(container); + + return view; } } -WebInspector.ShortcutsScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype; - /** * We cannot initialize it here as localized strings are not loaded yet. * @type {?WebInspector.ShortcutsScreen} @@ -130,7 +112,10 @@ WebInspector.ShortcutsSection.prototype = { renderSection: function(container) { var parent = container.createChild("div", "help-block"); - this._renderHeader(parent); + + var headLine = parent.createChild("div", "help-line"); + headLine.createChild("div", "help-key-cell"); + headLine.createChild("div", "help-section-title help-cell").textContent = this.name; for (var i = 0; i < this._lines.length; ++i) { var line = parent.createChild("div", "help-line"); @@ -141,13 +126,6 @@ WebInspector.ShortcutsSection.prototype = { } }, - _renderHeader: function(parent) - { - var line = parent.createChild("div", "help-line"); - line.createChild("div", "help-key-cell"); - line.createChild("div", "help-section-title help-cell").textContent = this.name; - }, - _renderSequence: function(sequence, delimiter) { var delimiterSpan = this._createSpan("help-key-delimiter", delimiter); diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 298f5fa2c..aedb3dbb5 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -61,7 +61,7 @@ WebInspector.TimelinePanel = function() this._timelineMemorySplitter.id = "timeline-memory-splitter"; this._timelineMemorySplitter.addEventListener("mousedown", this._startSplitterDragging.bind(this), false); this._timelineMemorySplitter.addStyleClass("hidden"); - this._memoryStatistics = new WebInspector.MemoryStatistics(this, this.splitView.preferredSidebarWidth()); + this._memoryStatistics = new WebInspector.MemoryStatistics(this, this._model, this.splitView.preferredSidebarWidth()); WebInspector.settings.memoryCounterGraphsHeight = WebInspector.settings.createSetting("memoryCounterGraphsHeight", 150); var itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true); @@ -482,9 +482,6 @@ WebInspector.TimelinePanel.prototype = { { this._innerAddRecordToTimeline(event.data, this._rootRecord()); this._scheduleRefresh(false); - - if (event.data["counters"]) - this._memoryStatistics.addTimlineEvent(event); }, _innerAddRecordToTimeline: function(record, parentRecord) @@ -537,7 +534,6 @@ WebInspector.TimelinePanel.prototype = { this._adjustScrollPosition(0); this._closeRecordDetails(); this._allRecordsCount = 0; - this._memoryStatistics.reset(); }, elementsToRestoreScrollPositionsFor: function() diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index b66e19f6a..5f2ac0975 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -197,6 +197,7 @@ <file>inspector.css</file> <file>inspectorCommon.css</file> <file>inspectorSyntaxHighlight.css</file> + <file>nativeMemoryProfiler.css</file> <file>navigatorView.css</file> <file>networkLogView.css</file> <file>networkPanel.css</file> diff --git a/Source/WebCore/inspector/front-end/helpScreen.css b/Source/WebCore/inspector/front-end/helpScreen.css index 020557242..b1a5d4621 100644 --- a/Source/WebCore/inspector/front-end/helpScreen.css +++ b/Source/WebCore/inspector/front-end/helpScreen.css @@ -51,27 +51,27 @@ body.compact .help-window-main { font-size: 13px; } -.help-content::-webkit-scrollbar { +.help-window-main ::-webkit-scrollbar { width: 11px; } -.help-content::-webkit-scrollbar-corner, -.help-content::-webkit-resizer { +.help-window-main ::-webkit-scrollbar-corner, +.help-window-main ::-webkit-resizer { display: none; } -.help-content::-webkit-scrollbar-thumb:vertical { +.help-window-main ::-webkit-scrollbar-thumb:vertical { background: -webkit-gradient(linear, left top, right top, from(rgb(128, 128, 128)), to(rgb(128, 128, 128)), color-stop(40%, rgb(96, 96, 96))); border-radius: 5px; min-height: 20px; } -.help-content::-webkit-scrollbar-thumb:vertical:hover, -.help-content::-webkit-scrollbar-thumb:vertical:active { +.help-window-main ::-webkit-scrollbar-thumb:vertical:hover, +.help-window-main ::-webkit-scrollbar-thumb:vertical:active { background: -webkit-gradient(linear, left top, right top, from(rgb(176, 176, 176)), to(rgb(176, 176, 176)), color-stop(40%, rgb(144, 144, 144))); } -.help-content::-webkit-scrollbar-track:vertical { +.help-window-main ::-webkit-scrollbar-track:vertical { background: -webkit-gradient(linear, left top, right top, from(rgb(10, 10, 10)), to(rgb(32, 32, 32)), color-stop(25%, rgb(32, 32, 32))); border-radius: 5px; } @@ -109,16 +109,24 @@ body:not(.platform-mac) .help-close-button { .help-container { width: 100%; -webkit-user-select: auto; - -webkit-column-width: 480px; + -webkit-column-width: 470px; +} + +body.platform-mac .help-container { + -webkit-column-width: 330px; } .help-block { display: inline-block; - width: 480px; + width: 470px; padding-bottom: 9px; } -#settings .help-container { +body.platform-mac .help-block { + width: 330px; +} + +#settings.help-container { -webkit-column-width: 240px; } @@ -132,10 +140,14 @@ body:not(.platform-mac) .help-close-button { .help-key-cell { display: inline-block; - width: 280px; + width: 270px; text-align: right; } +body.platform-mac .help-key-cell { + width: 120px; +} + .help-cell { display: inline; } @@ -168,7 +180,7 @@ body.platform-mac .help-key { } .help-content p { - margin: 0 0 3px 0; + margin: 3px 0; } .help-content fieldset { @@ -182,7 +194,6 @@ body.platform-mac .help-key { padding-left: 3px; } - .help-content fieldset label { padding-right: 4px; } @@ -206,8 +217,20 @@ body.platform-mac .help-key { .help-content input[type=checkbox] { height: 13px; width: 13px; - margin-left: 0; - margin-right: 4px; + margin: 0 4px 0 0; + vertical-align: -2px; +} + +body.platform-mac .help-content input[type=checkbox] { + vertical-align: -1px; +} + +.help-content input[type=radio] { + vertical-align: -2px; +} + +body.platform-mac .help-content input[type=radio] { + vertical-align: -1px; } .help-content select { @@ -226,3 +249,47 @@ body.platform-mac .help-key { background-color: black; color: white; } + +body:not(.compact) #settings-screen .tabbed-pane { + height: auto; +} + +#settings-screen .tabbed-pane-header { + height: auto; +} + +#settings-screen .tabbed-pane-header-tabs { + padding-top: 9px; +} + +#settings-screen .tabbed-pane-header-tab { + background-color: transparent; + position: relative; + top: 1px; + text-shadow: none; + color: rgb(255, 255, 255); + height: 19px; + font-size: 13px; + padding: 0 4px; + margin: 0; +} + +#settings-screen .help-close-button { + margin-top: 6px; + margin-bottom: 6px; +} + +#settings-screen .tabbed-pane-header-tab.selected { + border-bottom: solid 1px rgb(51, 51, 51); + border-bottom-right-radius: 2px; +} + +#settings-screen .tabbed-pane-content { + margin: 8px; + padding: 0 4px; +} + +#settings-screen .help-content { + margin: 0; + padding: 0; +} diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 17fab7cd0..a5c615057 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -706,7 +706,7 @@ WebInspector.documentKeyDown = function(event) if (event.keyIdentifier === "F1" || (event.keyIdentifier === helpKey && event.shiftKey && (!WebInspector.isBeingEdited(event.target) || event.metaKey))) { - WebInspector.shortcutsScreen.showModal(); + this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.Shortcuts); event.consume(true); return; } diff --git a/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css b/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css new file mode 100644 index 000000000..98f8e5ce5 --- /dev/null +++ b/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +.memory-pie-chart-container { + display: -webkit-box; + -webkit-box-orient: vertical; +} + +.memory-pie-chart { + -webkit-box-flex: 1; +} + +.memory-blocks-list .swatch { + background-image: none; +} + +.memory-blocks-list { + padding: 1px; + font-size: 11px; +} + +.memory-blocks-list .item { + margin: 10px; +} diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index a308b36c0..b7759396e 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -428,7 +428,7 @@ public: #endif virtual void getGuessesForWord(const String&, const String&, Vector<String>&) { } - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) { } + virtual void requestCheckingOfString(PassRefPtr<TextCheckingRequest>) { } }; class EmptyEditorClient : public EditorClient { @@ -499,10 +499,13 @@ public: virtual NSURL* canonicalizeURL(NSURL*) { return 0; } virtual NSURL* canonicalizeURLString(NSString*) { return 0; } #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) + +#if PLATFORM(MAC) virtual void uppercaseWord() { } virtual void lowercaseWord() { } virtual void capitalizeWord() { } +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool) { } virtual bool substitutionsPanelIsShowing() { return false; } virtual void toggleSmartInsertDelete() { } diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h index 15872efe3..f5c7a7266 100644 --- a/Source/WebCore/loader/FrameLoaderClient.h +++ b/Source/WebCore/loader/FrameLoaderClient.h @@ -311,7 +311,7 @@ namespace WebCore { virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, SecurityOrigin*, const KURL&) { return enabledPerSettings; } virtual bool allowRunningInsecureContent(bool enabledPerSettings, SecurityOrigin*, const KURL&) { return enabledPerSettings; } - virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; } + virtual bool allowShadowDOM(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; } virtual bool allowStyleScoped(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; } #if ENABLE(PAGE_POPUP) virtual bool allowPagePopup() { return false; } diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 05b4727f5..57d01134b 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -72,7 +72,7 @@ static bool shouldLoadAsEmptyDocument(const KURL& url) MainResourceLoader::MainResourceLoader(Frame* frame) : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck)) - , m_dataLoadTimer(this, &MainResourceLoader::handleDataLoadNow) + , m_dataLoadTimer(this, &MainResourceLoader::handleSubstituteDataLoadNow) , m_loadingMultipartContent(false) , m_waitingForContentPolicy(false) , m_timeOfLastDataReceived(0.0) @@ -167,7 +167,7 @@ void MainResourceLoader::continueAfterNavigationPolicy(const ResourceRequest& re // A redirect resulted in loading substitute data. ASSERT(documentLoader()->timing()->redirectCount()); handle()->cancel(); - handleDataLoadSoon(request); + handleSubstituteDataLoadSoon(request); } deref(); // balances ref in willSendRequest @@ -580,7 +580,7 @@ void MainResourceLoader::handleEmptyLoad(const KURL& url, bool forURLScheme) didReceiveResponse(response); } -void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*) +void MainResourceLoader::handleSubstituteDataLoadNow(MainResourceLoaderTimer*) { RefPtr<MainResourceLoader> protect(this); @@ -606,14 +606,14 @@ void MainResourceLoader::startDataLoadTimer() #endif } -void MainResourceLoader::handleDataLoadSoon(const ResourceRequest& r) +void MainResourceLoader::handleSubstituteDataLoadSoon(const ResourceRequest& r) { m_initialRequest = r; if (m_documentLoader->deferMainResourceDataLoad()) startDataLoadTimer(); else - handleDataLoadNow(0); + handleSubstituteDataLoadNow(0); } bool MainResourceLoader::loadNow(ResourceRequest& r) @@ -642,7 +642,7 @@ bool MainResourceLoader::loadNow(ResourceRequest& r) resourceLoadScheduler()->addMainResourceLoad(this); if (m_substituteData.isValid()) - handleDataLoadSoon(r); + handleSubstituteDataLoadSoon(r); else if (shouldLoadEmpty || frameLoader()->client()->representationExistsForURLScheme(url.protocol())) handleEmptyLoad(url, !shouldLoadEmpty); else @@ -696,13 +696,9 @@ void MainResourceLoader::setDefersLoading(bool defers) if (m_initialRequest.isNull()) return; - if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad()) - startDataLoadTimer(); - else { - ResourceRequest r(m_initialRequest); - m_initialRequest = ResourceRequest(); - loadNow(r); - } + ResourceRequest initialRequest(m_initialRequest); + m_initialRequest = ResourceRequest(); + loadNow(initialRequest); } } diff --git a/Source/WebCore/loader/MainResourceLoader.h b/Source/WebCore/loader/MainResourceLoader.h index e3413cab9..f005ddc3a 100644 --- a/Source/WebCore/loader/MainResourceLoader.h +++ b/Source/WebCore/loader/MainResourceLoader.h @@ -55,15 +55,15 @@ namespace WebCore { virtual ~MainResourceLoader(); void load(const ResourceRequest&, const SubstituteData&); - virtual void addData(const char*, int, bool allAtOnce); + virtual void addData(const char*, int, bool allAtOnce) OVERRIDE; - virtual void setDefersLoading(bool); + virtual void setDefersLoading(bool) OVERRIDE; - virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse); - virtual void didReceiveResponse(const ResourceResponse&); - virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce); - virtual void didFinishLoading(double finishTime); - virtual void didFail(const ResourceError&); + virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse) OVERRIDE; + virtual void didReceiveResponse(const ResourceResponse&) OVERRIDE; + virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce) OVERRIDE; + virtual void didFinishLoading(double finishTime) OVERRIDE; + virtual void didFail(const ResourceError&) OVERRIDE; #if HAVE(RUNLOOP_TIMER) typedef RunLoopTimer<MainResourceLoader> MainResourceLoaderTimer; @@ -71,23 +71,21 @@ namespace WebCore { typedef Timer<MainResourceLoader> MainResourceLoaderTimer; #endif - void handleDataLoadNow(MainResourceLoaderTimer*); - bool isLoadingMultipartContent() const { return m_loadingMultipartContent; } private: MainResourceLoader(Frame*); - virtual void willCancel(const ResourceError&); - virtual void didCancel(const ResourceError&); + virtual void willCancel(const ResourceError&) OVERRIDE; + virtual void didCancel(const ResourceError&) OVERRIDE; bool loadNow(ResourceRequest&); void handleEmptyLoad(const KURL&, bool forURLScheme); - void handleDataLoadSoon(const ResourceRequest& r); + void handleSubstituteDataLoadSoon(const ResourceRequest&); + void handleSubstituteDataLoadNow(MainResourceLoaderTimer*); void startDataLoadTimer(); - void handleDataLoad(ResourceRequest&); void receivedError(const ResourceError&); ResourceError interruptedForPolicyChangeError() const; diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp index 519ec6d73..5f4e2b106 100644 --- a/Source/WebCore/loader/cache/CachedImage.cpp +++ b/Source/WebCore/loader/cache/CachedImage.cpp @@ -131,11 +131,11 @@ pair<Image*, float> CachedImage::brokenImage(float deviceScaleFactor) const { if (deviceScaleFactor >= 2) { DEFINE_STATIC_LOCAL(Image*, brokenImageHiRes, (Image::loadPlatformResource("missingImage@2x").leakRef())); - return make_pair(brokenImageHiRes, 2); + return std::make_pair(brokenImageHiRes, 2); } DEFINE_STATIC_LOCAL(Image*, brokenImageLoRes, (Image::loadPlatformResource("missingImage").leakRef())); - return make_pair(brokenImageLoRes, 1); + return std::make_pair(brokenImageLoRes, 1); } bool CachedImage::willPaintBrokenImage() const diff --git a/Source/WebCore/loader/icon/IconLoader.cpp b/Source/WebCore/loader/icon/IconLoader.cpp index 1b07c833c..9d733da4d 100644 --- a/Source/WebCore/loader/icon/IconLoader.cpp +++ b/Source/WebCore/loader/icon/IconLoader.cpp @@ -60,6 +60,9 @@ void IconLoader::startLoading() return; ResourceRequest resourceRequest(m_frame->loader()->icon()->url()); +#if PLATFORM(BLACKBERRY) + resourceRequest.setTargetType(ResourceRequest::TargetIsFavicon); +#endif resourceRequest.setPriority(ResourceLoadPriorityLow); m_resource = m_frame->document()->cachedResourceLoader()->requestRawResource(resourceRequest, diff --git a/Source/WebCore/notifications/Notification.cpp b/Source/WebCore/notifications/Notification.cpp index 37f3b3e78..348992aeb 100644 --- a/Source/WebCore/notifications/Notification.cpp +++ b/Source/WebCore/notifications/Notification.cpp @@ -48,6 +48,7 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "ThreadableLoader.h" +#include "WindowFocusAllowedIndicator.h" #include "WorkerContext.h" namespace WebCore { @@ -222,6 +223,7 @@ void Notification::dispatchShowEvent() void Notification::dispatchClickEvent() { + WindowFocusAllowedIndicator windowFocusAllowed; dispatchEvent(Event::create(eventNames().clickEvent, false, false)); } diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp index 485b0a8bb..b190df52e 100644 --- a/Source/WebCore/page/ContextMenuController.cpp +++ b/Source/WebCore/page/ContextMenuController.cpp @@ -446,6 +446,11 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) case ContextMenuItemTagCapitalize: frame->editor()->capitalizeWord(); break; + case ContextMenuItemTagChangeBack: + frame->editor()->changeBackToReplacedString(m_hitTestResult.replacedString()); + break; +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) case ContextMenuItemTagShowSubstitutions: frame->editor()->showSubstitutionsPanel(); break; @@ -467,9 +472,6 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) case ContextMenuItemTagCorrectSpellingAutomatically: frame->editor()->toggleAutomaticSpellingCorrection(); break; - case ContextMenuItemTagChangeBack: - frame->editor()->changeBackToReplacedString(m_hitTestResult.replacedString()); - break; #endif #if ENABLE(INSPECTOR) case ContextMenuItemTagInspectElement: diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 400270b07..86c12126a 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -95,6 +95,7 @@ #include "SuddenTermination.h" #include "WebKitPoint.h" #include "WindowFeatures.h" +#include "WindowFocusAllowedIndicator.h" #include <algorithm> #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> @@ -899,7 +900,7 @@ Element* DOMWindow::frameElement() const return m_frame->ownerElement(); } -void DOMWindow::focus() +void DOMWindow::focus(ScriptExecutionContext* context) { if (!m_frame) return; @@ -908,8 +909,16 @@ void DOMWindow::focus() if (!page) return; + bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed() || !m_frame->settings()->windowFocusRestricted(); + if (context) { + ASSERT(isMainThread()); + Document* activeDocument = static_cast<Document*>(context); + if (opener() && activeDocument->domWindow() == opener()) + allowFocus = true; + } + // If we're a top level window, bring the window to the front. - if (m_frame == page->mainFrame()) + if (m_frame == page->mainFrame() && allowFocus) page->chrome()->focus(); if (!m_frame) @@ -920,6 +929,7 @@ void DOMWindow::focus() void DOMWindow::blur() { + if (!m_frame) return; @@ -927,6 +937,9 @@ void DOMWindow::blur() if (!page) return; + if (m_frame->settings()->windowFocusRestricted()) + return; + if (m_frame != page->mainFrame()) return; diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index 4ac81624d..728c315db 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -144,7 +144,7 @@ namespace WebCore { Element* frameElement() const; - void focus(); + void focus(ScriptExecutionContext* = 0); void blur(); void close(ScriptExecutionContext* = 0); void print(); diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 3661c1b34..f0656d8e1 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -64,7 +64,7 @@ module window { readonly attribute [CheckSecurityForNode] Element frameElement; - [DoNotCheckSecurity] void focus(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void focus(); [DoNotCheckSecurity] void blur(); [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close(); @@ -388,6 +388,8 @@ module window { attribute EntityReferenceConstructor EntityReference; attribute ProcessingInstructionConstructor ProcessingInstruction; attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] ShadowRootConstructor WebKitShadowRoot; + attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] HTMLContentElementConstructor HTMLContentElement; + attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] HTMLShadowElementConstructor HTMLShadowElement; attribute DOMSelectionConstructor Selection; attribute DOMWindowConstructor Window; @@ -708,7 +710,7 @@ module window { attribute SVGUnitTypesConstructor SVGUnitTypes; attribute SVGUseElementConstructor SVGUseElement; attribute SVGViewElementConstructor SVGViewElement; -// attribute SVGViewSpecConstructor SVGViewSpec; + attribute SVGViewSpecConstructor SVGViewSpec; attribute SVGZoomAndPanConstructor SVGZoomAndPan; attribute SVGAnimateColorElementConstructor SVGAnimateColorElement; diff --git a/Source/WebCore/page/DOMWindowProperty.cpp b/Source/WebCore/page/DOMWindowProperty.cpp index f4f32c29e..ad0469806 100644 --- a/Source/WebCore/page/DOMWindowProperty.cpp +++ b/Source/WebCore/page/DOMWindowProperty.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google, Inc. All Rights Reserved. + * Copyright (C) 2012 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,61 +34,81 @@ namespace WebCore { DOMWindowProperty::DOMWindowProperty(Frame* frame) : m_frame(frame) - , m_disconnectedDOMWindow(0) + , m_associatedDOMWindow(0) { - if (m_frame) - m_frame->domWindow()->registerProperty(this); + // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created with a null frame. + // See fast/dom/navigator-detached-no-crash.html for the recipe. + // We should fix that. <rdar://problem/11567132> + if (m_frame) { + m_associatedDOMWindow = m_frame->domWindow(); + m_associatedDOMWindow->registerProperty(this); + } } DOMWindowProperty::~DOMWindowProperty() { - if (m_frame) { - ASSERT(!m_disconnectedDOMWindow); - m_frame->domWindow()->unregisterProperty(this); - } else if (m_disconnectedDOMWindow) - m_disconnectedDOMWindow->unregisterProperty(this); + if (m_associatedDOMWindow) + m_associatedDOMWindow->unregisterProperty(this); + + m_associatedDOMWindow = 0; + m_frame = 0; } void DOMWindowProperty::disconnectFrameForPageCache() { + // If this property is being disconnected from its Frame to enter the PageCache, it must have + // been created with a Frame in the first place. ASSERT(m_frame); - ASSERT(!m_disconnectedDOMWindow); - m_disconnectedDOMWindow = m_frame->domWindow(); + ASSERT(m_associatedDOMWindow); + m_frame = 0; } void DOMWindowProperty::reconnectFrameFromPageCache(Frame* frame) { + // If this property is being reconnected to its Frame to enter the PageCache, it must have + // been disconnected from its Frame in the first place and it should still have an associated DOMWindow. ASSERT(frame); ASSERT(!m_frame); - ASSERT(m_disconnectedDOMWindow); + ASSERT(frame->domWindow() == m_associatedDOMWindow); + m_frame = frame; - m_disconnectedDOMWindow = 0; } void DOMWindowProperty::willDestroyGlobalObjectInCachedFrame() { - ASSERT(m_disconnectedDOMWindow); - // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important - // that it unregister itself from any DOMWindow it is associated with. - m_disconnectedDOMWindow->unregisterProperty(this); - m_disconnectedDOMWindow = 0; + // If the property has been disconnected from its Frame for the page cache, then it must have originally had a Frame + // and therefore should still have an associated DOMWindow. + ASSERT(!m_frame); + ASSERT(m_associatedDOMWindow); + + // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister + // itself from any DOMWindow it is associated with if that DOMWindow is going away. + if (m_associatedDOMWindow) + m_associatedDOMWindow->unregisterProperty(this); + m_associatedDOMWindow = 0; + m_frame = 0; } void DOMWindowProperty::willDestroyGlobalObjectInFrame() { + // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them. ASSERT(m_frame); - ASSERT(!m_disconnectedDOMWindow); + ASSERT(m_associatedDOMWindow); + // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister - // itself from any DOMWindow it is associated with. - m_frame->domWindow()->unregisterProperty(this); + // itself from any DOMWindow it is associated with if that DOMWindow is going away. + if (m_associatedDOMWindow) + m_associatedDOMWindow->unregisterProperty(this); + m_associatedDOMWindow = 0; m_frame = 0; } void DOMWindowProperty::willDetachGlobalObjectFromFrame() { + // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them. ASSERT(m_frame); - ASSERT(!m_disconnectedDOMWindow); + ASSERT(m_associatedDOMWindow); } } diff --git a/Source/WebCore/page/DOMWindowProperty.h b/Source/WebCore/page/DOMWindowProperty.h index 441bc242e..e2dcc4437 100644 --- a/Source/WebCore/page/DOMWindowProperty.h +++ b/Source/WebCore/page/DOMWindowProperty.h @@ -47,7 +47,7 @@ protected: virtual ~DOMWindowProperty(); Frame* m_frame; - DOMWindow* m_disconnectedDOMWindow; + DOMWindow* m_associatedDOMWindow; }; } diff --git a/Source/WebCore/page/EditorClient.h b/Source/WebCore/page/EditorClient.h index 7bc8f413c..214ec14e6 100644 --- a/Source/WebCore/page/EditorClient.h +++ b/Source/WebCore/page/EditorClient.h @@ -30,6 +30,7 @@ #include "EditorInsertAction.h" #include "FloatRect.h" #include "TextAffinity.h" +#include "TextChecking.h" #include "UndoStep.h" #include <wtf/Forward.h> #include <wtf/Vector.h> @@ -121,10 +122,12 @@ public: virtual NSURL* canonicalizeURLString(NSString*) = 0; #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) virtual void uppercaseWord() = 0; virtual void lowercaseWord() = 0; virtual void capitalizeWord() = 0; +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool show) = 0; virtual bool substitutionsPanelIsShowing() = 0; virtual void toggleSmartInsertDelete() = 0; diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 6c1be3adb..17f2a5e4c 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -2118,7 +2118,7 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo else { // If the target node is a text node, dispatch on the parent node - rdar://4196646 if (result && result->isTextNode()) { - ComposedShadowTreeWalker walker(result); + ComposedShadowTreeParentWalker walker(result); walker.parentIncludingInsertionPointAndShadowRoot(); result = walker.get(); } diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 8d141b8d1..adbe04968 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -1259,7 +1259,11 @@ bool FrameView::useSlowRepaints(bool considerOverlap) const { bool mustBeSlow = m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0); - if (contentsInCompositedLayer()) + // FIXME: WidgetMac.mm makes the assumption that useSlowRepaints == + // m_contentIsOpaque, so don't take the fast path for composited layers + // if they are a platform widget in order to get painting correctness + // for transparent layers. See the comment in WidgetMac::paint. + if (contentsInCompositedLayer() && !platformWidget()) return mustBeSlow; #if PLATFORM(CHROMIUM) diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp index 09405b424..9fb5d7ebe 100644 --- a/Source/WebCore/page/PageSerializer.cpp +++ b/Source/WebCore/page/PageSerializer.cpp @@ -75,7 +75,7 @@ static bool isCharsetSpecifyingNode(Node* node) for (unsigned i = 0; i < element->attributeCount(); ++i) { Attribute* item = element->attributeItem(i); // FIXME: We should deal appropriately with the attribute if they have a namespace. - attributes.append(make_pair(item->name().toString(), item->value().string())); + attributes.append(std::make_pair(item->name().toString(), item->value().string())); } } TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes); diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 87cb0b87c..8b7b1d77a 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -270,9 +270,11 @@ Settings::Settings(Page* page) , m_shouldRespectImageOrientation(false) , m_wantsBalancedSetDefersLoadingBehavior(false) , m_requestAnimationFrameEnabled(true) + , m_deviceSupportsTouch(false) , m_needsDidFinishLoadOrderQuirk(false) , m_fixedPositionCreatesStackingContext(false) , m_syncXHRInDocumentsEnabled(true) + , m_windowFocusRestricted(true) , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired) , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds) { diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index eca6bf3a7..fb1cd3fef 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -575,6 +575,9 @@ namespace WebCore { void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; } bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; } + void setDeviceSupportsTouch(bool enabled) { m_deviceSupportsTouch = enabled; } + bool deviceSupportsTouch() const { return m_deviceSupportsTouch; } + void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; } bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; } @@ -584,6 +587,12 @@ namespace WebCore { void setSyncXHRInDocumentsEnabled(bool enabled) { m_syncXHRInDocumentsEnabled = enabled; } bool syncXHRInDocumentsEnabled() const { return m_syncXHRInDocumentsEnabled; } + // When enabled, window.blur() does not change focus, and + // window.focus() only changes focus when invoked from the context that + // created the window. + void setWindowFocusRestricted(bool restricted) { m_windowFocusRestricted = restricted; } + bool windowFocusRestricted() const { return m_windowFocusRestricted; } + #if USE(JSC) static void setShouldRespectPriorityInCSSAttributeSetters(bool); static bool shouldRespectPriorityInCSSAttributeSetters(); @@ -753,11 +762,14 @@ namespace WebCore { bool m_shouldRespectImageOrientation : 1; bool m_wantsBalancedSetDefersLoadingBehavior : 1; bool m_requestAnimationFrameEnabled : 1; + bool m_deviceSupportsTouch : 1; bool m_needsDidFinishLoadOrderQuirk : 1; bool m_fixedPositionCreatesStackingContext : 1; bool m_syncXHRInDocumentsEnabled : 1; + bool m_windowFocusRestricted : 1; + Timer<Settings> m_loadsImagesAutomaticallyTimer; void loadsImagesAutomaticallyTimerFired(Timer<Settings>*); diff --git a/Source/WebCore/page/WindowFocusAllowedIndicator.cpp b/Source/WebCore/page/WindowFocusAllowedIndicator.cpp new file mode 100644 index 000000000..f44de6a07 --- /dev/null +++ b/Source/WebCore/page/WindowFocusAllowedIndicator.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Google, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WindowFocusAllowedIndicator.h" + +namespace WebCore { + +static bool s_windowFocusAllowed = false; + +bool WindowFocusAllowedIndicator::windowFocusAllowed() +{ + return s_windowFocusAllowed; +} + +WindowFocusAllowedIndicator::WindowFocusAllowedIndicator() + : m_previousWindowFocusAllowed(s_windowFocusAllowed) +{ + s_windowFocusAllowed = true; +} + +WindowFocusAllowedIndicator::~WindowFocusAllowedIndicator() +{ + s_windowFocusAllowed = m_previousWindowFocusAllowed; +} + +} // namespace WebCore diff --git a/Source/WebCore/accessibility/chromium/AccessibilityObjectWrapper.h b/Source/WebCore/page/WindowFocusAllowedIndicator.h index 85a65ed13..86598d7d6 100644 --- a/Source/WebCore/accessibility/chromium/AccessibilityObjectWrapper.h +++ b/Source/WebCore/page/WindowFocusAllowedIndicator.h @@ -1,6 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * Copyright (C) 2008 Google Inc. + * Copyright (C) 2012 Google, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,44 +10,39 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AccessibilityObjectWrapper_h -#define AccessibilityObjectWrapper_h +#ifndef WindowFocusAllowedIndicator_h +#define WindowFocusAllowedIndicator_h -#include <wtf/RefCounted.h> +#include <wtf/Noncopyable.h> +#include <wtf/RefPtr.h> namespace WebCore { - class AccessibilityObject; - class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { - public: - virtual ~AccessibilityObjectWrapper() {} - virtual void detach() = 0; - bool attached() const { return m_object; } - AccessibilityObject* accessibilityObject() const { return m_object; } +class WindowFocusAllowedIndicator { + WTF_MAKE_NONCOPYABLE(WindowFocusAllowedIndicator); +public: + WindowFocusAllowedIndicator(); + ~WindowFocusAllowedIndicator(); - protected: - AccessibilityObjectWrapper(AccessibilityObject* obj) - : m_object(obj) - { - } - AccessibilityObjectWrapper() : m_object(0) { } + static bool windowFocusAllowed(); - AccessibilityObject* m_object; - }; +private: + bool m_previousWindowFocusAllowed; +}; } // namespace WebCore -#endif +#endif // WindowFocusAllowedIndicator_h diff --git a/Source/WebCore/page/mac/SettingsMac.mm b/Source/WebCore/page/mac/SettingsMac.mm index 69bb6ffbd..370843a09 100644 --- a/Source/WebCore/page/mac/SettingsMac.mm +++ b/Source/WebCore/page/mac/SettingsMac.mm @@ -26,87 +26,39 @@ #include "config.h" #include "Settings.h" -#include "LocaleToScriptMapping.h" -#include <wtf/text/CString.h> - namespace WebCore { -static NSDictionary *defaultFontFamilyDictionary() -{ - static NSDictionary *fontFamilyDictionary; - if (fontFamilyDictionary) - return fontFamilyDictionary; - - NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"]; -#ifdef BUILDING_ON_LION - // Temporary workaround for a Safari Webpage Preview Fetcher crash caused by insufficient sandbox permissions. - if (!bundle) - return 0; -#endif - NSData *fileData = [NSData dataWithContentsOfURL:[bundle URLForResource:@"DefaultFonts" withExtension:@"plist"]]; - if (!fileData) - FATAL("Could not read font fallback file"); - NSError *error; - id propertyList = [NSPropertyListSerialization propertyListWithData:fileData options:NSPropertyListImmutable format:0 error:&error]; - if (!propertyList) - FATAL("Could not parse font fallback property list: %s", [[error description] UTF8String]); - if (![propertyList isKindOfClass:[NSDictionary class]]) - FATAL("Font fallback file has incorrect format - root object is not a dictionary"); - - fontFamilyDictionary = static_cast<NSDictionary *>(propertyList); - CFRetain(fontFamilyDictionary); - return fontFamilyDictionary; -} - void Settings::initializeDefaultFontFamilies() { - DEFINE_STATIC_LOCAL(AtomicString, standardFamily, ("standard")); - DEFINE_STATIC_LOCAL(AtomicString, monospaceFamily, ("monospace")); - DEFINE_STATIC_LOCAL(AtomicString, serifFamily, ("serif")); - DEFINE_STATIC_LOCAL(AtomicString, sansSerifFamily, ("sans-serif")); - DEFINE_STATIC_LOCAL(AtomicString, cursiveFamily, ("cursive")); - DEFINE_STATIC_LOCAL(AtomicString, fantasyFamily, ("fantasy")); - DEFINE_STATIC_LOCAL(AtomicString, pictographFamily, ("pictograph")); + setStandardFontFamily("Apple LiSung", USCRIPT_TRADITIONAL_HAN); + setFixedFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN); + setSerifFontFamily("Apple LiSung", USCRIPT_TRADITIONAL_HAN); + setSansSerifFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN); - NSDictionary *rootDictionary = defaultFontFamilyDictionary(); - for (NSString *scriptName in rootDictionary) { - NSDictionary *scriptDictionary = static_cast<NSDictionary *>([rootDictionary objectForKey:scriptName]); - if (![scriptName isKindOfClass:[NSString class]]) - FATAL("Font fallback file has incorrect format - script name is not a string"); - if (![scriptDictionary isKindOfClass:[NSDictionary class]]) - FATAL("Font fallback file has incorrect format - per-script value is not a dictionary"); + setStandardFontFamily("STSong", USCRIPT_SIMPLIFIED_HAN); + setFixedFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN); + setSerifFontFamily("STSong", USCRIPT_SIMPLIFIED_HAN); + setSansSerifFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN); - UScriptCode script = scriptNameToCode(scriptName); - if (script == USCRIPT_UNKNOWN) - FATAL("Font fallback file has incorrect format - unknown language code %s", [scriptName UTF8String]); + setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); + setFixedFontFamily("Osaka-Mono", USCRIPT_KATAKANA_OR_HIRAGANA); + setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); + setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA); - for (NSString *genericFamilyName in scriptDictionary) { - NSString *familyName = [scriptDictionary objectForKey:genericFamilyName]; - if (![genericFamilyName isKindOfClass:[NSString class]]) - FATAL("Font fallback file has incorrect format - generic family name is not a string"); - if (![familyName isKindOfClass:[NSString class]]) - FATAL("Font fallback file has incorrect format - font family name is not a string"); - - AtomicString genericFamily(genericFamilyName); + setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL); +#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) + setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); + setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); +#else + setFixedFontFamily("AppleGothic", USCRIPT_HANGUL); + setSansSerifFontFamily("AppleGothic", USCRIPT_HANGUL); +#endif + setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL); - if (genericFamily == standardFamily) - setStandardFontFamily(familyName, script); - else if (genericFamily == monospaceFamily) - setFixedFontFamily(familyName, script); - else if (genericFamily == serifFamily) - setSerifFontFamily(familyName, script); - else if (genericFamily == sansSerifFamily) - setSansSerifFontFamily(familyName, script); - else if (genericFamily == cursiveFamily) - setCursiveFontFamily(familyName, script); - else if (genericFamily == fantasyFamily) - setFantasyFontFamily(familyName, script); - else if (genericFamily == pictographFamily) - setPictographFontFamily(familyName, script); - else - FATAL("Font fallback file has incorrect format - unknown font family name %s", [familyName UTF8String]); - } - } + setStandardFontFamily("Times", USCRIPT_COMMON); + setFixedFontFamily("Courier", USCRIPT_COMMON); + setSerifFontFamily("Times", USCRIPT_COMMON); + setSansSerifFontFamily("Helvetica", USCRIPT_COMMON); } diff --git a/Source/WebCore/page/qt/EventHandlerQt.cpp b/Source/WebCore/page/qt/EventHandlerQt.cpp index 8aebb9c9a..d52222950 100644 --- a/Source/WebCore/page/qt/EventHandlerQt.cpp +++ b/Source/WebCore/page/qt/EventHandlerQt.cpp @@ -50,7 +50,7 @@ #include "RenderWidget.h" #include "Scrollbar.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) QT_BEGIN_NAMESPACE Q_GUI_EXPORT extern bool qt_tab_all_widgets; // from qapplication.cpp QT_END_NAMESPACE @@ -66,7 +66,7 @@ const double EventHandler::TextDragDelay = 0.0; bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) return !isKeyboardOptionTab(event); #else return (isKeyboardOptionTab(event) ? !qt_tab_all_widgets : qt_tab_all_widgets); diff --git a/Source/WebCore/page/wince/FrameWinCE.cpp b/Source/WebCore/page/wince/FrameWinCE.cpp index b886c2bce..0e8f3dc30 100644 --- a/Source/WebCore/page/wince/FrameWinCE.cpp +++ b/Source/WebCore/page/wince/FrameWinCE.cpp @@ -76,7 +76,7 @@ void computePageRectsForFrame(Frame* frame, const IntRect& printRect, float head float ratio = (float)printRect.height() / (float)printRect.width(); - float pageWidth = (float) root->maxXLayoutOverflow(); + float pageWidth = (float) root->layoutOverflowRect().maxX(); float pageHeight = pageWidth * ratio; outPageHeight = (int) pageHeight; // this is the height of the page adjusted by margins pageHeight -= (headerHeight + footerHeight); diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp new file mode 100644 index 000000000..d2dd8329c --- /dev/null +++ b/Source/WebCore/platform/Decimal.cpp @@ -0,0 +1,1007 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Decimal.h" + +#include <algorithm> +#include <float.h> + +#include <wtf/Assertions.h> +#include <wtf/MathExtras.h> +#include <wtf/Noncopyable.h> +#include <wtf/text/StringBuilder.h> + +namespace WebCore { + +namespace DecimalPrivate { + +static int const ExponentMax = 1023; +static int const ExponentMin = -1023; +static int const Precision = 18; + +static const uint64_t MaxCoefficient = UINT64_C(0x16345785D89FFFF); // 999999999999999999 == 18 9's + +// This class handles Decimal special values. +class SpecialValueHandler { + WTF_MAKE_NONCOPYABLE(SpecialValueHandler); +public: + enum HandleResult { + BothFinite, + BothInfinity, + EitherNaN, + LHSIsInfinity, + RHSIsInfinity, + }; + + SpecialValueHandler(const Decimal& lhs, const Decimal& rhs); + HandleResult handle(); + Decimal value() const; + +private: + enum Result { + ResultIsLHS, + ResultIsRHS, + ResultIsUnknown, + }; + + const Decimal& m_lhs; + const Decimal& m_rhs; + Result m_result; +}; + +SpecialValueHandler::SpecialValueHandler(const Decimal& lhs, const Decimal& rhs) + : m_lhs(lhs), m_rhs(rhs), m_result(ResultIsUnknown) +{ +} + +SpecialValueHandler::HandleResult SpecialValueHandler::handle() +{ + if (m_lhs.isFinite() && m_rhs.isFinite()) + return BothFinite; + + const Decimal::EncodedData::FormatClass lhsClass = m_lhs.value().formatClass(); + const Decimal::EncodedData::FormatClass rhsClass = m_rhs.value().formatClass(); + if (lhsClass == Decimal::EncodedData::ClassNaN) { + m_result = ResultIsLHS; + return EitherNaN; + } + + if (rhsClass == Decimal::EncodedData::ClassNaN) { + m_result = ResultIsRHS; + return EitherNaN; + } + + if (lhsClass == Decimal::EncodedData::ClassInfinity) + return rhsClass == Decimal::EncodedData::ClassInfinity ? BothInfinity : LHSIsInfinity; + + if (rhsClass == Decimal::EncodedData::ClassInfinity) + return RHSIsInfinity; + + ASSERT_NOT_REACHED(); + return BothFinite; +} + +Decimal SpecialValueHandler::value() const +{ + switch (m_result) { + case ResultIsLHS: + return m_lhs; + case ResultIsRHS: + return m_rhs; + case ResultIsUnknown: + default: + ASSERT_NOT_REACHED(); + return m_lhs; + } +} + +// This class is used for 128 bit unsigned integer arithmetic. +class UInt128 { +public: + UInt128(uint64_t low, uint64_t high) + : m_high(high), m_low(low) + { + } + + UInt128& operator/=(uint32_t); + + uint64_t high() const { return m_high; } + uint64_t low() const { return m_low; } + + static UInt128 multiply(uint64_t u, uint64_t v) { return UInt128(u * v, multiplyHigh(u, v)); } + +private: + static uint32_t highUInt32(uint64_t x) { return static_cast<uint32_t>(x >> 32); } + static uint32_t lowUInt32(uint64_t x) { return static_cast<uint32_t>(x & ((static_cast<uint64_t>(1) << 32) - 1)); } + bool isZero() const { return !m_low && !m_high; } + static uint64_t makeUInt64(uint32_t low, uint32_t high) { return low | (static_cast<uint64_t>(high) << 32); } + + static uint64_t multiplyHigh(uint64_t, uint64_t); + + uint64_t m_high; + uint64_t m_low; +}; + +UInt128& UInt128::operator/=(const uint32_t divisor) +{ + ASSERT(divisor); + + if (!m_high) { + m_low /= divisor; + return *this; + } + + uint32_t dividend[4]; + dividend[0] = lowUInt32(m_low); + dividend[1] = highUInt32(m_low); + dividend[2] = lowUInt32(m_high); + dividend[3] = highUInt32(m_high); + + uint32_t quotient[4]; + uint32_t remainder = 0; + for (int i = 3; i >= 0; --i) { + const uint64_t work = makeUInt64(remainder, dividend[i]); + remainder = static_cast<uint32_t>(work % divisor); + quotient[i] = static_cast<uint32_t>(work / divisor); + } + m_low = makeUInt64(quotient[0], quotient[1]); + m_high = makeUInt64(quotient[2], quotient[3]); + return *this; +} + +// Returns high 64bit of 128bit product. +uint64_t UInt128::multiplyHigh(uint64_t u, uint64_t v) +{ + const uint64_t uLow = lowUInt32(u); + const uint64_t uHigh = highUInt32(u); + const uint64_t vLow = lowUInt32(v); + const uint64_t vHigh = highUInt32(v); + const uint64_t partialProduct = uHigh * vLow + highUInt32(uLow * vLow); + return uHigh * vHigh + highUInt32(partialProduct) + highUInt32(uLow * vHigh + lowUInt32(partialProduct)); +} + +static int countDigits(uint64_t x) +{ + int numberOfDigits = 0; + for (uint64_t powerOfTen = 1; x >= powerOfTen; powerOfTen *= 10) { + ++numberOfDigits; + if (powerOfTen >= std::numeric_limits<uint64_t>::max() / 10) + break; + } + return numberOfDigits; +} + +static uint64_t scaleDown(uint64_t x, int n) +{ + ASSERT(n >= 0); + while (n > 0 && x) { + x /= 10; + --n; + } + return x; +} + +static uint64_t scaleUp(uint64_t x, int n) +{ + ASSERT(n >= 0); + ASSERT(n < Precision); + + uint64_t y = 1; + uint64_t z = 10; + for (;;) { + if (n & 1) + y = y * z; + + n >>= 1; + if (!n) + return x * y; + + z = z * z; + } +} + +} // namespace DecimalPrivate + +using namespace DecimalPrivate; + +Decimal::EncodedData::EncodedData(Sign sign, FormatClass formatClass) + : m_coefficient(0) + , m_exponent(0) + , m_formatClass(formatClass) + , m_sign(sign) +{ +} + +Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient) + : m_formatClass(coefficient ? ClassNormal : ClassZero) + , m_sign(sign) +{ + if (exponent >= ExponentMin && exponent <= ExponentMax) { + while (coefficient >= MaxCoefficient) { + coefficient /= 10; + ++exponent; + } + } + + if (exponent > ExponentMax) { + m_coefficient = 0; + m_exponent = 0; + m_formatClass = ClassInfinity; + return; + } + + if (exponent < ExponentMin) { + m_coefficient = 0; + m_exponent = 0; + m_formatClass = ClassZero; + return; + } + + m_coefficient = coefficient; + m_exponent = static_cast<int16_t>(exponent); +} + +bool Decimal::EncodedData::operator==(const EncodedData& another) const +{ + return m_sign == another.m_sign + && m_formatClass == another.m_formatClass + && m_exponent == another.m_exponent + && m_coefficient == another.m_coefficient; +} + +Decimal::Decimal(int32_t i32) + : m_data(i32 < 0 ? Negative : Positive, 0, i32 < 0 ? static_cast<uint64_t>(-static_cast<int64_t>(i32)) : static_cast<uint64_t>(i32)) +{ +} + +Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient) + : m_data(sign, exponent, coefficient) +{ +} + +Decimal::Decimal(const EncodedData& data) + : m_data(data) +{ +} + +Decimal::Decimal(const Decimal& other) + : m_data(other.m_data) +{ +} + +Decimal& Decimal::operator=(const Decimal& other) +{ + m_data = other.m_data; + return *this; +} + +Decimal& Decimal::operator+=(const Decimal& other) +{ + m_data = (*this + other).m_data; + return *this; +} + +Decimal& Decimal::operator-=(const Decimal& other) +{ + m_data = (*this - other).m_data; + return *this; +} + +Decimal& Decimal::operator*=(const Decimal& other) +{ + m_data = (*this * other).m_data; + return *this; +} + +Decimal& Decimal::operator/=(const Decimal& other) +{ + m_data = (*this / other).m_data; + return *this; +} + +Decimal Decimal::operator-() const +{ + if (isNaN()) + return *this; + + Decimal result(*this); + result.m_data.setSign(invertSign(m_data.sign())); + return result; +} + +Decimal Decimal::operator+(const Decimal& rhs) const +{ + const Decimal& lhs = *this; + const Sign lhsSign = lhs.sign(); + const Sign rhsSign = rhs.sign(); + + SpecialValueHandler handler(lhs, rhs); + switch (handler.handle()) { + case SpecialValueHandler::BothFinite: + break; + + case SpecialValueHandler::BothInfinity: + return lhsSign == rhsSign ? lhs : nan(); + + case SpecialValueHandler::EitherNaN: + return handler.value(); + + case SpecialValueHandler::LHSIsInfinity: + return lhs; + + case SpecialValueHandler::RHSIsInfinity: + return rhs; + } + + const AlignedOperands alignedOperands = alignOperands(lhs, rhs); + + const uint64_t result = lhsSign == rhsSign + ? alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient + : alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient; + + if (lhsSign == Negative && rhsSign == Positive && !result) + return Decimal(Positive, alignedOperands.exponent, 0); + + return static_cast<int64_t>(result) >= 0 + ? Decimal(lhsSign, alignedOperands.exponent, result) + : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result)); +} + +Decimal Decimal::operator-(const Decimal& rhs) const +{ + const Decimal& lhs = *this; + const Sign lhsSign = lhs.sign(); + const Sign rhsSign = rhs.sign(); + + SpecialValueHandler handler(lhs, rhs); + switch (handler.handle()) { + case SpecialValueHandler::BothFinite: + break; + + case SpecialValueHandler::BothInfinity: + return lhsSign == rhsSign ? nan() : lhs; + + case SpecialValueHandler::EitherNaN: + return handler.value(); + + case SpecialValueHandler::LHSIsInfinity: + return lhs; + + case SpecialValueHandler::RHSIsInfinity: + return infinity(invertSign(rhsSign)); + } + + const AlignedOperands alignedOperands = alignOperands(lhs, rhs); + + const uint64_t result = lhsSign == rhsSign + ? alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient + : alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient; + + if (lhsSign == Negative && rhsSign == Negative && !result) + return Decimal(Positive, alignedOperands.exponent, 0); + + return static_cast<int64_t>(result) >= 0 + ? Decimal(lhsSign, alignedOperands.exponent, result) + : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result)); +} + +Decimal Decimal::operator*(const Decimal& rhs) const +{ + const Decimal& lhs = *this; + const Sign lhsSign = lhs.sign(); + const Sign rhsSign = rhs.sign(); + const Sign resultSign = lhsSign == rhsSign ? Positive : Negative; + + SpecialValueHandler handler(lhs, rhs); + switch (handler.handle()) { + case SpecialValueHandler::BothFinite: { + const uint64_t lhsCoefficient = lhs.m_data.coefficient(); + const uint64_t rhsCoefficient = rhs.m_data.coefficient(); + int resultExponent = lhs.exponent() + rhs.exponent(); + UInt128 work(UInt128::multiply(lhsCoefficient, rhsCoefficient)); + while (work.high()) { + work /= 10; + ++resultExponent; + } + return Decimal(resultSign, resultExponent, work.low()); + } + + case SpecialValueHandler::BothInfinity: + return infinity(resultSign); + + case SpecialValueHandler::EitherNaN: + return handler.value(); + + case SpecialValueHandler::LHSIsInfinity: + return rhs.isZero() ? nan() : infinity(resultSign); + + case SpecialValueHandler::RHSIsInfinity: + return lhs.isZero() ? nan() : infinity(resultSign); + } + + ASSERT_NOT_REACHED(); + return nan(); +} + +Decimal Decimal::operator/(const Decimal& rhs) const +{ + const Decimal& lhs = *this; + const Sign lhsSign = lhs.sign(); + const Sign rhsSign = rhs.sign(); + const Sign resultSign = lhsSign == rhsSign ? Positive : Negative; + + SpecialValueHandler handler(lhs, rhs); + switch (handler.handle()) { + case SpecialValueHandler::BothFinite: + break; + + case SpecialValueHandler::BothInfinity: + return nan(); + + case SpecialValueHandler::EitherNaN: + return handler.value(); + + case SpecialValueHandler::LHSIsInfinity: + return infinity(resultSign); + + case SpecialValueHandler::RHSIsInfinity: + return zero(resultSign); + } + + ASSERT(lhs.isFinite()); + ASSERT(rhs.isFinite()); + + if (rhs.isZero()) + return lhs.isZero() ? nan() : infinity(resultSign); + + int resultExponent = lhs.exponent() - rhs.exponent(); + + if (lhs.isZero()) + return Decimal(resultSign, resultExponent, 0); + + uint64_t remainder = lhs.m_data.coefficient(); + const uint64_t divisor = rhs.m_data.coefficient(); + uint64_t result = 0; + while (result < MaxCoefficient / 100) { + while (remainder < divisor) { + remainder *= 10; + result *= 10; + --resultExponent; + } + result += remainder / divisor; + remainder %= divisor; + if (!remainder) + break; + } + + if (remainder > divisor / 2) + ++result; + + return Decimal(resultSign, resultExponent, result); +} + +bool Decimal::operator==(const Decimal& rhs) const +{ + return m_data == rhs.m_data || compareTo(rhs).isZero(); +} + +bool Decimal::operator!=(const Decimal& rhs) const +{ + if (m_data == rhs.m_data) + return false; + const Decimal result = compareTo(rhs); + if (result.isNaN()) + return false; + return !result.isZero(); +} + +bool Decimal::operator<(const Decimal& rhs) const +{ + const Decimal result = compareTo(rhs); + if (result.isNaN()) + return false; + return !result.isZero() && result.isNegative(); +} + +bool Decimal::operator<=(const Decimal& rhs) const +{ + if (m_data == rhs.m_data) + return true; + const Decimal result = compareTo(rhs); + if (result.isNaN()) + return false; + return result.isZero() || result.isNegative(); +} + +bool Decimal::operator>(const Decimal& rhs) const +{ + const Decimal result = compareTo(rhs); + if (result.isNaN()) + return false; + return !result.isZero() && result.isPositive(); +} + +bool Decimal::operator>=(const Decimal& rhs) const +{ + if (m_data == rhs.m_data) + return true; + const Decimal result = compareTo(rhs); + if (result.isNaN()) + return false; + return result.isZero() || !result.isNegative(); +} + +Decimal Decimal::abs() const +{ + Decimal result(*this); + result.m_data.setSign(Positive); + return result; +} + +Decimal::AlignedOperands Decimal::alignOperands(const Decimal& lhs, const Decimal& rhs) +{ + ASSERT(lhs.isFinite()); + ASSERT(rhs.isFinite()); + + const int lhsExponent = lhs.exponent(); + const int rhsExponent = rhs.exponent(); + int exponent = std::min(lhsExponent, rhsExponent); + uint64_t lhsCoefficient = lhs.m_data.coefficient(); + uint64_t rhsCoefficient = rhs.m_data.coefficient(); + + if (lhsExponent > rhsExponent) { + const int numberOfLHSDigits = countDigits(lhsCoefficient); + if (numberOfLHSDigits) { + const int lhsShiftAmount = lhsExponent - rhsExponent; + const int overflow = numberOfLHSDigits + lhsShiftAmount - Precision; + if (overflow <= 0) + lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount); + else { + lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount - overflow); + rhsCoefficient = scaleDown(rhsCoefficient, overflow); + exponent += overflow; + } + } + + } else if (lhsExponent < rhsExponent) { + const int numberOfRHSDigits = countDigits(rhsCoefficient); + if (numberOfRHSDigits) { + const int rhsShiftAmount = rhsExponent - lhsExponent; + const int overflow = numberOfRHSDigits + rhsShiftAmount - Precision; + if (overflow <= 0) + rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount); + else { + rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount - overflow); + lhsCoefficient = scaleDown(lhsCoefficient, overflow); + exponent += overflow; + } + } + } + + AlignedOperands alignedOperands; + alignedOperands.exponent = exponent; + alignedOperands.lhsCoefficient = lhsCoefficient; + alignedOperands.rhsCoefficient = rhsCoefficient; + return alignedOperands; +} + +// Round toward positive infinity. +// Note: Mac ports defines ceil(x) as wtf_ceil(x), so we can't use name "ceil" here. +Decimal Decimal::ceiling() const +{ + if (isSpecial()) + return *this; + + if (exponent() >= 0) + return *this; + + uint64_t result = m_data.coefficient(); + const int numberOfDigits = countDigits(result); + const int numberOfDropDigits = -exponent(); + if (numberOfDigits < numberOfDropDigits) + return zero(Positive); + + result = scaleDown(result, numberOfDropDigits - 1); + if (sign() == Positive && result % 10 > 0) + result += 10; + result /= 10; + return Decimal(sign(), 0, result); +} + +Decimal Decimal::compareTo(const Decimal& rhs) const +{ + const Decimal result(*this - rhs); + switch (result.m_data.formatClass()) { + case EncodedData::ClassInfinity: + return result.isNegative() ? Decimal(-1) : Decimal(1); + + case EncodedData::ClassNaN: + case EncodedData::ClassNormal: + return result; + + case EncodedData::ClassZero: + return zero(Positive); + + default: + ASSERT_NOT_REACHED(); + return nan(); + } +} + +// Round toward negative infinity. +Decimal Decimal::floor() const +{ + if (isSpecial()) + return *this; + + if (exponent() >= 0) + return *this; + + uint64_t result = m_data.coefficient(); + const int numberOfDigits = countDigits(result); + const int numberOfDropDigits = -exponent(); + if (numberOfDigits < numberOfDropDigits) + return zero(Positive); + + result = scaleDown(result, numberOfDropDigits - 1); + if (isNegative() && result % 10 > 0) + result += 10; + result /= 10; + return Decimal(sign(), 0, result); +} + +Decimal Decimal::fromString(const String& str) +{ + int exponent = 0; + Sign exponentSign = Positive; + int numberOfDigits = 0; + int numberOfDigitsAfterDot = 0; + int numberOfExtraDigits = 0; + Sign sign = Positive; + + enum { + StateDigit, + StateDot, + StateDotDigit, + StateE, + StateEDigit, + StateESign, + StateSign, + StateStart, + StateZero, + } state = StateStart; + +#define HandleCharAndBreak(expected, nextState) \ + if (ch == expected) { \ + state = nextState; \ + break; \ + } + +#define HandleTwoCharsAndBreak(expected1, expected2, nextState) \ + if (ch == expected1 || ch == expected2) { \ + state = nextState; \ + break; \ + } + + uint64_t accumulator = 0; + for (unsigned index = 0; index < str.length(); ++index) { + const int ch = str[index]; + switch (state) { + case StateDigit: + if (ch >= '0' && ch <= '9') { + if (numberOfDigits < Precision) { + ++numberOfDigits; + accumulator *= 10; + accumulator += ch - '0'; + } else + ++numberOfExtraDigits; + break; + } + + HandleCharAndBreak('.', StateDot); + HandleTwoCharsAndBreak('E', 'e', StateE); + return nan(); + + case StateDot: + if (ch >= '0' && ch <= '9') { + if (numberOfDigits < Precision) { + ++numberOfDigits; + ++numberOfDigitsAfterDot; + accumulator *= 10; + accumulator += ch - '0'; + } + state = StateDotDigit; + break; + } + + case StateDotDigit: + if (ch >= '0' && ch <= '9') { + if (numberOfDigits < Precision) { + ++numberOfDigits; + ++numberOfDigitsAfterDot; + accumulator *= 10; + accumulator += ch - '0'; + } + break; + } + + HandleTwoCharsAndBreak('E', 'e', StateE); + return nan(); + + case StateE: + if (ch == '+') { + exponentSign = Positive; + state = StateESign; + break; + } + + if (ch == '-') { + exponentSign = Negative; + state = StateESign; + break; + } + + if (ch >= '0' && ch <= '9') { + exponent = ch - '0'; + state = StateEDigit; + break; + } + + return nan(); + + case StateEDigit: + if (ch >= '0' && ch <= '9') { + exponent *= 10; + exponent += ch - '0'; + if (exponent > ExponentMax + Precision) { + if (accumulator) + return exponentSign == Negative ? zero(Positive) : infinity(sign); + return zero(sign); + } + state = StateEDigit; + break; + } + + return nan(); + + case StateESign: + if (ch >= '0' && ch <= '9') { + exponent = ch - '0'; + state = StateEDigit; + break; + } + + return nan(); + + case StateSign: + if (ch >= '1' && ch <= '9') { + accumulator = ch - '0'; + numberOfDigits = 1; + state = StateDigit; + break; + } + + HandleCharAndBreak('0', StateZero); + return nan(); + + case StateStart: + if (ch >= '1' && ch <= '9') { + accumulator = ch - '0'; + numberOfDigits = 1; + state = StateDigit; + break; + } + + if (ch == '-') { + sign = Negative; + state = StateSign; + break; + } + + if (ch == '+') { + sign = Positive; + state = StateSign; + break; + } + + HandleCharAndBreak('0', StateZero); + HandleCharAndBreak('.', StateDot); + return nan(); + + case StateZero: + if (ch == '0') + break; + + if (ch >= '1' && ch <= '9') { + accumulator = ch - '0'; + numberOfDigits = 1; + state = StateDigit; + break; + } + + HandleCharAndBreak('.', StateDot); + HandleTwoCharsAndBreak('E', 'e', StateE); + return nan(); + + default: + ASSERT_NOT_REACHED(); + return nan(); + } + } + + if (state == StateZero) + return zero(sign); + + if (state == StateDigit || state == StateEDigit || state == StateDotDigit) { + int resultExponent = exponent * (exponentSign == Negative ? -1 : 1) - numberOfDigitsAfterDot + numberOfExtraDigits; + if (resultExponent < ExponentMin) + return zero(Positive); + + const int overflow = resultExponent - ExponentMax + 1; + if (overflow > 0) { + if (overflow + numberOfDigits - numberOfDigitsAfterDot > Precision) + return infinity(sign); + accumulator = scaleUp(accumulator, overflow); + resultExponent -= overflow; + } + + return Decimal(sign, resultExponent, accumulator); + } + + return nan(); +} + +Decimal Decimal::infinity(const Sign sign) +{ + return Decimal(EncodedData(sign, EncodedData::ClassInfinity)); +} + +Decimal Decimal::nan() +{ + return Decimal(EncodedData(Positive, EncodedData::ClassNaN)); +} + +Decimal Decimal::remainder(const Decimal& rhs) const +{ + const Decimal quotient = (*this / rhs).round(); + return quotient.isSpecial() ? quotient : *this - quotient * rhs; +} + +Decimal Decimal::round() const +{ + if (isSpecial()) + return *this; + + if (exponent() >= 0) + return *this; + + uint64_t result = m_data.coefficient(); + const int numberOfDigits = countDigits(result); + const int numberOfDropDigits = -exponent(); + if (numberOfDigits < numberOfDropDigits) + return zero(Positive); + + result = scaleDown(result, numberOfDropDigits - 1); + if (result % 10 >= 5) + result += 10; + result /= 10; + return Decimal(sign(), 0, result); +} + +String Decimal::toString() const +{ + switch (m_data.formatClass()) { + case EncodedData::ClassInfinity: + return sign() ? "-Infinity" : "Infinity"; + + case EncodedData::ClassNaN: + return "NaN"; + + case EncodedData::ClassNormal: + case EncodedData::ClassZero: + break; + + default: + ASSERT_NOT_REACHED(); + return ""; + } + + StringBuilder builder; + if (sign()) + builder.append('-'); + + int originalExponent = exponent(); + + const int maxDigits = DBL_DIG; + uint64_t coefficient = m_data.coefficient(); + uint64_t lastDigit = 0; + while (countDigits(coefficient) > maxDigits) { + lastDigit = coefficient % 10; + coefficient /= 10; + ++originalExponent; + } + + if (lastDigit >= 5) + ++coefficient; + + while (originalExponent < 0 && coefficient && !(coefficient % 10)) { + coefficient /= 10; + ++originalExponent; + } + + const String digits = String::number(coefficient); + int coefficientLength = static_cast<int>(digits.length()); + const int adjustedExponent = originalExponent + coefficientLength - 1; + if (originalExponent <= 0 && adjustedExponent >= -6) { + if (!originalExponent) { + builder.append(digits); + return builder.toString(); + } + + if (adjustedExponent >= 0) { + for (int i = 0; i < coefficientLength; ++i) { + builder.append(digits[i]); + if (i == adjustedExponent) + builder.append('.'); + } + return builder.toString(); + } + + builder.append("0."); + for (int i = adjustedExponent + 1; i < 0; ++i) + builder.append('0'); + + builder.append(digits); + + } else { + builder.append(digits[0]); + while (coefficientLength >= 2 && digits[coefficientLength - 1] == '0') + --coefficientLength; + if (coefficientLength >= 2) { + builder.append('.'); + for (int i = 1; i < coefficientLength; ++i) + builder.append(digits[i]); + } + + if (adjustedExponent) { + builder.append(adjustedExponent < 0 ? "e" : "e+"); + builder.append(String::number(adjustedExponent)); + } + } + return builder.toString(); +} + +Decimal Decimal::zero(Sign sign) +{ + return Decimal(EncodedData(sign, EncodedData::ClassZero)); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/Decimal.h b/Source/WebCore/platform/Decimal.h new file mode 100644 index 000000000..2ef886200 --- /dev/null +++ b/Source/WebCore/platform/Decimal.h @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Decimal_h +#define Decimal_h + +#include <stdint.h> +#include <wtf/Assertions.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +namespace DecimalPrivate { +class SpecialValueHandler; +} + +// This class represents decimal base floating point number. +// +// FIXME: Once all C++ compiler support decimal type, we should replace this +// class to compiler supported one. See below URI for current status of decimal +// type for C++: // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1977.html +class Decimal { +public: + enum Sign { + Positive, + Negative, + }; + + // You should not use EncodedData other than unit testing. + class EncodedData { + // For accessing FormatClass. + friend class Decimal; + friend class DecimalPrivate::SpecialValueHandler; + public: + EncodedData(Sign, int exponent, uint64_t coefficient); + + bool operator==(const EncodedData&) const; + bool operator!=(const EncodedData& another) const { return !operator==(another); } + + uint64_t coefficient() const { return m_coefficient; } + int countDigits() const; + int exponent() const { return m_exponent; } + bool isFinite() const { return !isSpecial(); } + bool isNaN() const { return m_formatClass == ClassNaN; } + bool isSpecial() const { return m_formatClass == ClassInfinity || m_formatClass == ClassNaN; } + bool isZero() const { return m_formatClass == ClassZero; } + Sign sign() const { return m_sign; } + void setSign(Sign sign) { m_sign = sign; } + + private: + enum FormatClass { + ClassInfinity, + ClassNormal, + ClassNaN, + ClassZero, + }; + + EncodedData(Sign, FormatClass); + FormatClass formatClass() const { return m_formatClass; } + + uint64_t m_coefficient; + int16_t m_exponent; + FormatClass m_formatClass; + Sign m_sign; + }; + + Decimal(int32_t = 0); + Decimal(Sign, int exponent, uint64_t coefficient); + Decimal(const Decimal&); + + Decimal& operator=(const Decimal&); + Decimal& operator+=(const Decimal&); + Decimal& operator-=(const Decimal&); + Decimal& operator*=(const Decimal&); + Decimal& operator/=(const Decimal&); + + Decimal operator-() const; + + bool operator==(const Decimal&) const; + bool operator!=(const Decimal&) const; + bool operator<(const Decimal&) const; + bool operator<=(const Decimal&) const; + bool operator>(const Decimal&) const; + bool operator>=(const Decimal&) const; + + Decimal operator+(const Decimal&) const; + Decimal operator-(const Decimal&) const; + Decimal operator*(const Decimal&) const; + Decimal operator/(const Decimal&) const; + + int exponent() const + { + ASSERT(isFinite()); + return m_data.exponent(); + } + + bool isFinite() const { return m_data.isFinite(); } + bool isNaN() const { return m_data.isNaN(); } + bool isNegative() const { return sign() == Negative; } + bool isPositive() const { return sign() == Positive; } + bool isSpecial() const { return m_data.isSpecial(); } + bool isZero() const { return m_data.isZero(); } + + Decimal abs() const; + Decimal ceiling() const; + Decimal floor() const; + Decimal remainder(const Decimal&) const; + Decimal round() const; + + // Note: toString method supports infinity and nan but fromString not. + String toString() const; + + // fromString supports following syntax EBNF: + // number ::= sign? digit+ ('.' digit*) (exponent-marker sign? digit+)? + // | sign? '.' digit+ (exponent-marker sign? digit+)? + // sign ::= '+' | '-' + // exponent-marker ::= 'e' | 'E' + // digit ::= '0' | '1' | ... | '9' + // Note: fromString doesn't support "infinity" and "nan". + static Decimal fromString(const String&); + static Decimal infinity(Sign); + static Decimal nan(); + static Decimal zero(Sign); + + // You should not use below methods. We expose them for unit testing. + explicit Decimal(const EncodedData&); + const EncodedData& value() const { return m_data; } + +private: + struct AlignedOperands { + uint64_t lhsCoefficient; + uint64_t rhsCoefficient; + int exponent; + }; + + Decimal(double); + Decimal compareTo(const Decimal&) const; + + static AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs); + static inline Sign invertSign(Sign sign) { return sign == Negative ? Positive : Negative; } + + Sign sign() const { return m_data.sign(); } + + EncodedData m_data; +}; + +} // namespace WebCore + +#endif // Decimal_h diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp index 21bb58c19..b140f9c07 100644 --- a/Source/WebCore/platform/LocalizedStrings.cpp +++ b/Source/WebCore/platform/LocalizedStrings.cpp @@ -675,7 +675,7 @@ String crashedPluginText() String insecurePluginVersionText() { - return WEB_UI_STRING("Insecure Plug-In Version", "Label text to be used when an insecure plug-in version was blocked from loading"); + return WEB_UI_STRING("Blocked Plug-in", "Label text to be used when an insecure plug-in version was blocked from loading"); } String multipleFileUploadText(unsigned numberOfFiles) diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp index de2aca671..289c6699b 100755 --- a/Source/WebCore/platform/MIMETypeRegistry.cpp +++ b/Source/WebCore/platform/MIMETypeRegistry.cpp @@ -39,9 +39,9 @@ #include <ApplicationServices/ApplicationServices.h> #include <wtf/RetainPtr.h> #endif -#if PLATFORM(QT) && USE(QT_IMAGE_DECODER) -#include <qimagereader.h> -#include <qimagewriter.h> +#if PLATFORM(QT) +#include <QImageReader> +#include <QImageWriter> #endif #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) @@ -227,22 +227,6 @@ static void initializeSupportedImageMIMETypes() supportedImageMIMETypes->remove("application/pdf"); supportedImageMIMETypes->remove("application/postscript"); -#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER) - QList<QByteArray> formats = QImageReader::supportedImageFormats(); - for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) { -#if ENABLE(SVG) - /* - * Qt has support for SVG, but we want to use KSVG2 - */ - if (formats.at(i).toLower().startsWith("svg")) - continue; -#endif - String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData()); - if (!mimeType.isEmpty()) { - supportedImageMIMETypes->add(mimeType); - supportedImageResourceMIMETypes->add(mimeType); - } - } #else // assume that all implementations at least support the following standard // image types: @@ -259,6 +243,22 @@ static void initializeSupportedImageMIMETypes() supportedImageMIMETypes->add(types[i]); supportedImageResourceMIMETypes->add(types[i]); } + +#if PLATFORM(QT) + QList<QByteArray> formats = QImageReader::supportedImageFormats(); + for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) { +#if ENABLE(SVG) + // Qt has support for SVG, but we want to use KSVG2 + if (formats.at(i).toLower().startsWith("svg")) + continue; +#endif // ENABLE(SVG) + String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData()); + if (!mimeType.isEmpty()) { + supportedImageMIMETypes->add(mimeType); + supportedImageResourceMIMETypes->add(mimeType); + } + } +#endif // PLATFORM(QT) #endif } @@ -283,14 +283,14 @@ static void initializeSupportedImageMIMETypesForEncoding() supportedImageMIMETypesForEncoding->add("image/jpeg"); supportedImageMIMETypesForEncoding->add("image/gif"); #endif -#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER) +#elif PLATFORM(QT) QList<QByteArray> formats = QImageWriter::supportedImageFormats(); for (int i = 0; i < formats.size(); ++i) { String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData()); if (!mimeType.isEmpty()) supportedImageMIMETypesForEncoding->add(mimeType); } -#elif PLATFORM(GTK) || (PLATFORM(QT) && !USE(QT_IMAGE_DECODER)) +#elif PLATFORM(GTK) supportedImageMIMETypesForEncoding->add("image/png"); supportedImageMIMETypesForEncoding->add("image/jpeg"); supportedImageMIMETypesForEncoding->add("image/tiff"); diff --git a/Source/WebCore/platform/MemoryUsageSupport.cpp b/Source/WebCore/platform/MemoryUsageSupport.cpp index 2f06c7639..77eb4f46f 100644 --- a/Source/WebCore/platform/MemoryUsageSupport.cpp +++ b/Source/WebCore/platform/MemoryUsageSupport.cpp @@ -58,4 +58,9 @@ int MemoryUsageSupport::highUsageDeltaMB() return 0; } +bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*) +{ + return false; +} + } // namespace WebCore diff --git a/Source/WebCore/platform/MemoryUsageSupport.h b/Source/WebCore/platform/MemoryUsageSupport.h index 9d12e3740..4f1a0bdd7 100644 --- a/Source/WebCore/platform/MemoryUsageSupport.h +++ b/Source/WebCore/platform/MemoryUsageSupport.h @@ -52,6 +52,11 @@ public: // Delta of memory usage growth (vs. last actualMemoryUsageMB()) // to force GC when memory usage is high. static int highUsageDeltaMB(); + + // Returns private and shared usage, in bytes. Private bytes is the amount of + // memory currently allocated to this process that cannot be shared. Returns + // false on platform specific error conditions. + static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes); }; } // namespace WebCore diff --git a/Source/WebCore/platform/Timer.h b/Source/WebCore/platform/Timer.h index 637bbc055..3a5cd9d6f 100644 --- a/Source/WebCore/platform/Timer.h +++ b/Source/WebCore/platform/Timer.h @@ -109,6 +109,52 @@ inline bool TimerBase::isActive() const return m_nextFireTime; } +template <typename TimerFiredClass> class DeferrableOneShotTimer : private TimerBase { +public: + typedef void (TimerFiredClass::*TimerFiredFunction)(DeferrableOneShotTimer*); + + DeferrableOneShotTimer(TimerFiredClass* o, TimerFiredFunction f, double delay) + : m_object(o) + , m_function(f) + , m_delay(delay) + , m_shouldRestartWhenTimerFires(false) + { + } + + void restart() + { + // Setting this boolean is much more efficient than calling startOneShot + // again, which might result in rescheduling the system timer which + // can be quite expensive. + + if (isActive()) { + m_shouldRestartWhenTimerFires = true; + return; + } + startOneShot(m_delay); + } + + using TimerBase::stop; + using TimerBase::isActive; +private: + virtual void fired() + { + if (m_shouldRestartWhenTimerFires) { + m_shouldRestartWhenTimerFires = false; + startOneShot(m_delay); + return; + } + + (m_object->*m_function)(this); + } + + TimerFiredClass* m_object; + TimerFiredFunction m_function; + + double m_delay; + bool m_shouldRestartWhenTimerFires; +}; + } #endif diff --git a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h index 8f959dcdd..8a1f8870f 100644 --- a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h +++ b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h @@ -70,7 +70,7 @@ public: virtual int showAlertDialog(BlackBerry::WebKit::WebPageClient::AlertType) = 0; virtual bool isActive() const = 0; virtual bool isVisible() const = 0; - virtual WebCore::Credential authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&) = 0; + virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0; }; diff --git a/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp b/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp index 70c4389b9..dcc73e5c2 100644 --- a/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp @@ -905,14 +905,13 @@ Color RenderThemeBlackBerry::platformFocusRingColor() const #if ENABLE(TOUCH_EVENTS) Color RenderThemeBlackBerry::platformTapHighlightColor() const { - // Same color as 'focusRingPen' + 80 of alpha channel. - return Color(163, 200, 254, 80); + return Color(0, 168, 223, 50); } #endif Color RenderThemeBlackBerry::platformActiveSelectionBackgroundColor() const { - return Color(selection); + return Color(0, 168, 223, 50); } double RenderThemeBlackBerry::animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const diff --git a/Source/WebCore/platform/chromium/DragDataChromium.cpp b/Source/WebCore/platform/chromium/DragDataChromium.cpp index 021a6569f..de41342e3 100644 --- a/Source/WebCore/platform/chromium/DragDataChromium.cpp +++ b/Source/WebCore/platform/chromium/DragDataChromium.cpp @@ -38,9 +38,11 @@ #include "KURL.h" #include "NotImplemented.h" #include "PlatformString.h" -#include "PlatformSupport.h" #include "markup.h" +#include <public/Platform.h> +#include <public/WebFileUtilities.h> + namespace WebCore { static bool containsHTML(const ChromiumDataObject* dropData) @@ -60,7 +62,8 @@ String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* if (m_platformDragData->types().contains(mimeTypeTextURIList)) m_platformDragData->urlAndTitle(url, title); else if (filenamePolicy == ConvertFilenames && containsFiles()) { - url = PlatformSupport::filePathToURL(PlatformSupport::getAbsolutePath(m_platformDragData->filenames()[0])); + String path = String(WebKit::Platform::current()->fileUtilities()->getAbsolutePath(m_platformDragData->filenames()[0])); + url = KURL(WebKit::Platform::current()->fileUtilities()->filePathToURL(path)); } return url; } diff --git a/Source/WebCore/platform/chromium/FileSystemChromium.cpp b/Source/WebCore/platform/chromium/FileSystemChromium.cpp index d7ac34c81..21e0937b2 100644 --- a/Source/WebCore/platform/chromium/FileSystemChromium.cpp +++ b/Source/WebCore/platform/chromium/FileSystemChromium.cpp @@ -34,24 +34,27 @@ #include "FileMetadata.h" #include "NotImplemented.h" #include "PlatformString.h" -#include "PlatformSupport.h" + +#include <public/Platform.h> +#include <public/WebFileInfo.h> +#include <public/WebFileUtilities.h> namespace WebCore { bool deleteFile(const String& path) { - return PlatformSupport::deleteFile(path); + return WebKit::Platform::current()->fileUtilities()->deleteFile(path); } bool deleteEmptyDirectory(const String& path) { - return PlatformSupport::deleteEmptyDirectory(path); + return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); } bool getFileSize(const String& path, long long& result) { FileMetadata metadata; - if (!PlatformSupport::getFileMetadata(path, metadata)) + if (!getFileMetadata(path, metadata)) return false; result = metadata.length; return true; @@ -60,7 +63,7 @@ bool getFileSize(const String& path, long long& result) bool getFileModificationTime(const String& path, time_t& result) { FileMetadata metadata; - if (!PlatformSupport::getFileMetadata(path, metadata)) + if (!getFileMetadata(path, metadata)) return false; result = metadata.modificationTime; return true; @@ -68,57 +71,63 @@ bool getFileModificationTime(const String& path, time_t& result) bool getFileMetadata(const String& path, FileMetadata& metadata) { - return PlatformSupport::getFileMetadata(path, metadata); + WebKit::WebFileInfo webFileInfo; + if (!WebKit::Platform::current()->fileUtilities()->getFileInfo(path, webFileInfo)) + return false; + metadata.modificationTime = webFileInfo.modificationTime; + metadata.length = webFileInfo.length; + metadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); + return true; } String directoryName(const String& path) { - return PlatformSupport::directoryName(path); + return WebKit::Platform::current()->fileUtilities()->directoryName(path); } String pathByAppendingComponent(const String& path, const String& component) { - return PlatformSupport::pathByAppendingComponent(path, component); + return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component); } bool makeAllDirectories(const String& path) { - return PlatformSupport::makeAllDirectories(path); + return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path); } bool fileExists(const String& path) { - return PlatformSupport::fileExists(path); + return WebKit::Platform::current()->fileUtilities()->fileExists(path); } PlatformFileHandle openFile(const String& path, FileOpenMode mode) { - return PlatformSupport::openFile(path, mode); + return WebKit::Platform::current()->fileUtilities()->openFile(path, mode); } void closeFile(PlatformFileHandle& handle) { - return PlatformSupport::closeFile(handle); + WebKit::Platform::current()->fileUtilities()->closeFile(handle); } long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) { - return PlatformSupport::seekFile(handle, offset, origin); + return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin); } bool truncateFile(PlatformFileHandle handle, long long offset) { - return PlatformSupport::truncateFile(handle, offset); + return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset); } int readFromFile(PlatformFileHandle handle, char* data, int length) { - return PlatformSupport::readFromFile(handle, data, length); + return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length); } int writeToFile(PlatformFileHandle handle, const char* data, int length) { - return PlatformSupport::writeToFile(handle, data, length); + return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length); } Vector<String> listDirectory(const String& path, const String& filter) diff --git a/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp b/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp index 0c3553eae..d21dece90 100644 --- a/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp +++ b/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp @@ -60,4 +60,9 @@ int MemoryUsageSupport::highUsageDeltaMB() return WebKit::Platform::current()->highUsageDeltaMB(); } +bool MemoryUsageSupport::processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes) +{ + return WebKit::Platform::current()->processMemorySizesInBytes(privateBytes, sharedBytes); +} + } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h index 7800f0cef..c4864b88e 100644 --- a/Source/WebCore/platform/chromium/PlatformSupport.h +++ b/Source/WebCore/platform/chromium/PlatformSupport.h @@ -122,24 +122,6 @@ public: static void deleteCookie(const Document*, const KURL&, const String& cookieName); static bool cookiesEnabled(const Document*); - // File --------------------------------------------------------------- - static bool fileExists(const String&); - static bool deleteFile(const String&); - static bool deleteEmptyDirectory(const String&); - static bool getFileMetadata(const String&, FileMetadata& result); - static String directoryName(const String& path); - static String pathByAppendingComponent(const String& path, const String& component); - static bool makeAllDirectories(const String& path); - static String getAbsolutePath(const String&); - static bool isDirectory(const String&); - static KURL filePathToURL(const String&); - static PlatformFileHandle openFile(const String& path, FileOpenMode); - static void closeFile(PlatformFileHandle&); - static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); - static bool truncateFile(PlatformFileHandle, long long offset); - static int readFromFile(PlatformFileHandle, char* data, int length); - static int writeToFile(PlatformFileHandle, const char* data, int length); - #if ENABLE(FILE_SYSTEM) static PassOwnPtr<AsyncFileSystem> createAsyncFileSystem(); #endif diff --git a/Source/WebCore/platform/chromium/PopupContainer.cpp b/Source/WebCore/platform/chromium/PopupContainer.cpp index 825716d08..b806b3c55 100644 --- a/Source/WebCore/platform/chromium/PopupContainer.cpp +++ b/Source/WebCore/platform/chromium/PopupContainer.cpp @@ -185,13 +185,10 @@ IntRect PopupContainer::layoutAndCalculateWidgetRect(int targetControlHeight, co else m_listBox->setMaxHeight(spaceBelow); layoutAndGetRTLOffset(); - // Our height has changed, so recompute only Y axis of widgetRect. - // We don't have to recompute X axis, so we only replace Y axis - // in widgetRect. - IntRect frameInScreen = chromeClient->rootViewToScreen(frameRect()); - widgetRectInScreen.setY(frameInScreen.y()); - widgetRectInScreen.setHeight(frameInScreen.height()); - // And move upwards if necessary. + // Container height may have changed in layoutAndGetRTLOffset(), + // so set the WebWidget height to the container height. + widgetRectInScreen.setHeight(height()); + // Move WebWidget upwards if necessary. if (spaceAbove > spaceBelow) widgetRectInScreen.move(0, -(widgetRectInScreen.height() + targetControlHeight)); } diff --git a/Source/WebCore/platform/chromium/PopupListBox.cpp b/Source/WebCore/platform/chromium/PopupListBox.cpp index d437bc882..0d4c0ef05 100644 --- a/Source/WebCore/platform/chromium/PopupListBox.cpp +++ b/Source/WebCore/platform/chromium/PopupListBox.cpp @@ -632,7 +632,7 @@ int PopupListBox::getRowHeight(int index) { int scale = m_settings.defaultDeviceScaleFactor; int paddingForTouch = 0; - if (RuntimeEnabledFeatures::touchEnabled()) + if (m_settings.deviceSupportsTouch) paddingForTouch = PopupMenuChromium::optionPaddingForTouch(); if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone()) return PopupMenuChromium::minimumRowHeight() * scale; diff --git a/Source/WebCore/platform/chromium/PopupListBox.h b/Source/WebCore/platform/chromium/PopupListBox.h index b685313cc..c7309e5e8 100644 --- a/Source/WebCore/platform/chromium/PopupListBox.h +++ b/Source/WebCore/platform/chromium/PopupListBox.h @@ -80,7 +80,13 @@ struct PopupContainerSettings { // Autocomplete popups are restricted, combo-boxes (select tags) aren't. bool restrictWidthOfListBox; + // The default device scale factor of the screen used to draw the menu + // at this scale suitable for the device DPI. int defaultDeviceScaleFactor; + + // If the device is a touch screen we increase the height of menu items + // to make it easier to unambiguously touch them. + bool deviceSupportsTouch; }; // A container for the data for each menu item (e.g. represented by <option> diff --git a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp index 62e1008fb..daca45bea 100644 --- a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -66,17 +66,18 @@ PopupMenuChromium::~PopupMenuChromium() hide(); } -void PopupMenuChromium::show(const IntRect& r, FrameView* v, int index) +void PopupMenuChromium::show(const IntRect& rect, FrameView* frameView, int index) { if (!p.popup) { + Settings* settings = frameView->frame()->page()->settings(); PopupContainerSettings popupSettings = dropDownSettings; - popupSettings.defaultDeviceScaleFactor = - v->frame()->page()->settings()->defaultDeviceScaleFactor(); + popupSettings.defaultDeviceScaleFactor = settings->defaultDeviceScaleFactor(); if (!popupSettings.defaultDeviceScaleFactor) popupSettings.defaultDeviceScaleFactor = 1; + popupSettings.deviceSupportsTouch = settings->deviceSupportsTouch(); p.popup = PopupContainer::create(client(), PopupContainer::Select, popupSettings); } - p.popup->showInRect(r, v, index); + p.popup->showInRect(rect, frameView, index); } void PopupMenuChromium::hide() diff --git a/Source/WebCore/platform/chromium/Prerender.cpp b/Source/WebCore/platform/chromium/Prerender.cpp index 933a8aa71..0ece44056 100644 --- a/Source/WebCore/platform/chromium/Prerender.cpp +++ b/Source/WebCore/platform/chromium/Prerender.cpp @@ -47,9 +47,6 @@ Prerender::Prerender(const KURL& url, const String& referrer, ReferrerPolicy pol : m_url(url) , m_referrer(referrer) , m_referrerPolicy(policy) -#ifndef NDEBUG - , m_state(Inactive) -#endif { } @@ -57,24 +54,13 @@ Prerender::~Prerender() { } -void Prerender::setState(State state) -{ -#ifdef NDEBUG - UNUSED_PARAM(state); -#else - m_state = state; -#endif -} - void Prerender::add() { - ASSERT(m_state == Inactive); WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current(); if (!platform) return; WebKit::WebPrerender webPrerender(this); platform->add(webPrerender); - setState(Active); } void Prerender::cancel() @@ -83,10 +69,8 @@ void Prerender::cancel() WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current(); if (!platform) return; - ASSERT(m_state == Active); WebKit::WebPrerender webPrerender(this); platform->cancel(webPrerender); - setState(Inactive); } void Prerender::abandon() @@ -94,12 +78,8 @@ void Prerender::abandon() WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current(); if (!platform) return; - // FIXME: Assert on the state as Inactive here. It is currently common to call abandon() on an Inactive - // prerender, as the Prerenderer doesn't keep track of which prerenders are active, and so any page that - // ever had a now-canceled Prerender will get this bogus stop() call. WebKit::WebPrerender webPrerender(this); platform->abandon(webPrerender); - setState(Inactive); } void Prerender::suspend() diff --git a/Source/WebCore/platform/chromium/Prerender.h b/Source/WebCore/platform/chromium/Prerender.h index 9465b22ca..ce4ccc7fa 100644 --- a/Source/WebCore/platform/chromium/Prerender.h +++ b/Source/WebCore/platform/chromium/Prerender.h @@ -71,22 +71,11 @@ public: ExtraData* extraData() { return m_extraData.get(); } private: - enum State { - Inactive, - Active, - }; - - void setState(State); - const KURL m_url; const String m_referrer; const ReferrerPolicy m_referrerPolicy; RefPtr<ExtraData> m_extraData; - -#ifndef NDEBUG - State m_state; -#endif }; } diff --git a/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp b/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp new file mode 100644 index 000000000..12bd00b26 --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebTransformOperations.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <public/WebTransformOperations.h> + +#include <wtf/Vector.h> + +namespace WebKit { + +struct WebTransformOperation { + enum Type { + WebTransformOperationTranslate, + WebTransformOperationRotate, + WebTransformOperationScale, + WebTransformOperationSkew, + WebTransformOperationPerspective, + WebTransformOperationMatrix + }; + + Type type; + WebTransformationMatrix matrix; +}; + +class WebTransformOperationsPrivate { +public: + Vector<WebTransformOperation> operations; +}; + +WebTransformationMatrix WebTransformOperations::apply() const +{ + WebTransformationMatrix toReturn; + for (size_t i = 0; i < m_private->operations.size(); ++i) + toReturn.multiply(m_private->operations[i].matrix); + return toReturn; +} + +WebTransformationMatrix WebTransformOperations::blend(const WebTransformOperations& from, double progress) const +{ + WebTransformationMatrix toReturn; + if (matchesTypes(from)) { + for (size_t i = 0; i < m_private->operations.size(); ++i) { + WebTransformationMatrix blended = m_private->operations[i].matrix; + blended.blend(from.m_private->operations[i].matrix, progress); + toReturn.multiply(blended); + } + } else { + toReturn = apply(); + WebTransformationMatrix fromTransform = from.apply(); + toReturn.blend(fromTransform, progress); + } + return toReturn; +} + +bool WebTransformOperations::matchesTypes(const WebTransformOperations& other) const +{ + if (m_private->operations.size() != other.m_private->operations.size()) + return false; + + for (size_t i = 0; i < m_private->operations.size(); ++i) { + if (m_private->operations[i].type != other.m_private->operations[i].type) + return false; + } + + return true; +} + +void WebTransformOperations::appendTranslate(double x, double y, double z) +{ + WebTransformOperation toAdd; + toAdd.matrix.translate3d(x, y, z); + toAdd.type = WebTransformOperation::WebTransformOperationTranslate; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::appendRotate(double x, double y, double z, double degrees) +{ + WebTransformOperation toAdd; + toAdd.matrix.rotate3d(x, y, z, degrees); + toAdd.type = WebTransformOperation::WebTransformOperationRotate; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::appendScale(double x, double y, double z) +{ + WebTransformOperation toAdd; + toAdd.matrix.scale3d(x, y, z); + toAdd.type = WebTransformOperation::WebTransformOperationScale; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::appendSkew(double x, double y) +{ + WebTransformOperation toAdd; + toAdd.matrix.skewX(x); + toAdd.matrix.skewY(y); + toAdd.type = WebTransformOperation::WebTransformOperationSkew; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::appendPerspective(double depth) +{ + WebTransformOperation toAdd; + toAdd.matrix.applyPerspective(depth); + toAdd.type = WebTransformOperation::WebTransformOperationPerspective; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::appendMatrix(const WebTransformationMatrix& matrix) +{ + WebTransformOperation toAdd; + toAdd.matrix = matrix; + toAdd.type = WebTransformOperation::WebTransformOperationMatrix; + m_private->operations.append(toAdd); +} + +void WebTransformOperations::reset() +{ + m_private.reset(0); +} + +void WebTransformOperations::initialize() +{ + m_private.reset(new WebTransformOperationsPrivate); +} + +void WebTransformOperations::initialize(const WebTransformOperations& other) +{ + if (m_private.get() != other.m_private.get()) + m_private.reset(new WebTransformOperationsPrivate(*other.m_private.get())); + else + initialize(); +} + +} // namespace WebKit diff --git a/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp b/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp index bc86a5e2e..eefd154e8 100644 --- a/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp +++ b/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp @@ -32,44 +32,43 @@ using namespace WebCore; namespace WebKit { -// FIXME: The overhead of allocating a new TransformationMatrix in these constructors needs to go away as soon -// as possible. - WebTransformationMatrix::WebTransformationMatrix() - : m_private(new TransformationMatrix()) + : m_private() { } WebTransformationMatrix::WebTransformationMatrix(double a, double b, double c, double d, double e, double f) - : m_private(new TransformationMatrix(a, b, c, d, e, f)) + : m_private(a, b, c, d, e, f) { } -WebTransformationMatrix::WebTransformationMatrix(const WebTransformationMatrix& t) - : m_private(new TransformationMatrix(*t.m_private.get())) +WebTransformationMatrix::WebTransformationMatrix(double m11, double m12, double m13, double m14, + double m21, double m22, double m23, double m24, + double m31, double m32, double m33, double m34, + double m41, double m42, double m43, double m44) + : m_private(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) { } -WebTransformationMatrix::WebTransformationMatrix(const TransformationMatrix& t) - : m_private(new TransformationMatrix(t)) +WebTransformationMatrix::WebTransformationMatrix(const WebTransformationMatrix& t) + : m_private(t.m_private) { } -void WebTransformationMatrix::reset() +WebTransformationMatrix::WebTransformationMatrix(const TransformationMatrix& t) + : m_private(t) { - m_private.reset(0); } WebTransformationMatrix& WebTransformationMatrix::operator=(const WebTransformationMatrix& t) { - *m_private.get() = *t.m_private.get(); + m_private = t.m_private; return *this; } bool WebTransformationMatrix::operator==(const WebTransformationMatrix& t) const { - bool isEqual = (*m_private.get() == *t.m_private.get()); - return isEqual; + return m_private == t.m_private; } WebTransformationMatrix WebTransformationMatrix::operator*(const WebTransformationMatrix& t) const @@ -82,380 +81,380 @@ WebTransformationMatrix WebTransformationMatrix::operator*(const WebTransformati WebTransformationMatrix WebTransformationMatrix::inverse() const { WebTransformationMatrix result; - *result.m_private.get() = m_private->inverse(); + result.m_private = m_private.inverse(); return result; } WebTransformationMatrix WebTransformationMatrix::to2dTransform() const { WebTransformationMatrix result; - *result.m_private.get() = m_private->to2dTransform(); + result.m_private = m_private.to2dTransform(); return result; } void WebTransformationMatrix::multiply(const WebTransformationMatrix& t) { - m_private->multiply(*t.m_private.get()); + m_private.multiply(t.m_private); } void WebTransformationMatrix::makeIdentity() { - m_private->makeIdentity(); + m_private.makeIdentity(); } void WebTransformationMatrix::translate(double tx, double ty) { - m_private->translate(tx, ty); + m_private.translate(tx, ty); } void WebTransformationMatrix::translate3d(double tx, double ty, double tz) { - m_private->translate3d(tx, ty, tz); + m_private.translate3d(tx, ty, tz); } void WebTransformationMatrix::translateRight3d(double tx, double ty, double tz) { - m_private->translateRight3d(tx, ty, tz); + m_private.translateRight3d(tx, ty, tz); } void WebTransformationMatrix::scale(double s) { - m_private->scale(s); + m_private.scale(s); } void WebTransformationMatrix::scaleNonUniform(double sx, double sy) { - m_private->scaleNonUniform(sx, sy); + m_private.scaleNonUniform(sx, sy); } void WebTransformationMatrix::scale3d(double sx, double sy, double sz) { - m_private->scale3d(sx, sy, sz); + m_private.scale3d(sx, sy, sz); } void WebTransformationMatrix::rotate(double angle) { - m_private->rotate(angle); + m_private.rotate(angle); } void WebTransformationMatrix::rotate3d(double rx, double ry, double rz) { - m_private->rotate3d(rx, ry, rz); + m_private.rotate3d(rx, ry, rz); } void WebTransformationMatrix::rotate3d(double x, double y, double z, double angle) { - m_private->rotate3d(x, y, z, angle); + m_private.rotate3d(x, y, z, angle); } void WebTransformationMatrix::skewX(double angle) { - m_private->skewX(angle); + m_private.skewX(angle); } void WebTransformationMatrix::skewY(double angle) { - m_private->skewY(angle); + m_private.skewY(angle); } void WebTransformationMatrix::applyPerspective(double p) { - m_private->applyPerspective(p); + m_private.applyPerspective(p); } void WebTransformationMatrix::blend(const WebTransformationMatrix& from, double progress) { - m_private->blend(*from.m_private.get(), progress); + m_private.blend(from.m_private, progress); } bool WebTransformationMatrix::hasPerspective() const { - return m_private->hasPerspective(); + return m_private.hasPerspective(); } bool WebTransformationMatrix::isInvertible() const { - return m_private->isInvertible(); + return m_private.isInvertible(); } bool WebTransformationMatrix::isBackFaceVisible() const { - return m_private->isBackFaceVisible(); + return m_private.isBackFaceVisible(); } bool WebTransformationMatrix::isIdentity() const { - return m_private->isIdentity(); + return m_private.isIdentity(); } bool WebTransformationMatrix::isIdentityOrTranslation() const { - return m_private->isIdentityOrTranslation(); + return m_private.isIdentityOrTranslation(); } bool WebTransformationMatrix::isIntegerTranslation() const { - return m_private->isIntegerTranslation(); + return m_private.isIntegerTranslation(); } double WebTransformationMatrix::m11() const { - return m_private->m11(); + return m_private.m11(); } void WebTransformationMatrix::setM11(double f) { - m_private->setM11(f); + m_private.setM11(f); } double WebTransformationMatrix::m12() const { - return m_private->m12(); + return m_private.m12(); } void WebTransformationMatrix::setM12(double f) { - m_private->setM12(f); + m_private.setM12(f); } double WebTransformationMatrix::m13() const { - return m_private->m13(); + return m_private.m13(); } void WebTransformationMatrix::setM13(double f) { - m_private->setM13(f); + m_private.setM13(f); } double WebTransformationMatrix::m14() const { - return m_private->m14(); + return m_private.m14(); } void WebTransformationMatrix::setM14(double f) { - m_private->setM14(f); + m_private.setM14(f); } double WebTransformationMatrix::m21() const { - return m_private->m21(); + return m_private.m21(); } void WebTransformationMatrix::setM21(double f) { - m_private->setM21(f); + m_private.setM21(f); } double WebTransformationMatrix::m22() const { - return m_private->m22(); + return m_private.m22(); } void WebTransformationMatrix::setM22(double f) { - m_private->setM22(f); + m_private.setM22(f); } double WebTransformationMatrix::m23() const { - return m_private->m23(); + return m_private.m23(); } void WebTransformationMatrix::setM23(double f) { - m_private->setM23(f); + m_private.setM23(f); } double WebTransformationMatrix::m24() const { - return m_private->m24(); + return m_private.m24(); } void WebTransformationMatrix::setM24(double f) { - m_private->setM24(f); + m_private.setM24(f); } double WebTransformationMatrix::m31() const { - return m_private->m31(); + return m_private.m31(); } void WebTransformationMatrix::setM31(double f) { - m_private->setM31(f); + m_private.setM31(f); } double WebTransformationMatrix::m32() const { - return m_private->m32(); + return m_private.m32(); } void WebTransformationMatrix::setM32(double f) { - m_private->setM32(f); + m_private.setM32(f); } double WebTransformationMatrix::m33() const { - return m_private->m33(); + return m_private.m33(); } void WebTransformationMatrix::setM33(double f) { - m_private->setM33(f); + m_private.setM33(f); } double WebTransformationMatrix::m34() const { - return m_private->m34(); + return m_private.m34(); } void WebTransformationMatrix::setM34(double f) { - m_private->setM34(f); + m_private.setM34(f); } double WebTransformationMatrix::m41() const { - return m_private->m41(); + return m_private.m41(); } void WebTransformationMatrix::setM41(double f) { - m_private->setM41(f); + m_private.setM41(f); } double WebTransformationMatrix::m42() const { - return m_private->m42(); + return m_private.m42(); } void WebTransformationMatrix::setM42(double f) { - m_private->setM42(f); + m_private.setM42(f); } double WebTransformationMatrix::m43() const { - return m_private->m43(); + return m_private.m43(); } void WebTransformationMatrix::setM43(double f) { - m_private->setM43(f); + m_private.setM43(f); } double WebTransformationMatrix::m44() const { - return m_private->m44(); + return m_private.m44(); } void WebTransformationMatrix::setM44(double f) { - m_private->setM44(f); + m_private.setM44(f); } double WebTransformationMatrix::a() const { - return m_private->a(); + return m_private.a(); } void WebTransformationMatrix::setA(double a) { - m_private->setA(a); + m_private.setA(a); } double WebTransformationMatrix::b() const { - return m_private->b(); + return m_private.b(); } void WebTransformationMatrix::setB(double b) { - m_private->setB(b); + m_private.setB(b); } double WebTransformationMatrix::c() const { - return m_private->c(); + return m_private.c(); } void WebTransformationMatrix::setC(double c) { - m_private->setC(c); + m_private.setC(c); } double WebTransformationMatrix::d() const { - return m_private->d(); + return m_private.d(); } void WebTransformationMatrix::setD(double d) { - m_private->setD(d); + m_private.setD(d); } double WebTransformationMatrix::e() const { - return m_private->e(); + return m_private.e(); } void WebTransformationMatrix::setE(double e) { - m_private->setE(e); + m_private.setE(e); } double WebTransformationMatrix::f() const { - return m_private->f(); + return m_private.f(); } void WebTransformationMatrix::setF(double f) { - m_private->setF(f); + m_private.setF(f); } -TransformationMatrix& WebTransformationMatrix::toWebCoreTransform() const +TransformationMatrix WebTransformationMatrix::toWebCoreTransform() const { - return *m_private.get(); + return m_private; } FloatRect WebTransformationMatrix::mapRect(const FloatRect& rect) const { - return m_private->mapRect(rect); + return m_private.mapRect(rect); } IntRect WebTransformationMatrix::mapRect(const IntRect& rect) const { - return m_private->mapRect(rect); + return m_private.mapRect(rect); } FloatPoint3D WebTransformationMatrix::mapPoint(const FloatPoint3D& p) const { - return m_private->mapPoint(p); + return m_private.mapPoint(p); } FloatPoint WebTransformationMatrix::mapPoint(const FloatPoint& p) const { - return m_private->mapPoint(p); + return m_private.mapPoint(p); } IntPoint WebTransformationMatrix::mapPoint(const IntPoint& p) const { - return m_private->mapPoint(p); + return m_private.mapPoint(p); } FloatQuad WebTransformationMatrix::mapQuad(const FloatQuad& quad) const { - return m_private->mapQuad(quad); + return m_private.mapQuad(quad); } FloatPoint WebTransformationMatrix::projectPoint(const FloatPoint& p, bool* clamped) const { - return m_private->projectPoint(p, clamped); + return m_private.projectPoint(p, clamped); } } // namespace WebKit diff --git a/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp b/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp index 16b2c6ad9..65c7b4968 100644 --- a/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp +++ b/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp @@ -215,22 +215,6 @@ String keyIdentifierForEvasKeyName(const String& keyName) return keyName; } -String singleCharacterString(const String& keyName) -{ - if (keyName == "Return") - return String("\r"); - if (keyName == "BackSpace") - return String("\x8"); - if (keyName == "Tab") - return String("\t"); - if (keyName == "Print") - return String(""); - if (keyName == "Escape") - return String("\x1b"); - - return keyName; -} - int windowsKeyCodeForEvasKeyName(const String& keyName) { if (windowsKeyMap().isEmpty()) diff --git a/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp b/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp index 7487948d2..dc7969969 100644 --- a/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp +++ b/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp @@ -42,8 +42,8 @@ namespace WebCore { PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* event) : PlatformEvent(PlatformEvent::KeyDown, evas_key_modifier_is_set(event->modifiers, "Shift"), evas_key_modifier_is_set(event->modifiers, "Control"), evas_key_modifier_is_set(event->modifiers, "Alt"), evas_key_modifier_is_set(event->modifiers, "Meta"), currentTime()) - , m_text(singleCharacterString(String::fromUTF8(event->string))) - , m_unmodifiedText(singleCharacterString(String::fromUTF8(event->string))) + , m_text(String::fromUTF8(event->string)) + , m_unmodifiedText(String::fromUTF8(event->string)) , m_keyIdentifier(keyIdentifierForEvasKeyName(String(event->key))) , m_windowsVirtualKeyCode(windowsKeyCodeForEvasKeyName(String(event->key))) , m_nativeVirtualKeyCode(0) @@ -56,8 +56,8 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* event) PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Up* event) : PlatformEvent(PlatformEvent::KeyUp, evas_key_modifier_is_set(event->modifiers, "Shift"), evas_key_modifier_is_set(event->modifiers, "Control"), evas_key_modifier_is_set(event->modifiers, "Alt"), evas_key_modifier_is_set(event->modifiers, "Meta"), currentTime()) - , m_text(singleCharacterString(String::fromUTF8(event->string))) - , m_unmodifiedText(singleCharacterString(String::fromUTF8(event->string))) + , m_text(String::fromUTF8(event->string)) + , m_unmodifiedText(String::fromUTF8(event->string)) , m_keyIdentifier(keyIdentifierForEvasKeyName(String(event->key))) , m_windowsVirtualKeyCode(windowsKeyCodeForEvasKeyName(String(event->key))) , m_nativeVirtualKeyCode(0) diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index 68a7eaa93..8766f6578 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -295,7 +295,8 @@ void RenderThemeEfl::applyEdjeStateFromForm(Evas_Object* object, ControlStates s "read-only", "default", "window-inactive", - "indeterminate" + "indeterminate", + "spinup" }; edje_object_signal_emit(object, "reset", ""); @@ -579,6 +580,7 @@ const char* RenderThemeEfl::edjeGroupFromFormType(FormType type) const W("mediacontrol/seekbackward_button"), W("mediacontrol/fullscreen_button"), #endif + W("spinner"), #undef W 0 }; @@ -983,6 +985,20 @@ bool RenderThemeEfl::paintSearchField(RenderObject* object, const PaintInfo& inf return paintThemePart(object, SearchField, info, rect); } +void RenderThemeEfl::adjustInnerSpinButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const +{ + if (!m_page && element && element->document()->page()) { + static_cast<RenderThemeEfl*>(element->document()->page()->theme())->adjustInnerSpinButtonStyle(styleResolver, style, element); + return; + } + adjustSizeConstraints(style, Spinner); +} + +bool RenderThemeEfl::paintInnerSpinButton(RenderObject* object, const PaintInfo& info, const IntRect& rect) +{ + return paintThemePart(object, Spinner, info, rect); +} + void RenderThemeEfl::setDefaultFontSize(int size) { defaultFontSize = size; diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h index 7e0ff3930..a31598e9e 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.h +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -65,6 +65,7 @@ enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType() SeekBackwardButton, FullScreenButton, #endif + Spinner, FormTypeLast }; @@ -162,6 +163,9 @@ public: virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const; + virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); + static void setDefaultFontSize(int fontsize); #if ENABLE(PROGRESS_TAG) diff --git a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp index dd706b00f..f337dd0e7 100644 --- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp +++ b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp @@ -90,4 +90,10 @@ void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicRatio = FloatSize(); } +void GeneratorGeneratedImage::invalidateCacheTimerFired(DeferrableOneShotTimer<GeneratorGeneratedImage>*) +{ + m_cachedImageBuffer.clear(); + m_cachedAdjustedSize = IntSize(); +} + } diff --git a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h index f3b9595d3..55ac38d3a 100644 --- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h +++ b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h @@ -58,49 +58,19 @@ protected: virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect); + void invalidateCacheTimerFired(DeferrableOneShotTimer<GeneratorGeneratedImage>*); + GeneratorGeneratedImage(PassRefPtr<Generator> generator, const IntSize& size) : m_generator(generator) - , m_cacheTimer(this) + , m_cacheTimer(this, &GeneratorGeneratedImage::invalidateCacheTimerFired, generatedImageCacheClearDelay) { m_size = size; } - - class GeneratedImageCacheTimer : public TimerBase { - public: - GeneratedImageCacheTimer(GeneratorGeneratedImage * parent) - : m_shouldRestartWhenTimerFires(false) - , m_parent(parent) { } - - void restart() - { - if (isActive()) { - m_shouldRestartWhenTimerFires = true; - return; - } - startOneShot(generatedImageCacheClearDelay); - }; - private: - virtual void fired() OVERRIDE - { - if (m_shouldRestartWhenTimerFires) { - m_shouldRestartWhenTimerFires = false; - startOneShot(generatedImageCacheClearDelay); - return; - } - - if (m_parent) { - m_parent->m_cachedImageBuffer.clear(); - m_parent->m_cachedAdjustedSize = IntSize(); - } - }; - bool m_shouldRestartWhenTimerFires; - GeneratorGeneratedImage* m_parent; - }; RefPtr<Generator> m_generator; OwnPtr<ImageBuffer> m_cachedImageBuffer; - GeneratedImageCacheTimer m_cacheTimer; + DeferrableOneShotTimer<GeneratorGeneratedImage> m_cacheTimer; IntSize m_cachedAdjustedSize; unsigned m_cachedGeneratorHash; }; diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 692da56a5..b0bc5c009 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -68,7 +68,7 @@ typedef unsigned int GLuint; #if PLATFORM(MAC) typedef CGLContextObj PlatformGraphicsContext3D; #elif PLATFORM(QT) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) typedef QOpenGLContext* PlatformGraphicsContext3D; typedef QSurface* PlatformGraphicsSurface3D; #else diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index bb7d3f73c..0ace7ac20 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -167,6 +167,23 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo startAnimation(); } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) +FloatRect Image::adjustSourceRectForDownSampling(const FloatRect& srcRect, const IntSize& scaledSize) const +{ + const IntSize unscaledSize = size(); + if (unscaledSize == scaledSize) + return srcRect; + + // Image has been down-sampled. + float xscale = static_cast<float>(scaledSize.width()) / unscaledSize.width(); + float yscale = static_cast<float>(scaledSize.height()) / unscaledSize.height(); + FloatRect scaledSrcRect = srcRect; + scaledSrcRect.scale(xscale, yscale); + + return scaledSrcRect; +} +#endif + void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) { intrinsicRatio = size(); diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h index b78fc7d81..3ff48236a 100644 --- a/Source/WebCore/platform/graphics/Image.h +++ b/Source/WebCore/platform/graphics/Image.h @@ -163,6 +163,10 @@ public: virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + FloatRect adjustSourceRectForDownSampling(const FloatRect& srcRect, const IntSize& scaledSize) const; +#endif + #if !ASSERT_DISABLED virtual bool notSolidColor() { return true; } #endif diff --git a/Source/WebCore/platform/graphics/ImageSource.cpp b/Source/WebCore/platform/graphics/ImageSource.cpp index ff9fe0d9f..75ed5a1a2 100644 --- a/Source/WebCore/platform/graphics/ImageSource.cpp +++ b/Source/WebCore/platform/graphics/ImageSource.cpp @@ -29,11 +29,7 @@ #include "config.h" #include "ImageSource.h" -#if PLATFORM(QT) -#include "ImageDecoderQt.h" -#else #include "ImageDecoder.h" -#endif #include "ImageOrientation.h" #include "NotImplemented.h" diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h index 6d01c8605..ed625bc66 100644 --- a/Source/WebCore/platform/graphics/ImageSource.h +++ b/Source/WebCore/platform/graphics/ImageSource.h @@ -70,10 +70,6 @@ class ImageDecoder; class TiledImageOpenVG; typedef ImageDecoder* NativeImageSourcePtr; typedef TiledImageOpenVG* NativeImagePtr; -#elif PLATFORM(QT) -class ImageDecoderQt; -typedef ImageDecoderQt* NativeImageSourcePtr; -typedef QPixmap* NativeImagePtr; #else class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; @@ -93,6 +89,8 @@ typedef RefPtr<SharedBitmap> NativeImagePtr; class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; typedef void* NativeImagePtr; +#elif PLATFORM(QT) +typedef QPixmap* NativeImagePtr; #endif #endif diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp index af30eb123..9357330e4 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -131,7 +131,7 @@ public: virtual PassRefPtr<TimeRanges> buffered() const { return TimeRanges::create(); } virtual unsigned totalBytes() const { return 0; } - virtual unsigned bytesLoaded() const { return 0; } + virtual bool didLoadingProgress() const { return false; } virtual void setSize(const IntSize&) { } @@ -681,9 +681,9 @@ float MediaPlayer::maxTimeSeekable() return m_private->maxTimeSeekable(); } -unsigned MediaPlayer::bytesLoaded() +bool MediaPlayer::didLoadingProgress() { - return m_private->bytesLoaded(); + return m_private->didLoadingProgress(); } void MediaPlayer::setSize(const IntSize& size) diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index a03ade71c..516f2fe98 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -278,7 +278,7 @@ public: PassRefPtr<TimeRanges> seekable(); float maxTimeSeekable(); - unsigned bytesLoaded(); + bool didLoadingProgress(); float volume() const; void setVolume(float); diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h index f76d49e23..085278e3e 100644 --- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h +++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h @@ -96,7 +96,7 @@ public: virtual float maxTimeSeekable() const = 0; virtual PassRefPtr<TimeRanges> buffered() const = 0; - virtual unsigned bytesLoaded() const = 0; + virtual bool didLoadingProgress() const = 0; virtual void setSize(const IntSize&) = 0; diff --git a/Source/WebCore/platform/graphics/OpenGLShims.cpp b/Source/WebCore/platform/graphics/OpenGLShims.cpp index f59f26c60..a23dc6895 100644 --- a/Source/WebCore/platform/graphics/OpenGLShims.cpp +++ b/Source/WebCore/platform/graphics/OpenGLShims.cpp @@ -42,7 +42,7 @@ OpenGLFunctionTable* openGLFunctionTable() #if PLATFORM(QT) static void* getProcAddress(const char* procName) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) return reinterpret_cast<void*>(QOpenGLContext::currentContext()->getProcAddress(procName)); #else return reinterpret_cast<void*>(QGLContext::currentContext()->getProcAddress(QString::fromLatin1(procName))); diff --git a/Source/WebCore/platform/graphics/OpenGLShims.h b/Source/WebCore/platform/graphics/OpenGLShims.h index 1d5f37d9e..706f17d9b 100644 --- a/Source/WebCore/platform/graphics/OpenGLShims.h +++ b/Source/WebCore/platform/graphics/OpenGLShims.h @@ -22,7 +22,7 @@ #if PLATFORM(QT) #include <qglobal.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <qopenglfunctions.h> #include <QOpenGLContext> #include <QSurface> diff --git a/Source/WebCore/platform/graphics/Path.cpp b/Source/WebCore/platform/graphics/Path.cpp index 52153e571..97960f4b6 100644 --- a/Source/WebCore/platform/graphics/Path.cpp +++ b/Source/WebCore/platform/graphics/Path.cpp @@ -105,13 +105,20 @@ void Path::addRoundedRect(const FloatRect& rect, const FloatSize& roundingRadii, FloatSize radius(roundingRadii); FloatSize halfSize(rect.width() / 2, rect.height() / 2); - // If rx is greater than half of the width of the rectangle - // then set rx to half of the width (required in SVG spec) + // Apply the SVG corner radius constraints, per the rect section of the SVG shapes spec: if + // one of rx,ry is negative, then the other corner radius value is used. If both values are + // negative then rx = ry = 0. If rx is greater than half of the width of the rectangle + // then set rx to half of the width; ry is handled similarly. + + if (radius.width() < 0) + radius.setWidth((radius.height() < 0) ? 0 : radius.height()); + + if (radius.height() < 0) + radius.setHeight(radius.width()); + if (radius.width() > halfSize.width()) radius.setWidth(halfSize.width()); - // If ry is greater than half of the height of the rectangle - // then set ry to half of the height (required in SVG spec) if (radius.height() > halfSize.height()) radius.setHeight(halfSize.height()); diff --git a/Source/WebCore/platform/graphics/Path.h b/Source/WebCore/platform/graphics/Path.h index 96c810425..a33ab4c8b 100644 --- a/Source/WebCore/platform/graphics/Path.h +++ b/Source/WebCore/platform/graphics/Path.h @@ -159,6 +159,10 @@ namespace WebCore { void platformAddPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius); #endif +#if PLATFORM(BLACKBERRY) + Path(const SkPath&); +#endif + private: PlatformPathPtr m_path; }; diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp index 8f3a8dffb..73134ed2a 100644 --- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp +++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp @@ -57,6 +57,7 @@ MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(MediaPlayer* play , m_cachedMaxTimeSeekable(0) , m_cachedDuration(invalidTime()) , m_reportedDuration(invalidTime()) + , m_maxTimeLoadedAtLastDidLoadingProgress(invalidTime()) , m_seekTo(invalidTime()) , m_requestedRate(1) , m_delayCallbacks(0) @@ -366,14 +367,15 @@ float MediaPlayerPrivateAVFoundation::maxTimeLoaded() const return m_cachedMaxTimeLoaded; } -unsigned MediaPlayerPrivateAVFoundation::bytesLoaded() const +bool MediaPlayerPrivateAVFoundation::didLoadingProgress() const { - float dur = duration(); - if (!dur) - return 0; - unsigned loaded = totalBytes() * maxTimeLoaded() / dur; - LOG(Media, "MediaPlayerPrivateAVFoundation::bytesLoaded(%p) - returning %i", this, loaded); - return loaded; + if (!duration() || !totalBytes()) + return false; + float currentMaxTimeLoaded = maxTimeLoaded(); + bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; + m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded; + LOG(Media, "MediaPlayerPrivateAVFoundation::didLoadingProgress(%p) - returning %d", this, didLoadingProgress); + return didLoadingProgress; } bool MediaPlayerPrivateAVFoundation::isReadyForVideoSetup() const diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h index 72302346f..63fe6aa4e 100644 --- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h +++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h @@ -140,7 +140,7 @@ protected: virtual MediaPlayer::ReadyState readyState() const { return m_readyState; } virtual float maxTimeSeekable() const; virtual PassRefPtr<TimeRanges> buffered() const; - virtual unsigned bytesLoaded() const; + virtual bool didLoadingProgress() const; virtual void setSize(const IntSize&); virtual void paint(GraphicsContext*, const IntRect&) = 0; virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) = 0; @@ -263,7 +263,7 @@ private: mutable float m_cachedMaxTimeSeekable; mutable float m_cachedDuration; float m_reportedDuration; - + mutable float m_maxTimeLoadedAtLastDidLoadingProgress; float m_seekTo; float m_requestedRate; mutable int m_delayCallbacks; diff --git a/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp index 7ef896d1c..4d4a2ca20 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp +++ b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp @@ -36,6 +36,7 @@ #include "LayerCompositingThread.h" +#include "LayerCompositingThreadClient.h" #include "LayerMessage.h" #include "LayerRenderer.h" #include "LayerWebKitThread.h" @@ -54,12 +55,22 @@ namespace WebCore { -PassRefPtr<LayerCompositingThread> LayerCompositingThread::create(LayerType type, PassRefPtr<LayerTiler> tiler) +void LayerOverride::removeAnimation(const String& name) { - return adoptRef(new LayerCompositingThread(type, tiler)); + for (size_t i = 0; i < m_animations.size(); ++i) { + if (m_animations[i]->name() == name) { + m_animations.remove(i); + return; + } + } } -LayerCompositingThread::LayerCompositingThread(LayerType type, PassRefPtr<LayerTiler> tiler) +PassRefPtr<LayerCompositingThread> LayerCompositingThread::create(LayerType type, LayerCompositingThreadClient* client) +{ + return adoptRef(new LayerCompositingThread(type, client)); +} + +LayerCompositingThread::LayerCompositingThread(LayerType type, LayerCompositingThreadClient* client) : LayerData(type) , m_layerRenderer(0) , m_superlayer(0) @@ -67,7 +78,7 @@ LayerCompositingThread::LayerCompositingThread(LayerType type, PassRefPtr<LayerT , m_drawOpacity(0) , m_visible(false) , m_commitScheduled(false) - , m_tiler(tiler) + , m_client(client) { } @@ -75,8 +86,6 @@ LayerCompositingThread::~LayerCompositingThread() { ASSERT(isCompositingThread()); - m_tiler->layerCompositingThreadDestroyed(); - ASSERT(!superlayer()); // Remove the superlayer reference from all sublayers. @@ -90,6 +99,9 @@ LayerCompositingThread::~LayerCompositingThread() // layer renderer to track us anymore if (m_layerRenderer) m_layerRenderer->removeLayer(this); + + if (m_client) + m_client->layerCompositingThreadDestroyed(this); } void LayerCompositingThread::setLayerRenderer(LayerRenderer* renderer) @@ -106,15 +118,22 @@ void LayerCompositingThread::deleteTextures() { releaseTextureResources(); - m_tiler->deleteTextures(); + if (m_client) + m_client->deleteTextures(this); } -void LayerCompositingThread::setDrawTransform(const TransformationMatrix& matrix) +void LayerCompositingThread::setDrawTransform(double scale, const TransformationMatrix& matrix) { m_drawTransform = matrix; float bx = m_bounds.width() / 2.0; float by = m_bounds.height() / 2.0; + + if (sizeIsScaleInvariant()) { + bx /= scale; + by /= scale; + } + m_transformedBounds.setP1(matrix.mapPoint(FloatPoint(-bx, -by))); m_transformedBounds.setP2(matrix.mapPoint(FloatPoint(-bx, by))); m_transformedBounds.setP3(matrix.mapPoint(FloatPoint(bx, by))); @@ -185,9 +204,9 @@ FloatQuad LayerCompositingThread::getTransformedHolePunchRect() const return getTransformedRect(m_bounds, drawRect, m_drawTransform); } -void LayerCompositingThread::drawTextures(int positionLocation, int texCoordLocation, const FloatRect& visibleRect) +void LayerCompositingThread::drawTextures(double scale, int positionLocation, int texCoordLocation, const FloatRect& visibleRect) { - float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; + static float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; if (m_pluginView) { if (m_isVisible) { @@ -256,7 +275,8 @@ void LayerCompositingThread::drawTextures(int positionLocation, int texCoordLoca return; } - m_tiler->drawTextures(this, positionLocation, texCoordLocation); + if (m_client) + m_client->drawTextures(this, scale, positionLocation, texCoordLocation); } void LayerCompositingThread::drawSurface(const TransformationMatrix& drawTransform, LayerCompositingThread* mask, int positionLocation, int texCoordLocation) @@ -279,23 +299,21 @@ void LayerCompositingThread::drawSurface(const TransformationMatrix& drawTransfo FloatQuad surfaceQuad = getTransformedRect(m_bounds, IntRect(IntPoint::zero(), m_bounds), drawTransform); glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &surfaceQuad); - float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; + static float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } } -void LayerCompositingThread::drawMissingTextures(int positionLocation, int texCoordLocation, const FloatRect& visibleRect) +bool LayerCompositingThread::hasMissingTextures() const { - if (m_pluginView || m_texID) - return; - -#if ENABLE(VIDEO) - if (m_mediaPlayer) - return; -#endif + return m_client ? m_client->hasMissingTextures(this) : false; +} - m_tiler->drawMissingTextures(this, positionLocation, texCoordLocation); +void LayerCompositingThread::drawMissingTextures(double scale, int positionLocation, int texCoordLocation, const FloatRect& /*visibleRect*/) +{ + if (m_client) + m_client->drawMissingTextures(this, scale, positionLocation, texCoordLocation); } void LayerCompositingThread::releaseTextureResources() @@ -380,6 +398,13 @@ const LayerCompositingThread* LayerCompositingThread::rootLayer() const return layer; } +void LayerCompositingThread::addSublayer(LayerCompositingThread* layer) +{ + layer->removeFromSuperlayer(); + layer->setSuperlayer(this); + m_sublayers.append(layer); +} + void LayerCompositingThread::removeFromSuperlayer() { if (m_superlayer) @@ -410,15 +435,14 @@ void LayerCompositingThread::setSublayers(const Vector<RefPtr<LayerCompositingTh void LayerCompositingThread::updateTextureContentsIfNeeded() { - if (m_texID || pluginView()) - return; - -#if ENABLE(VIDEO) - if (mediaPlayer()) - return; -#endif + if (m_client) + m_client->uploadTexturesIfNeeded(this); +} - m_tiler->uploadTexturesIfNeeded(); +void LayerCompositingThread::bindContentsTexture() +{ + if (m_client) + m_client->bindContentsTexture(this); } void LayerCompositingThread::setVisible(bool visible) @@ -428,15 +452,8 @@ void LayerCompositingThread::setVisible(bool visible) m_visible = visible; - if (m_texID || pluginView()) - return; - -#if ENABLE(VIDEO) - if (mediaPlayer()) - return; -#endif - - m_tiler->layerVisibilityChanged(visible); + if (m_client) + m_client->layerVisibilityChanged(this, visible); } void LayerCompositingThread::setNeedsCommit() @@ -447,6 +464,9 @@ void LayerCompositingThread::setNeedsCommit() void LayerCompositingThread::scheduleCommit() { + if (!m_client) + return; + if (!isWebKitThread()) { if (m_commitScheduled) return; @@ -459,9 +479,7 @@ void LayerCompositingThread::scheduleCommit() m_commitScheduled = false; - // FIXME: The only way to get at our LayerWebKitThread is to go through the tiler. - if (LayerWebKitThread* layer = m_tiler->layer()) - layer->setNeedsCommit(); + m_client->scheduleCommit(); } bool LayerCompositingThread::updateAnimations(double currentTime) @@ -484,7 +502,30 @@ bool LayerCompositingThread::updateAnimations(double currentTime) animation->apply(this, elapsedTime); } - return !m_runningAnimations.isEmpty(); + bool hasRunningAnimations = !m_runningAnimations.isEmpty(); + + // If there are any overrides, apply them + if (m_override) { + if (m_override->isPositionSet()) + m_position = m_override->position(); + if (m_override->isAnchorPointSet()) + m_anchorPoint = m_override->anchorPoint(); + if (m_override->isBoundsSet()) + m_bounds = m_override->bounds(); + if (m_override->isTransformSet()) + m_transform = m_override->transform(); + if (m_override->isOpacitySet()) + m_opacity = m_override->opacity(); + + for (size_t i = 0; i < m_override->animations().size(); ++i) { + LayerAnimation* animation = m_override->animations()[i].get(); + double elapsedTime = (m_suspendTime ? m_suspendTime : currentTime) - animation->startTime() + animation->timeOffset(); + animation->apply(this, elapsedTime); + hasRunningAnimations |= true; + } + } + + return hasRunningAnimations; } bool LayerCompositingThread::hasVisibleHolePunchRect() const @@ -506,6 +547,28 @@ void LayerCompositingThread::createLayerRendererSurface() m_layerRendererSurface = adoptPtr(new LayerRendererSurface(m_layerRenderer, this)); } +void LayerCompositingThread::removeAnimation(const String& name) +{ + for (size_t i = 0; i < m_runningAnimations.size(); ++i) { + if (m_runningAnimations[i]->name() == name) { + m_runningAnimations.remove(i); + return; + } + } +} + +LayerOverride* LayerCompositingThread::override() +{ + if (!m_override) + m_override = LayerOverride::create(); + return m_override.get(); +} + +void LayerCompositingThread::clearOverride() +{ + m_override.clear(); +} + } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h index b8470094f..b33560669 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h @@ -36,6 +36,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "FloatQuad.h" +#include "LayerAnimation.h" #include "LayerData.h" #include "LayerRendererSurface.h" #include "LayerTiler.h" @@ -53,11 +54,65 @@ class Buffer; namespace WebCore { +class LayerCompositingThreadClient; class LayerRenderer; +class LayerOverride { +public: + static PassOwnPtr<LayerOverride> create() { return adoptPtr(new LayerOverride()); } + + bool isPositionSet() const { return m_positionSet; } + FloatPoint position() const { return m_position; } + void setPosition(const FloatPoint& position) { m_position = position; m_positionSet = true; } + + bool isAnchorPointSet() const { return m_anchorPointSet; } + FloatPoint anchorPoint() const { return m_anchorPoint; } + void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; m_anchorPointSet = true; } + + bool isBoundsSet() const { return m_boundsSet; } + IntSize bounds() const { return m_bounds; } + void setBounds(const IntSize&) { m_bounds = bounds; m_boundsSet = true; } + + bool isTransformSet() const { return m_transformSet; } + const TransformationMatrix& transform() const { return m_transform; } + void setTransform(const TransformationMatrix& transform) { m_transform = transform; m_transformSet = true; } + + bool isOpacitySet() const { return m_opacitySet; } + float opacity() const { return m_opacity; } + void setOpacity(float) { m_opacity = opacity; m_opacitySet = true; } + + const Vector<RefPtr<LayerAnimation> >& animations() const { return m_animations; } + void addAnimation(PassRefPtr<LayerAnimation> animation) { m_animations.append(animation); } + void removeAnimation(const String& name); + +private: + LayerOverride() + : m_opacity(1.0) + , m_positionSet(false) + , m_anchorPointSet(false) + , m_boundsSet(false) + , m_transformSet(false) + , m_opacitySet(false) + { + } + + FloatPoint m_position; + FloatPoint m_anchorPoint; + IntSize m_bounds; + TransformationMatrix m_transform; + float m_opacity; + Vector<RefPtr<LayerAnimation> > m_animations; + + unsigned m_positionSet : 1; + unsigned m_anchorPointSet : 1; + unsigned m_boundsSet : 1; + unsigned m_transformSet : 1; + unsigned m_opacitySet : 1; +}; + class LayerCompositingThread : public ThreadSafeRefCounted<LayerCompositingThread>, public LayerData, public BlackBerry::Platform::GuardedPointerBase { public: - static PassRefPtr<LayerCompositingThread> create(LayerType, PassRefPtr<LayerTiler>); + static PassRefPtr<LayerCompositingThread> create(LayerType, LayerCompositingThreadClient*); // Thread safe void setPluginView(PluginView*); @@ -68,14 +123,23 @@ public: // Not thread safe + // These will be overwritten on the next commit if this layer has a LayerWebKitThread counterpart. + // Useful for stand-alone layers that are created and managed on the compositing thread. + // These functions can also be used to update animated properties in LayerAnimation. + void setPosition(const FloatPoint& position) { m_position = position; } + void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; } + void setBounds(const IntSize& bounds) { m_bounds = bounds; } + void setSizeIsScaleInvariant(bool invariant) { m_sizeIsScaleInvariant = invariant; } + void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; } + void setOpacity(float opacity) { m_opacity = opacity; } + void addSublayer(LayerCompositingThread*); + void removeFromSuperlayer(); + void setNeedsTexture(bool needsTexture) { m_needsTexture = needsTexture; } + // Returns true if we have an animation bool updateAnimations(double currentTime); void updateTextureContentsIfNeeded(); - void bindContentsTexture() - { - if (m_tiler) - m_tiler->bindContentsTexture(); - } + void bindContentsTexture(); const LayerCompositingThread* rootLayer() const; void setSublayers(const Vector<RefPtr<LayerCompositingThread> >&); @@ -86,7 +150,7 @@ public: // The layer renderer must be set if the layer has been rendered void setLayerRenderer(LayerRenderer*); - void setDrawTransform(const TransformationMatrix&); + void setDrawTransform(double scale, const TransformationMatrix&); const TransformationMatrix& drawTransform() const { return m_drawTransform; } void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } @@ -108,11 +172,10 @@ public: void deleteTextures(); - void drawTextures(int positionLocation, int texCoordLocation, const FloatRect& visibleRect); - bool hasMissingTextures() const { return m_tiler ? m_tiler->hasMissingTextures() : false; } - void drawMissingTextures(int positionLocation, int texCoordLocation, const FloatRect& visibleRect); + void drawTextures(double scale, int positionLocation, int texCoordLocation, const FloatRect& visibleRect); + bool hasMissingTextures() const; + void drawMissingTextures(double scale, int positionLocation, int texCoordLocation, const FloatRect& visibleRect); void drawSurface(const TransformationMatrix&, LayerCompositingThread* mask, int positionLocation, int texCoordLocation); - bool isDirty() const { return m_tiler ? m_tiler->hasDirtyTiles() : false; } void releaseTextureResources(); @@ -131,26 +194,27 @@ public: // this allows you to do it from the compositing thread. void scheduleCommit(); - // These two functions are used to update animated properties in LayerAnimation. - void setOpacity(float opacity) { m_opacity = opacity; } - void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; } - bool hasRunningAnimations() const { return !m_runningAnimations.isEmpty(); } bool hasVisibleHolePunchRect() const; + void addAnimation(LayerAnimation* animation) { m_runningAnimations.append(animation); } + void removeAnimation(const String& name); + + void setRunningAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_runningAnimations = animations; } + void setSuspendedAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_suspendedAnimations = animations; } + + LayerOverride* override(); + void clearOverride(); + protected: virtual ~LayerCompositingThread(); private: - LayerCompositingThread(LayerType, PassRefPtr<LayerTiler>); + LayerCompositingThread(LayerType, LayerCompositingThreadClient*); void updateTileContents(const IntRect& tile); - void removeFromSuperlayer(); - - size_t numSublayers() const { return m_sublayers.size(); } - // Returns the index of the sublayer or -1 if not found. int indexOfSublayer(const LayerCompositingThread*); @@ -182,7 +246,11 @@ private: bool m_visible; bool m_commitScheduled; - RefPtr<LayerTiler> m_tiler; + Vector<RefPtr<LayerAnimation> > m_runningAnimations; + Vector<RefPtr<LayerAnimation> > m_suspendedAnimations; + + OwnPtr<LayerOverride> m_override; + LayerCompositingThreadClient* m_client; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/blackberry/LayerCompositingThreadClient.h b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThreadClient.h new file mode 100644 index 000000000..746adea49 --- /dev/null +++ b/Source/WebCore/platform/graphics/blackberry/LayerCompositingThreadClient.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LayerCompositingThreadClient_h +#define LayerCompositingThreadClient_h + +#if USE(ACCELERATED_COMPOSITING) + +namespace WebCore { + +class LayerCompositingThread; + +class LayerCompositingThreadClient { +public: + virtual ~LayerCompositingThreadClient() { } + + virtual void layerCompositingThreadDestroyed(LayerCompositingThread*) = 0; + + virtual void layerVisibilityChanged(LayerCompositingThread*, bool visible) = 0; + + virtual void uploadTexturesIfNeeded(LayerCompositingThread*) = 0; + virtual void drawTextures(LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation) = 0; + virtual void deleteTextures(LayerCompositingThread*) = 0; + + // Optional. Allows layers to serve as a mask for other layers + virtual void bindContentsTexture(LayerCompositingThread*) { } + + // Optional. Allows layers to have uncached regions, typically drawn as checkerboard + virtual bool hasMissingTextures(const LayerCompositingThread*) const { return false; } + virtual void drawMissingTextures(LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation) { } + + // Unlike the other methods here, this one will be called on the WebKit thread + virtual void scheduleCommit() { } +}; + +} // namespace WebCore + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif diff --git a/Source/WebCore/platform/graphics/blackberry/LayerData.h b/Source/WebCore/platform/graphics/blackberry/LayerData.h index 2a55bcfe5..d99121551 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerData.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerData.h @@ -37,7 +37,6 @@ #include "FloatPoint.h" #include "FloatRect.h" #include "IntRect.h" -#include "LayerAnimation.h" #include "PlatformString.h" #include "TransformationMatrix.h" #include <wtf/HashMap.h> @@ -54,7 +53,7 @@ class MediaPlayer; class LayerData { public: - enum LayerType { Layer, TransformLayer, WebGLLayer, CanvasLayer }; + enum LayerType { Layer, TransformLayer, WebGLLayer, CanvasLayer, CustomLayer }; enum FilterType { Linear, Nearest, Trilinear, Lanczos }; enum LayerProgramShader { LayerProgramShaderRGBA = 0, LayerProgramShaderBGRA, @@ -86,6 +85,7 @@ public: , m_hasFixedContainer(false) , m_hasFixedAncestorInDOMTree(false) , m_isVisible(true) + , m_sizeIsScaleInvariant(false) { } @@ -105,6 +105,8 @@ public: IntSize bounds() const { return m_bounds; } + bool sizeIsScaleInvariant() const { return m_sizeIsScaleInvariant; } + bool doubleSided() const { return m_doubleSided; } FloatRect frame() const { return m_frame; } @@ -191,8 +193,6 @@ protected: pthread_mutex_t* m_frontBufferLock; - Vector<RefPtr<LayerAnimation> > m_runningAnimations; - Vector<RefPtr<LayerAnimation> > m_suspendedAnimations; double m_suspendTime; unsigned m_doubleSided : 1; @@ -208,6 +208,7 @@ protected: // The following is only available for media (video) and plugin layers. unsigned m_isVisible : 1; + unsigned m_sizeIsScaleInvariant : 1; // CAUTION: all the data members are copied from one instance to another // i.e. from one thread to another in the replicate method. diff --git a/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp b/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp index 3235a92b8..f42144ec0 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp +++ b/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp @@ -40,16 +40,16 @@ #include "PlatformString.h" #include "TextureCacheCompositingThread.h" +#include <BlackBerryPlatformGraphics.h> #include <BlackBerryPlatformLog.h> -#include <wtf/CurrentTime.h> +#include <limits> #include <wtf/text/CString.h> #define ENABLE_SCISSOR 1 #define DEBUG_SHADER_COMPILATION 0 -#define DEBUG_DIRTY_LAYERS 0 // Show dirty layers as red. #define DEBUG_LAYER_ANIMATIONS 0 // Show running animations as green. -#define DEBUG_VIDEO_CLIPPING 0 +#define DEBUG_CLIPPING 0 using BlackBerry::Platform::Graphics::GLES2Context; using namespace std; @@ -116,7 +116,7 @@ static GLuint loadShaderProgram(const char* vertexShaderSource, const char* frag return programObject; } -static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ) +TransformationMatrix LayerRenderer::orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ) { float deltaX = right - left; float deltaY = top - bottom; @@ -152,6 +152,8 @@ LayerRenderer::LayerRenderer(GLES2Context* context) , m_checkerProgramObject(0) , m_positionLocation(0) , m_texCoordLocation(1) + , m_scale(1.0) + , m_animationTime(-numeric_limits<double>::infinity()) , m_fbo(0) , m_currentLayerRendererSurface(0) , m_clearSurfaceOnDrawLayers(true) @@ -207,67 +209,54 @@ static inline bool compareLayerZ(const LayerCompositingThread* a, const LayerCom return transformA.m43() < transformB.m43(); } -// Re-composites all sublayers. -void LayerRenderer::drawLayers(const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize, const IntRect& dstRect) +void LayerRenderer::prepareFrame(double animationTime, LayerCompositingThread* rootLayer) { - ASSERT(m_hardwareCompositing); - if (!m_hardwareCompositing) - return; + if (animationTime != m_animationTime) { + m_animationTime = animationTime; - bool wasEmpty = m_lastRenderingResults.isEmpty(); - m_lastRenderingResults = LayerRenderingResults(); - m_lastRenderingResults.wasEmpty = wasEmpty; + // Aha, new frame! Reset rendering results. + bool wasEmpty = m_lastRenderingResults.isEmpty(); + m_lastRenderingResults = LayerRenderingResults(); + m_lastRenderingResults.wasEmpty = wasEmpty; + } - if (!m_rootLayer) + if (!rootLayer) return; + bool isContextCurrent = makeContextCurrent(); + prepareFrameRecursive(rootLayer, animationTime, isContextCurrent); +} + +void LayerRenderer::setViewport(const IntRect& targetRect, const IntRect& clipRect, const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize) +{ // These parameters are used to calculate position of fixed position elements m_visibleRect = visibleRect; m_layoutRect = layoutRect; m_contentsSize = contentsSize; - // WebKit uses row vectors which are multiplied by the matrix on the left (i.e. v*M) - // Transformations are composed on the left so that M1.xform(M2) means M2*M1 - // We therefore start with our (othogonal) projection matrix, which will be applied - // as the last transformation. - TransformationMatrix matrix = orthoMatrix(0, visibleRect.width(), visibleRect.height(), 0, -1000, 1000); - matrix.translate3d(-visibleRect.x(), -visibleRect.y(), 0); - - // OpenGL window coordinates origin is at the lower left corner of the surface while - // WebKit uses upper left as the origin of the window coordinate system. The passed in 'dstRect' - // is in WebKit window coordinate system. Here we setup the viewport to the corresponding value - // in OpenGL window coordinates. - int viewportY = std::max(0, m_context->surfaceSize().height() - dstRect.maxY()); - m_viewport = IntRect(dstRect.x(), viewportY, dstRect.width(), dstRect.height()); - - double animationTime = currentTime(); - -#if DEBUG_VIDEO_CLIPPING - // Invoking updateLayersRecursive() which will call LayerCompositingThread::setDrawTransform(). - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "LayerRenderer::drawLayers() visible=(x=%.2f,y=%.2f,width=%.2f,height=%.2f), layout=(x=%d,y=%d,width=%d,height=%d), contents=(%dx%d), dst=(x=%d,y=%d,width=%d,height=%d).", - visibleRect.x(), visibleRect.y(), visibleRect.width(), visibleRect.height(), - layoutRect.x(), layoutRect.y(), layoutRect.width(), layoutRect.height(), - contentsSize.width(), contentsSize.height(), - dstRect.x(), dstRect.y(), dstRect.width(), dstRect.height()); + m_viewport = targetRect; + m_scissorRect = clipRect; + + // The clipRect parameter uses render target coordinates, map to normalized device coordinates + m_clipRect = clipRect; + m_clipRect.intersect(targetRect); + m_clipRect = FloatRect(-1 + 2 * (m_clipRect.x() - targetRect.x()) / targetRect.width(), + -1 + 2 * (m_clipRect.y() - targetRect.y()) / targetRect.height(), + 2 * m_clipRect.width() / targetRect.width(), + 2 * m_clipRect.height() / targetRect.height()); + +#if DEBUG_CLIPPING + printf("LayerRenderer::setViewport() m_visibleRect=(%.2f,%.2f %.2fx%.2f), m_layoutRect=(%d,%d %dx%d), m_contentsSize=(%dx%d), m_viewport=(%d,%d %dx%d), m_scissorRect=(%d,%d %dx%d), m_clipRect=(%.2f,%.2f %.2fx%.2f)\n", + m_visibleRect.x(), m_visibleRect.y(), m_visibleRect.width(), m_visibleRect.height(), + m_layoutRect.x(), m_layoutRect.y(), m_layoutRect.width(), m_layoutRect.height(), + m_contentsSize.width(), m_contentsSize.height(), + m_viewport.x(), m_viewport.y(), m_viewport.width(), m_viewport.height(), + m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height(), + m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height()); + fflush(stdout); #endif - Vector<RefPtr<LayerCompositingThread> > surfaceLayers; - const Vector<RefPtr<LayerCompositingThread> >& sublayers = m_rootLayer->getSublayers(); - for (size_t i = 0; i < sublayers.size(); i++) { - float opacity = 1; - FloatRect clipRect(-1, -1, 2, 2); - updateLayersRecursive(sublayers[i].get(), matrix, surfaceLayers, opacity, clipRect, animationTime); - } - - // Decompose the dirty rect into a set of non-overlaping rectangles - // (they need to not overlap so that the blending code doesn't draw any region twice). - for (int i = 0; i < LayerRenderingResults::NumberOfDirtyRects; ++i) { - BlackBerry::Platform::IntRectRegion region(BlackBerry::Platform::IntRect(m_lastRenderingResults.dirtyRect(i))); - m_lastRenderingResults.dirtyRegion = BlackBerry::Platform::IntRectRegion::unionRegions(m_lastRenderingResults.dirtyRegion, region); - } - - // If we won't draw anything, don't touch the OpenGL APIs. - if (m_lastRenderingResults.isEmpty() && wasEmpty) + if (!m_hardwareCompositing) return; // Okay, we're going to do some drawing. @@ -293,43 +282,86 @@ void LayerRenderer::drawLayers(const FloatRect& visibleRect, const IntRect& layo // The layer quads are drawn in clock-wise order so the front face is CCW. glFrontFace(GL_CCW); - // The shader used to render layers returns pre-multiplied alpha colors - // so we need to send the blending mode appropriately. - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - // Update the parameters for the checkerboard drawing. glUseProgram(m_checkerProgramObject); float bitmapScale = static_cast<float>(m_layoutRect.width()) / static_cast<float>(m_visibleRect.width()); glUniform1f(m_checkerScaleLocation, bitmapScale); - float scale = static_cast<float>(dstRect.width()) / static_cast<float>(m_visibleRect.width()); + float scale = static_cast<float>(m_viewport.width()) / static_cast<float>(m_visibleRect.width()); glUniform2f(m_checkerOriginLocation, m_visibleRect.x()*scale, m_visibleRect.y()*scale); glUniform1f(m_checkerSurfaceHeightLocation, m_context->surfaceSize().height()); checkGLError(); - // If some layers should be drawed on temporary surfaces, we should do it first. - drawLayersOnSurfaces(surfaceLayers); + glViewport(m_viewport.x(), m_viewport.y(), m_viewport.width(), m_viewport.height()); #if ENABLE_SCISSOR - m_scissorRect = m_viewport; glEnable(GL_SCISSOR_TEST); +#if DEBUG_CLIPPING + printf("LayerRenderer::compositeLayers(): clipping to (%d,%d %dx%d)\n", m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height()); + fflush(stdout); +#endif glScissor(m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height()); #endif glClearStencil(0); glClearColor(0, 0, 0, 0); GLenum buffersToClear = GL_STENCIL_BUFFER_BIT; - if (m_clearSurfaceOnDrawLayers) { + if (m_clearSurfaceOnDrawLayers) buffersToClear |= GL_COLOR_BUFFER_BIT; - } glClear(buffersToClear); +} + +void LayerRenderer::compositeLayers(const TransformationMatrix& matrix, LayerCompositingThread* rootLayer) +{ + ASSERT(m_hardwareCompositing); + if (!m_hardwareCompositing) + return; + + if (!rootLayer) + return; + + // Used to draw scale invariant layers. We assume uniform scale. + // The matrix maps to normalized device coordinates, a system that maps the + // viewport to the interval -1 to 1. + // So it has to scale down by a factor equal to one half the viewport. + m_scale = matrix.m11() * m_viewport.width() / 2; + + Vector<RefPtr<LayerCompositingThread> > surfaceLayers; + const Vector<RefPtr<LayerCompositingThread> >& sublayers = rootLayer->getSublayers(); + for (size_t i = 0; i < sublayers.size(); i++) { + float opacity = 1; + FloatRect clipRect(m_clipRect); + updateLayersRecursive(sublayers[i].get(), matrix, surfaceLayers, opacity, clipRect); + } + + // Decompose the dirty rect into a set of non-overlaping rectangles + // (they need to not overlap so that the blending code doesn't draw any region twice). + for (int i = 0; i < LayerRenderingResults::NumberOfDirtyRects; ++i) { + BlackBerry::Platform::IntRectRegion region(BlackBerry::Platform::IntRect(m_lastRenderingResults.dirtyRect(i))); + m_lastRenderingResults.dirtyRegion = BlackBerry::Platform::IntRectRegion::unionRegions(m_lastRenderingResults.dirtyRegion, region); + } + + // If we won't draw anything, don't touch the OpenGL APIs. + if (m_lastRenderingResults.isEmpty() && m_lastRenderingResults.wasEmpty) + return; + + // Okay, we're going to do some drawing. + if (!makeContextCurrent()) + return; + + // The shader used to render layers returns pre-multiplied alpha colors + // so we need to send the blending mode appropriately. + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + // If some layers should be drawed on temporary surfaces, we should do it first. + drawLayersOnSurfaces(surfaceLayers); // Don't render the root layer, the BlackBerry port uses the BackingStore to draw the // root layer. for (size_t i = 0; i < sublayers.size(); i++) { int currentStencilValue = 0; - FloatRect clipRect(-1, -1, 2, 2); + FloatRect clipRect(m_clipRect); compositeLayersRecursive(sublayers[i].get(), currentStencilValue, clipRect); } @@ -351,6 +383,9 @@ void LayerRenderer::drawLayers(const FloatRect& visibleRect, const IntRect& layo // driver by unbinding early (when the pixmap is hopefully still around). glBindTexture(GL_TEXTURE_2D, 0); + // Turn off blending again + glDisable(GL_BLEND); + LayerSet::iterator iter = m_layersLockingTextureResources.begin(); for (; iter != m_layersLockingTextureResources.end(); ++iter) (*iter)->releaseTextureResources(); @@ -359,12 +394,65 @@ void LayerRenderer::drawLayers(const FloatRect& visibleRect, const IntRect& layo if (m_needsCommit) { m_needsCommit = false; - m_rootLayer->scheduleCommit(); + rootLayer->scheduleCommit(); } textureCacheCompositingThread()->collectGarbage(); } +static float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; + +void LayerRenderer::compositeBuffer(const TransformationMatrix& transform, const FloatRect& contents, BlackBerry::Platform::Graphics::Buffer* buffer, float opacity) +{ + if (!buffer) + return; + + FloatQuad vertices(transform.mapPoint(contents.minXMinYCorner()), + transform.mapPoint(contents.minXMaxYCorner()), + transform.mapPoint(contents.maxXMaxYCorner()), + transform.mapPoint(contents.maxXMinYCorner())); + + if (!vertices.boundingBox().intersects(m_clipRect)) + return; + + if (opacity < 1.0f) { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + + glUseProgram(m_layerProgramObject[LayerData::LayerProgramShaderRGBA]); + glUniform1f(m_alphaLocation[LayerData::LayerProgramShaderRGBA], opacity); + + glVertexAttribPointer(m_positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &vertices); + glVertexAttribPointer(m_texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); + + if (BlackBerry::Platform::Graphics::lockAndBindBufferGLTexture(buffer, GL_TEXTURE_2D)) { + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + BlackBerry::Platform::Graphics::releaseBufferGLTexture(buffer); + } + + if (opacity < 1.0f) + glDisable(GL_BLEND); +} + +void LayerRenderer::drawCheckerboardPattern(const TransformationMatrix& transform, const FloatRect& contents) +{ + FloatQuad vertices(transform.mapPoint(contents.minXMinYCorner()), + transform.mapPoint(contents.minXMaxYCorner()), + transform.mapPoint(contents.maxXMaxYCorner()), + transform.mapPoint(contents.maxXMinYCorner())); + + if (!vertices.boundingBox().intersects(m_clipRect)) + return; + + glUseProgram(m_checkerProgramObject); + + glVertexAttribPointer(m_positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &vertices); + glVertexAttribPointer(m_texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + bool LayerRenderer::useSurface(LayerRendererSurface* surface) { if (m_currentLayerRendererSurface == surface) @@ -415,15 +503,13 @@ void LayerRenderer::drawLayersOnSurfaces(const Vector<RefPtr<LayerCompositingThr // If there are layers drawed on surfaces, we need to switch to default framebuffer. // Otherwise, we just need to set viewport. - if (surfaceLayers.size()) + if (surfaceLayers.size()) { useSurface(0); - else - glViewport(m_viewport.x(), m_viewport.y(), m_viewport.width(), m_viewport.height()); -} - -void LayerRenderer::setRootLayer(LayerCompositingThread* layer) -{ - m_rootLayer = layer; +#if ENABLE_SCISSOR + glEnable(GL_SCISSOR_TEST); + glScissor(m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height()); +#endif + } } void LayerRenderer::addLayer(LayerCompositingThread* layer) @@ -488,11 +574,6 @@ void LayerRenderer::drawDebugBorder(LayerCompositingThread* layer) { Color borderColor = layer->borderColor(); -#if DEBUG_DIRTY_LAYERS - if (layer->isDirty()) - borderColor = Color(0xFF, 0x00, 0x00, 0xFF); -#endif - #if DEBUG_LAYER_ANIMATIONS if (layer->hasRunningAnimations()) borderColor = Color(0x00, 0xFF, 0x00, 0xFF); @@ -526,9 +607,34 @@ void LayerRenderer::drawHolePunchRect(LayerCompositingThread* layer) m_lastRenderingResults.addHolePunchRect(holeWC); } -void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const TransformationMatrix& matrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect, double currentTime) +void LayerRenderer::prepareFrameRecursive(LayerCompositingThread* layer, double animationTime, bool isContextCurrent) { + // This might cause the layer to recompute some attributes. + m_lastRenderingResults.needsAnimationFrame |= layer->updateAnimations(animationTime); + + if (isContextCurrent) { + // Even non-visible layers need to perform their texture jobs, or they will + // pile up and waste memory. + if (layer->needsTexture()) + layer->updateTextureContentsIfNeeded(); + if (layer->maskLayer() && layer->maskLayer()->needsTexture()) + layer->maskLayer()->updateTextureContentsIfNeeded(); + if (layer->replicaLayer()) { + LayerCompositingThread* replica = layer->replicaLayer(); + if (replica->needsTexture()) + replica->updateTextureContentsIfNeeded(); + if (replica->maskLayer() && replica->maskLayer()->needsTexture()) + replica->maskLayer()->updateTextureContentsIfNeeded(); + } + } + + const Vector<RefPtr<LayerCompositingThread> >& sublayers = layer->getSublayers(); + for (size_t i = 0; i < sublayers.size(); i++) + prepareFrameRecursive(sublayers[i].get(), animationTime, isContextCurrent); +} +void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const TransformationMatrix& matrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect) +{ // The contract for LayerCompositingThread::setLayerRenderer is it must be set if the layer has been rendered. // So do it now, before we render it in compositeLayersRecursive. layer->setLayerRenderer(this); @@ -541,9 +647,6 @@ void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const T replica->maskLayer()->setLayerRenderer(this); } - // This might cause the layer to recompute some attributes. - m_lastRenderingResults.needsAnimationFrame |= layer->updateAnimations(currentTime); - // Compute the new matrix transformation that will be applied to this layer and // all its sublayers. It's important to remember that the layer's position // is the position of the layer's anchor point. Also, the coordinate system used @@ -562,7 +665,9 @@ void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const T // Where: P is the projection matrix // M is the layer's matrix computed above // S is the scale adjustment (to scale up to the layer size) - IntSize bounds = layer->bounds(); + FloatSize bounds = layer->bounds(); + if (layer->sizeIsScaleInvariant()) + bounds.scale(1.0 / m_scale); FloatPoint anchorPoint = layer->anchorPoint(); FloatPoint position = layer->position(); @@ -629,7 +734,7 @@ void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const T surface->setReplicaDrawTransform(replicaMatrix); } - IntRect drawRect = IntRect(IntPoint(), bounds); + IntRect drawRect = enclosingIntRect(FloatRect(FloatPoint(), bounds)); surface->setContentRect(drawRect); TransformationMatrix projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.y(), drawRect.maxY(), -1000, 1000); @@ -642,7 +747,7 @@ void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const T surfaceLayers.append(layer); } - layer->setDrawTransform(localMatrix); + layer->setDrawTransform(m_scale, localMatrix); #if ENABLE(VIDEO) bool layerVisible = clipRect.intersects(layer->getDrawRect()) || layer->mediaPlayer(); @@ -681,7 +786,7 @@ void LayerRenderer::updateLayersRecursive(LayerCompositingThread* layer, const T const Vector<RefPtr<LayerCompositingThread> >& sublayers = layer->getSublayers(); for (size_t i = 0; i < sublayers.size(); i++) - updateLayersRecursive(sublayers[i].get(), localMatrix, surfaceLayers, opacity, clipRect, currentTime); + updateLayersRecursive(sublayers[i].get(), localMatrix, surfaceLayers, opacity, clipRect); } static bool hasRotationalComponent(const TransformationMatrix& m) @@ -731,20 +836,6 @@ void LayerRenderer::compositeLayersRecursive(LayerCompositingThread* layer, int // 1. Layers that have their own GraphicsContext and can draw their contents on demand (layer->drawsContent() == true). // 2. Layers that are just containers of images/video/etc that don't own a GraphicsContext (layer->contents() == true). - // Even non-visible layers need to perform their texture jobs, or they will - // pile up and waste memory. - if (layer->needsTexture()) - layer->updateTextureContentsIfNeeded(); - if (layer->maskLayer() && layer->maskLayer()->needsTexture()) - layer->maskLayer()->updateTextureContentsIfNeeded(); - if (layer->replicaLayer()) { - LayerCompositingThread* replica = layer->replicaLayer(); - if (replica->needsTexture()) - replica->updateTextureContentsIfNeeded(); - if (replica->maskLayer() && replica->maskLayer()->needsTexture()) - replica->maskLayer()->updateTextureContentsIfNeeded(); - } - if ((layer->needsTexture() || layer->layerRendererSurface()) && layerVisible) { updateScissorIfNeeded(clipRect); @@ -764,7 +855,7 @@ void LayerRenderer::compositeLayersRecursive(LayerCompositingThread* layer, int if (!drawSurface) { glUseProgram(m_layerProgramObject[shader]); glUniform1f(m_alphaLocation[shader], layer->drawOpacity()); - layer->drawTextures(m_positionLocation, m_texCoordLocation, m_visibleRect); + layer->drawTextures(m_scale, m_positionLocation, m_texCoordLocation, m_visibleRect); } else { // Draw the reflection if it exists. if (layer->replicaLayer()) { @@ -788,7 +879,7 @@ void LayerRenderer::compositeLayersRecursive(LayerCompositingThread* layer, int if (layer->hasMissingTextures()) { glDisable(GL_BLEND); glUseProgram(m_checkerProgramObject); - layer->drawMissingTextures(m_positionLocation, m_texCoordLocation, m_visibleRect); + layer->drawMissingTextures(m_scale, m_positionLocation, m_texCoordLocation, m_visibleRect); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } @@ -870,11 +961,19 @@ void LayerRenderer::compositeLayersRecursive(LayerCompositingThread* layer, int void LayerRenderer::updateScissorIfNeeded(const FloatRect& clipRect) { #if ENABLE_SCISSOR +#if DEBUG_CLIPPING + printf("LayerRenderer::updateScissorIfNeeded(): clipRect=(%.2f,%.2f %.2fx%.2f)\n", clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()); + fflush(stdout); +#endif IntRect clipRectWC = toOpenGLWindowCoordinates(clipRect); if (m_scissorRect == clipRectWC) return; m_scissorRect = clipRectWC; +#if DEBUG_CLIPPING + printf("LayerRenderer::updateScissorIfNeeded(): clipping to (%d,%d %dx%d)\n", m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height()); + fflush(stdout); +#endif glScissor(m_scissorRect.x(), m_scissorRect.y(), m_scissorRect.width(), m_scissorRect.height()); #endif } @@ -1092,8 +1191,9 @@ IntRect LayerRenderingResults::holePunchRect(unsigned index) const void LayerRenderingResults::addHolePunchRect(const IntRect& rect) { -#if DEBUG_VIDEO_CLIPPING - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "LayerRenderingResults::addHolePunchRect (x=%d,y=%d,width=%d,height=%d).", rect.x(), rect.y(), rect.width(), rect.height()); +#if DEBUG_CLIPPING + printf("LayerRenderingResults::addHolePunchRect (%d,%d %dx%d)\n", rect.x(), rect.y(), rect.width(), rect.height()); + fflush(stdout); #endif if (!rect.isEmpty()) m_holePunchRects.append(rect); diff --git a/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h b/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h index fe5ea0011..5d21ecbbc 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h @@ -79,6 +79,8 @@ private: class LayerRenderer { WTF_MAKE_NONCOPYABLE(LayerRenderer); public: + static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ); + static PassOwnPtr<LayerRenderer> create(BlackBerry::Platform::Graphics::GLES2Context*); LayerRenderer(BlackBerry::Platform::Graphics::GLES2Context*); @@ -86,11 +88,26 @@ public: void releaseLayerResources(); - // Recomposites all the layers. Returns true if it needs more draw. - void drawLayers(const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize, const IntRect& dstRect); + // In order to render the layers, you must do the following 3 operations, in order. + + // 1. Upload textures and other operations that should be performed at the beginning of each frame. + // Note, this call also resets the last rendering results. + void prepareFrame(double animationTime, LayerCompositingThread* rootLayer); - void setRootLayer(LayerCompositingThread*); - LayerCompositingThread* rootLayer() { return m_rootLayer.get(); } + // 2. Set the OpenGL viewport and store other viewport-related parameters + // viewport is the GL viewport + // clipRect is an additional clip rect, if clipping is required beyond the clipping effect of the viewport. + // visibleRect is the subrect of the web page that you wish to composite, expressed in content coordinates + // The last two parameters are required to draw fixed position elements in the right place: + // layoutRect is the subrect of the web page that the WebKit thread believes is visible (scroll position, actual visible size). + // contentsSize is the contents size of the web page + void setViewport(const IntRect& viewport, const IntRect& clipRect, const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize); + + // 3. Prepares all the layers for compositing + // transform is the model-view-project matrix that goes all the way from contents to normalized device coordinates. + void compositeLayers(const TransformationMatrix&, LayerCompositingThread* rootLayer); + void compositeBuffer(const TransformationMatrix&, const FloatRect& contents, BlackBerry::Platform::Graphics::Buffer*, float opacity); + void drawCheckerboardPattern(const TransformationMatrix&, const FloatRect& contents); // Keep track of layers that need cleanup when the LayerRenderer is destroyed void addLayer(LayerCompositingThread*); @@ -118,7 +135,8 @@ public: bool layerAlreadyOnSurface(LayerCompositingThread*) const; private: - void updateLayersRecursive(LayerCompositingThread*, const TransformationMatrix& parentMatrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect, double currentTime); + void prepareFrameRecursive(LayerCompositingThread*, double animationTime, bool isContextCurrent); + void updateLayersRecursive(LayerCompositingThread*, const TransformationMatrix& parentMatrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect); void compositeLayersRecursive(LayerCompositingThread*, int stencilValue, FloatRect clipRect); void updateScissorIfNeeded(const FloatRect& clipRect); @@ -158,14 +176,15 @@ private: int m_checkerSurfaceHeightLocation; // Current draw configuration. + double m_scale; + double m_animationTime; FloatRect m_visibleRect; IntRect m_layoutRect; IntSize m_contentsSize; - IntRect m_viewport; - IntRect m_scissorRect; - - RefPtr<LayerCompositingThread> m_rootLayer; + IntRect m_viewport; // In render target coordinates + IntRect m_scissorRect; // In render target coordinates + FloatRect m_clipRect; // In normalized device coordinates unsigned m_fbo; LayerRendererSurface* m_currentLayerRendererSurface; diff --git a/Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp b/Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp index d517aaa7b..db6e75c2f 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp +++ b/Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp @@ -75,6 +75,7 @@ LayerTiler::LayerTiler(LayerWebKitThread* layer) , m_hasMissingTextures(false) , m_contentsScale(0.0) { + ref(); // This ref() is matched by a deref in layerCompositingThreadDestroyed(); } LayerTiler::~LayerTiler() @@ -90,9 +91,10 @@ void LayerTiler::layerWebKitThreadDestroyed() m_layer = 0; } -void LayerTiler::layerCompositingThreadDestroyed() +void LayerTiler::layerCompositingThreadDestroyed(LayerCompositingThread*) { ASSERT(isCompositingThread()); + deref(); // Matched by ref() in constructor; } void LayerTiler::setNeedsDisplay(const FloatRect& dirtyRect) @@ -120,6 +122,11 @@ void LayerTiler::updateTextureContentsIfNeeded(double scale) renderJobs = m_renderJobs; } + // There's no point in drawing contents at a higher resolution for scale + // invariant layers. + if (m_layer->sizeIsScaleInvariant()) + scale = 1.0; + bool isZoomJob = false; if (scale != m_contentsScale) { // The first time around, it does not count as a zoom job. @@ -349,7 +356,7 @@ void LayerTiler::commitPendingTextureUploads() m_pendingTextureJobs.clear(); } -void LayerTiler::layerVisibilityChanged(bool visible) +void LayerTiler::layerVisibilityChanged(LayerCompositingThread*, bool visible) { // For visible layers, we handle the tile-level visibility // in the draw loop, see LayerTiler::drawTextures(). @@ -369,7 +376,7 @@ void LayerTiler::layerVisibilityChanged(bool visible) } } -void LayerTiler::uploadTexturesIfNeeded() +void LayerTiler::uploadTexturesIfNeeded(LayerCompositingThread*) { TileJobsMap tileJobsMap; Deque<TextureJob>::const_iterator textureJobIterEnd = m_textureJobs.end(); @@ -468,20 +475,25 @@ void LayerTiler::performTileJob(LayerTile* tile, const TextureJob& job, const In ASSERT_NOT_REACHED(); } -void LayerTiler::drawTextures(LayerCompositingThread* layer, int pos, int texCoord) +void LayerTiler::drawTextures(LayerCompositingThread* layer, double scale, int pos, int texCoord) { - drawTexturesInternal(layer, pos, texCoord, false /* drawMissing */); + drawTexturesInternal(layer, scale, pos, texCoord, false /* drawMissing */); } -void LayerTiler::drawMissingTextures(LayerCompositingThread* layer, int pos, int texCoord) +void LayerTiler::drawMissingTextures(LayerCompositingThread* layer, double scale, int pos, int texCoord) { - drawTexturesInternal(layer, pos, texCoord, true /* drawMissing */); + drawTexturesInternal(layer, scale, pos, texCoord, true /* drawMissing */); } -void LayerTiler::drawTexturesInternal(LayerCompositingThread* layer, int positionLocation, int texCoordLocation, bool drawMissing) +void LayerTiler::drawTexturesInternal(LayerCompositingThread* layer, double scale, int positionLocation, int texCoordLocation, bool drawMissing) { const TransformationMatrix& drawTransform = layer->drawTransform(); - IntSize bounds = layer->bounds(); + FloatSize bounds = layer->bounds(); + + if (layer->sizeIsScaleInvariant()) { + bounds.setWidth(bounds.width() / scale); + bounds.setHeight(bounds.width() / scale); + } float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; float vertices[4 * 4]; @@ -611,7 +623,7 @@ void LayerTiler::removeRenderJob(const TileIndex& index) m_renderJobs.remove(index); } -void LayerTiler::deleteTextures() +void LayerTiler::deleteTextures(LayerCompositingThread*) { // Since textures are deleted by a synchronous message // from WebKit thread to compositing thread, we don't need @@ -675,6 +687,14 @@ void LayerTiler::disableTiling(bool disable) updateTileSize(); } +void LayerTiler::scheduleCommit() +{ + ASSERT(isWebKitThread()); + + if (m_layer) + m_layer->setNeedsCommit(); +} + bool LayerTiler::shouldPrefillTile(const TileIndex& index) { // For now, we use the heuristic of prefilling the first screenful of tiles. @@ -716,18 +736,7 @@ IntRect LayerTiler::rectForTile(const TileIndex& index, const IntSize& bounds) return IntRect(origin, size); } -bool LayerTiler::hasDirtyTiles() const -{ - for (TileMap::const_iterator it = m_tilesCompositingThread.begin(); it != m_tilesCompositingThread.end(); ++it) { - const LayerTile* tile = (*it).second; - if (tile->isDirty()) - return true; - } - - return false; -} - -void LayerTiler::bindContentsTexture() +void LayerTiler::bindContentsTexture(LayerCompositingThread*) { ASSERT(m_tilesCompositingThread.size() == 1); if (m_tilesCompositingThread.size() != 1) diff --git a/Source/WebCore/platform/graphics/blackberry/LayerTiler.h b/Source/WebCore/platform/graphics/blackberry/LayerTiler.h index 376662955..7694dec70 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerTiler.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerTiler.h @@ -24,6 +24,7 @@ #include "Color.h" #include "FloatRect.h" #include "IntRect.h" +#include "LayerCompositingThreadClient.h" #include "LayerTile.h" #include "LayerTileIndex.h" @@ -38,7 +39,7 @@ namespace WebCore { class LayerCompositingThread; class LayerWebKitThread; -class LayerTiler : public ThreadSafeRefCounted<LayerTiler> { +class LayerTiler : public ThreadSafeRefCounted<LayerTiler>, public LayerCompositingThreadClient { public: TileIndex indexOfTile(const IntPoint& origin); IntPoint originOfTile(const TileIndex&); @@ -58,18 +59,18 @@ public: void setNeedsDisplay(); void updateTextureContentsIfNeeded(double scale); void disableTiling(bool); + virtual void scheduleCommit(); // Compositing thread - void layerCompositingThreadDestroyed(); - void uploadTexturesIfNeeded(); - void drawTextures(LayerCompositingThread*, int positionLocation, int texCoordLocation); - bool hasMissingTextures() const { return m_hasMissingTextures; } - void drawMissingTextures(LayerCompositingThread*, int positionLocation, int texCoordLocation); - void deleteTextures(); + virtual void layerCompositingThreadDestroyed(LayerCompositingThread*); + virtual void layerVisibilityChanged(LayerCompositingThread*, bool visible); + virtual void uploadTexturesIfNeeded(LayerCompositingThread*); + virtual void bindContentsTexture(LayerCompositingThread*); + virtual void drawTextures(LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation); + virtual bool hasMissingTextures(const LayerCompositingThread*) const { return m_hasMissingTextures; } + virtual void drawMissingTextures(LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation); + virtual void deleteTextures(LayerCompositingThread*); void commitPendingTextureUploads(); - void layerVisibilityChanged(bool visible); - bool hasDirtyTiles() const; - void bindContentsTexture(); // Thread safe void addRenderJob(const TileIndex&); @@ -156,7 +157,7 @@ private: void addTileJob(const TileIndex&, const TextureJob&, TileJobsMap&); void performTileJob(LayerTile*, const TextureJob&, const IntRect&); void processTextureJob(const TextureJob&, TileJobsMap&); - void drawTexturesInternal(LayerCompositingThread*, int positionLocation, int texCoordLocation, bool missing); + void drawTexturesInternal(LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation, bool missing); void pruneTextures(); void visibilityChanged(bool needsDisplay); diff --git a/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp b/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp index 6c5438267..15bbe0a8f 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp +++ b/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp @@ -63,9 +63,12 @@ LayerWebKitThread::LayerWebKitThread(LayerType type, GraphicsLayerBlackBerry* ow , m_scale(1.0) , m_isDrawable(false) , m_isMask(false) + , m_animationsChanged(false) + , m_clearOverrideOnCommit(false) { - m_tiler = LayerTiler::create(this); - m_layerCompositingThread = LayerCompositingThread::create(type, m_tiler); + if (type == Layer) + m_tiler = LayerTiler::create(this); + m_layerCompositingThread = LayerCompositingThread::create(type, m_tiler.get()); } LayerWebKitThread::~LayerWebKitThread() @@ -75,7 +78,8 @@ LayerWebKitThread::~LayerWebKitThread() if (m_frontBufferLock) pthread_mutex_destroy(m_frontBufferLock); - m_tiler->layerWebKitThreadDestroyed(); + if (m_tiler) + m_tiler->layerWebKitThreadDestroyed(); // Our superlayer should be holding a reference to us so there should be no // way for us to be destroyed while we still have a superlayer. @@ -167,7 +171,8 @@ void LayerWebKitThread::createFrontBufferLock() void LayerWebKitThread::updateTextureContentsIfNeeded() { - m_tiler->updateTextureContentsIfNeeded(m_isMask ? 1.0 : contentsScale()); + if (m_tiler) + m_tiler->updateTextureContentsIfNeeded(m_isMask ? 1.0 : contentsScale()); } void LayerWebKitThread::setContents(Image* contents) @@ -226,6 +231,7 @@ void LayerWebKitThread::startAnimations(double time) { for (size_t i = 0; i < m_runningAnimations.size(); ++i) { if (!m_runningAnimations[i]->startTime()) { + m_animationsChanged = true; m_runningAnimations[i]->setStartTime(time); notifyAnimationStarted(time); } @@ -278,9 +284,19 @@ void LayerWebKitThread::commitOnCompositingThread() m_position += m_absoluteOffset; // Copy the base variables from this object into m_layerCompositingThread replicate(m_layerCompositingThread.get()); + if (m_animationsChanged) { + m_layerCompositingThread->setRunningAnimations(m_runningAnimations); + m_layerCompositingThread->setSuspendedAnimations(m_suspendedAnimations); + m_animationsChanged = false; + } + if (m_clearOverrideOnCommit) { + m_layerCompositingThread->clearOverride(); + m_clearOverrideOnCommit = false; + } m_position = oldPosition; updateLayerHierarchy(); - m_tiler->commitPendingTextureUploads(); + if (m_tiler) + m_tiler->commitPendingTextureUploads(); size_t listSize = m_sublayers.size(); for (size_t i = 0; i < listSize; i++) @@ -424,13 +440,15 @@ void LayerWebKitThread::setSublayers(const Vector<RefPtr<LayerWebKitThread> >& s void LayerWebKitThread::setNeedsDisplayInRect(const FloatRect& dirtyRect) { - m_tiler->setNeedsDisplay(dirtyRect); + if (m_tiler) + m_tiler->setNeedsDisplay(dirtyRect); setNeedsCommit(); // FIXME: Replace this with a more targeted message for dirty rect handling with plugin content? } void LayerWebKitThread::setNeedsDisplay() { - m_tiler->setNeedsDisplay(); + if (m_tiler) + m_tiler->setNeedsDisplay(); setNeedsCommit(); // FIXME: Replace this with a more targeted message for dirty rect handling with plugin content? } @@ -448,10 +466,24 @@ void LayerWebKitThread::updateLayerHierarchy() void LayerWebKitThread::setIsMask(bool isMask) { m_isMask = isMask; - if (isMask) + if (isMask && m_tiler) m_tiler->disableTiling(true); } +void LayerWebKitThread::setRunningAnimations(const Vector<RefPtr<LayerAnimation> >& animations) +{ + m_runningAnimations = animations; + m_animationsChanged = true; + setNeedsCommit(); +} + +void LayerWebKitThread::setSuspendedAnimations(const Vector<RefPtr<LayerAnimation> >& animations) +{ + m_suspendedAnimations = animations; + m_animationsChanged = true; + setNeedsCommit(); +} + } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.h b/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.h index 848c184a6..49a49be5f 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.h @@ -36,6 +36,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerBlackBerry.h" +#include "LayerAnimation.h" #include "LayerData.h" #include "LayerTiler.h" @@ -73,6 +74,8 @@ public: void setBounds(const IntSize&); + void setSizeIsScaleInvariant(bool invariant) { m_sizeIsScaleInvariant = invariant; setNeedsCommit(); } + void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; setNeedsCommit(); } void setFrame(const FloatRect&); @@ -142,8 +145,11 @@ public: void setNeedsCommit(); void notifyAnimationStarted(double time); - void setRunningAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_runningAnimations = animations; setNeedsCommit(); } - void setSuspendedAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_suspendedAnimations = animations; setNeedsCommit(); } + void setRunningAnimations(const Vector<RefPtr<LayerAnimation> >&); + void setSuspendedAnimations(const Vector<RefPtr<LayerAnimation> >&); + + // Allows you to clear the LayerCompositingThread::overrides from the WK thread + void clearOverride() { m_clearOverrideOnCommit = true; setNeedsCommit(); } protected: LayerWebKitThread(LayerType, GraphicsLayerBlackBerry* owner); @@ -178,6 +184,9 @@ private: GraphicsLayerBlackBerry* m_owner; + Vector<RefPtr<LayerAnimation> > m_runningAnimations; + Vector<RefPtr<LayerAnimation> > m_suspendedAnimations; + Vector<RefPtr<LayerWebKitThread> > m_sublayers; LayerWebKitThread* m_superlayer; RefPtr<LayerWebKitThread> m_maskLayer; @@ -189,8 +198,10 @@ private: RefPtr<LayerTiler> m_tiler; FloatSize m_absoluteOffset; double m_scale; // Scale applies only to content layers - bool m_isDrawable; - bool m_isMask; + unsigned m_isDrawable : 1; + unsigned m_isMask : 1; + unsigned m_animationsChanged : 1; + unsigned m_clearOverrideOnCommit : 1; }; } diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp index dc9a534af..3ac93e8b4 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp @@ -22,6 +22,8 @@ #include "MediaPlayerPrivateBlackBerry.h" #include "CookieManager.h" +#include "Credential.h" +#include "CredentialStorage.h" #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" @@ -30,6 +32,7 @@ #include "HostWindow.h" #include "NotImplemented.h" #include "PlatformContextSkia.h" +#include "ProtectionSpace.h" #include "RenderBox.h" #include "TimeRanges.h" #include "WebPageClient.h" @@ -285,10 +288,10 @@ PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const return timeRanges.release(); } -unsigned MediaPlayerPrivate::bytesLoaded() const +bool MediaPlayerPrivate::didLoadingProgress() const { notImplemented(); - return 0; + return false; } void MediaPlayerPrivate::setSize(const IntSize&) @@ -657,6 +660,50 @@ void MediaPlayerPrivate::onBuffering(bool flag) } #endif +static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuthChallenge& authChallenge) +{ + KURL url(ParsedURLString, String(authChallenge.url().c_str())); + ASSERT(url.isValid()); + + return ProtectionSpace(url.host(), url.port(), + static_cast<ProtectionSpaceServerType>(authChallenge.serverType()), + authChallenge.realm().c_str(), + static_cast<ProtectionSpaceAuthenticationScheme>(authChallenge.authScheme())); +} + +bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge) +{ + KURL url(ParsedURLString, String(authChallenge.url().c_str())); + if (!url.isValid()) + return false; + + ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge); + Credential credential = CredentialStorage::get(protectionSpace); + bool isConfirmed = false; + if (credential.isEmpty()) { + if (frameView() && frameView()->hostWindow()) + isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential); + } else + isConfirmed = true; + + if (isConfirmed) + authChallenge.setCredential(credential.user().utf8().data(), credential.password().utf8().data(), static_cast<MMRAuthChallenge::CredentialPersistence>(credential.persistence())); + + return isConfirmed; +} + +void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authChallenge) const +{ + KURL url(ParsedURLString, String(authChallenge.url().c_str())); + if (!url.isValid()) + return; + + ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge); + Credential savedCredential = CredentialStorage::get(protectionSpace); + if (savedCredential.isEmpty()) + CredentialStorage::set(Credential(authChallenge.username().c_str(), authChallenge.password().c_str(), static_cast<CredentialPersistence>(authChallenge.persistence())), protectionSpace, url); +} + int MediaPlayerPrivate::showErrorDialog(MMRPlayer::Error type) { using namespace BlackBerry::WebKit; diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h index bcc5473a6..0ac466bec 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h @@ -83,7 +83,7 @@ public: virtual float maxTimeSeekable() const; virtual PassRefPtr<TimeRanges> buffered() const; - virtual unsigned bytesLoaded() const; + virtual bool didLoadingProgress() const; virtual void setSize(const IntSize&); @@ -130,6 +130,8 @@ public: #if USE(ACCELERATED_COMPOSITING) virtual void onBuffering(bool); #endif + virtual bool onAuthenticationNeeded(BlackBerry::Platform::MMRAuthChallenge&); + virtual void onAuthenticationAccepted(const BlackBerry::Platform::MMRAuthChallenge&) const; virtual bool isFullscreen() const; virtual bool isElementPaused() const; diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 70d590dd6..748946820 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -132,18 +132,16 @@ struct SubimageCacheHash { typedef HashSet<SubimageCacheEntry, SubimageCacheHash, SubimageCacheEntryTraits> SubimageCache; -class SubimageCacheTimer : private TimerBase { -public: - SubimageCacheTimer() : m_shouldRestartWhenTimerFires(false) { } - void restart(); -private: - virtual void fired() OVERRIDE; - bool m_shouldRestartWhenTimerFires; -}; - struct SubimageCacheWithTimer { SubimageCache cache; - SubimageCacheTimer timer; + DeferrableOneShotTimer<SubimageCacheWithTimer> timer; + + SubimageCacheWithTimer() + : timer(this, &SubimageCacheWithTimer::invalidateCacheTimerFired, subimageCacheClearDelay) + { + } + + void invalidateCacheTimerFired(DeferrableOneShotTimer<SubimageCacheWithTimer>*); }; static SubimageCacheWithTimer& subimageCache() @@ -152,25 +150,8 @@ static SubimageCacheWithTimer& subimageCache() return cache; } -inline void SubimageCacheTimer::restart() +void SubimageCacheWithTimer::invalidateCacheTimerFired(DeferrableOneShotTimer<SubimageCacheWithTimer>*) { - // Setting this boolean is much more efficient than calling startOneShot - // again, which might result in rescheduling the system timer and that - // can be quite expensive. - if (isActive()) { - m_shouldRestartWhenTimerFires = true; - return; - } - startOneShot(subimageCacheClearDelay); -} - -void SubimageCacheTimer::fired() -{ - if (m_shouldRestartWhenTimerFires) { - m_shouldRestartWhenTimerFires = false; - startOneShot(subimageCacheClearDelay); - return; - } subimageCache().cache.clear(); } diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index b86ad31da..ae8d3208b 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -49,9 +49,9 @@ namespace WebCore { class ContentLayerPainter : public LayerPainterChromium { WTF_MAKE_NONCOPYABLE(ContentLayerPainter); public: - static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate, TiledLayerChromium* layer) + static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate) { - return adoptPtr(new ContentLayerPainter(delegate, layer)); + return adoptPtr(new ContentLayerPainter(delegate)); } virtual void paint(GraphicsContext& context, const IntRect& contentRect) @@ -59,27 +59,19 @@ public: double paintStart = currentTime(); context.clearRect(contentRect); context.clip(contentRect); - { - GraphicsContextStateSaver stateSaver(context, m_layer->layerTreeHost()->settings().debugShowTileInfo); - - m_delegate->paintContents(context, contentRect); - double paintEnd = currentTime(); - double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); - } - if (m_layer->layerTreeHost()->settings().debugShowTileInfo) - m_layer->paintDebugTileInfo(context, contentRect); + m_delegate->paintContents(context, contentRect); + double paintEnd = currentTime(); + double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); } private: - explicit ContentLayerPainter(ContentLayerDelegate* delegate, TiledLayerChromium* layer) + explicit ContentLayerPainter(ContentLayerDelegate* delegate) : m_delegate(delegate) - , m_layer(layer) { } ContentLayerDelegate* m_delegate; - TiledLayerChromium* m_layer; }; PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerDelegate* delegate) @@ -134,11 +126,11 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() if (m_textureUpdater) return; if (layerTreeHost()->settings().acceleratePainting) - m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this)); + m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); else if (layerTreeHost()->settings().perTilePainting) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); else - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); m_textureUpdater->setOpaque(opaque()); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index 74459a851..f61fd35d5 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -44,9 +44,10 @@ #include "cc/CCLayerTreeHost.h" #include "skia/ext/platform_canvas.h" -namespace WebCore { - using namespace std; +using WebKit::WebTransformationMatrix; + +namespace WebCore { static int s_nextLayerId = 1; @@ -361,7 +362,7 @@ void LayerChromium::setPosition(const FloatPoint& position) setNeedsCommit(); } -void LayerChromium::setSublayerTransform(const TransformationMatrix& sublayerTransform) +void LayerChromium::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) { if (m_sublayerTransform == sublayerTransform) return; @@ -369,7 +370,7 @@ void LayerChromium::setSublayerTransform(const TransformationMatrix& sublayerTra setNeedsCommit(); } -void LayerChromium::setTransform(const TransformationMatrix& transform) +void LayerChromium::setTransform(const WebTransformationMatrix& transform) { if (m_transform == transform) return; @@ -590,7 +591,7 @@ void LayerChromium::setOpacityFromAnimation(float opacity) m_opacity = opacity; } -void LayerChromium::setTransformFromAnimation(const TransformationMatrix& transform) +void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& transform) { // This is called due to an ongoing accelerated animation. Since this animation is // also being run on the impl thread, there is no need to request a commit to push diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h index 9be0279e2..a93d1760f 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h @@ -41,11 +41,11 @@ #include "Region.h" #include "RenderSurfaceChromium.h" #include "ShaderChromium.h" -#include "TransformationMatrix.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCOcclusionTracker.h" #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -77,8 +77,8 @@ public: virtual int id() const OVERRIDE { return m_layerId; } virtual void setOpacityFromAnimation(float) OVERRIDE; virtual float opacity() const OVERRIDE { return m_opacity; } - virtual void setTransformFromAnimation(const TransformationMatrix&) OVERRIDE; - virtual const TransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE; + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } virtual const IntSize& bounds() const OVERRIDE { return m_bounds; } const LayerChromium* rootLayer() const; @@ -130,10 +130,10 @@ public: void setPosition(const FloatPoint&); FloatPoint position() const { return m_position; } - void setSublayerTransform(const TransformationMatrix&); - const TransformationMatrix& sublayerTransform() const { return m_sublayerTransform; } + void setSublayerTransform(const WebKit::WebTransformationMatrix&); + const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; } - void setTransform(const TransformationMatrix&); + void setTransform(const WebKit::WebTransformationMatrix&); bool transformIsAnimating() const; const IntRect& visibleLayerRect() const { return m_visibleLayerRect; } @@ -213,11 +213,11 @@ public: void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; } // This moves from layer space, with origin in the center to target space with origin in the top left - const TransformationMatrix& drawTransform() const { return m_drawTransform; } - void setDrawTransform(const TransformationMatrix& matrix) { m_drawTransform = matrix; } + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } + void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; } // This moves from layer space, with origin the top left to screen space with origin in the top left - const TransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } - void setScreenSpaceTransform(const TransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } + const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } + void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } const IntRect& drawableContentRect() const { return m_drawableContentRect; } void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; } float contentsScale() const { return m_contentsScale; } @@ -334,8 +334,8 @@ private: bool m_drawCheckerboardForMissingTiles; bool m_forceRenderSurface; - TransformationMatrix m_transform; - TransformationMatrix m_sublayerTransform; + WebKit::WebTransformationMatrix m_transform; + WebKit::WebTransformationMatrix m_sublayerTransform; // Replica layer used for reflections. RefPtr<LayerChromium> m_replicaLayer; @@ -346,8 +346,8 @@ private: bool m_drawOpacityIsAnimating; IntRect m_clipRect; RenderSurfaceChromium* m_targetRenderSurface; - TransformationMatrix m_drawTransform; - TransformationMatrix m_screenSpaceTransform; + WebKit::WebTransformationMatrix m_drawTransform; + WebKit::WebTransformationMatrix m_screenSpaceTransform; bool m_drawTransformIsAnimating; bool m_screenSpaceTransformIsAnimating; IntRect m_drawableContentRect; diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index a9f3d4665..acacc353b 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -46,6 +46,8 @@ #include "PlatformColor.h" #include "PlatformContextSkia.h" #include "RenderSurfaceChromium.h" +#include "SharedGraphicsContext3D.h" +#include "SkBitmap.h" #include "TextureCopier.h" #include "TextureManager.h" #include "ThrottledTextureUploader.h" @@ -56,11 +58,13 @@ #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerImpl.h" +#include "cc/CCLayerQuad.h" #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" #include "cc/CCRenderPass.h" #include "cc/CCRenderSurfaceDrawQuad.h" +#include "cc/CCRenderSurfaceFilters.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTextureDrawQuad.h" #include "cc/CCTileDrawQuad.h" @@ -70,16 +74,17 @@ #include <wtf/MainThread.h> using namespace std; +using WebKit::WebTransformationMatrix; namespace WebCore { namespace { -static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top) +static WebTransformationMatrix orthoMatrix(float left, float right, float bottom, float top) { float deltaX = right - left; float deltaY = top - bottom; - TransformationMatrix ortho; + WebTransformationMatrix ortho; if (!deltaX || !deltaY) return ortho; ortho.setM11(2.0f / deltaX); @@ -94,9 +99,9 @@ static TransformationMatrix orthoMatrix(float left, float right, float bottom, f return ortho; } -static TransformationMatrix screenMatrix(int x, int y, int width, int height) +static WebTransformationMatrix screenMatrix(int x, int y, int width, int height) { - TransformationMatrix screen; + WebTransformationMatrix screen; // Map to viewport. screen.translate3d(x, y, 0); @@ -522,7 +527,7 @@ void LayerRendererChromium::drawCheckerboardQuad(const CCCheckerboardDrawQuad* q GLC(context(), context()->useProgram(program->program())); IntRect tileRect = quad->quadRect(); - TransformationMatrix tileTransform = quad->quadTransform(); + WebTransformationMatrix tileTransform = quad->quadTransform(); tileTransform.translate(tileRect.x() + tileRect.width() / 2.0, tileRect.y() + tileRect.height() / 2.0); float texOffsetX = tileRect.x(); @@ -551,7 +556,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const CCDebugBorderDrawQuad* qua GLC(context(), context()->useProgram(program->program())); const IntRect& layerRect = quad->quadRect(); - TransformationMatrix renderMatrix = quad->quadTransform(); + WebTransformationMatrix renderMatrix = quad->quadTransform(); renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); LayerRendererChromium::toGLMatrix(&glMatrix[0], projectionMatrix() * renderMatrix); @@ -568,7 +573,21 @@ void LayerRendererChromium::drawDebugBorderQuad(const CCDebugBorderDrawQuad* qua GLC(context(), context()->drawElements(GraphicsContext3D::LINE_LOOP, 4, GraphicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short))); } -void LayerRendererChromium::drawBackgroundFilters(const CCRenderSurfaceDrawQuad* quad) +static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, ManagedTexture* sourceTexture) +{ + if (filters.isEmpty()) + return SkBitmap(); + + RefPtr<GraphicsContext3D> filterContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get(); + if (!filterContext) + return SkBitmap(); + + layerRenderer->context()->flush(); + + return CCRenderSurfaceFilters::apply(filters, sourceTexture->textureId(), sourceTexture->size(), filterContext.get()); +} + +void LayerRendererChromium::drawBackgroundFilters(const CCRenderSurfaceDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform) { // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. // The algorithm works as follows: @@ -585,7 +604,7 @@ void LayerRendererChromium::drawBackgroundFilters(const CCRenderSurfaceDrawQuad* // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. CCRenderSurface* drawingSurface = quad->layer()->renderSurface(); - if (drawingSurface->backgroundFilters().isEmpty()) + if (quad->backgroundFilters().isEmpty()) return; // FIXME: We only allow background filters on the root render surface because other surfaces may contain @@ -593,17 +612,21 @@ void LayerRendererChromium::drawBackgroundFilters(const CCRenderSurfaceDrawQuad* if (!isCurrentRenderSurface(m_defaultRenderSurface)) return; - const TransformationMatrix& surfaceDrawTransform = quad->isReplica() ? drawingSurface->replicaDrawTransform() : drawingSurface->drawTransform(); - // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused). - IntRect deviceRect = drawingSurface->readbackDeviceContentRect(this, surfaceDrawTransform); + IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())); + + int top, right, bottom, left; + quad->backgroundFilters().getOutsets(top, right, bottom, left); + deviceRect.move(-left, -top); + deviceRect.expand(left + right, top + bottom); + deviceRect.intersect(m_currentRenderSurface->contentRect()); OwnPtr<ManagedTexture> deviceBackgroundTexture = ManagedTexture::create(m_renderSurfaceTextureManager.get()); if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) return; - SkBitmap filteredDeviceBackground = drawingSurface->applyFilters(this, drawingSurface->backgroundFilters(), deviceBackgroundTexture.get()); + SkBitmap filteredDeviceBackground = applyFilters(this, quad->backgroundFilters(), deviceBackgroundTexture.get()); if (!filteredDeviceBackground.getTexture()) return; @@ -613,29 +636,144 @@ void LayerRendererChromium::drawBackgroundFilters(const CCRenderSurfaceDrawQuad* if (!drawingSurface->prepareBackgroundTexture(this)) return; - // This must be computed before switching the target render surface to the background texture. - TransformationMatrix contentsDeviceTransform = drawingSurface->computeDeviceTransform(this, surfaceDrawTransform); - CCRenderSurface* targetRenderSurface = m_currentRenderSurface; - if (useManagedTexture(drawingSurface->backgroundTexture(), drawingSurface->contentRect())) { - drawingSurface->copyDeviceToBackgroundTexture(this, filteredDeviceBackgroundTextureId, deviceRect, contentsDeviceTransform); + if (useManagedTexture(drawingSurface->backgroundTexture(), quad->quadRect())) { + // Copy the readback pixels from device to the background texture for the surface. + WebTransformationMatrix deviceToSurfaceTransform; + deviceToSurfaceTransform.translate(quad->quadRect().width() / 2.0, quad->quadRect().height() / 2.0); + deviceToSurfaceTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); + deviceToSurfaceTransform.multiply(contentsDeviceTransform.inverse()); + deviceToSurfaceTransform.translate(deviceRect.width() / 2.0, deviceRect.height() / 2.0); + deviceToSurfaceTransform.translate(deviceRect.x(), deviceRect.y()); + + copyTextureToFramebuffer(filteredDeviceBackgroundTextureId, deviceRect.size(), deviceToSurfaceTransform); + useRenderSurface(targetRenderSurface); } } void LayerRendererChromium::drawRenderSurfaceQuad(const CCRenderSurfaceDrawQuad* quad) { - CCLayerImpl* layer = quad->layer(); + // The replica is always drawn first, so free after drawing the contents. + bool shouldReleaseTextures = !quad->isReplica(); - drawBackgroundFilters(quad); + CCRenderSurface* drawingSurface = quad->layer()->renderSurface(); - layer->renderSurface()->setScissorRect(this, quad->surfaceDamageRect()); - if (quad->isReplica()) - layer->renderSurface()->drawReplica(this); - else - layer->renderSurface()->drawContents(this); - layer->renderSurface()->releaseBackgroundTexture(); - layer->renderSurface()->releaseContentsTexture(); + WebTransformationMatrix renderTransform = quad->layerTransform(); + // Apply a scaling factor to size the quad from 1x1 to its intended size. + renderTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); + WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * renderTransform).to2dTransform(); + + // Can only draw surface if device matrix is invertible. + if (!contentsDeviceTransform.isInvertible() || !drawingSurface->hasValidContentsTexture()) { + if (shouldReleaseTextures) { + drawingSurface->releaseBackgroundTexture(); + drawingSurface->releaseContentsTexture(); + } + return; + } + + drawBackgroundFilters(quad, contentsDeviceTransform); + + // FIXME: Remove this call when the quad's scissorRect() is set correctly. + drawingSurface->setScissorRect(this, quad->surfaceDamageRect()); + + // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. + // Apply filters to the contents texture. + SkBitmap filterBitmap = applyFilters(this, quad->filters(), drawingSurface->contentsTexture()); + int contentsTextureId = drawingSurface->contentsTexture()->textureId(); + if (filterBitmap.getTexture()) { + GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); + contentsTextureId = texture->getTextureHandle(); + } + + // Draw the background texture if there is one. + if (drawingSurface->hasValidBackgroundTexture()) + copyTextureToFramebuffer(drawingSurface->backgroundTexture()->textureId(), quad->quadRect().size(), quad->layerTransform()); + + FloatQuad deviceQuad = contentsDeviceTransform.mapQuad(sharedGeometryQuad()); + CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox())); + CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad); + + // Use anti-aliasing programs only when necessary. + bool useAA = (!deviceQuad.isRectilinear() || !deviceQuad.boundingBox().isExpressibleAsIntRect()); + if (useAA) { + deviceLayerBounds.inflateAntiAliasingDistance(); + deviceLayerEdges.inflateAntiAliasingDistance(); + } + + bool useMask = quad->maskTextureId(); + + // FIXME: use the backgroundTexture and blend the background in with this draw instead of having a separate copy of the background texture. + + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, contentsTextureId); + + int shaderQuadLocation = -1; + int shaderEdgeLocation = -1; + int shaderMaskSamplerLocation = -1; + int shaderMatrixLocation = -1; + int shaderAlphaLocation = -1; + if (useAA && useMask) { + const RenderSurfaceMaskProgramAA* program = renderSurfaceMaskProgramAA(); + GLC(context(), context()->useProgram(program->program())); + GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); + + shaderQuadLocation = program->vertexShader().pointLocation(); + shaderEdgeLocation = program->fragmentShader().edgeLocation(); + shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); + shaderMatrixLocation = program->vertexShader().matrixLocation(); + shaderAlphaLocation = program->fragmentShader().alphaLocation(); + } else if (!useAA && useMask) { + const RenderSurfaceMaskProgram* program = renderSurfaceMaskProgram(); + GLC(context(), context()->useProgram(program->program())); + GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); + + shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); + shaderMatrixLocation = program->vertexShader().matrixLocation(); + shaderAlphaLocation = program->fragmentShader().alphaLocation(); + } else if (useAA && !useMask) { + const RenderSurfaceProgramAA* program = renderSurfaceProgramAA(); + GLC(context(), context()->useProgram(program->program())); + GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); + + shaderQuadLocation = program->vertexShader().pointLocation(); + shaderEdgeLocation = program->fragmentShader().edgeLocation(); + shaderMatrixLocation = program->vertexShader().matrixLocation(); + shaderAlphaLocation = program->fragmentShader().alphaLocation(); + } else { + const RenderSurfaceProgram* program = renderSurfaceProgram(); + GLC(context(), context()->useProgram(program->program())); + GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); + + shaderMatrixLocation = program->vertexShader().matrixLocation(); + shaderAlphaLocation = program->fragmentShader().alphaLocation(); + } + + if (shaderMaskSamplerLocation != -1) { + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); + GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->maskTextureId()); + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + } + + if (shaderEdgeLocation != -1) { + float edge[24]; + deviceLayerEdges.toFloatArray(edge); + deviceLayerBounds.toFloatArray(&edge[12]); + GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); + } + + // Map device space quad to surface space. + FloatQuad surfaceQuad = contentsDeviceTransform.inverse().mapQuad(deviceLayerEdges.floatQuad()); + + drawTexturedQuad(quad->layerTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, + shaderMatrixLocation, shaderAlphaLocation, shaderQuadLocation); + + if (shouldReleaseTextures) { + drawingSurface->releaseBackgroundTexture(); + drawingSurface->releaseContentsTexture(); + } } void LayerRendererChromium::drawSolidColorQuad(const CCSolidColorDrawQuad* quad) @@ -645,7 +783,7 @@ void LayerRendererChromium::drawSolidColorQuad(const CCSolidColorDrawQuad* quad) IntRect tileRect = quad->quadRect(); - TransformationMatrix tileTransform = quad->quadTransform(); + WebTransformationMatrix tileTransform = quad->quadTransform(); tileTransform.translate(tileRect.x() + tileRect.width() / 2.0, tileRect.y() + tileRect.height() / 2.0); const Color& color = quad->color(); @@ -721,7 +859,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) FloatQuad localQuad; - TransformationMatrix deviceTransform = TransformationMatrix(windowMatrix() * projectionMatrix() * quad->quadTransform()).to2dTransform(); + WebTransformationMatrix deviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * quad->quadTransform()).to2dTransform(); if (!deviceTransform.isInvertible()) return; @@ -810,7 +948,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); // Map quad to layer space. - TransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); + WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); localQuad = inverseDeviceTransform.mapQuad(deviceQuad.floatQuad()); } else { // Move fragment shader transform to vertex shader. We can do this while @@ -1083,7 +1221,7 @@ void LayerRendererChromium::drawHeadsUpDisplay(ManagedTexture* hudTexture, const GLC(m_context, m_context->useProgram(program->program())); GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); - TransformationMatrix matrix; + WebTransformationMatrix matrix; matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); drawTexturedQuad(matrix, hudSize.width(), hudSize.height(), 1, sharedGeometryQuad(), program->vertexShader().matrixLocation(), @@ -1096,6 +1234,8 @@ void LayerRendererChromium::finishDrawingFrame() GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); + m_renderSurfaceTextureManager->unprotectAllTextures(); + size_t contentsMemoryUseBytes = m_contentsTextureAllocator->currentMemoryUseBytes(); size_t reclaimLimit = TextureManager::reclaimLimitBytes(viewportSize()); size_t preferredLimit = reclaimLimit > contentsMemoryUseBytes ? reclaimLimit - contentsMemoryUseBytes : 0; @@ -1104,7 +1244,7 @@ void LayerRendererChromium::finishDrawingFrame() m_renderSurfaceTextureManager->deleteEvictedTextures(m_renderSurfaceTextureAllocator.get()); } -void LayerRendererChromium::toGLMatrix(float* flattened, const TransformationMatrix& m) +void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformationMatrix& m) { flattened[0] = m.m11(); flattened[1] = m.m12(); @@ -1124,13 +1264,13 @@ void LayerRendererChromium::toGLMatrix(float* flattened, const TransformationMat flattened[15] = m.m44(); } -void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& drawMatrix, +void LayerRendererChromium::drawTexturedQuad(const WebTransformationMatrix& drawMatrix, float width, float height, float opacity, const FloatQuad& quad, int matrixLocation, int alphaLocation, int quadLocation) { static float glMatrix[16]; - TransformationMatrix renderMatrix = drawMatrix; + WebTransformationMatrix renderMatrix = drawMatrix; // Apply a scaling factor to size the quad from 1x1 to its intended size. renderMatrix.scale3d(width, height, 1); @@ -1159,6 +1299,25 @@ void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& drawMat GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)); } +void LayerRendererChromium::copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebTransformationMatrix& drawMatrix) +{ + const RenderSurfaceProgram* program = renderSurfaceProgram(); + + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); + GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); + GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); + + GLC(context(), context()->useProgram(program->program())); + GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); + drawTexturedQuad(drawMatrix, bounds.width(), bounds.height(), 1, sharedGeometryQuad(), + program->vertexShader().matrixLocation(), + program->fragmentShader().alphaLocation(), + -1); +} + void LayerRendererChromium::finish() { TRACE_EVENT("LayerRendererChromium::finish", this, 0); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 1a2ebed0e..0f965a8b4 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -107,8 +107,8 @@ public: static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line); - const TransformationMatrix& projectionMatrix() const { return m_projectionMatrix; } - const TransformationMatrix& windowMatrix() const { return m_windowMatrix; } + const WebKit::WebTransformationMatrix& projectionMatrix() const { return m_projectionMatrix; } + const WebKit::WebTransformationMatrix& windowMatrix() const { return m_windowMatrix; } const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); } const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } @@ -131,10 +131,11 @@ public: GC3Denum bestTextureFormat(); - static void toGLMatrix(float*, const TransformationMatrix&); - void drawTexturedQuad(const TransformationMatrix& layerMatrix, + static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); + void drawTexturedQuad(const WebKit::WebTransformationMatrix& layerMatrix, float width, float height, float opacity, const FloatQuad&, int matrixLocation, int alphaLocation, int quadLocation); + void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix); protected: friend class LayerRendererGpuMemoryAllocationChangedCallbackAdapter; @@ -153,7 +154,7 @@ private: void drawQuad(const CCDrawQuad*, const FloatRect& surfaceDamageRect); void drawCheckerboardQuad(const CCCheckerboardDrawQuad*); void drawDebugBorderQuad(const CCDebugBorderDrawQuad*); - void drawBackgroundFilters(const CCRenderSurfaceDrawQuad*); + void drawBackgroundFilters(const CCRenderSurfaceDrawQuad*, const WebKit::WebTransformationMatrix& deviceTransform); void drawRenderSurfaceQuad(const CCRenderSurfaceDrawQuad*); void drawSolidColorQuad(const CCSolidColorDrawQuad*); void drawTextureQuad(const CCTextureDrawQuad*); @@ -194,8 +195,8 @@ private: LayerRendererCapabilities m_capabilities; - TransformationMatrix m_projectionMatrix; - TransformationMatrix m_windowMatrix; + WebKit::WebTransformationMatrix m_projectionMatrix; + WebKit::WebTransformationMatrix m_windowMatrix; CCRenderSurface* m_currentRenderSurface; ManagedTexture* m_currentManagedTexture; diff --git a/Source/WebCore/platform/graphics/chromium/LinkHighlight.cpp b/Source/WebCore/platform/graphics/chromium/LinkHighlight.cpp index 53536b32c..bcb7b3c36 100644 --- a/Source/WebCore/platform/graphics/chromium/LinkHighlight.cpp +++ b/Source/WebCore/platform/graphics/chromium/LinkHighlight.cpp @@ -34,6 +34,8 @@ #if USE(ACCELERATED_COMPOSITING) +using WebKit::WebTransformationMatrix; + namespace WebCore { PassRefPtr<LinkHighlight> LinkHighlight::create(GraphicsLayerChromium* parent, const Path& path, int animationId, int groupId) @@ -52,7 +54,7 @@ LinkHighlight::LinkHighlight(GraphicsLayerChromium* parent, const Path& path, in m_contentLayer->setBounds(rect.size()); - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); m_contentLayer->setTransform(transform); diff --git a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp index 267e01957..376434e62 100644 --- a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp +++ b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp @@ -29,6 +29,7 @@ #include "ProgramBinding.h" +#include "Extensions3D.h" #include "GeometryBinding.h" #include "GraphicsContext.h" #include "GraphicsContext3D.h" @@ -50,10 +51,16 @@ ProgramBindingBase::~ProgramBindingBase() ASSERT(!m_initialized); } +static bool contextLost(GraphicsContext3D* context) +{ + return (context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); +} + + void ProgramBindingBase::init(GraphicsContext3D* context, const String& vertexShader, const String& fragmentShader) { m_program = createShaderProgram(context, vertexShader, fragmentShader); - ASSERT(m_program); + ASSERT(m_program || contextLost(context)); } void ProgramBindingBase::cleanup(GraphicsContext3D* context) @@ -91,20 +98,23 @@ unsigned ProgramBindingBase::createShaderProgram(GraphicsContext3D* context, con TRACE_EVENT("ProgramBindingBase::createShaderProgram", this, 0); unsigned vertexShader = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShaderSource); if (!vertexShader) { - LOG_ERROR("Failed to create vertex shader"); + if (!contextLost(context)) + LOG_ERROR("Failed to create vertex shader"); return 0; } unsigned fragmentShader = loadShader(context, GraphicsContext3D::FRAGMENT_SHADER, fragmentShaderSource); if (!fragmentShader) { GLC(context, context->deleteShader(vertexShader)); - LOG_ERROR("Failed to create fragment shader"); + if (!contextLost(context)) + LOG_ERROR("Failed to create fragment shader"); return 0; } unsigned programObject = context->createProgram(); if (!programObject) { - LOG_ERROR("Failed to create shader program"); + if (!contextLost(context)) + LOG_ERROR("Failed to create shader program"); return 0; } @@ -120,7 +130,8 @@ unsigned ProgramBindingBase::createShaderProgram(GraphicsContext3D* context, con int linked = 0; GLC(context, context->getProgramiv(programObject, GraphicsContext3D::LINK_STATUS, &linked)); if (!linked) { - LOG_ERROR("Failed to link shader program"); + if (!contextLost(context)) + LOG_ERROR("Failed to link shader program"); GLC(context, context->deleteProgram(programObject)); return 0; } diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp index f5fe9a7b5..80a8a03eb 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp @@ -64,6 +64,14 @@ FloatRect RenderSurfaceChromium::drawableContentRect() const return drawableContentRect; } +RenderSurfaceChromium* RenderSurfaceChromium::targetRenderSurface() const +{ + LayerChromium* parent = m_owningLayer->parent(); + if (!parent) + return 0; + return parent->targetRenderSurface(); +} + bool RenderSurfaceChromium::hasReplica() const { return m_owningLayer->replicaLayer(); diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 8d017a313..e6711ef2a 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -34,8 +34,8 @@ #include "ProgramBinding.h" #include "ShaderChromium.h" #include "TextureManager.h" -#include "TransformationMatrix.h" #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Noncopyable.h> namespace WebCore { @@ -65,23 +65,23 @@ public: // This goes from content space with the origin in the center of the rect being transformed to the target space with the origin in the top left of the // rect being transformed. Position the rect so that the origin is in the center of it before applying this transform. - const TransformationMatrix& drawTransform() const { return m_drawTransform; } - void setDrawTransform(const TransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } + void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } - const TransformationMatrix& originTransform() const { return m_originTransform; } - void setOriginTransform(const TransformationMatrix& originTransform) { m_originTransform = originTransform; } + const WebKit::WebTransformationMatrix& originTransform() const { return m_originTransform; } + void setOriginTransform(const WebKit::WebTransformationMatrix& originTransform) { m_originTransform = originTransform; } - const TransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } - void setScreenSpaceTransform(const TransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } + const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } + void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } - const TransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } - void setReplicaDrawTransform(const TransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } + const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } + void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } - const TransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } - void setReplicaOriginTransform(const TransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } + const WebKit::WebTransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } + void setReplicaOriginTransform(const WebKit::WebTransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } - const TransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } - void setReplicaScreenSpaceTransform(const TransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } + const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } + void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; } void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; } @@ -108,6 +108,8 @@ public: void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; } const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; } + RenderSurfaceChromium* targetRenderSurface() const; + bool hasReplica() const; bool hasMask() const; @@ -122,12 +124,12 @@ private: float m_drawOpacity; bool m_drawOpacityIsAnimating; - TransformationMatrix m_drawTransform; - TransformationMatrix m_originTransform; - TransformationMatrix m_screenSpaceTransform; - TransformationMatrix m_replicaDrawTransform; - TransformationMatrix m_replicaOriginTransform; - TransformationMatrix m_replicaScreenSpaceTransform; + WebKit::WebTransformationMatrix m_drawTransform; + WebKit::WebTransformationMatrix m_originTransform; + WebKit::WebTransformationMatrix m_screenSpaceTransform; + WebKit::WebTransformationMatrix m_replicaDrawTransform; + WebKit::WebTransformationMatrix m_replicaOriginTransform; + WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; bool m_targetSurfaceTransformsAreAnimating; bool m_screenSpaceTransformsAreAnimating; WebKit::WebFilterOperations m_filters; diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index d029d775f..12e3717ca 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -29,13 +29,10 @@ #include "TiledLayerChromium.h" -#include "FontCache.h" -#include "FontDescription.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "ManagedTexture.h" #include "Region.h" -#include "TextRun.h" #include "TextStream.h" #include "TraceEvent.h" @@ -47,6 +44,7 @@ #include <wtf/MathExtras.h> using namespace std; +using WebKit::WebTransformationMatrix; namespace WebCore { @@ -76,15 +74,11 @@ public: bool partialUpdate; bool updated; bool isInUseOnImpl; - int lastUpdateFrame; - int totalPaintCount; private: explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) : partialUpdate(false) , updated(false) , isInUseOnImpl(false) - , lastUpdateFrame(0) - , totalPaintCount(0) , m_texture(texture) { } @@ -416,13 +410,6 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in return; } - if (tile->isDirty() && layerTreeHost()->settings().debugShowTileInfo) { - // Invalidate the entire tile so that text updates. - tile->dirtyRect = m_tiler->tileRect(tile); - tile->lastUpdateFrame = layerTreeHost()->frameNumber(); - tile->totalPaintCount++; - } - paintRect.unite(tile->dirtyRect); } } @@ -503,7 +490,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in tile->texture()->prepareRect(sourceRect); if (occlusion) - occlusion->overdrawMetrics().didUpload(TransformationMatrix(), sourceRect, tile->opaqueRect()); + occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), sourceRect, tile->opaqueRect()); const IntPoint anchor = m_tiler->tileRect(tile).location(); @@ -726,71 +713,5 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleLayerRect) return prepaintRect; } -void TiledLayerChromium::paintDebugTileInfo(GraphicsContext& context, const IntRect& layerRect) -{ - FontCachePurgePreventer fontCachePurgePreventer; - - // Don't bother writing info onto small tiles. - const int minDimension = 200; - if (m_tiler->tileSize().width() < minDimension || m_tiler->tileSize().height() < minDimension) - return; - - if (!m_debugInfoFont) { - FontDescription fontDesc; - fontDesc.setGenericFamily(FontDescription::MonospaceFamily); - fontDesc.setComputedSize(10); - m_debugInfoFont = adoptPtr(new Font(fontDesc, 0, 0)); - m_debugInfoFont->update(0); - } - - int fontHeight = m_debugInfoFont->fontMetrics().floatHeight() + 2; - - int left, top, right, bottom; - m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); - for (int j = top; j <= bottom; ++j) { - for (int i = left; i <= right; ++i) { - UpdatableTile* tile = tileAt(i, j); - if (!tile) - continue; - - IntRect tileRect = m_tiler->tileRect(tile); - String info[] = { - String::format("LayerId(%d)", id()), - String::format("Index(%d, %d)", i, j), - String::format("Tile(%d, %d, %d, %d)", tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height()), - String::format("Frame(%d)", tile->lastUpdateFrame), - String::format("Count(%d)", tile->totalPaintCount), - String::format("Layer(%d, %d)", contentBounds().width(), contentBounds().height()), - }; - const size_t lines = sizeof(info) / sizeof(info[0]); - int width[lines]; - - IntPoint center = m_tiler->tileRect(tile).center(); - int currentY = center.y() - fontHeight * lines / 2; - - int maxWidth = 0; - for (size_t i = 0; i < lines; ++i) { - width[i] = m_debugInfoFont->width(TextRun(info[i])); - maxWidth = max(width[i], maxWidth); - } - - IntRect textRect(IntPoint(center.x() - maxWidth / 2, currentY - fontHeight / 2), IntSize(maxWidth, fontHeight * lines + fontHeight / 2)); - - context.setFillColor(Color(192, 192, 192, 192), ColorSpaceDeviceRGB); - context.fillRect(FloatRect(textRect)); - - context.setFillColor(Color(64, 64, 64), ColorSpaceDeviceRGB); - - for (size_t i = 0; i < lines; ++i) { - TextRun run(info[i]); - int textWidth = m_debugInfoFont->width(run); - IntPoint textStart(center.x() - textWidth / 2, currentY + fontHeight / 2); - context.drawText(*m_debugInfoFont, run, textStart); - currentY += fontHeight; - } - } - } -} - } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index ebc4ee492..ca389f2e4 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -28,7 +28,6 @@ #if USE(ACCELERATED_COMPOSITING) -#include "Font.h" #include "LayerChromium.h" #include "cc/CCLayerTilingData.h" #include "cc/CCTiledLayerImpl.h" @@ -66,8 +65,6 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE; - void paintDebugTileInfo(GraphicsContext&, const IntRect&); - protected: TiledLayerChromium(); @@ -130,7 +127,6 @@ private: TilingOption m_tilingOption; OwnPtr<CCLayerTilingData> m_tiler; - OwnPtr<Font> m_debugInfoFont; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCAnimationCurve.h b/Source/WebCore/platform/graphics/chromium/cc/CCAnimationCurve.h index 7f506a706..e21de8964 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCAnimationCurve.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCAnimationCurve.h @@ -25,14 +25,14 @@ #ifndef CCAnimationCurve_h #define CCAnimationCurve_h -#include "TransformationMatrix.h" - +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class CCFloatAnimationCurve; class CCTransformAnimationCurve; +class IntSize; class TransformOperations; // An animation curve is a function that returns a value given a time. @@ -65,7 +65,7 @@ class CCTransformAnimationCurve : public CCAnimationCurve { public: virtual ~CCTransformAnimationCurve() { } - virtual TransformationMatrix getValue(double t, const IntSize& layerSize) const = 0; + virtual WebKit::WebTransformationMatrix getValue(double t, const IntSize& layerSize) const = 0; // Partial CCAnimation implementation. virtual Type type() const OVERRIDE { return Transform; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp index 567bd1f1f..8fd3ed124 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp @@ -40,6 +40,8 @@ #include "cc/CCRenderSurface.h" #include <public/WebFilterOperations.h> +using WebKit::WebTransformationMatrix; + namespace WebCore { PassOwnPtr<CCDamageTracker> CCDamageTracker::create() @@ -244,7 +246,7 @@ void CCDamageTracker::extendDamageForLayer(CCLayerImpl* layer, FloatRect& target // Property changes take priority over update rects. // Compute the layer's "originTransform" by translating the drawTransform. - TransformationMatrix originTransform = layer->drawTransform(); + WebTransformationMatrix originTransform = layer->drawTransform(); originTransform.translate(-0.5 * layer->bounds().width(), -0.5 * layer->bounds().height()); bool layerIsNew = false; @@ -304,12 +306,12 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect // If there was damage, transform it to target space, and possibly contribute its reflection if needed. if (!damageRectInLocalSpace.isEmpty()) { - const TransformationMatrix& originTransform = renderSurface->originTransform(); + const WebTransformationMatrix& originTransform = renderSurface->originTransform(); FloatRect damageRectInTargetSpace = CCMathUtil::mapClippedRect(originTransform, damageRectInLocalSpace); targetDamageRect.uniteIfNonZero(damageRectInTargetSpace); if (layer->replicaLayer()) { - const TransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); + const WebTransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); targetDamageRect.uniteIfNonZero(CCMathUtil::mapClippedRect(replicaOriginTransform, damageRectInLocalSpace)); } } @@ -322,7 +324,7 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. - const TransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); + const WebTransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); FloatRect replicaMaskLayerRect = CCMathUtil::mapClippedRect(replicaOriginTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height()))); saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h index f4ef2d3f2..381cbaeac 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h @@ -47,8 +47,8 @@ class CCDrawQuad { WTF_MAKE_NONCOPYABLE(CCDrawQuad); public: const IntRect& quadRect() const { return m_quadRect; } - const TransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform(); } - const TransformationMatrix& layerTransform() const { return m_sharedQuadState->layerTransform(); } + const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform(); } + const WebKit::WebTransformationMatrix& layerTransform() const { return m_sharedQuadState->layerTransform(); } const IntRect& layerRect() const { return m_sharedQuadState->layerRect(); } const IntRect& clipRect() const { return m_sharedQuadState->clipRect(); } float opacity() const { return m_sharedQuadState->opacity(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.cpp index ae41fe069..4db39b69a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.cpp @@ -37,6 +37,8 @@ #include <wtf/OwnPtr.h> +using WebKit::WebTransformationMatrix; + namespace WebCore { namespace { @@ -176,7 +178,7 @@ PassOwnPtr<CCTransformKeyframe> CCTransformKeyframe::clone() const } case TransformOperation::MATRIX: { MatrixTransformOperation* transform = static_cast<MatrixTransformOperation*>(m_value.operations()[j].get()); - TransformationMatrix m = transform->matrix(); + WebTransformationMatrix m = WebTransformationMatrix(transform->matrix()); operations.operations().append(MatrixTransformOperation::create(m.a(), m.b(), m.c(), m.d(), m.e(), m.f())); break; } @@ -287,18 +289,19 @@ PassOwnPtr<CCAnimationCurve> CCKeyframedTransformAnimationCurve::clone() const return toReturn.release(); } -TransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t, const IntSize& layerSize) const +WebTransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t, const IntSize& layerSize) const { + // Note: WebCore data type used here, just for now. TransformationMatrix transformMatrix; if (t <= m_keyframes.first()->time()) { m_keyframes.first()->value().apply(layerSize, transformMatrix); - return transformMatrix; + return WebTransformationMatrix(transformMatrix); } if (t >= m_keyframes.last()->time()) { m_keyframes.last()->value().apply(layerSize, transformMatrix); - return transformMatrix; + return WebTransformationMatrix(transformMatrix); } size_t i = 0; @@ -316,6 +319,7 @@ TransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t, cons for (size_t j = 0; j < m_keyframes[i+1]->value().size(); ++j) m_keyframes[i+1]->value().operations()[j]->blend(m_keyframes[i]->value().at(j), progress)->apply(transformMatrix, layerSize); } else { + // Note: WebCore data type used here, just for now. TransformationMatrix source; m_keyframes[i]->value().apply(layerSize, source); @@ -324,7 +328,7 @@ TransformationMatrix CCKeyframedTransformAnimationCurve::getValue(double t, cons transformMatrix.blend(source, progress); } - return transformMatrix; + return WebTransformationMatrix(transformMatrix); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.h b/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.h index 8d1f0e055..e70cdafb7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCKeyframedAnimationCurve.h @@ -116,7 +116,7 @@ public: virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE; // CCTransformAnimationCurve implementation - virtual TransformationMatrix getValue(double t, const IntSize&) const OVERRIDE; + virtual WebKit::WebTransformationMatrix getValue(double t, const IntSize&) const OVERRIDE; private: CCKeyframedTransformAnimationCurve(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp index 14fb78a65..096979544 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp @@ -27,12 +27,14 @@ #include "cc/CCLayerAnimationController.h" #include "GraphicsLayer.h" // for KeyframeValueList -#include "TransformationMatrix.h" #include "cc/CCActiveAnimation.h" #include "cc/CCKeyframedAnimationCurve.h" +#include <public/WebTransformationMatrix.h> #include <wtf/CurrentTime.h> #include <wtf/HashMap.h> +using WebKit::WebTransformationMatrix; + namespace WebCore { namespace { @@ -478,7 +480,7 @@ void CCLayerAnimationController::tickAnimations(double monotonicTime) case CCActiveAnimation::Transform: { const CCTransformAnimationCurve* transformAnimationCurve = m_activeAnimations[i]->curve()->toTransformAnimationCurve(); - const TransformationMatrix matrix = transformAnimationCurve->getValue(trimmed, m_client->bounds()); + const WebTransformationMatrix matrix = transformAnimationCurve->getValue(trimmed, m_client->bounds()); if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) m_activeAnimations[i]->setRunState(CCActiveAnimation::Finished, monotonicTime); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h index ac7287f71..c4c9158b2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h @@ -34,12 +34,16 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> + +namespace WebKit { +class WebTransformationMatrix; +} + namespace WebCore { class Animation; class IntSize; class KeyframeValueList; -class TransformationMatrix; class CCLayerAnimationControllerClient { public: @@ -48,8 +52,8 @@ public: virtual int id() const = 0; virtual void setOpacityFromAnimation(float) = 0; virtual float opacity() const = 0; - virtual void setTransformFromAnimation(const TransformationMatrix&) = 0; - virtual const TransformationMatrix& transform() const = 0; + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) = 0; + virtual const WebKit::WebTransformationMatrix& transform() const = 0; virtual const IntSize& bounds() const = 0; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 6d80684f6..1f08b9b99 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -38,6 +38,8 @@ #include "cc/CCSolidColorDrawQuad.h" #include <wtf/text/WTFString.h> +using WebKit::WebTransformationMatrix; + namespace WebCore { CCLayerImpl::CCLayerImpl(int id) @@ -169,9 +171,10 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, debugBorderColor(), debugBorderWidth())); } -void CCLayerImpl::bindContentsTexture(LayerRendererChromium*) +unsigned CCLayerImpl::contentsTextureId() const { ASSERT_NOT_REACHED(); + return 0; } void CCLayerImpl::scrollBy(const FloatSize& scroll) @@ -193,9 +196,9 @@ const IntRect CCLayerImpl::getDrawRect() const return mappedRect; } -TransformationMatrix CCLayerImpl::quadTransform() const +WebTransformationMatrix CCLayerImpl::quadTransform() const { - TransformationMatrix quadTransformation = drawTransform(); + WebTransformationMatrix quadTransformation = drawTransform(); float offsetX = -0.5 * bounds().width(); float offsetY = -0.5 * bounds().height(); @@ -308,7 +311,7 @@ void CCLayerImpl::setOpacityFromAnimation(float opacity) setOpacity(opacity); } -void CCLayerImpl::setTransformFromAnimation(const TransformationMatrix& transform) +void CCLayerImpl::setTransformFromAnimation(const WebTransformationMatrix& transform) { setTransform(transform); } @@ -454,7 +457,7 @@ void CCLayerImpl::setPreserves3D(bool preserves3D) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setSublayerTransform(const TransformationMatrix& sublayerTransform) +void CCLayerImpl::setSublayerTransform(const WebTransformationMatrix& sublayerTransform) { if (m_sublayerTransform == sublayerTransform) return; @@ -464,7 +467,7 @@ void CCLayerImpl::setSublayerTransform(const TransformationMatrix& sublayerTrans noteLayerPropertyChangedForDescendants(); } -void CCLayerImpl::setTransform(const TransformationMatrix& transform) +void CCLayerImpl::setTransform(const WebTransformationMatrix& transform) { if (m_transform == transform) return; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index bb75a89eb..2c41d06ea 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -31,11 +31,11 @@ #include "IntRect.h" #include "Region.h" #include "TextStream.h" -#include "TransformationMatrix.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCRenderSurface.h" #include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -61,8 +61,8 @@ public: virtual int id() const OVERRIDE { return m_layerId; } virtual void setOpacityFromAnimation(float) OVERRIDE; virtual float opacity() const OVERRIDE { return m_opacity; } - virtual void setTransformFromAnimation(const TransformationMatrix&) OVERRIDE; - virtual const TransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE; + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } virtual const IntSize& bounds() const OVERRIDE { return m_bounds; } // Tree structure. @@ -88,7 +88,7 @@ public: virtual void didDraw(); void appendDebugBorderQuad(CCQuadCuller&, const CCSharedQuadState*) const; - virtual void bindContentsTexture(LayerRendererChromium*); + virtual unsigned contentsTextureId() const; // Returns true if this layer has content to draw. void setDrawsContent(bool); @@ -136,8 +136,8 @@ public: void setIsNonCompositedContent(bool isNonCompositedContent) { m_isNonCompositedContent = isNonCompositedContent; } bool isNonCompositedContent() const { return m_isNonCompositedContent; } - void setSublayerTransform(const TransformationMatrix&); - const TransformationMatrix& sublayerTransform() const { return m_sublayerTransform; } + void setSublayerTransform(const WebKit::WebTransformationMatrix&); + const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; } // Debug layer border - visual effect only, do not change geometry/clipping/etc. void setDebugBorderColor(Color); @@ -212,13 +212,13 @@ public: // Returns the rect containtaining this layer in the current view's coordinate system. const IntRect getDrawRect() const; - void setTransform(const TransformationMatrix&); + void setTransform(const WebKit::WebTransformationMatrix&); bool transformIsAnimating() const; - const TransformationMatrix& drawTransform() const { return m_drawTransform; } - void setDrawTransform(const TransformationMatrix& matrix) { m_drawTransform = matrix; } - const TransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } - void setScreenSpaceTransform(const TransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } + void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; } + const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } + void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; } @@ -253,7 +253,7 @@ protected: static void writeIndent(TextStream&, int indent); // Transformation used to transform quads provided in appendQuads. - virtual TransformationMatrix quadTransform() const; + virtual WebKit::WebTransformationMatrix quadTransform() const; private: void setParent(CCLayerImpl* parent) { m_parent = parent; } @@ -304,8 +304,8 @@ private: FloatPoint m_position; bool m_preserves3D; bool m_drawCheckerboardForMissingTiles; - TransformationMatrix m_sublayerTransform; - TransformationMatrix m_transform; + WebKit::WebTransformationMatrix m_sublayerTransform; + WebKit::WebTransformationMatrix m_transform; bool m_usesLayerClipping; bool m_isNonCompositedContent; @@ -339,8 +339,8 @@ private: WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; - TransformationMatrix m_drawTransform; - TransformationMatrix m_screenSpaceTransform; + WebKit::WebTransformationMatrix m_drawTransform; + WebKit::WebTransformationMatrix m_screenSpaceTransform; bool m_drawTransformIsAnimating; bool m_screenSpaceTransformIsAnimating; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp index 1af639c8b..fdf3c7bb2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp @@ -26,13 +26,14 @@ #include "cc/CCLayerSorter.h" -#include "TransformationMatrix.h" #include "cc/CCMathUtil.h" #include "cc/CCRenderSurface.h" #include <limits.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Deque.h> using namespace std; +using WebKit::WebTransformationMatrix; #define LOG_CHANNEL_PREFIX Log #define SHOW_DEBUG_LOG 0 @@ -151,7 +152,7 @@ CCLayerSorter::ABCompareResult CCLayerSorter::checkOverlap(LayerShape* a, LayerS return BBeforeA; } -CCLayerSorter::LayerShape::LayerShape(float width, float height, const TransformationMatrix& drawTransform) +CCLayerSorter::LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform) { FloatQuad layerQuad(FloatPoint(-width * 0.5, height * 0.5), FloatPoint(width * 0.5, height * 0.5), @@ -236,7 +237,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera LOG(CCLayerSorter, "Layer %d (%d x %d)\n", node.layer->id(), node.layer->bounds().width(), node.layer->bounds().height()); #endif - TransformationMatrix drawTransform; + WebTransformationMatrix drawTransform; float layerWidth, layerHeight; if (renderSurface) { drawTransform = renderSurface->drawTransform(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.h index 3e2a88c92..cb88e85db 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.h @@ -33,6 +33,10 @@ #include <wtf/Noncopyable.h> #include <wtf/Vector.h> +namespace WebKit { +class WebTransformationMatrix; +} + namespace WebCore { class CCLayerSorter { @@ -47,7 +51,7 @@ public: // Holds various useful properties derived from a layer's 3D outline. struct LayerShape { LayerShape() { } - LayerShape(float width, float height, const TransformationMatrix& drawTransform); + LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform); float layerZFromProjectedPoint(const FloatPoint&) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 96397ca45..cb610dfd9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -43,6 +43,7 @@ #include "cc/CCThreadProxy.h" using namespace std; +using WebKit::WebTransformationMatrix; namespace { static int numLayerTreeInstances; @@ -511,8 +512,8 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u { TRACE_EVENT("CCLayerTreeHost::updateLayers::calcDrawEtc", this, 0); - TransformationMatrix identityMatrix; - TransformationMatrix deviceScaleTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix deviceScaleTransform; deviceScaleTransform.scale(m_settings.deviceScaleFactor); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, updateList, rootRenderSurface->layerList(), layerRendererCapabilities().maxTextureSize); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index 714602356..dc8fb1c93 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -30,7 +30,6 @@ #include "IntRect.h" #include "LayerChromium.h" #include "RateLimiter.h" -#include "TransformationMatrix.h" #include "cc/CCAnimationEvents.h" #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCProxy.h" @@ -77,7 +76,6 @@ protected: struct CCSettings { CCSettings() : acceleratePainting(false) - , debugShowTileInfo(false) , showFPSCounter(false) , showPlatformLayerTree(false) , showPaintRects(false) @@ -94,7 +92,6 @@ struct CCSettings { { } bool acceleratePainting; - bool debugShowTileInfo; bool showFPSCounter; bool showPlatformLayerTree; bool showPaintRects; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index 2a0f71803..b5bcabbf0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -31,7 +31,6 @@ #include "IntRect.h" #include "LayerChromium.h" #include "RenderSurfaceChromium.h" -#include "TransformationMatrix.h" #include "cc/CCActiveAnimation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" @@ -39,10 +38,13 @@ #include "cc/CCLayerSorter.h" #include "cc/CCMathUtil.h" #include "cc/CCRenderSurface.h" +#include <public/WebTransformationMatrix.h> + +using WebKit::WebTransformationMatrix; namespace WebCore { -IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const TransformationMatrix& transform) +IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform) { // Is this layer fully contained within the target surface? IntRect layerInSurfaceSpace = CCMathUtil::mapClippedRect(transform, layerBoundRect); @@ -59,7 +61,7 @@ IntRect CCLayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurface // This bounding rectangle may be larger than it needs to be (being // axis-aligned), but is a reasonable filter on the space to consider. // Non-invertible transforms will create an empty rect here. - const TransformationMatrix surfaceToLayer = transform.inverse(); + const WebTransformationMatrix surfaceToLayer = transform.inverse(); IntRect layerRect = enclosingIntRect(CCMathUtil::projectClippedRect(surfaceToLayer, FloatRect(minimalSurfaceRect))); layerRect.intersect(layerBoundRect); return layerRect; @@ -102,7 +104,7 @@ static bool isLayerBackFaceVisible(LayerType* layer) } template<typename LayerType> -static bool isSurfaceBackFaceVisible(LayerType* layer, const TransformationMatrix& drawTransform) +static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMatrix& drawTransform) { if (layerIsInExisting3DRenderingContext(layer)) return drawTransform.isBackFaceVisible(); @@ -133,7 +135,7 @@ static IntRect calculateVisibleLayerRect(LayerType* layer) const IntSize& contentBounds = layer->contentBounds(); const IntRect layerBoundRect = IntRect(IntPoint(), contentBounds); - TransformationMatrix transform = layer->drawTransform(); + WebTransformationMatrix transform = layer->drawTransform(); transform.scaleNonUniform(bounds.width() / static_cast<double>(contentBounds.width()), bounds.height() / static_cast<double>(contentBounds.height())); @@ -143,7 +145,7 @@ static IntRect calculateVisibleLayerRect(LayerType* layer) return visibleLayerRect; } -static bool isScaleOrTranslation(const TransformationMatrix& m) +static bool isScaleOrTranslation(const WebTransformationMatrix& m) { return !m.m12() && !m.m13() && !m.m14() && !m.m21() && !m.m23() && !m.m24() @@ -282,7 +284,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig // Recursively walks the layer tree starting at the given node and computes all the // necessary transformations, clipRects, render surfaces, etc. template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter> -static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, LayerSorter* layerSorter, int maxTextureSize) +static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, LayerSorter* layerSorter, int maxTextureSize) { // This function computes the new matrix transformations recursively for this // layer and all its descendants. It also computes the appropriate render surfaces. @@ -296,7 +298,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer // projection applied at draw time flips the Y axis appropriately. // // 2. The anchor point, when given as a FloatPoint object, is specified in "unit layer space", - // where the bounds of the layer map to [0, 1]. However, as a TransformationMatrix object, + // where the bounds of the layer map to [0, 1]. However, as a WebTransformationMatrix object, // the transform to the anchor point is specified in "pixel layer space", where the bounds // of the layer map to [bounds.width(), bounds.height()]. // @@ -399,7 +401,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer float centerOffsetX = (0.5 - anchorPoint.x()) * bounds.width(); float centerOffsetY = (0.5 - anchorPoint.y()) * bounds.height(); - TransformationMatrix layerLocalTransform; + WebTransformationMatrix layerLocalTransform; // LT = Tr[origin] * S[pageScaleDelta] layerLocalTransform.scale(layer->pageScaleDelta()); // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] @@ -409,8 +411,8 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] layerLocalTransform.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ()); - TransformationMatrix combinedTransform = parentMatrix; - combinedTransform = combinedTransform.multiply(layerLocalTransform); + WebTransformationMatrix combinedTransform = parentMatrix; + combinedTransform.multiply(layerLocalTransform); bool animatingTransformToTarget = layer->transformIsAnimating(); bool animatingTransformToScreen = animatingTransformToTarget; @@ -424,7 +426,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurface's space. // nextHierarchyMatrix will only change if this layer uses a new RenderSurface, otherwise remains the same. - TransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; + WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; // FIXME: This seems like the wrong place to set this layer->setUsesLayerClipping(false); @@ -441,7 +443,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer renderSurface->clearLayerList(); // The origin of the new surface is the upper left corner of the layer. - TransformationMatrix drawTransform; + WebTransformationMatrix drawTransform; drawTransform.translate3d(0.5 * bounds.width(), 0.5 * bounds.height(), 0); layer->setDrawTransform(drawTransform); @@ -453,7 +455,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer layer->setDrawOpacity(1); layer->setDrawOpacityIsAnimating(false); - TransformationMatrix surfaceOriginTransform = combinedTransform; + WebTransformationMatrix surfaceOriginTransform = combinedTransform; surfaceOriginTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0); renderSurface->setOriginTransform(surfaceOriginTransform); @@ -475,11 +477,8 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer layer->setUsesLayerClipping(false); layer->setClipRect(IntRect()); - if (layer->maskLayer()) { - renderSurface->setMaskLayer(layer->maskLayer()); + if (layer->maskLayer()) layer->maskLayer()->setTargetRenderSurface(renderSurface); - } else - renderSurface->setMaskLayer(0); if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) layer->replicaLayer()->maskLayer()->setTargetRenderSurface(renderSurface); @@ -529,7 +528,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer // Note that at this point, layer->drawTransform() is not necessarily the same as local variable drawTransform. // layerScreenSpaceTransform represents the transform between root layer's "screen space" and local layer space. - TransformationMatrix layerScreenSpaceTransform = nextHierarchyMatrix; + WebTransformationMatrix layerScreenSpaceTransform = nextHierarchyMatrix; layerScreenSpaceTransform.multiply(layer->drawTransform()); layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0); layer->setScreenSpaceTransform(layerScreenSpaceTransform); @@ -544,7 +543,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer } else layer->setDrawableContentRect(IntRect()); - TransformationMatrix sublayerMatrix = layer->drawTransform(); + WebTransformationMatrix sublayerMatrix = layer->drawTransform(); // Flatten to 2D if the layer doesn't preserve 3D. if (!layer->preserves3D()) { @@ -632,7 +631,7 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer layer->setClipRect(layer->drawableContentRect()); // Adjust the origin of the transform to be the center of the render surface. - TransformationMatrix drawTransform = renderSurface->originTransform(); + WebTransformationMatrix drawTransform = renderSurface->originTransform(); drawTransform.translate3d(surfaceCenter.x() + centerOffsetDueToClipping.width(), surfaceCenter.y() + centerOffsetDueToClipping.height(), 0); renderSurface->setDrawTransform(drawTransform); @@ -641,23 +640,23 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer if (layer->replicaLayer()) { // Compute the transformation matrix used to draw the surface's replica to the target surface. - TransformationMatrix replicaDrawTransform = renderSurface->originTransform(); + WebTransformationMatrix replicaDrawTransform = renderSurface->originTransform(); replicaDrawTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); replicaDrawTransform.multiply(layer->replicaLayer()->transform()); replicaDrawTransform.translate(surfaceCenter.x() - anchorPoint.x() * bounds.width(), surfaceCenter.y() - anchorPoint.y() * bounds.height()); renderSurface->setReplicaDrawTransform(replicaDrawTransform); - TransformationMatrix surfaceOriginToReplicaOriginTransform; + WebTransformationMatrix surfaceOriginToReplicaOriginTransform; surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform()); surfaceOriginToReplicaOriginTransform.translate(-anchorPoint.x() * bounds.width(), -anchorPoint.y() * bounds.height()); // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. - TransformationMatrix replicaOriginTransform = layer->renderSurface()->originTransform() * surfaceOriginToReplicaOriginTransform; + WebTransformationMatrix replicaOriginTransform = layer->renderSurface()->originTransform() * surfaceOriginToReplicaOriginTransform; renderSurface->setReplicaOriginTransform(replicaOriginTransform); // Compute the replica's "screenSpaceTransform" that maps from the replica's origin space to the screen's origin space. - TransformationMatrix replicaScreenSpaceTransform = layer->renderSurface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform; + WebTransformationMatrix replicaScreenSpaceTransform = layer->renderSurface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform; renderSurface->setReplicaScreenSpaceTransform(replicaScreenSpaceTransform); } @@ -710,13 +709,13 @@ static void walkLayersAndCalculateVisibleLayerRects(const LayerList& renderSurfa } } -void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(LayerChromium* layer, LayerChromium* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize) +void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(LayerChromium* layer, LayerChromium* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize) { WebCore::calculateDrawTransformsAndVisibilityInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, 0, maxTextureSize); walkLayersAndCalculateVisibleLayerRects<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList); } -void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* layer, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextureSize) +void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* layer, CCLayerImpl* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextureSize) { calculateDrawTransformsAndVisibilityInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize); walkLayersAndCalculateVisibleLayerRects<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface>(renderSurfaceLayerList); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h index 3762f64b1..0585aff4f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h @@ -27,7 +27,7 @@ #include "IntRect.h" #include "IntSize.h" -#include "TransformationMatrix.h" +#include <public/WebTransformationMatrix.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -39,10 +39,10 @@ class LayerChromium; class CCLayerTreeHostCommon { public: - static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const TransformationMatrix&); + static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); - static void calculateDrawTransformsAndVisibility(LayerChromium*, LayerChromium* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize); - static void calculateDrawTransformsAndVisibility(CCLayerImpl*, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter*, int maxTextureSize); + static void calculateDrawTransformsAndVisibility(LayerChromium*, LayerChromium* rootLayer, const WebKit::WebTransformationMatrix& parentMatrix, const WebKit::WebTransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize); + static void calculateDrawTransformsAndVisibility(CCLayerImpl*, CCLayerImpl* rootLayer, const WebKit::WebTransformationMatrix& parentMatrix, const WebKit::WebTransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter*, int maxTextureSize); template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 91336a776..0a49f8e7d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -47,6 +47,8 @@ #include "cc/CCThreadTask.h" #include <wtf/CurrentTime.h> +using WebKit::WebTransformationMatrix; + namespace { void didVisibilityChange(WebCore::CCLayerTreeHostImpl* id, bool visible) @@ -234,7 +236,7 @@ static FloatRect damageInSurfaceSpace(CCLayerImpl* renderSurfaceLayer, const Flo FloatRect surfaceDamageRect; // For now, we conservatively use the root damage as the damage for // all surfaces, except perspective transforms. - const TransformationMatrix& screenSpaceTransform = renderSurfaceLayer->renderSurface()->screenSpaceTransform(); + const WebTransformationMatrix& screenSpaceTransform = renderSurfaceLayer->renderSurface()->screenSpaceTransform(); if (screenSpaceTransform.hasPerspective()) { // Perspective projections do not play nice with mapRect of // inverse transforms. In this uncommon case, its simpler to @@ -243,7 +245,7 @@ static FloatRect damageInSurfaceSpace(CCLayerImpl* renderSurfaceLayer, const Flo CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); surfaceDamageRect = renderSurface->contentRect(); } else { - TransformationMatrix inverseScreenSpaceTransform = screenSpaceTransform.inverse(); + WebTransformationMatrix inverseScreenSpaceTransform = screenSpaceTransform.inverse(); surfaceDamageRect = inverseScreenSpaceTransform.mapRect(rootDamageRect); } return surfaceDamageRect; @@ -264,8 +266,8 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur { TRACE_EVENT("CCLayerTreeHostImpl::calcDrawEtc", this, 0); - TransformationMatrix identityMatrix; - TransformationMatrix deviceScaleTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix deviceScaleTransform; deviceScaleTransform.scale(m_settings.deviceScaleFactor); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(m_rootLayerImpl.get(), m_rootLayerImpl.get(), deviceScaleTransform, identityMatrix, renderSurfaceLayerList, m_rootLayerImpl->renderSurface()->layerList(), &m_layerSorter, layerRendererCapabilities().maxTextureSize); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index f8b763140..7f0c7ff66 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -50,7 +50,6 @@ class CCLayerTreeHostImplTimeSourceAdapter; class LayerRendererChromium; class TextureAllocator; struct LayerRendererCapabilities; -class TransformationMatrix; // CCLayerTreeHost->CCProxy callback interface. class CCLayerTreeHostImplClient { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp index 42933688b..867469dde 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp @@ -29,42 +29,13 @@ #include "FloatPoint.h" #include "FloatQuad.h" #include "IntRect.h" -#include "TransformationMatrix.h" +#include <public/WebTransformationMatrix.h> -namespace WebCore { - -struct HomogeneousCoordinate { - HomogeneousCoordinate(double newX, double newY, double newZ, double newW) - : x(newX) - , y(newY) - , z(newZ) - , w(newW) - { - } +using WebKit::WebTransformationMatrix; - bool shouldBeClipped() const - { - return w <= 0; - } - - FloatPoint cartesianPoint2d() const - { - if (w == 1) - return FloatPoint(x, y); - - // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. - ASSERT(w); - double invW = 1.0 / w; - return FloatPoint(x * invW, y * invW); - } - - double x; - double y; - double z; - double w; -}; +namespace WebCore { -static HomogeneousCoordinate projectPoint(const TransformationMatrix& transform, const FloatPoint& p) +static HomogeneousCoordinate projectPoint(const WebTransformationMatrix& transform, const FloatPoint& p) { // In this case, the layer we are trying to project onto is perpendicular to ray // (point p and z-axis direction) that we are trying to project. This happens when the @@ -86,7 +57,7 @@ static HomogeneousCoordinate projectPoint(const TransformationMatrix& transform, return HomogeneousCoordinate(outX, outY, outZ, outW); } -static HomogeneousCoordinate mapPoint(const TransformationMatrix& transform, const FloatPoint& p) +static HomogeneousCoordinate mapPoint(const WebTransformationMatrix& transform, const FloatPoint& p) { double x = p.x(); double y = p.y(); @@ -138,67 +109,18 @@ static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& y ymax = std::max(p.y(), ymax); } -static FloatRect computeEnclosingRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4) -{ - // This function performs clipping as necessary and computes the enclosing 2d - // FloatRect of the vertices. Doing these two steps simultaneously allows us to avoid - // the overhead of storing an unknown number of clipped vertices. - - // If no vertices on the quad are clipped, then we can simply return the enclosing rect directly. - bool somethingClipped = h1.shouldBeClipped() || h2.shouldBeClipped() || h3.shouldBeClipped() || h4.shouldBeClipped(); - if (!somethingClipped) { - FloatQuad mappedQuad = FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d()); - return mappedQuad.boundingBox(); - } - - bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped(); - if (everythingClipped) - return FloatRect(); - - float xmin = std::numeric_limits<float>::max(); - float xmax = std::numeric_limits<float>::min(); - float ymin = std::numeric_limits<float>::max(); - float ymax = std::numeric_limits<float>::min(); - - if (!h1.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h1.cartesianPoint2d()); - - if (h1.shouldBeClipped() ^ h2.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h1, h2).cartesianPoint2d()); - - if (!h2.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h2.cartesianPoint2d()); - - if (h2.shouldBeClipped() ^ h3.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h2, h3).cartesianPoint2d()); - - if (!h3.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h3.cartesianPoint2d()); - - if (h3.shouldBeClipped() ^ h4.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h3, h4).cartesianPoint2d()); - - if (!h4.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h4.cartesianPoint2d()); - - if (h4.shouldBeClipped() ^ h1.shouldBeClipped()) - expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h4, h1).cartesianPoint2d()); - - return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin)); -} - static inline void addVertexToClippedQuad(const FloatPoint& newVertex, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad) { clippedQuad[numVerticesInClippedQuad] = newVertex; numVerticesInClippedQuad++; } -IntRect CCMathUtil::mapClippedRect(const TransformationMatrix& transform, const IntRect& srcRect) +IntRect CCMathUtil::mapClippedRect(const WebTransformationMatrix& transform, const IntRect& srcRect) { return enclosingIntRect(mapClippedRect(transform, FloatRect(srcRect))); } -FloatRect CCMathUtil::mapClippedRect(const TransformationMatrix& transform, const FloatRect& srcRect) +FloatRect CCMathUtil::mapClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) { if (transform.isIdentityOrTranslation()) { FloatRect mappedRect(srcRect); @@ -213,10 +135,10 @@ FloatRect CCMathUtil::mapClippedRect(const TransformationMatrix& transform, cons HomogeneousCoordinate h3 = mapPoint(transform, q.p3()); HomogeneousCoordinate h4 = mapPoint(transform, q.p4()); - return computeEnclosingRect(h1, h2, h3, h4); + return computeEnclosingClippedRect(h1, h2, h3, h4); } -FloatRect CCMathUtil::projectClippedRect(const TransformationMatrix& transform, const FloatRect& srcRect) +FloatRect CCMathUtil::projectClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect) { // Perform the projection, but retain the result in homogeneous coordinates. FloatQuad q = FloatQuad(FloatRect(srcRect)); @@ -225,10 +147,10 @@ FloatRect CCMathUtil::projectClippedRect(const TransformationMatrix& transform, HomogeneousCoordinate h3 = projectPoint(transform, q.p3()); HomogeneousCoordinate h4 = projectPoint(transform, q.p4()); - return computeEnclosingRect(h1, h2, h3, h4); + return computeEnclosingClippedRect(h1, h2, h3, h4); } -void CCMathUtil::mapClippedQuad(const TransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad) +void CCMathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad) { HomogeneousCoordinate h1 = mapPoint(transform, srcQuad.p1()); HomogeneousCoordinate h2 = mapPoint(transform, srcQuad.p2()); @@ -272,9 +194,9 @@ FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int return FloatRect(); float xmin = std::numeric_limits<float>::max(); - float xmax = std::numeric_limits<float>::min(); + float xmax = -std::numeric_limits<float>::max(); float ymin = std::numeric_limits<float>::max(); - float ymax = std::numeric_limits<float>::min(); + float ymax = -std::numeric_limits<float>::max(); for (int i = 0; i < numVertices; ++i) expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, vertices[i]); @@ -282,7 +204,57 @@ FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin)); } -FloatQuad CCMathUtil::mapQuad(const TransformationMatrix& transform, const FloatQuad& q, bool& clipped) +FloatRect CCMathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4) +{ + // This function performs clipping as necessary and computes the enclosing 2d + // FloatRect of the vertices. Doing these two steps simultaneously allows us to avoid + // the overhead of storing an unknown number of clipped vertices. + + // If no vertices on the quad are clipped, then we can simply return the enclosing rect directly. + bool somethingClipped = h1.shouldBeClipped() || h2.shouldBeClipped() || h3.shouldBeClipped() || h4.shouldBeClipped(); + if (!somethingClipped) { + FloatQuad mappedQuad = FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d()); + return mappedQuad.boundingBox(); + } + + bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped(); + if (everythingClipped) + return FloatRect(); + + + float xmin = std::numeric_limits<float>::max(); + float xmax = -std::numeric_limits<float>::max(); + float ymin = std::numeric_limits<float>::max(); + float ymax = -std::numeric_limits<float>::max(); + + if (!h1.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h1.cartesianPoint2d()); + + if (h1.shouldBeClipped() ^ h2.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h1, h2).cartesianPoint2d()); + + if (!h2.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h2.cartesianPoint2d()); + + if (h2.shouldBeClipped() ^ h3.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h2, h3).cartesianPoint2d()); + + if (!h3.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h3.cartesianPoint2d()); + + if (h3.shouldBeClipped() ^ h4.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h3, h4).cartesianPoint2d()); + + if (!h4.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, h4.cartesianPoint2d()); + + if (h4.shouldBeClipped() ^ h1.shouldBeClipped()) + expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h4, h1).cartesianPoint2d()); + + return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin)); +} + +FloatQuad CCMathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) { if (transform.isIdentityOrTranslation()) { FloatQuad mappedQuad(q); @@ -302,7 +274,7 @@ FloatQuad CCMathUtil::mapQuad(const TransformationMatrix& transform, const Float return FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d()); } -FloatQuad CCMathUtil::projectQuad(const TransformationMatrix& transform, const FloatQuad& q, bool& clipped) +FloatQuad CCMathUtil::projectQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped) { FloatQuad projectedQuad; bool clippedPoint; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.h b/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.h index 398604d9a..63ca00312 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.h @@ -25,20 +25,56 @@ #ifndef CCMathUtil_h #define CCMathUtil_h +#include "FloatPoint.h" + +namespace WebKit { +class WebTransformationMatrix; +} + namespace WebCore { class IntRect; class FloatPoint; class FloatRect; class FloatQuad; -class TransformationMatrix; + +struct HomogeneousCoordinate { + HomogeneousCoordinate(double newX, double newY, double newZ, double newW) + : x(newX) + , y(newY) + , z(newZ) + , w(newW) + { + } + + bool shouldBeClipped() const + { + return w <= 0; + } + + FloatPoint cartesianPoint2d() const + { + if (w == 1) + return FloatPoint(x, y); + + // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. + ASSERT(w); + double invW = 1.0 / w; + return FloatPoint(x * invW, y * invW); + } + + double x; + double y; + double z; + double w; +}; // This class contains math helper functionality that does not belong in WebCore. // It is possible that this functionality should be migrated to WebCore eventually. class CCMathUtil { public: - // Background: TransformationMatrix code in WebCore does not do the right thing in + // Background: WebTransformationMatrix code in WebCore does not do the right thing in // mapRect / mapQuad / projectQuad when there is a perspective projection that causes // one of the transformed vertices to go to w < 0. In those cases, it is necessary to // perform clipping in homogeneous coordinates, after applying the transform, before @@ -46,21 +82,23 @@ public: // // These functions return the axis-aligned rect that encloses the correctly clipped, // transformed polygon. - static IntRect mapClippedRect(const TransformationMatrix&, const IntRect&); - static FloatRect mapClippedRect(const TransformationMatrix&, const FloatRect&); - static FloatRect projectClippedRect(const TransformationMatrix&, const FloatRect&); + static IntRect mapClippedRect(const WebKit::WebTransformationMatrix&, const IntRect&); + static FloatRect mapClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&); + static FloatRect projectClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&); // Returns an array of vertices that represent the clipped polygon. After returning, indexes from // 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that // numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and // none of the vertices in the array are valid. - static void mapClippedQuad(const TransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad); + static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad); + static FloatRect computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices); + static FloatRect computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4); // NOTE: These functions do not do correct clipping against w = 0 plane, but they // correctly detect the clipped condition via the boolean clipped. - static FloatQuad mapQuad(const TransformationMatrix&, const FloatQuad&, bool& clipped); - static FloatQuad projectQuad(const TransformationMatrix&, const FloatQuad&, bool& clipped); + static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped); + static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped); }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index 792f8629a..68ccdc9c0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -36,6 +36,7 @@ #include <algorithm> using namespace std; +using WebKit::WebTransformationMatrix; namespace WebCore { @@ -131,7 +132,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::finishedTargetRenderS } template<typename RenderSurfaceType> -static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surface, const Region& region, const TransformationMatrix& transform) +static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surface, const Region& region, const WebTransformationMatrix& transform) { // Verify that rects within the |surface| will remain rects in its target surface after applying |transform|. If this is true, then // apply |transform| to each rect within |region| in order to transform the entire Region. @@ -194,7 +195,7 @@ static inline void reduceOcclusion(const IntRect& affectedArea, const IntRect& e } template<typename RenderSurfaceType> -static void reduceOcclusionBelowSurface(RenderSurfaceType* surface, const IntRect& surfaceRect, const TransformationMatrix& surfaceTransform, RenderSurfaceType* surfaceTarget, Region& occlusionInTarget, Region& occlusionInScreen) +static void reduceOcclusionBelowSurface(RenderSurfaceType* surface, const IntRect& surfaceRect, const WebTransformationMatrix& surfaceTransform, RenderSurfaceType* surfaceTarget, Region& occlusionInTarget, Region& occlusionInScreen) { if (surfaceRect.isEmpty()) return; @@ -260,13 +261,13 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToTargetRenderSu } template<typename LayerType> -static inline TransformationMatrix contentToScreenSpaceTransform(const LayerType* layer) +static inline WebTransformationMatrix contentToScreenSpaceTransform(const LayerType* layer) { ASSERT(layerTransformsToScreenKnown(layer)); IntSize boundsInLayerSpace = layer->bounds(); IntSize boundsInContentSpace = layer->contentBounds(); - TransformationMatrix transform = layer->screenSpaceTransform(); + WebTransformationMatrix transform = layer->screenSpaceTransform(); if (boundsInContentSpace.isEmpty()) return transform; @@ -279,13 +280,13 @@ static inline TransformationMatrix contentToScreenSpaceTransform(const LayerType } template<typename LayerType> -static inline TransformationMatrix contentToTargetSurfaceTransform(const LayerType* layer) +static inline WebTransformationMatrix contentToTargetSurfaceTransform(const LayerType* layer) { ASSERT(layerTransformsToTargetKnown(layer)); IntSize boundsInLayerSpace = layer->bounds(); IntSize boundsInContentSpace = layer->contentBounds(); - TransformationMatrix transform = layer->drawTransform(); + WebTransformationMatrix transform = layer->drawTransform(); if (boundsInContentSpace.isEmpty()) return transform; @@ -302,7 +303,7 @@ static inline TransformationMatrix contentToTargetSurfaceTransform(const LayerTy // FIXME: Remove usePaintTracking when paint tracking is on for paint culling. template<typename LayerType> -static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const TransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize) +static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize) { ASSERT(layer->visibleLayerRect().contains(opaqueContents.bounds())); @@ -345,7 +346,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay // remain rectilinear, then we don't add any occlusion in screen space. if (layerTransformsToScreenKnown(layer)) { - TransformationMatrix targetToScreenTransform = m_stack.last().surface->screenSpaceTransform(); + WebTransformationMatrix targetToScreenTransform = m_stack.last().surface->screenSpaceTransform(); bool clipped; FloatQuad scissorInScreenQuad = CCMathUtil::mapQuad(targetToScreenTransform, FloatQuad(FloatRect(scissorInTarget)), clipped); // FIXME: Find a rect interior to the transformed scissor quad. @@ -356,7 +357,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay } } -static inline bool testContentRectOccluded(const IntRect& contentRect, const TransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion) +static inline bool testContentRectOccluded(const IntRect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion) { FloatRect transformedRect = CCMathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect)); // Take the enclosingIntRect, as we want to include partial pixels in the test. @@ -391,7 +392,7 @@ static inline IntRect rectSubtractRegion(const IntRect& rect, const Region& regi return rectRegion.bounds(); } -static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, const TransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion) +static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion) { if (!contentSpaceTransform.isInvertible()) return contentRect; @@ -439,34 +440,45 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu // This should be called while the contributing render surface is still considered the current target in the occlusion tracker. ASSERT(surface == m_stack.last().surface); - // A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is - // found just below the top of the stack (if it exists). - if (m_stack.size() < 2) - return contentRect; if (contentRect.isEmpty()) return contentRect; - const StackObject& secondLast = m_stack[m_stack.size() - 2]; - IntRect surfaceClipRect = surface->clipRect(); if (surfaceClipRect.isEmpty()) { - const RenderSurfaceType* targetSurface = secondLast.surface; - surfaceClipRect = intersection(targetSurface->contentRect(), enclosingIntRect(surface->drawableContentRect())); + const RenderSurfaceType* targetSurface = surface->targetRenderSurface(); + if (targetSurface) + surfaceClipRect = intersection(targetSurface->contentRect(), enclosingIntRect(surface->drawableContentRect())); + else + surfaceClipRect = m_scissorRectInScreenSpace; } - const TransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform(); - const TransformationMatrix& transformToTarget = forReplica ? surface->replicaOriginTransform() : surface->originTransform(); + // A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is + // found just below the top of the stack (if it exists). + bool hasOcclusion = m_stack.size() > 1; + + const WebTransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform(); + const WebTransformationMatrix& transformToTarget = forReplica ? surface->replicaOriginTransform() : surface->originTransform(); IntRect unoccludedInScreen = contentRect; - if (surfaceTransformsToScreenKnown(surface)) - unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, secondLast.occlusionInScreen); + if (surfaceTransformsToScreenKnown(surface)) { + if (hasOcclusion) { + const StackObject& secondLast = m_stack[m_stack.size() - 2]; + unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, secondLast.occlusionInScreen); + } else + unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, Region()); + } if (unoccludedInScreen.isEmpty()) return unoccludedInScreen; IntRect unoccludedInTarget = contentRect; - if (surfaceTransformsToTargetKnown(surface)) - unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, secondLast.occlusionInTarget); + if (surfaceTransformsToTargetKnown(surface)) { + if (hasOcclusion) { + const StackObject& secondLast = m_stack[m_stack.size() - 2]; + unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, secondLast.occlusionInTarget); + } else + unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, Region()); + } return intersection(unoccludedInScreen, unoccludedInTarget); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h index 232874523..12801ffbe 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h @@ -28,7 +28,6 @@ #include "FloatQuad.h" #include "Region.h" -#include "TransformationMatrix.h" #include "cc/CCLayerIterator.h" #include "cc/CCOverdrawMetrics.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.cpp index 3b0193ec4..7b57c89b1 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.cpp @@ -31,10 +31,12 @@ #include "FloatQuad.h" #include "IntRect.h" #include "TraceEvent.h" -#include "TransformationMatrix.h" #include "cc/CCLayerTreeHost.h" #include "cc/CCLayerTreeHostImpl.h" #include <public/Platform.h> +#include <public/WebTransformationMatrix.h> + +using WebKit::WebTransformationMatrix; namespace WebCore { @@ -78,7 +80,7 @@ void CCOverdrawMetrics::didCullTileForUpload() ++m_tilesCulledForUpload; } -void CCOverdrawMetrics::didUpload(const TransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect) +void CCOverdrawMetrics::didUpload(const WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect) { if (!m_recordMetricsForFrame) return; @@ -90,7 +92,7 @@ void CCOverdrawMetrics::didUpload(const TransformationMatrix& transformToTarget, m_pixelsUploadedTranslucent += uploadArea - uploadOpaqueArea; } -void CCOverdrawMetrics::didCullForDrawing(const TransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect) +void CCOverdrawMetrics::didCullForDrawing(const WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect) { if (!m_recordMetricsForFrame) return; @@ -101,7 +103,7 @@ void CCOverdrawMetrics::didCullForDrawing(const TransformationMatrix& transformT m_pixelsCulledForDrawing += beforeCullArea - afterCullArea; } -void CCOverdrawMetrics::didDraw(const TransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect) +void CCOverdrawMetrics::didDraw(const WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect) { if (!m_recordMetricsForFrame) return; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.h b/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.h index 5156c3c39..715f5e151 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOverdrawMetrics.h @@ -27,9 +27,12 @@ #include <wtf/PassOwnPtr.h> +namespace WebKit { +class WebTransformationMatrix; +} + namespace WebCore { class IntRect; -class TransformationMatrix; class CCLayerTreeHost; class CCLayerTreeHostImpl; @@ -45,14 +48,14 @@ public: // Records that an invalid tile was culled and did not need to be painted/uploaded, and did not contribute to other tiles needing to be painted. void didCullTileForUpload(); // Records pixels that were uploaded to texture memory. - void didUpload(const TransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect); + void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect); // These methods are used for saving metrics during draw. // Record pixels that were not drawn to screen. - void didCullForDrawing(const TransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect); + void didCullForDrawing(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect); // Record pixels that were drawn to screen. - void didDraw(const TransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect); + void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect); void recordMetrics(const CCLayerTreeHost*) const; void recordMetrics(const CCLayerTreeHostImpl*) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index 364624866..66eef39fc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -30,12 +30,12 @@ #include "cc/CCQuadCuller.h" #include "Region.h" -#include "TransformationMatrix.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCOverdrawMetrics.h" #include "cc/CCRenderPass.h" #include "cc/CCRenderSurfaceDrawQuad.h" +#include <public/WebTransformationMatrix.h> using namespace std; @@ -89,11 +89,5 @@ bool CCQuadCuller::appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad) return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); } -bool CCQuadCuller::appendReplica(PassOwnPtr<CCDrawQuad> passDrawQuad) -{ - IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), true, passDrawQuad->quadRect()); - return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); -} - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h index 2d2d80166..2999b6ad5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -41,7 +41,6 @@ public: // Returns true if the quad is added to the list, and false if the quad is entirely culled. virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad); virtual bool appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad); - virtual bool appendReplica(PassOwnPtr<CCDrawQuad> passDrawQuad); private: CCQuadList& m_quadList; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 848730a2c..fd89990c7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -28,24 +28,14 @@ #include "cc/CCRenderPass.h" #include "Color.h" -#include "cc/CCDamageTracker.h" -#include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCQuadCuller.h" -#include "cc/CCRenderSurfaceDrawQuad.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSolidColorDrawQuad.h" -namespace WebCore { +using WebKit::WebTransformationMatrix; -static const int debugSurfaceBorderWidth = 2; -static const int debugSurfaceBorderAlpha = 100; -static const int debugSurfaceBorderColorRed = 0; -static const int debugSurfaceBorderColorGreen = 0; -static const int debugSurfaceBorderColorBlue = 255; -static const int debugReplicaBorderColorRed = 160; -static const int debugReplicaBorderColorGreen = 0; -static const int debugReplicaBorderColorBlue = 255; +namespace WebCore { PassOwnPtr<CCRenderPass> CCRenderPass::create(CCRenderSurface* targetSurface) { @@ -75,26 +65,20 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, CCOcclus CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders()); CCRenderSurface* surface = layer->renderSurface(); + OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(); - if (layer->hasDebugBorders()) { - Color color(debugSurfaceBorderColorRed, debugSurfaceBorderColorGreen, debugSurfaceBorderColorBlue, debugSurfaceBorderAlpha); - quadCuller.appendSurface(CCDebugBorderDrawQuad::create(sharedQuadState.get(), surface->contentRect(), color, debugSurfaceBorderWidth)); - } bool isReplica = false; - quadCuller.appendSurface(CCRenderSurfaceDrawQuad::create(sharedQuadState.get(), surface->contentRect(), layer, surfaceDamageRect(), isReplica)); + surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, surfaceDamageRect()); m_sharedQuadStateList.append(sharedQuadState.release()); + if (!surface->hasReplica()) + return; + // Add replica after the surface so that it appears below the surface. - if (surface->hasReplica()) { - OwnPtr<CCSharedQuadState> sharedQuadState = surface->createReplicaSharedQuadState(); - if (layer->hasDebugBorders()) { - Color color(debugReplicaBorderColorRed, debugReplicaBorderColorGreen, debugReplicaBorderColorBlue, debugSurfaceBorderAlpha); - quadCuller.appendReplica(CCDebugBorderDrawQuad::create(sharedQuadState.get(), surface->contentRect(), color, debugSurfaceBorderWidth)); - } - bool isReplica = true; - quadCuller.appendReplica(CCRenderSurfaceDrawQuad::create(sharedQuadState.get(), surface->contentRect(), layer, surfaceDamageRect(), isReplica)); - m_sharedQuadStateList.append(sharedQuadState.release()); - } + OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(); + isReplica = true; + surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, surfaceDamageRect()); + m_sharedQuadStateList.append(replicaSharedQuadState.release()); } void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, const Color& screenBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) @@ -107,7 +91,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, const Color& return; OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(); - TransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); + WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { IntRect layerRect = transformToLayerSpace.mapRect(fillRects[i]); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index 6ab50998d..943c53fbf 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -29,27 +29,32 @@ #include "cc/CCRenderSurface.h" -#include "GeometryBinding.h" -#include "GrTexture.h" #include "GraphicsContext3D.h" #include "LayerChromium.h" #include "LayerRendererChromium.h" #include "ManagedTexture.h" -#include "SharedGraphicsContext3D.h" #include "TextStream.h" #include "cc/CCDamageTracker.h" +#include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" -#include "cc/CCProxy.h" -#include "cc/CCRenderSurfaceFilters.h" +#include "cc/CCQuadCuller.h" +#include "cc/CCRenderSurfaceDrawQuad.h" #include "cc/CCSharedQuadState.h" #include <wtf/text/CString.h> namespace WebCore { +static const int debugSurfaceBorderWidth = 2; +static const int debugSurfaceBorderAlpha = 100; +static const int debugSurfaceBorderColorRed = 0; +static const int debugSurfaceBorderColorGreen = 0; +static const int debugSurfaceBorderColorBlue = 255; +static const int debugReplicaBorderColorRed = 160; +static const int debugReplicaBorderColorGreen = 0; +static const int debugReplicaBorderColorBlue = 255; + CCRenderSurface::CCRenderSurface(CCLayerImpl* owningLayer) : m_owningLayer(owningLayer) - , m_maskLayer(0) - , m_skipsDraw(false) , m_surfacePropertyChanged(false) , m_drawOpacity(1) , m_drawOpacityIsAnimating(false) @@ -79,7 +84,6 @@ FloatRect CCRenderSurface::drawableContentRect() const bool CCRenderSurface::prepareContentsTexture(LayerRendererChromium* layerRenderer) { - IntSize requiredSize(m_contentRect.size()); TextureManager* textureManager = layerRenderer->renderSurfaceTextureManager(); if (!m_contentsTexture) @@ -88,25 +92,26 @@ bool CCRenderSurface::prepareContentsTexture(LayerRendererChromium* layerRendere if (m_contentsTexture->isReserved()) return true; - if (!m_contentsTexture->reserve(requiredSize, GraphicsContext3D::RGBA)) { - m_skipsDraw = true; + if (!m_contentsTexture->reserve(m_contentRect.size(), GraphicsContext3D::RGBA)) return false; - } - m_skipsDraw = false; return true; } void CCRenderSurface::releaseContentsTexture() { - if (m_skipsDraw || !m_contentsTexture) + if (!m_contentsTexture || !m_contentsTexture->isReserved()) return; m_contentsTexture->unreserve(); } +bool CCRenderSurface::hasValidContentsTexture() const +{ + return m_contentsTexture && m_contentsTexture->isReserved() && m_contentsTexture->isValid(m_contentRect.size(), GraphicsContext3D::RGBA); +} + bool CCRenderSurface::prepareBackgroundTexture(LayerRendererChromium* layerRenderer) { - IntSize requiredSize(m_contentRect.size()); TextureManager* textureManager = layerRenderer->renderSurfaceTextureManager(); if (!m_backgroundTexture) @@ -115,7 +120,7 @@ bool CCRenderSurface::prepareBackgroundTexture(LayerRendererChromium* layerRende if (m_backgroundTexture->isReserved()) return true; - if (!m_backgroundTexture->reserve(requiredSize, GraphicsContext3D::RGBA)) + if (!m_backgroundTexture->reserve(m_contentRect.size(), GraphicsContext3D::RGBA)) return false; return true; @@ -123,89 +128,14 @@ bool CCRenderSurface::prepareBackgroundTexture(LayerRendererChromium* layerRende void CCRenderSurface::releaseBackgroundTexture() { - if (!m_backgroundTexture) + if (!m_backgroundTexture || !m_backgroundTexture->isReserved()) return; m_backgroundTexture->unreserve(); } -TransformationMatrix CCRenderSurface::computeDeviceTransform(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const +bool CCRenderSurface::hasValidBackgroundTexture() const { - TransformationMatrix renderTransform = drawTransform; - // Apply a scaling factor to size the quad from 1x1 to its intended size. - renderTransform.scale3d(m_contentRect.width(), m_contentRect.height(), 1); - TransformationMatrix deviceTransform = TransformationMatrix(layerRenderer->windowMatrix() * layerRenderer->projectionMatrix() * renderTransform).to2dTransform(); - return deviceTransform; -} - -IntRect CCRenderSurface::computeDeviceBoundingBox(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const -{ - TransformationMatrix contentsDeviceTransform = computeDeviceTransform(layerRenderer, drawTransform); - - // Can only draw surface if device matrix is invertible. - if (!contentsDeviceTransform.isInvertible()) - return IntRect(); - - FloatQuad deviceQuad = contentsDeviceTransform.mapQuad(layerRenderer->sharedGeometryQuad()); - return enclosingIntRect(deviceQuad.boundingBox()); -} - -IntRect CCRenderSurface::computeReadbackDeviceBoundingBox(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const -{ - IntRect deviceRect = computeDeviceBoundingBox(layerRenderer, drawTransform); - - if (m_backgroundFilters.isEmpty()) - return deviceRect; - - int top, right, bottom, left; - m_backgroundFilters.getOutsets(top, right, bottom, left); - deviceRect.move(-left, -top); - deviceRect.expand(left + right, top + bottom); - - return deviceRect; -} - -IntRect CCRenderSurface::readbackDeviceContentRect(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const -{ - return computeReadbackDeviceBoundingBox(layerRenderer, drawTransform); -} - -void CCRenderSurface::copyTextureToFramebuffer(LayerRendererChromium* layerRenderer, int textureId, const IntSize& bounds, const TransformationMatrix& drawMatrix) -{ - const LayerRendererChromium::RenderSurfaceProgram* program = layerRenderer->renderSurfaceProgram(); - - GLC(layerRenderer->context(), layerRenderer->context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(layerRenderer->context(), layerRenderer->context()->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - GLC(layerRenderer->context(), layerRenderer->context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(layerRenderer->context(), layerRenderer->context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - - GLC(layerRenderer->context(), layerRenderer->context()->useProgram(program->program())); - GLC(layerRenderer->context(), layerRenderer->context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); - layerRenderer->drawTexturedQuad(drawMatrix, bounds.width(), bounds.height(), 1, layerRenderer->sharedGeometryQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); -} - -void CCRenderSurface::copyDeviceToBackgroundTexture(LayerRendererChromium* layerRenderer, int deviceBackgroundTextureId, const IntRect& deviceTextureRect, const TransformationMatrix& deviceTransform) const -{ - ASSERT(!m_backgroundFilters.isEmpty()); - - TransformationMatrix deviceToSurfaceTransform; - deviceToSurfaceTransform.translate(m_contentRect.width() / 2.0, m_contentRect.height() / 2.0); - deviceToSurfaceTransform.scale3d(m_contentRect.width(), m_contentRect.height(), 1); - deviceToSurfaceTransform *= deviceTransform.inverse(); - deviceToSurfaceTransform.translate(deviceTextureRect.width() / 2.0, deviceTextureRect.height() / 2.0); - deviceToSurfaceTransform.translate(deviceTextureRect.x(), deviceTextureRect.y()); - - copyTextureToFramebuffer(layerRenderer, deviceBackgroundTextureId, deviceTextureRect.size(), deviceToSurfaceTransform); -} - -inline static int getSkBitmapTextureId(const SkBitmap& bitmap, int fallback) -{ - if (!bitmap.getTexture()) - return fallback; - GrTexture* texture = reinterpret_cast<GrTexture*>(bitmap.getTexture()); - return texture->getTextureHandle(); + return m_backgroundTexture && m_backgroundTexture->isReserved() && m_backgroundTexture->isValid(m_contentRect.size(), GraphicsContext3D::RGBA); } void CCRenderSurface::setScissorRect(LayerRendererChromium* layerRenderer, const FloatRect& surfaceDamageRect) const @@ -222,139 +152,6 @@ void CCRenderSurface::setScissorRect(LayerRendererChromium* layerRenderer, const GLC(layerRenderer->context(), layerRenderer->context()->disable(GraphicsContext3D::SCISSOR_TEST)); } -void CCRenderSurface::drawContents(LayerRendererChromium* layerRenderer) -{ - if (m_skipsDraw || !m_contentsTexture) - return; - - // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. - // Apply filters to the contents texture. - SkBitmap filterBitmap = applyFilters(layerRenderer, m_filters, m_contentsTexture.get()); - - int contentsTextureId = getSkBitmapTextureId(filterBitmap, m_contentsTexture->textureId()); - drawLayer(layerRenderer, m_maskLayer, m_drawTransform, contentsTextureId); -} - -void CCRenderSurface::drawReplica(LayerRendererChromium* layerRenderer) -{ - ASSERT(hasReplica()); - if (!hasReplica() || m_skipsDraw || !m_contentsTexture) - return; - - // Apply filters to the contents texture. - SkBitmap filterBitmap = applyFilters(layerRenderer, m_filters, m_contentsTexture.get()); - - // FIXME: By using the same RenderSurface for both the content and its reflection, - // it's currently not possible to apply a separate mask to the reflection layer - // or correctly handle opacity in reflections (opacity must be applied after drawing - // both the layer and its reflection). The solution is to introduce yet another RenderSurface - // to draw the layer and its reflection in. For now we only apply a separate reflection - // mask if the contents don't have a mask of their own. - CCLayerImpl* replicaMaskLayer = m_maskLayer; - if (!m_maskLayer && m_owningLayer->replicaLayer()) - replicaMaskLayer = m_owningLayer->replicaLayer()->maskLayer(); - - int contentsTextureId = getSkBitmapTextureId(filterBitmap, m_contentsTexture->textureId()); - drawLayer(layerRenderer, replicaMaskLayer, m_replicaDrawTransform, contentsTextureId); -} - -void CCRenderSurface::drawLayer(LayerRendererChromium* layerRenderer, CCLayerImpl* maskLayer, const TransformationMatrix& drawTransform, int contentsTextureId) -{ - TransformationMatrix deviceMatrix = computeDeviceTransform(layerRenderer, drawTransform); - - // Can only draw surface if device matrix is invertible. - if (!deviceMatrix.isInvertible()) - return; - - // Draw the background texture if there is one. - if (m_backgroundTexture && m_backgroundTexture->isReserved()) - copyTextureToFramebuffer(layerRenderer, m_backgroundTexture->textureId(), m_contentRect.size(), drawTransform); - - FloatQuad quad = deviceMatrix.mapQuad(layerRenderer->sharedGeometryQuad()); - CCLayerQuad deviceRect = CCLayerQuad(FloatQuad(quad.boundingBox())); - CCLayerQuad layerQuad = CCLayerQuad(quad); - - // Use anti-aliasing programs only when necessary. - bool useAA = (!quad.isRectilinear() || !quad.boundingBox().isExpressibleAsIntRect()); - - if (useAA) { - deviceRect.inflateAntiAliasingDistance(); - layerQuad.inflateAntiAliasingDistance(); - } - - bool useMask = false; - if (maskLayer && maskLayer->drawsContent()) - if (!maskLayer->bounds().isEmpty()) - useMask = true; - - // FIXME: pass in backgroundTextureId and blend the background in with this draw instead of having a separate drawBackground() pass. - - if (useMask) { - if (useAA) { - const LayerRendererChromium::RenderSurfaceMaskProgramAA* program = layerRenderer->renderSurfaceMaskProgramAA(); - drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, contentsTextureId, program, program->fragmentShader().maskSamplerLocation(), program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation()); - } else { - const LayerRendererChromium::RenderSurfaceMaskProgram* program = layerRenderer->renderSurfaceMaskProgram(); - drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, contentsTextureId, program, program->fragmentShader().maskSamplerLocation(), -1, -1); - } - } else { - if (useAA) { - const LayerRendererChromium::RenderSurfaceProgramAA* program = layerRenderer->renderSurfaceProgramAA(); - drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, contentsTextureId, program, -1, program->vertexShader().pointLocation(), program->fragmentShader().edgeLocation()); - } else { - const LayerRendererChromium::RenderSurfaceProgram* program = layerRenderer->renderSurfaceProgram(); - drawSurface(layerRenderer, maskLayer, drawTransform, deviceMatrix, deviceRect, layerQuad, contentsTextureId, program, -1, -1, -1); - } - } -} - -template <class T> -void CCRenderSurface::drawSurface(LayerRendererChromium* layerRenderer, CCLayerImpl* maskLayer, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad& layerQuad, int contentsTextureId, const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation) -{ - GraphicsContext3D* context3D = layerRenderer->context(); - - context3D->makeContextCurrent(); - GLC(context3D, context3D->useProgram(program->program())); - - GLC(context3D, context3D->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context3D, context3D->uniform1i(program->fragmentShader().samplerLocation(), 0)); - context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, contentsTextureId); - - if (shaderMaskSamplerLocation != -1) { - GLC(context3D, context3D->activeTexture(GraphicsContext3D::TEXTURE1)); - GLC(context3D, context3D->uniform1i(shaderMaskSamplerLocation, 1)); - maskLayer->bindContentsTexture(layerRenderer); - GLC(context3D, context3D->activeTexture(GraphicsContext3D::TEXTURE0)); - } - - if (shaderEdgeLocation != -1) { - float edge[24]; - layerQuad.toFloatArray(edge); - deviceRect.toFloatArray(&edge[12]); - GLC(context3D, context3D->uniform3fv(shaderEdgeLocation, 8, edge)); - } - - // Map device space quad to layer space. - FloatQuad quad = deviceTransform.inverse().mapQuad(layerQuad.floatQuad()); - - layerRenderer->drawTexturedQuad(drawTransform, m_contentRect.width(), m_contentRect.height(), m_drawOpacity, quad, - program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), shaderQuadLocation); -} - -SkBitmap CCRenderSurface::applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, ManagedTexture* sourceTexture) -{ - if (filters.isEmpty()) - return SkBitmap(); - - RefPtr<GraphicsContext3D> filterContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get(); - if (!filterContext) - return SkBitmap(); - - layerRenderer->context()->flush(); - - return CCRenderSurfaceFilters::apply(filters, sourceTexture->textureId(), sourceTexture->size(), filterContext.get()); -} - String CCRenderSurface::name() const { return String::format("RenderSurface(id=%i,owner=%s)", m_owningLayer->id(), m_owningLayer->debugName().utf8().data()); @@ -391,6 +188,14 @@ int CCRenderSurface::owningLayerId() const return m_owningLayer ? m_owningLayer->id() : 0; } +CCRenderSurface* CCRenderSurface::targetRenderSurface() const +{ + CCLayerImpl* parent = m_owningLayer->parent(); + if (!parent) + return 0; + return parent->targetRenderSurface(); +} + bool CCRenderSurface::hasReplica() const { return m_owningLayer->replicaLayer(); @@ -398,12 +203,12 @@ bool CCRenderSurface::hasReplica() const bool CCRenderSurface::hasMask() const { - return m_maskLayer; + return m_owningLayer->maskLayer(); } bool CCRenderSurface::replicaHasMask() const { - return hasReplica() && (m_maskLayer || m_owningLayer->replicaLayer()->maskLayer()); + return hasReplica() && (m_owningLayer->maskLayer() || m_owningLayer->replicaLayer()->maskLayer()); } void CCRenderSurface::setClipRect(const IntRect& clipRect) @@ -455,5 +260,38 @@ PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() co return CCSharedQuadState::create(replicaOriginTransform(), replicaDrawTransform(), contentRect(), clipRect(), drawOpacity(), isOpaque); } +void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, const FloatRect& surfaceDamageRect) +{ + ASSERT(!forReplica || hasReplica()); + + if (m_owningLayer->hasDebugBorders()) { + int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed; + int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; + int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; + Color color(red, green, blue, debugSurfaceBorderAlpha); + quadList.appendSurface(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); + } + + // FIXME: By using the same RenderSurface for both the content and its reflection, + // it's currently not possible to apply a separate mask to the reflection layer + // or correctly handle opacity in reflections (opacity must be applied after drawing + // both the layer and its reflection). The solution is to introduce yet another RenderSurface + // to draw the layer and its reflection in. For now we only apply a separate reflection + // mask if the contents don't have a mask of their own. + CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); + if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty())) + maskLayer = 0; + + if (!maskLayer && forReplica) { + maskLayer = m_owningLayer->replicaLayer()->maskLayer(); + if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty())) + maskLayer = 0; + } + + int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0; + + quadList.appendSurface(CCRenderSurfaceDrawQuad::create(sharedQuadState, contentRect(), m_owningLayer, surfaceDamageRect, forReplica, filters(), backgroundFilters(), maskTextureId)); +} + } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index a6dee10ec..855fcce7e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -31,16 +31,16 @@ #include "FloatRect.h" #include "IntRect.h" -#include "SkBitmap.h" #include "TextureManager.h" -#include "TransformationMatrix.h" #include "cc/CCLayerQuad.h" #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Noncopyable.h> namespace WebCore { class CCDamageTracker; +class CCQuadCuller; class CCSharedQuadState; class CCLayerImpl; class LayerRendererChromium; @@ -54,19 +54,14 @@ public: bool prepareContentsTexture(LayerRendererChromium*); void releaseContentsTexture(); + bool hasValidContentsTexture() const; bool prepareBackgroundTexture(LayerRendererChromium*); void releaseBackgroundTexture(); + bool hasValidBackgroundTexture() const; void setScissorRect(LayerRendererChromium*, const FloatRect& surfaceDamageRect) const; - void drawContents(LayerRendererChromium*); - void drawReplica(LayerRendererChromium*); - - // Takes a texture with pixels in device space, and a transform from content space to the device. Copies the device-space texture back into - // content space for the surface, storing the result in the backgroundTexture(). The surface's backgroundTexture() must be the active drawing target. - void copyDeviceToBackgroundTexture(LayerRendererChromium*, int deviceBackgroundTextureId, const IntRect& deviceTextureRect, const TransformationMatrix& deviceTransform) const; - String name() const; void dumpSurface(TextStream&, int indent) const; @@ -74,18 +69,12 @@ public: // Returns the rect that encloses the RenderSurface including any reflection. FloatRect drawableContentRect() const; - // Returns the rect that encloses the pixels that may affect the pixel values in this surface through background filters. - IntRect readbackDeviceContentRect(LayerRendererChromium*, const TransformationMatrix& drawTransform) const; - - // Gives the transform from the surface content space, with origin in the top left, to the current target device space, with origin in the top left. - TransformationMatrix computeDeviceTransform(LayerRendererChromium*, const TransformationMatrix& drawTransform) const; float drawOpacity() const { return m_drawOpacity; } void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; } const WebKit::WebFilterOperations& filters() const { return m_filters; } - SkBitmap applyFilters(LayerRendererChromium*, const WebKit::WebFilterOperations&, ManagedTexture* sourceTexture); void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; } const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } @@ -96,23 +85,23 @@ public: bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } - void setDrawTransform(const TransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } - const TransformationMatrix& drawTransform() const { return m_drawTransform; } + void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } - void setOriginTransform(const TransformationMatrix& originTransform) { m_originTransform = originTransform; } - const TransformationMatrix& originTransform() const { return m_originTransform; } + void setOriginTransform(const WebKit::WebTransformationMatrix& originTransform) { m_originTransform = originTransform; } + const WebKit::WebTransformationMatrix& originTransform() const { return m_originTransform; } - void setScreenSpaceTransform(const TransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } - const TransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } + void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } + const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } - void setReplicaDrawTransform(const TransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } - const TransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } + void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } + const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } - void setReplicaOriginTransform(const TransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } - const TransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } + void setReplicaOriginTransform(const WebKit::WebTransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } + const WebKit::WebTransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } - void setReplicaScreenSpaceTransform(const TransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } - const TransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } + void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } + const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; } void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; } @@ -126,18 +115,14 @@ public: void setContentRect(const IntRect&); const IntRect& contentRect() const { return m_contentRect; } - void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } - bool skipsDraw() const { return m_skipsDraw; } - void clearLayerList() { m_layerList.clear(); } Vector<CCLayerImpl*>& layerList() { return m_layerList; } - void setMaskLayer(CCLayerImpl* maskLayer) { m_maskLayer = maskLayer; } - ManagedTexture* contentsTexture() const { return m_contentsTexture.get(); } ManagedTexture* backgroundTexture() const { return m_backgroundTexture.get(); } int owningLayerId() const; + CCRenderSurface* targetRenderSurface() const; bool hasReplica() const; @@ -153,21 +138,13 @@ public: PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const; -private: - IntRect computeDeviceBoundingBox(LayerRendererChromium*, const TransformationMatrix& drawTransform) const; - IntRect computeReadbackDeviceBoundingBox(LayerRendererChromium*, const TransformationMatrix& drawTransform) const; - - void drawLayer(LayerRendererChromium*, CCLayerImpl*, const TransformationMatrix&, int contentsTextureId); - template <class T> - void drawSurface(LayerRendererChromium*, CCLayerImpl*, const TransformationMatrix& drawTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad&, int contentsTextureId, const T* program, int shaderMaskSamplerLocation, int shaderQuadLocation, int shaderEdgeLocation); - - static void copyTextureToFramebuffer(LayerRendererChromium*, int textureId, const IntSize& bounds, const TransformationMatrix& drawMatrix); + // FIXME: Remove the surfaceDamageRect parameter when the value is removed from CCRenderSurfaceDrawQuad. + void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, const FloatRect& surfaceDamageRect); +private: CCLayerImpl* m_owningLayer; - CCLayerImpl* m_maskLayer; IntRect m_contentRect; - bool m_skipsDraw; bool m_surfacePropertyChanged; OwnPtr<ManagedTexture> m_contentsTexture; @@ -175,12 +152,12 @@ private: float m_drawOpacity; bool m_drawOpacityIsAnimating; - TransformationMatrix m_drawTransform; - TransformationMatrix m_originTransform; - TransformationMatrix m_screenSpaceTransform; - TransformationMatrix m_replicaDrawTransform; - TransformationMatrix m_replicaOriginTransform; - TransformationMatrix m_replicaScreenSpaceTransform; + WebKit::WebTransformationMatrix m_drawTransform; + WebKit::WebTransformationMatrix m_originTransform; + WebKit::WebTransformationMatrix m_screenSpaceTransform; + WebKit::WebTransformationMatrix m_replicaDrawTransform; + WebKit::WebTransformationMatrix m_replicaOriginTransform; + WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; bool m_targetSurfaceTransformsAreAnimating; bool m_screenSpaceTransformsAreAnimating; WebKit::WebFilterOperations m_filters; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.cpp index c6e021ece..df00c0e0f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.cpp @@ -29,16 +29,19 @@ namespace WebCore { -PassOwnPtr<CCRenderSurfaceDrawQuad> CCRenderSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer, const FloatRect& surfaceDamageRect, bool isReplica) +PassOwnPtr<CCRenderSurfaceDrawQuad> CCRenderSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer, const FloatRect& surfaceDamageRect, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId) { - return adoptPtr(new CCRenderSurfaceDrawQuad(sharedQuadState, quadRect, layer, surfaceDamageRect, isReplica)); + return adoptPtr(new CCRenderSurfaceDrawQuad(sharedQuadState, quadRect, layer, surfaceDamageRect, isReplica, filters, backgroundFilters, maskTextureId)); } -CCRenderSurfaceDrawQuad::CCRenderSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer, const FloatRect& surfaceDamageRect, bool isReplica) +CCRenderSurfaceDrawQuad::CCRenderSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer, const FloatRect& surfaceDamageRect, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId) : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderSurface, quadRect) , m_layer(layer) , m_surfaceDamageRect(surfaceDamageRect) , m_isReplica(isReplica) + , m_filters(filters) + , m_backgroundFilters(backgroundFilters) + , m_maskTextureId(maskTextureId) { ASSERT(m_layer); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.h index 8f6da5eee..0a01281fa 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceDrawQuad.h @@ -27,6 +27,7 @@ #define CCRenderSurfaceDrawQuad_h #include "cc/CCDrawQuad.h" +#include <public/WebFilterOperations.h> #include <wtf/PassOwnPtr.h> namespace WebCore { @@ -36,21 +37,28 @@ class CCLayerImpl; class CCRenderSurfaceDrawQuad : public CCDrawQuad { WTF_MAKE_NONCOPYABLE(CCRenderSurfaceDrawQuad); public: - static PassOwnPtr<CCRenderSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*, const FloatRect& surfaceDamageRect, bool isReplica); + static PassOwnPtr<CCRenderSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*, const FloatRect& surfaceDamageRect, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId); CCLayerImpl* layer() const { return m_layer; } bool isReplica() const { return m_isReplica; } + unsigned maskTextureId() const { return m_maskTextureId; } // The surface damage rect for the target surface this quad draws into. // FIXME: This can be removed once render surfaces get their own layer type. const FloatRect& surfaceDamageRect() const { return m_surfaceDamageRect; } + const WebKit::WebFilterOperations& filters() const { return m_filters; } + const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } + private: - CCRenderSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*, const FloatRect& surfaceDamageRect, bool isReplica); + CCRenderSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*, const FloatRect& surfaceDamageRect, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId); CCLayerImpl* m_layer; FloatRect m_surfaceDamageRect; bool m_isReplica; + WebKit::WebFilterOperations m_filters; + WebKit::WebFilterOperations m_backgroundFilters; + unsigned m_maskTextureId; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp index 9bf76925b..3f2837e05 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp @@ -27,14 +27,16 @@ #include "cc/CCSharedQuadState.h" +using WebKit::WebTransformationMatrix; + namespace WebCore { -PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const TransformationMatrix& quadTransform, const TransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque) +PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque) { return adoptPtr(new CCSharedQuadState(quadTransform, layerTransform, layerRect, clipRect, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(const TransformationMatrix& quadTransform, const TransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque) +CCSharedQuadState::CCSharedQuadState(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque) : m_quadTransform(quadTransform) , m_layerTransform(layerTransform) , m_layerRect(layerRect) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h index 4206aa5c2..a14b17daa 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h @@ -28,7 +28,7 @@ #include "FloatQuad.h" #include "IntRect.h" -#include "TransformationMatrix.h" +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> namespace WebCore { @@ -36,12 +36,12 @@ namespace WebCore { class CCSharedQuadState { WTF_MAKE_NONCOPYABLE(CCSharedQuadState); public: - static PassOwnPtr<CCSharedQuadState> create(const TransformationMatrix& quadTransform, const TransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque); + static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque); // The transform that quads in a CCDrawQuad should be transformed with. - const TransformationMatrix& quadTransform() const { return m_quadTransform; } + const WebKit::WebTransformationMatrix& quadTransform() const { return m_quadTransform; } // The transform that layerRect() should be transformed with. - const TransformationMatrix& layerTransform() const { return m_layerTransform; } + const WebKit::WebTransformationMatrix& layerTransform() const { return m_layerTransform; } const IntRect& layerRect() const { return m_layerRect; } // Usage: if clipRect is empty, this clipRect should not be used. const IntRect& clipRect() const { return m_clipRect; } @@ -51,10 +51,10 @@ public: bool isLayerAxisAlignedIntRect() const; private: - CCSharedQuadState(const TransformationMatrix& quadTransform, const TransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque); + CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& clipRect, float opacity, bool opaque); - TransformationMatrix m_quadTransform; - TransformationMatrix m_layerTransform; + WebKit::WebTransformationMatrix m_quadTransform; + WebKit::WebTransformationMatrix m_layerTransform; IntRect m_layerRect; IntRect m_clipRect; float m_opacity; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 0113c079a..17cdc59e4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -58,9 +58,6 @@ private: CCSingleThreadProxy* m_proxy; }; -// Measured in seconds. -static const double animationTimerDelay = 1 / 60.0; - PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) { return adoptPtr(new CCSingleThreadProxy(layerTreeHost)); @@ -165,7 +162,10 @@ bool CCSingleThreadProxy::initializeLayerRenderer() if (ok) { m_layerRendererInitialized = true; m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); - } + } else + // If we couldn't initialize the layer renderer, we shouldn't process any future animation events. + m_animationTimer->stop(); + return ok; } } @@ -278,7 +278,7 @@ bool CCSingleThreadProxy::commitRequested() const void CCSingleThreadProxy::didAddAnimation() { - m_animationTimer->startOneShot(animationTimerDelay); + m_animationTimer->startOneShot(animationTimerDelay()); } void CCSingleThreadProxy::stop() @@ -326,6 +326,11 @@ void CCSingleThreadProxy::compositeImmediately() } } +double CCSingleThreadProxy::animationTimerDelay() +{ + return 1 / 60.0; +} + void CCSingleThreadProxy::forceSerializeOnSwapBuffers() { { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h index 8fc8984bf..441466afc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h @@ -79,6 +79,9 @@ public: // Called by the legacy path where RenderWidget does the scheduling. void compositeImmediately(); + // Measured in seconds. + static double animationTimerDelay(); + private: explicit CCSingleThreadProxy(CCLayerTreeHost*); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp index 6ae3a1729..d1a4f7626 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp @@ -36,6 +36,7 @@ #include <wtf/text/WTFString.h> using namespace std; +using WebKit::WebTransformationMatrix; namespace WebCore { @@ -49,9 +50,9 @@ CCSolidColorLayerImpl::~CCSolidColorLayerImpl() { } -TransformationMatrix CCSolidColorLayerImpl::quadTransform() const +WebTransformationMatrix CCSolidColorLayerImpl::quadTransform() const { - TransformationMatrix solidColorTransform = drawTransform(); + WebTransformationMatrix solidColorTransform = drawTransform(); solidColorTransform.translate(-bounds().width() / 2.0, -bounds().height() / 2.0); return solidColorTransform; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h index d8fce3761..64291255f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h @@ -26,8 +26,8 @@ #ifndef CCSolidColorLayerImpl_h #define CCSolidColorLayerImpl_h -#include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" +#include <public/WebTransformationMatrix.h> namespace WebCore { @@ -41,7 +41,7 @@ public: } virtual ~CCSolidColorLayerImpl(); - virtual TransformationMatrix quadTransform() const OVERRIDE; + virtual WebKit::WebTransformationMatrix quadTransform() const OVERRIDE; virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; protected: diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index ec22a9fd6..efecabd1d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -38,6 +38,7 @@ #include <wtf/text/WTFString.h> using namespace std; +using WebKit::WebTransformationMatrix; namespace WebCore { @@ -77,7 +78,7 @@ CCTiledLayerImpl::~CCTiledLayerImpl() { } -void CCTiledLayerImpl::bindContentsTexture(LayerRendererChromium* layerRenderer) +unsigned CCTiledLayerImpl::contentsTextureId() const { // This function is only valid for single texture layers, e.g. masks. ASSERT(m_tiler); @@ -88,7 +89,7 @@ void CCTiledLayerImpl::bindContentsTexture(LayerRendererChromium* layerRenderer) Platform3DObject textureId = tile ? tile->textureId() : 0; ASSERT(textureId); - layerRenderer->context()->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId); + return textureId; } void CCTiledLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const @@ -121,9 +122,9 @@ DrawableTile* CCTiledLayerImpl::createTile(int i, int j) return addedTile; } -TransformationMatrix CCTiledLayerImpl::quadTransform() const +WebTransformationMatrix CCTiledLayerImpl::quadTransform() const { - TransformationMatrix transform = drawTransform(); + WebTransformationMatrix transform = drawTransform(); if (contentBounds().isEmpty()) return transform; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h index bd146650b..f588c9cf5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h @@ -27,9 +27,9 @@ #define CCTiledLayerImpl_h #include "LayerTextureUpdater.h" -#include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTilingData.h" +#include <public/WebTransformationMatrix.h> namespace WebCore { @@ -45,7 +45,7 @@ public: virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual void bindContentsTexture(LayerRendererChromium*) OVERRIDE; + virtual unsigned contentsTextureId() const OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; @@ -65,7 +65,7 @@ protected: bool hasTileAt(int, int) const; bool hasTextureIdForTileAt(int, int) const; - virtual TransformationMatrix quadTransform() const OVERRIDE; + virtual WebKit::WebTransformationMatrix quadTransform() const OVERRIDE; private: diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index fd84c0972..839708ee9 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -227,6 +227,7 @@ MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player) , m_preload(MediaPlayer::Auto) , m_delayingLoad(false) , m_mediaDurationKnown(true) + , m_maxTimeLoadedAtLastDidLoadingProgress(0) , m_volumeTimerHandler(0) , m_muteTimerHandler(0) , m_hasVideo(false) @@ -920,17 +921,15 @@ float MediaPlayerPrivateGStreamer::maxTimeLoaded() const return loaded; } -unsigned MediaPlayerPrivateGStreamer::bytesLoaded() const +bool MediaPlayerPrivateGStreamer::didLoadingProgress() const { - if (!m_playBin) - return 0; - - if (!m_mediaDuration) - return 0; - - unsigned loaded = totalBytes() * maxTimeLoaded() / m_mediaDuration; - LOG_VERBOSE(Media, "bytesLoaded: %d", loaded); - return loaded; + if (!m_playBin || !m_mediaDuration || !totalBytes()) + return false; + float currentMaxTimeLoaded = maxTimeLoaded(); + bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; + m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded; + LOG_VERBOSE(Media, "didLoadingProgress: %d", didLoadingProgress); + return didLoadingProgress; } unsigned MediaPlayerPrivateGStreamer::totalBytes() const @@ -1674,7 +1673,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin() g_signal_connect(m_playBin, "video-changed", G_CALLBACK(mediaPlayerPrivateVideoChangedCallback), this); g_signal_connect(m_playBin, "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this); - m_webkitVideoSink = webkit_video_sink_new(m_gstGWorld.get()); + m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get()); g_signal_connect(m_webkitVideoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this); diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h index 1b0ff26e6..39ee9ce4b 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h @@ -90,7 +90,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface { PassRefPtr<TimeRanges> buffered() const; float maxTimeSeekable() const; - unsigned bytesLoaded() const; + bool didLoadingProgress() const; unsigned totalBytes() const; void setVisible(bool); @@ -181,6 +181,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface { MediaPlayer::Preload m_preload; bool m_delayingLoad; bool m_mediaDurationKnown; + mutable float m_maxTimeLoadedAtLastDidLoadingProgress; #ifndef GST_API_VERSION_1 RefPtr<GStreamerGWorld> m_gstGWorld; #endif diff --git a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h index 33600f696..b929e90e4 100644 --- a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h +++ b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h @@ -23,7 +23,7 @@ #include <QEvent> #include <QTimer> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QWindow> #else #include <QWidget> @@ -33,7 +33,7 @@ namespace WebCore { class HTMLVideoElement; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 typedef QWindow Base; #else typedef QWidget Base; diff --git a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp index 506a59d1f..3e431f241 100644 --- a/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp @@ -38,7 +38,7 @@ static const int gHideMouseCursorDelay = 3000; FullScreenVideoWindow::FullScreenVideoWindow() : m_mediaElement(0) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) setAttribute(Qt::WA_NativeWindow); setAttribute(Qt::WA_NoSystemBackground, true); setAttribute(Qt::WA_PaintOnScreen, true); @@ -83,7 +83,7 @@ bool FullScreenVideoWindow::event(QEvent* ev) #ifndef QT_NO_CURSOR m_cursorTimer.stop(); #endif -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) setMouseTracking(false); releaseMouse(); #endif @@ -100,11 +100,11 @@ bool FullScreenVideoWindow::event(QEvent* ev) void FullScreenVideoWindow::showFullScreen() { Base::showFullScreen(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) setMouseTracking(true); #endif raise(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) setFocus(); #endif hideCursor(); @@ -132,7 +132,7 @@ PlatformVideoWindow::PlatformVideoWindow() m_window = win; win->setWindowFlags(win->windowFlags() | Qt::FramelessWindowHint); // FIXME: Port to Qt 5. -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) QPalette p; p.setColor(QPalette::Base, Qt::black); p.setColor(QPalette::Window, Qt::black); diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp index 436303662..1389b695f 100644 --- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 OpenedHand * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,36 +18,32 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * SECTION:webkit-video-sink - * @short_description: GStreamer video sink +/* * - * #WebKitVideoSink is a GStreamer sink element that triggers + * WebKitVideoSink is a GStreamer sink element that triggers * repaints in the WebKit GStreamer media player for the * current video buffer. */ #include "config.h" +#if USE(GSTREAMER) #include "VideoSinkGStreamer.h" -#if ENABLE(VIDEO) && USE(GSTREAMER) #include <glib.h> #include <gst/gst.h> -#include <gst/video/video.h> #include <wtf/FastAllocBase.h> -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE("sink", - GST_PAD_SINK, GST_PAD_ALWAYS, // CAIRO_FORMAT_RGB24 used to render the video buffers is little/big endian dependant. #if G_BYTE_ORDER == G_LITTLE_ENDIAN - GST_STATIC_CAPS(GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_BGRA) +#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_BGRA #else - GST_STATIC_CAPS(GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_ARGB) +#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_ARGB #endif -); +static GstStaticPadTemplate s_sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS(WEBKIT_VIDEO_SINK_PAD_CAPS)); + -GST_DEBUG_CATEGORY_STATIC(webkit_video_sink_debug); -#define GST_CAT_DEFAULT webkit_video_sink_debug +GST_DEBUG_CATEGORY_STATIC(webkitVideoSinkDebug); +#define GST_CAT_DEFAULT webkitVideoSinkDebug enum { REPAINT_REQUESTED, @@ -57,13 +54,14 @@ enum { PROP_0 }; -static guint webkit_video_sink_signals[LAST_SIGNAL] = { 0, }; +static guint webkitVideoSinkSignals[LAST_SIGNAL] = { 0, }; struct _WebKitVideoSinkPrivate { GstBuffer* buffer; - guint timeout_id; - GMutex* buffer_mutex; - GCond* data_cond; + guint timeoutId; + GMutex* bufferMutex; + GCond* dataCondition; + WebCore::GStreamerGWorld* gstGWorld; // If this is TRUE all processing should finish ASAP @@ -74,92 +72,67 @@ struct _WebKitVideoSinkPrivate { // to deadlocks because render() holds the stream lock. // // Protected by the buffer mutex - gboolean unlocked; + bool unlocked; }; -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT(webkit_video_sink_debug, \ - "webkitsink", \ - 0, \ - "webkit video sink") +#define webkit_video_sink_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE(WebKitVideoSink, webkit_video_sink, GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT(webkitVideoSinkDebug, "webkitsink", 0, "webkit video sink")); -GST_BOILERPLATE_FULL(WebKitVideoSink, - webkit_video_sink, - GstVideoSink, - GST_TYPE_VIDEO_SINK, - _do_init); -static void -webkit_video_sink_base_init(gpointer g_class) +static void webkit_video_sink_init(WebKitVideoSink* sink) { - GstElementClass* element_class = GST_ELEMENT_CLASS(g_class); - - gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&sinktemplate)); - gst_element_class_set_details_simple(element_class, "WebKit video sink", - "Sink/Video", "Sends video data from a GStreamer pipeline to a Cairo surface", - "Alp Toker <alp@atoker.com>"); -} - -static void -webkit_video_sink_init(WebKitVideoSink* sink, WebKitVideoSinkClass* klass) -{ - WebKitVideoSinkPrivate* priv; - - sink->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate); + sink->priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate); #if GLIB_CHECK_VERSION(2, 31, 0) - priv->data_cond = WTF::fastNew<GCond>(); - g_cond_init(priv->data_cond); - priv->buffer_mutex = WTF::fastNew<GMutex>(); - g_mutex_init(priv->buffer_mutex); + sink->priv->dataCondition = WTF::fastNew<GCond>(); + g_cond_init(sink->priv->dataCondition); + sink->priv->bufferMutex = WTF::fastNew<GMutex>(); + g_mutex_init(sink->priv->bufferMutex); #else - priv->data_cond = g_cond_new(); - priv->buffer_mutex = g_mutex_new(); + sink->priv->dataCondition = g_cond_new(); + sink->priv->bufferMutex = g_mutex_new(); #endif } -static gboolean -webkit_video_sink_timeout_func(gpointer data) +static gboolean webkitVideoSinkTimeoutCallback(gpointer data) { WebKitVideoSink* sink = reinterpret_cast<WebKitVideoSink*>(data); WebKitVideoSinkPrivate* priv = sink->priv; - GstBuffer* buffer; - g_mutex_lock(priv->buffer_mutex); - buffer = priv->buffer; + g_mutex_lock(priv->bufferMutex); + GstBuffer* buffer = priv->buffer; priv->buffer = 0; - priv->timeout_id = 0; + priv->timeoutId = 0; - if (!buffer || priv->unlocked || G_UNLIKELY(!GST_IS_BUFFER(buffer))) { - g_cond_signal(priv->data_cond); - g_mutex_unlock(priv->buffer_mutex); + if (!buffer || priv->unlocked || UNLIKELY(!GST_IS_BUFFER(buffer))) { + g_cond_signal(priv->dataCondition); + g_mutex_unlock(priv->bufferMutex); return FALSE; } - g_signal_emit(sink, webkit_video_sink_signals[REPAINT_REQUESTED], 0, buffer); + g_signal_emit(sink, webkitVideoSinkSignals[REPAINT_REQUESTED], 0, buffer); gst_buffer_unref(buffer); - g_cond_signal(priv->data_cond); - g_mutex_unlock(priv->buffer_mutex); + g_cond_signal(priv->dataCondition); + g_mutex_unlock(priv->bufferMutex); return FALSE; } -static GstFlowReturn -webkit_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer) +static GstFlowReturn webkitVideoSinkRender(GstBaseSink* baseSink, GstBuffer* buffer) { - WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(bsink); + WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink); WebKitVideoSinkPrivate* priv = sink->priv; - g_mutex_lock(priv->buffer_mutex); + g_mutex_lock(priv->bufferMutex); if (priv->unlocked) { - g_mutex_unlock(priv->buffer_mutex); + g_mutex_unlock(priv->bufferMutex); return GST_FLOW_OK; } // Ignore buffers if the video is already in fullscreen using // another sink. if (priv->gstGWorld->isFullscreen()) { - g_mutex_unlock(priv->buffer_mutex); + g_mutex_unlock(priv->bufferMutex); return GST_FLOW_OK; } @@ -167,17 +140,17 @@ webkit_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer) // For the unlikely case where the buffer has no caps, the caps // are implicitely the caps of the pad. This shouldn't happen. - if (G_UNLIKELY(!GST_BUFFER_CAPS(buffer))) { + if (UNLIKELY(!GST_BUFFER_CAPS(buffer))) { buffer = priv->buffer = gst_buffer_make_metadata_writable(priv->buffer); - gst_buffer_set_caps(priv->buffer, GST_PAD_CAPS(GST_BASE_SINK_PAD(bsink))); + gst_buffer_set_caps(priv->buffer, GST_PAD_CAPS(GST_BASE_SINK_PAD(baseSink))); } - GstCaps *caps = GST_BUFFER_CAPS(buffer); + GstCaps* caps = GST_BUFFER_CAPS(buffer); GstVideoFormat format; int width, height; - if (G_UNLIKELY(!gst_video_format_parse_caps(caps, &format, &width, &height))) { + if (UNLIKELY(!gst_video_format_parse_caps(caps, &format, &width, &height))) { gst_buffer_unref(buffer); - g_mutex_unlock(priv->buffer_mutex); + g_mutex_unlock(priv->bufferMutex); return GST_FLOW_ERROR; } @@ -187,36 +160,35 @@ webkit_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer) // Because GstBaseSink::render() only owns the buffer reference in the // method scope we can't use gst_buffer_make_writable() here. Also // The buffer content should not be changed here because the same buffer - // could be passed multiple times to this method (in theory) - GstBuffer *newBuffer = gst_buffer_try_new_and_alloc(GST_BUFFER_SIZE(buffer)); + // could be passed multiple times to this method (in theory). + + GstBuffer* newBuffer = gst_buffer_try_new_and_alloc(GST_BUFFER_SIZE(buffer)); - // Check if allocation failed - if (G_UNLIKELY(!newBuffer)) { - gst_buffer_unref(buffer); - g_mutex_unlock(priv->buffer_mutex); + // Check if allocation failed. + if (UNLIKELY(!newBuffer)) { + g_mutex_unlock(priv->bufferMutex); return GST_FLOW_ERROR; } - gst_buffer_copy_metadata(newBuffer, buffer, (GstBufferCopyFlags) GST_BUFFER_COPY_ALL); + gst_buffer_copy_metadata(newBuffer, buffer, static_cast<GstBufferCopyFlags>(GST_BUFFER_COPY_ALL)); // We don't use Color::premultipliedARGBFromColor() here because // one function call per video pixel is just too expensive: // For 720p/PAL for example this means 1280*720*25=23040000 // function calls per second! - unsigned short alpha; - const guint8 *source = GST_BUFFER_DATA(buffer); - guint8 *destination = GST_BUFFER_DATA(newBuffer); + const guint8* source = GST_BUFFER_DATA(buffer); + guint8* destination = GST_BUFFER_DATA(newBuffer); for (int x = 0; x < height; x++) { for (int y = 0; y < width; y++) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN - alpha = source[3]; + unsigned short alpha = source[3]; destination[0] = (source[0] * alpha + 128) / 255; destination[1] = (source[1] * alpha + 128) / 255; destination[2] = (source[2] * alpha + 128) / 255; destination[3] = alpha; #else - alpha = source[0]; + unsigned short alpha = source[0]; destination[0] = alpha; destination[1] = (source[1] * alpha + 128) / 255; destination[2] = (source[2] * alpha + 128) / 255; @@ -226,6 +198,7 @@ webkit_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer) destination += 4; } } + gst_buffer_unref(buffer); buffer = priv->buffer = newBuffer; } @@ -233,165 +206,151 @@ webkit_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer) // This should likely use a lower priority, but glib currently starves // lower priority sources. // See: https://bugzilla.gnome.org/show_bug.cgi?id=610830. - priv->timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, - webkit_video_sink_timeout_func, - gst_object_ref(sink), - (GDestroyNotify)gst_object_unref); + priv->timeoutId = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, webkitVideoSinkTimeoutCallback, + gst_object_ref(sink), reinterpret_cast<GDestroyNotify>(gst_object_unref)); - g_cond_wait(priv->data_cond, priv->buffer_mutex); - g_mutex_unlock(priv->buffer_mutex); + g_cond_wait(priv->dataCondition, priv->bufferMutex); + g_mutex_unlock(priv->bufferMutex); return GST_FLOW_OK; } -static void -webkit_video_sink_dispose(GObject* object) +static void webkitVideoSinkDispose(GObject* object) { WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(object); WebKitVideoSinkPrivate* priv = sink->priv; - if (priv->data_cond) { + if (priv->dataCondition) { #if GLIB_CHECK_VERSION(2, 31, 0) - g_cond_clear(priv->data_cond); - WTF::fastDelete(priv->data_cond); + g_cond_clear(priv->dataCondition); + WTF::fastDelete(priv->dataCondition); #else - g_cond_free(priv->data_cond); + g_cond_free(priv->dataCondition); #endif - priv->data_cond = 0; + priv->dataCondition = 0; } - if (priv->buffer_mutex) { + if (priv->bufferMutex) { #if GLIB_CHECK_VERSION(2, 31, 0) - g_mutex_clear(priv->buffer_mutex); - WTF::fastDelete(priv->buffer_mutex); + g_mutex_clear(priv->bufferMutex); + WTF::fastDelete(priv->bufferMutex); #else - g_mutex_free(priv->buffer_mutex); + g_mutex_free(priv->bufferMutex); #endif - priv->buffer_mutex = 0; + priv->bufferMutex = 0; } G_OBJECT_CLASS(parent_class)->dispose(object); } -static void -unlock_buffer_mutex(WebKitVideoSinkPrivate* priv) +static void unlockBufferMutex(WebKitVideoSinkPrivate* priv) { - g_mutex_lock(priv->buffer_mutex); + g_mutex_lock(priv->bufferMutex); if (priv->buffer) { gst_buffer_unref(priv->buffer); priv->buffer = 0; } - priv->unlocked = TRUE; + priv->unlocked = true; - g_cond_signal(priv->data_cond); - g_mutex_unlock(priv->buffer_mutex); + g_cond_signal(priv->dataCondition); + g_mutex_unlock(priv->bufferMutex); } -static gboolean -webkit_video_sink_unlock(GstBaseSink* object) +static gboolean webkitVideoSinkUnlock(GstBaseSink* baseSink) { - WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(object); + WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink); - unlock_buffer_mutex(sink->priv); + unlockBufferMutex(sink->priv); - return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, unlock, - (object), TRUE); + return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, unlock, (baseSink), TRUE); } -static gboolean -webkit_video_sink_unlock_stop(GstBaseSink* object) +static gboolean webkitVideoSinkUnlockStop(GstBaseSink* baseSink) { - WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(object); - WebKitVideoSinkPrivate* priv = sink->priv; + WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv; - g_mutex_lock(priv->buffer_mutex); - priv->unlocked = FALSE; - g_mutex_unlock(priv->buffer_mutex); + g_mutex_lock(priv->bufferMutex); + priv->unlocked = false; + g_mutex_unlock(priv->bufferMutex); - return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, unlock_stop, - (object), TRUE); + return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, unlock_stop, (baseSink), TRUE); } -static gboolean -webkit_video_sink_stop(GstBaseSink* base_sink) +static gboolean webkitVideoSinkStop(GstBaseSink* baseSink) { - WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(base_sink)->priv; - - unlock_buffer_mutex(priv); + unlockBufferMutex(WEBKIT_VIDEO_SINK(baseSink)->priv); return TRUE; } -static gboolean -webkit_video_sink_start(GstBaseSink* base_sink) +static gboolean webkitVideoSinkStart(GstBaseSink* baseSink) { - WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(base_sink)->priv; + WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv; - g_mutex_lock(priv->buffer_mutex); - priv->unlocked = FALSE; - g_mutex_unlock(priv->buffer_mutex); + g_mutex_lock(priv->bufferMutex); + priv->unlocked = false; + g_mutex_unlock(priv->bufferMutex); return TRUE; } -static void -marshal_VOID__MINIOBJECT(GClosure * closure, GValue * return_value, - guint n_param_values, const GValue * param_values, - gpointer invocation_hint, gpointer marshal_data) +static void webkitVideoSinkMarshalVoidAndMiniObject(GClosure* closure, GValue* returnValue, guint parametersNumber, const GValue* parameterValues, gpointer invocationHint, gpointer marshalData) { - typedef void (*marshalfunc_VOID__MINIOBJECT) (gpointer obj, gpointer arg1, gpointer data2); - marshalfunc_VOID__MINIOBJECT callback; - GCClosure *cc = (GCClosure *) closure; - gpointer data1, data2; - - g_return_if_fail(n_param_values == 2); - - if (G_CCLOSURE_SWAP_DATA(closure)) { - data1 = closure->data; - data2 = g_value_peek_pointer(param_values + 0); - } else { - data1 = g_value_peek_pointer(param_values + 0); - data2 = closure->data; - } - callback = (marshalfunc_VOID__MINIOBJECT) (marshal_data ? marshal_data : cc->callback); - - callback(data1, gst_value_get_mini_object(param_values + 1), data2); + typedef void (*marshalfunc_VOID__MINIOBJECT) (gpointer obj, gpointer arg1, gpointer data2); + marshalfunc_VOID__MINIOBJECT callback; + GCClosure* cclosure = reinterpret_cast<GCClosure*>(closure); + gpointer data1, data2; + + g_return_if_fail(parametersNumber == 2); + + if (G_CCLOSURE_SWAP_DATA(closure)) { + data1 = closure->data; + data2 = g_value_peek_pointer(parameterValues + 0); + } else { + data1 = g_value_peek_pointer(parameterValues + 0); + data2 = closure->data; + } + + callback = (marshalfunc_VOID__MINIOBJECT) (marshalData ? marshalData : cclosure->callback); + callback(data1, gst_value_get_mini_object(parameterValues + 1), data2); } -static void -webkit_video_sink_class_init(WebKitVideoSinkClass* klass) +static void webkit_video_sink_class_init(WebKitVideoSinkClass* klass) { - GObjectClass* gobject_class = G_OBJECT_CLASS(klass); - GstBaseSinkClass* gstbase_sink_class = GST_BASE_SINK_CLASS(klass); + GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); + GstBaseSinkClass* baseSinkClass = GST_BASE_SINK_CLASS(klass); + GstElementClass* elementClass = GST_ELEMENT_CLASS(klass); + + gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&s_sinkTemplate)); + gst_element_class_set_details_simple(elementClass, + "WebKit video sink", + "Sink/Video", "Sends video data from a GStreamer pipeline to a Cairo surface", + "Alp Toker <alp@atoker.com>"); g_type_class_add_private(klass, sizeof(WebKitVideoSinkPrivate)); - gobject_class->dispose = webkit_video_sink_dispose; + gobjectClass->dispose = webkitVideoSinkDispose; - gstbase_sink_class->unlock = webkit_video_sink_unlock; - gstbase_sink_class->unlock_stop = webkit_video_sink_unlock_stop; - gstbase_sink_class->render = webkit_video_sink_render; - gstbase_sink_class->preroll = webkit_video_sink_render; - gstbase_sink_class->stop = webkit_video_sink_stop; - gstbase_sink_class->start = webkit_video_sink_start; + baseSinkClass->unlock = webkitVideoSinkUnlock; + baseSinkClass->unlock_stop = webkitVideoSinkUnlockStop; + baseSinkClass->render = webkitVideoSinkRender; + baseSinkClass->preroll = webkitVideoSinkRender; + baseSinkClass->stop = webkitVideoSinkStop; + baseSinkClass->start = webkitVideoSinkStart; - webkit_video_sink_signals[REPAINT_REQUESTED] = g_signal_new("repaint-requested", + webkitVideoSinkSignals[REPAINT_REQUESTED] = g_signal_new("repaint-requested", G_TYPE_FROM_CLASS(klass), - (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), - 0, - 0, - 0, - marshal_VOID__MINIOBJECT, - G_TYPE_NONE, 1, GST_TYPE_BUFFER); + static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, // Class offset + 0, // Accumulator + 0, // Accumulator data + webkitVideoSinkMarshalVoidAndMiniObject, + G_TYPE_NONE, // Return type + 1, // Only one parameter + GST_TYPE_BUFFER); } -/** - * webkit_video_sink_new: - * - * Creates a new GStreamer video sink. - * - * Return value: a #GstElement for the newly created video sink - */ -GstElement* webkit_video_sink_new(WebCore::GStreamerGWorld* gstGWorld) + +GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld* gstGWorld) { GstElement* element = GST_ELEMENT(g_object_new(WEBKIT_TYPE_VIDEO_SINK, 0)); WEBKIT_VIDEO_SINK(element)->priv->gstGWorld = gstGWorld; diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h index 501850fde..34057aa46 100644 --- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h +++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h @@ -25,46 +25,29 @@ #include "GStreamerGWorld.h" #include <glib-object.h> #include <gst/video/gstvideosink.h> - -G_BEGIN_DECLS +#include <gst/video/video.h> #define WEBKIT_TYPE_VIDEO_SINK webkit_video_sink_get_type() -#define WEBKIT_VIDEO_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSink)) - -#define WEBKIT_VIDEO_SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkClass)) - -#define WEBKIT_IS_VIDEO_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - WEBKIT_TYPE_VIDEO_SINK)) +#define WEBKIT_VIDEO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSink)) +#define WEBKIT_VIDEO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkClass)) +#define WEBKIT_IS_VIDEO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_VIDEO_SINK)) +#define WEBKIT_IS_VIDEO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_VIDEO_SINK)) +#define WEBKIT_VIDEO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkClass)) -#define WEBKIT_IS_VIDEO_SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - WEBKIT_TYPE_VIDEO_SINK)) - -#define WEBKIT_VIDEO_SINK_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkClass)) - -typedef struct _WebKitVideoSink WebKitVideoSink; -typedef struct _WebKitVideoSinkClass WebKitVideoSinkClass; +typedef struct _WebKitVideoSink WebKitVideoSink; +typedef struct _WebKitVideoSinkClass WebKitVideoSinkClass; typedef struct _WebKitVideoSinkPrivate WebKitVideoSinkPrivate; struct _WebKitVideoSink { - /*< private >*/ GstVideoSink parent; - WebKitVideoSinkPrivate *priv; + WebKitVideoSinkPrivate* priv; }; struct _WebKitVideoSinkClass { - /*< private >*/ GstVideoSinkClass parent_class; - /* Future padding */ + // Future padding void (* _webkit_reserved1)(void); void (* _webkit_reserved2)(void); void (* _webkit_reserved3)(void); @@ -73,11 +56,9 @@ struct _WebKitVideoSinkClass { void (* _webkit_reserved6)(void); }; +GType webkit_video_sink_get_type() G_GNUC_CONST; -GType webkit_video_sink_get_type(void) G_GNUC_CONST; -GstElement *webkit_video_sink_new(WebCore::GStreamerGWorld*); - -G_END_DECLS +GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld*); #endif // USE(GSTREAMER) #endif diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h index 3089ae2d4..011ec36a2 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h @@ -121,7 +121,7 @@ private: PassRefPtr<TimeRanges> buffered() const; float maxTimeSeekable() const; - unsigned bytesLoaded() const; + bool didLoadingProgress() const; unsigned totalBytes() const; void setVisible(bool); @@ -212,6 +212,7 @@ private: bool m_videoFrameHasDrawn; bool m_isAllowedToRender; bool m_privateBrowsing; + mutable float m_maxTimeLoadedAtLastDidLoadingProgress; #if DRAW_FRAME_RATE int m_frameCountWhilePlaying; double m_timeStartedPlaying; diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index 98599e96b..29249aa78 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -214,6 +214,7 @@ MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit(MediaPlayer* player) , m_videoFrameHasDrawn(false) , m_isAllowedToRender(false) , m_privateBrowsing(false) + , m_maxTimeLoadedAtLastDidLoadingProgress(0) #if DRAW_FRAME_RATE , m_frameCountWhilePlaying(0) , m_timeStartedPlaying(0) @@ -945,12 +946,14 @@ float MediaPlayerPrivateQTKit::maxTimeLoaded() const return wkQTMovieMaxTimeLoaded(m_qtMovie.get()); } -unsigned MediaPlayerPrivateQTKit::bytesLoaded() const +bool MediaPlayerPrivateQTKit::didLoadingProgress() const { - float dur = duration(); - if (!dur) - return 0; - return totalBytes() * maxTimeLoaded() / dur; + if (!duration() || !totalBytes()) + return false; + float currentMaxTimeLoaded = maxTimeLoaded(); + bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; + m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded; + return didLoadingProgress; } unsigned MediaPlayerPrivateQTKit::totalBytes() const diff --git a/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp b/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp index 98a730c06..9510882cc 100644 --- a/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp +++ b/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp @@ -105,24 +105,6 @@ void BitmapImage::invalidatePlatformData() { } -#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) -static void adjustSourceRectForDownSampling(FloatRect& srcRect, const IntSize& origSize, const IntSize& scaledSize) -{ - // We assume down-sampling zoom rates in X direction and in Y direction are same. - if (origSize.width() == scaledSize.width()) - return; - - // Image has been down sampled. - double rate = static_cast<double>(scaledSize.width()) / origSize.width(); - double temp = srcRect.right() * rate; - srcRect.setX(srcRect.x() * rate); - srcRect.setWidth(temp - srcRect.x()); - temp = srcRect.bottom() * rate; - srcRect.setY(srcRect.y() * rate); - srcRect.setHeight(temp - srcRect.y()); -} -#endif - void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op) { if (dst.isEmpty() || src.isEmpty()) @@ -147,9 +129,10 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo else context->setCompositeOperation(op); - FloatRect srcRectLocal(src); #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) - adjustSourceRectForDownSampling(srcRectLocal, size(), image->size()); + FloatRect srcRectLocal = adjustSourceRectForDownSampling(src, image->size()); +#else + FloatRect srcRectLocal(src); #endif context->platformContext()->activePainter()->drawImage(image, dst, srcRectLocal); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index af95e4f74..f3a7ea8ab 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -194,7 +194,7 @@ void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() con if (!m_context->m_attrs.antialias) return; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) const QOpenGLContext* currentContext = QOpenGLContext::currentContext(); QSurface* currentSurface = 0; if (currentContext != m_platformContext) { @@ -220,7 +220,7 @@ void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() con bool GraphicsContext3DPrivate::makeCurrentIfNeeded() const { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) const QOpenGLContext* currentContext = QOpenGLContext::currentContext(); if (currentContext == m_platformContext) return true; @@ -322,7 +322,6 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi #endif } -#if !defined(QT_OPENGL_ES_2) // ANGLE initialization. ShBuiltInResources ANGLEResources; ShInitBuiltInResources(&ANGLEResources); @@ -339,6 +338,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi ANGLEResources.MaxDrawBuffers = 1; m_compiler.setResources(ANGLEResources); +#if !defined(QT_OPENGL_ES_2) glEnable(GL_POINT_SPRITE); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); #endif diff --git a/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index 1f93aa3cd..e03636f20 100644 --- a/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -31,21 +31,10 @@ #include <QtCore/QByteArray> #include <QtCore/QBuffer> - #include <QtGui/QImageReader> -#include <qdebug.h> namespace WebCore { -ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - if (data.size() < 4) - return 0; - - return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption); -} - ImageDecoderQt::ImageDecoderQt(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) : ImageDecoder(alphaOption, gammaAndColorProfileOption) , m_repetitionCount(cAnimationNone) @@ -129,7 +118,7 @@ int ImageDecoderQt::repetitionCount() const String ImageDecoderQt::filenameExtension() const { return String(m_format.constData(), m_format.length()); -}; +} ImageFrame* ImageDecoderQt::frameBufferAtIndex(size_t index) { @@ -167,6 +156,12 @@ void ImageDecoderQt::internalDecodeSize() } setSize(size.width(), size.height()); + + // We don't need the tables set by prepareScaleDataIfNecessary, + // but their dimensions are used by ImageDecoder::scaledSize(). + prepareScaleDataIfNecessary(); + if (m_scaled) + m_reader->setScaledSize(scaledSize()); } void ImageDecoderQt::internalReadImage(size_t frameIndex) @@ -194,21 +189,44 @@ void ImageDecoderQt::internalReadImage(size_t frameIndex) bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex) { - QPixmap pixmap = QPixmap::fromImageReader(m_reader.get()); + ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; + QSize imageSize = m_reader->scaledSize(); + if (imageSize.isEmpty()) + imageSize = m_reader->size(); + + if (!buffer->setSize(imageSize.width(), imageSize.height())) + return false; + + QImage image(reinterpret_cast<uchar*>(buffer->getAddr(0, 0)), imageSize.width(), imageSize.height(), sizeof(ImageFrame::PixelData) * imageSize.width(), m_reader->imageFormat()); + + buffer->setDuration(m_reader->nextImageDelay()); + m_reader->read(&image); + + // ImageFrame expects ARGB32. + if (buffer->premultiplyAlpha()) { + if (image.format() != QImage::Format_ARGB32_Premultiplied) + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + } else { + if (image.format() != QImage::Format_ARGB32) + image = image.convertToFormat(QImage::Format_ARGB32); + } + + if (reinterpret_cast<const uchar*>(image.constBits()) != reinterpret_cast<const uchar*>(buffer->getAddr(0, 0))) { + // The in-buffer was replaced during decoding with another, so copy into it manually. + memcpy(buffer->getAddr(0, 0), image.constBits(), image.byteCount()); + } - if (pixmap.isNull()) { + if (image.isNull()) { frameCount(); repetitionCount(); clearPointers(); return false; } - // now into the ImageFrame - even if the image is not - ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; - buffer->setOriginalFrameRect(m_reader->currentImageRect()); + buffer->setOriginalFrameRect(image.rect()); + buffer->setHasAlpha(image.hasAlphaChannel()); buffer->setStatus(ImageFrame::FrameComplete); - buffer->setDuration(m_reader->nextImageDelay()); - buffer->setPixmap(pixmap); + return true; } @@ -245,6 +263,20 @@ void ImageDecoderQt::clearPointers() m_reader.clear(); m_buffer.clear(); } + +NativeImagePtr ImageFrame::asNewNativeImage() const +{ + QImage::Format format; + if (m_hasAlpha) + format = m_premultiplyAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32; + else + format = QImage::Format_RGB32; + + QImage img(reinterpret_cast<uchar*>(m_bytes), m_size.width(), m_size.height(), sizeof(PixelData) * m_size.width(), format); + + return new QPixmap(QPixmap::fromImage(img)); +} + } // vim: ts=4 sw=4 et diff --git a/Source/WebCore/platform/graphics/qt/ImageQt.cpp b/Source/WebCore/platform/graphics/qt/ImageQt.cpp index 182b36684..849435f63 100644 --- a/Source/WebCore/platform/graphics/qt/ImageQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageQt.cpp @@ -132,9 +132,15 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const if (!framePixmap) // If it's too early we won't have an image yet. return; +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + FloatRect tileRectAdjusted = adjustSourceRectForDownSampling(tileRect, framePixmap->size()); +#else + FloatRect tileRectAdjusted = tileRect; +#endif + // Qt interprets 0 width/height as full width/height so just short circuit. QRectF dr = QRectF(destRect).normalized(); - QRect tr = QRectF(tileRect).toRect().normalized(); + QRect tr = QRectF(tileRectAdjusted).toRect().normalized(); if (!dr.width() || !dr.height() || !tr.width() || !tr.height()) return; @@ -239,6 +245,10 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, return; } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + normalizedSrc = adjustSourceRectForDownSampling(normalizedSrc, image->size()); +#endif + CompositeOperator previousOperator = ctxt->compositeOperation(); ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op); diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 9529cd47a..3a307cb27 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -116,6 +116,7 @@ MediaPlayerPrivateQt::MediaPlayerPrivateQt(MediaPlayer* player) , m_isSeeking(false) , m_composited(false) , m_preload(MediaPlayer::Auto) + , m_bytesLoadedAtLastDidLoadingProgress(0) , m_suppressNextPlaybackChanged(false) { m_mediaPlayer->setVideoOutput(m_videoItem); @@ -361,13 +362,17 @@ float MediaPlayerPrivateQt::maxTimeSeekable() const return static_cast<float>(m_mediaPlayerControl->availablePlaybackRanges().latestTime()) / 1000.0f; } -unsigned MediaPlayerPrivateQt::bytesLoaded() const +bool MediaPlayerPrivateQt::didLoadingProgress() const { + unsigned bytesLoaded = 0; QLatin1String bytesLoadedKey("bytes-loaded"); if (m_mediaPlayer->availableExtendedMetaData().contains(bytesLoadedKey)) - return m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt(); - - return m_mediaPlayer->bufferStatus(); + bytesLoaded = m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt(); + else + bytesLoaded = m_mediaPlayer->bufferStatus(); + bool didLoadingProgress = bytesLoaded != m_bytesLoadedAtLastDidLoadingProgress; + m_bytesLoadedAtLastDidLoadingProgress = bytesLoaded; + return didLoadingProgress; } unsigned MediaPlayerPrivateQt::totalBytes() const diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h index 67f64c74b..c6fcbd838 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h @@ -86,7 +86,7 @@ public: PassRefPtr<TimeRanges> buffered() const; float maxTimeSeekable() const; - unsigned bytesLoaded() const; + bool didLoadingProgress() const; unsigned totalBytes() const; void setVisible(bool); @@ -156,6 +156,7 @@ private: bool m_isSeeking; bool m_composited; MediaPlayer::Preload m_preload; + mutable unsigned m_bytesLoadedAtLastDidLoadingProgress; bool m_delayingLoad; String m_mediaUrl; bool m_suppressNextPlaybackChanged; diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp index 1bcd6c05b..4c01f1dac 100644 --- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp @@ -148,7 +148,7 @@ void SimpleFontData::platformInit() float spaceWidth = fm.width(QLatin1Char(' ')); #endif -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) // Qt subtracts 1 from the descent to account for the baseline, // we add it back here to get correct metrics for WebKit. descent += 1; diff --git a/Source/WebCore/platform/graphics/skia/PathSkia.cpp b/Source/WebCore/platform/graphics/skia/PathSkia.cpp index 0ba6d070e..8795b4c3c 100644 --- a/Source/WebCore/platform/graphics/skia/PathSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PathSkia.cpp @@ -53,6 +53,13 @@ Path::Path(const Path& other) m_path = new SkPath(*other.m_path); } +#if PLATFORM(BLACKBERRY) +Path::Path(const SkPath& path) +{ + m_path = new SkPath(path); +} +#endif + Path::~Path() { delete m_path; diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp index b43a1012e..018a89c9b 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp @@ -46,6 +46,11 @@ uint32_t GraphicsSurface::exportToken() return platformExport(); } +uint32_t GraphicsSurface::getTextureID() +{ + return platformGetTextureID(); +} + PassOwnPtr<GraphicsContext> GraphicsSurface::beginPaint(const IntRect& rect, LockOptions lockOptions) { int stride = 0; @@ -59,6 +64,11 @@ void GraphicsSurface::copyToGLTexture(uint32_t target, uint32_t texture, const I platformCopyToGLTexture(target, texture, targetRect, offset); } +void GraphicsSurface::copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRect) +{ + platformCopyFromFramebuffer(fbo, sourceRect); +} + GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags) : m_size(size) , m_flags(flags) diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h index da941d497..96b1c15a1 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h @@ -64,7 +64,9 @@ public: static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags); static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags, uint32_t token); void copyToGLTexture(uint32_t target, uint32_t texture, const IntRect& targetRect, const IntPoint& sourceOffset); + void copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRect); uint32_t exportToken(); + uint32_t getTextureID(); PassOwnPtr<GraphicsContext> beginPaint(const IntRect&, LockOptions); PassRefPtr<Image> createReadOnlyImage(const IntRect&); @@ -74,9 +76,11 @@ protected: uint32_t platformExport(); void platformDestroy(); + uint32_t platformGetTextureID(); char* platformLock(const IntRect&, int* stride, LockOptions); void platformUnlock(); void platformCopyToGLTexture(uint32_t target, uint32_t texture, const IntRect&, const IntPoint&); + void platformCopyFromFramebuffer(uint32_t fbo, const IntRect& sourceRect); PassOwnPtr<GraphicsContext> platformBeginPaint(const IntSize&, char* bits, int stride); diff --git a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp index b6a1a0202..a8fe4ddc2 100644 --- a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp +++ b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp @@ -64,6 +64,13 @@ static uint32_t createTexture(IOSurfaceRef handle) return texture; } +uint32_t GraphicsSurface::platformGetTextureID() +{ + if (!m_texture) + m_texture = createTexture(m_platformSurface); + return m_texture; +} + void GraphicsSurface::platformCopyToGLTexture(uint32_t target, uint32_t id, const IntRect& targetRect, const IntPoint& offset) { glPushAttrib(GL_ALL_ATTRIB_BITS); @@ -83,6 +90,28 @@ void GraphicsSurface::platformCopyToGLTexture(uint32_t target, uint32_t id, cons glPopAttrib(); } +void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntRect& sourceRect) +{ + glPushAttrib(GL_ALL_ATTRIB_BITS); + if (!m_texture) + m_texture = createTexture(m_platformSurface); + if (!m_fbo) + glGenFramebuffers(1, &m_fbo); + GLint oldFBO; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + glBindFramebuffer(GL_READ_FRAMEBUFFER, originFbo); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, m_texture, 0); + glBlitFramebuffer(0, 0, sourceRect.width(), sourceRect.height(), 0, sourceRect.height(), sourceRect.width(), 0, GL_COLOR_BUFFER_BIT, GL_LINEAR); // Flip the texture upside down. + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, 0, 0); + glBindFramebuffer(GL_FRAMEBUFFER, oldFBO); + glPopAttrib(); + + // Flushing the gl command buffer is necessary to ensure the texture has correctly been bound to the IOSurface. + glFlush(); +} + bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags) { unsigned pixelFormat = 'BGRA'; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.h b/Source/WebCore/platform/graphics/texmap/TextureMapper.h index 2907d1ac8..12498ecc3 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.h @@ -25,7 +25,7 @@ #if PLATFORM(QT) #include <qglobal.h> -#if defined(QT_OPENGL_LIB) || (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#if defined(QT_OPENGL_LIB) || HAVE(QT5) #if defined(QT_OPENGL_ES_2) && !defined(TEXMAP_OPENGL_ES_2) #define TEXMAP_OPENGL_ES_2 #endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp index 0f7652cd4..660334a67 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp @@ -505,7 +505,7 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co #if PLATFORM(QT) QImage qtImage; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) // With QPA, we can avoid a deep copy. qtImage = *frameImage->handle()->buffer(); #else diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp index 1cc0a220e..8e6c14e5f 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp +++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp @@ -727,15 +727,13 @@ TransformationMatrix& TransformationMatrix::scale3d(double sx, double sy, double TransformationMatrix& TransformationMatrix::rotate3d(double x, double y, double z, double angle) { - // angles are in degrees. Switch to radians + // Angles are in degrees. Switch to radians. angle = deg2rad(angle); + + double sinTheta = sin(angle); + double cosTheta = cos(angle); - angle /= 2.0f; - double sinA = sin(angle); - double cosA = cos(angle); - double sinA2 = sinA * sinA; - - // normalize + // Normalize the axis of rotation double length = sqrt(x * x + y * y + z * z); if (length == 0) { // bad vector, just use something reasonable @@ -750,39 +748,39 @@ TransformationMatrix& TransformationMatrix::rotate3d(double x, double y, double TransformationMatrix mat; - // optimize case where axis is along major axis + // Optimize cases where the axis is along a major axis if (x == 1.0f && y == 0.0f && z == 0.0f) { mat.m_matrix[0][0] = 1.0f; mat.m_matrix[0][1] = 0.0f; mat.m_matrix[0][2] = 0.0f; mat.m_matrix[1][0] = 0.0f; - mat.m_matrix[1][1] = 1.0f - 2.0f * sinA2; - mat.m_matrix[1][2] = 2.0f * sinA * cosA; + mat.m_matrix[1][1] = cosTheta; + mat.m_matrix[1][2] = sinTheta; mat.m_matrix[2][0] = 0.0f; - mat.m_matrix[2][1] = -2.0f * sinA * cosA; - mat.m_matrix[2][2] = 1.0f - 2.0f * sinA2; + mat.m_matrix[2][1] = -sinTheta; + mat.m_matrix[2][2] = cosTheta; mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0f; mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; } else if (x == 0.0f && y == 1.0f && z == 0.0f) { - mat.m_matrix[0][0] = 1.0f - 2.0f * sinA2; + mat.m_matrix[0][0] = cosTheta; mat.m_matrix[0][1] = 0.0f; - mat.m_matrix[0][2] = -2.0f * sinA * cosA; + mat.m_matrix[0][2] = -sinTheta; mat.m_matrix[1][0] = 0.0f; mat.m_matrix[1][1] = 1.0f; mat.m_matrix[1][2] = 0.0f; - mat.m_matrix[2][0] = 2.0f * sinA * cosA; + mat.m_matrix[2][0] = sinTheta; mat.m_matrix[2][1] = 0.0f; - mat.m_matrix[2][2] = 1.0f - 2.0f * sinA2; + mat.m_matrix[2][2] = cosTheta; mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0f; mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; } else if (x == 0.0f && y == 0.0f && z == 1.0f) { - mat.m_matrix[0][0] = 1.0f - 2.0f * sinA2; - mat.m_matrix[0][1] = 2.0f * sinA * cosA; + mat.m_matrix[0][0] = cosTheta; + mat.m_matrix[0][1] = sinTheta; mat.m_matrix[0][2] = 0.0f; - mat.m_matrix[1][0] = -2.0f * sinA * cosA; - mat.m_matrix[1][1] = 1.0f - 2.0f * sinA2; + mat.m_matrix[1][0] = -sinTheta; + mat.m_matrix[1][1] = cosTheta; mat.m_matrix[1][2] = 0.0f; mat.m_matrix[2][0] = 0.0f; mat.m_matrix[2][1] = 0.0f; @@ -791,19 +789,23 @@ TransformationMatrix& TransformationMatrix::rotate3d(double x, double y, double mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; } else { - double x2 = x*x; - double y2 = y*y; - double z2 = z*z; - - mat.m_matrix[0][0] = 1.0f - 2.0f * (y2 + z2) * sinA2; - mat.m_matrix[0][1] = 2.0f * (x * y * sinA2 + z * sinA * cosA); - mat.m_matrix[0][2] = 2.0f * (x * z * sinA2 - y * sinA * cosA); - mat.m_matrix[1][0] = 2.0f * (y * x * sinA2 - z * sinA * cosA); - mat.m_matrix[1][1] = 1.0f - 2.0f * (z2 + x2) * sinA2; - mat.m_matrix[1][2] = 2.0f * (y * z * sinA2 + x * sinA * cosA); - mat.m_matrix[2][0] = 2.0f * (z * x * sinA2 + y * sinA * cosA); - mat.m_matrix[2][1] = 2.0f * (z * y * sinA2 - x * sinA * cosA); - mat.m_matrix[2][2] = 1.0f - 2.0f * (x2 + y2) * sinA2; + // This case is the rotation about an arbitrary unit vector. + // + // Formula is adapted from Wikipedia article on Rotation matrix, + // http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle + // + // An alternate resource with the same matrix: http://www.fastgraph.com/makegames/3drotation/ + // + double oneMinusCosTheta = 1 - cosTheta; + mat.m_matrix[0][0] = cosTheta + x * x * oneMinusCosTheta; + mat.m_matrix[0][1] = y * x * oneMinusCosTheta + z * sinTheta; + mat.m_matrix[0][2] = z * x * oneMinusCosTheta - y * sinTheta; + mat.m_matrix[1][0] = x * y * oneMinusCosTheta - z * sinTheta; + mat.m_matrix[1][1] = cosTheta + y * y * oneMinusCosTheta; + mat.m_matrix[1][2] = z * y * oneMinusCosTheta + x * sinTheta; + mat.m_matrix[2][0] = x * z * oneMinusCosTheta + y * sinTheta; + mat.m_matrix[2][1] = y * z * oneMinusCosTheta - x * sinTheta; + mat.m_matrix[2][2] = cosTheta + z * z * oneMinusCosTheta; mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0f; mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; @@ -814,23 +816,21 @@ TransformationMatrix& TransformationMatrix::rotate3d(double x, double y, double TransformationMatrix& TransformationMatrix::rotate3d(double rx, double ry, double rz) { - // angles are in degrees. Switch to radians + // Angles are in degrees. Switch to radians. rx = deg2rad(rx); ry = deg2rad(ry); rz = deg2rad(rz); TransformationMatrix mat; - rz /= 2.0f; - double sinA = sin(rz); - double cosA = cos(rz); - double sinA2 = sinA * sinA; + double sinTheta = sin(rz); + double cosTheta = cos(rz); - mat.m_matrix[0][0] = 1.0f - 2.0f * sinA2; - mat.m_matrix[0][1] = 2.0f * sinA * cosA; + mat.m_matrix[0][0] = cosTheta; + mat.m_matrix[0][1] = sinTheta; mat.m_matrix[0][2] = 0.0f; - mat.m_matrix[1][0] = -2.0f * sinA * cosA; - mat.m_matrix[1][1] = 1.0f - 2.0f * sinA2; + mat.m_matrix[1][0] = -sinTheta; + mat.m_matrix[1][1] = cosTheta; mat.m_matrix[1][2] = 0.0f; mat.m_matrix[2][0] = 0.0f; mat.m_matrix[2][1] = 0.0f; @@ -841,44 +841,40 @@ TransformationMatrix& TransformationMatrix::rotate3d(double rx, double ry, doubl TransformationMatrix rmat(mat); - ry /= 2.0f; - sinA = sin(ry); - cosA = cos(ry); - sinA2 = sinA * sinA; + sinTheta = sin(ry); + cosTheta = cos(ry); - mat.m_matrix[0][0] = 1.0f - 2.0f * sinA2; + mat.m_matrix[0][0] = cosTheta; mat.m_matrix[0][1] = 0.0f; - mat.m_matrix[0][2] = -2.0f * sinA * cosA; + mat.m_matrix[0][2] = -sinTheta; mat.m_matrix[1][0] = 0.0f; mat.m_matrix[1][1] = 1.0f; mat.m_matrix[1][2] = 0.0f; - mat.m_matrix[2][0] = 2.0f * sinA * cosA; + mat.m_matrix[2][0] = sinTheta; mat.m_matrix[2][1] = 0.0f; - mat.m_matrix[2][2] = 1.0f - 2.0f * sinA2; + mat.m_matrix[2][2] = cosTheta; mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0f; mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; - + rmat.multiply(mat); - rx /= 2.0f; - sinA = sin(rx); - cosA = cos(rx); - sinA2 = sinA * sinA; + sinTheta = sin(rx); + cosTheta = cos(rx); mat.m_matrix[0][0] = 1.0f; mat.m_matrix[0][1] = 0.0f; mat.m_matrix[0][2] = 0.0f; mat.m_matrix[1][0] = 0.0f; - mat.m_matrix[1][1] = 1.0f - 2.0f * sinA2; - mat.m_matrix[1][2] = 2.0f * sinA * cosA; + mat.m_matrix[1][1] = cosTheta; + mat.m_matrix[1][2] = sinTheta; mat.m_matrix[2][0] = 0.0f; - mat.m_matrix[2][1] = -2.0f * sinA * cosA; - mat.m_matrix[2][2] = 1.0f - 2.0f * sinA2; + mat.m_matrix[2][1] = -sinTheta; + mat.m_matrix[2][2] = cosTheta; mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0f; mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0f; mat.m_matrix[3][3] = 1.0f; - + rmat.multiply(mat); multiply(rmat); diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp index b0037c3ab..7d9dcafe6 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp @@ -183,6 +183,7 @@ MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualConte , m_delayingLoad(false) , m_privateBrowsing(false) , m_preload(MediaPlayer::Auto) + , m_maxTimeLoadedAtLastDidLoadingProgress(0) { } @@ -583,15 +584,14 @@ float MediaPlayerPrivateQuickTimeVisualContext::maxTimeLoaded() const return m_movie->maxTimeLoaded(); } -unsigned MediaPlayerPrivateQuickTimeVisualContext::bytesLoaded() const +bool MediaPlayerPrivateQuickTimeVisualContext::didLoadingProgress() const { - if (!m_movie) - return 0; - float dur = duration(); - float maxTime = maxTimeLoaded(); - if (!dur) - return 0; - return totalBytes() * maxTime / dur; + if (!m_movie || !duration()) + return false; + float currentMaxTimeLoaded = maxTimeLoaded(); + bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; + m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded; + return didLoadingProgress; } unsigned MediaPlayerPrivateQuickTimeVisualContext::totalBytes() const diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h index 70fd2a5df..4c44af401 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h @@ -99,7 +99,7 @@ private: PassRefPtr<TimeRanges> buffered() const; float maxTimeSeekable() const; - unsigned bytesLoaded() const; + bool didLoadingProgress() const; unsigned totalBytes() const; void setVisible(bool); @@ -201,6 +201,7 @@ private: String m_movieURL; bool m_privateBrowsing; MediaPlayer::Preload m_preload; + mutable float m_maxTimeLoadedAtLastDidLoadingProgress; #if DRAW_FRAME_RATE double m_frameCountWhilePlaying; double m_timeStartedPlaying; diff --git a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp index c0a1eb2be..b46bf1170 100644 --- a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp @@ -85,13 +85,15 @@ public: }; TextRunComponent::TextRunComponent(const UChar *start, int length, const TextRun& parentTextRun, const Font &font, int o) - : m_textRun(start, length, parentTextRun.allowTabs(), 0, 0 + : m_textRun(start, length, 0, 0 , parentTextRun.allowsTrailingExpansion() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion , parentTextRun.direction() , parentTextRun.directionalOverride()) , m_offset(o) , m_spaces(0) { + m_textRun.setTabSize(parentTextRun.allowTabs(), parentTextRun.tabSize()); + WidthIterator it(&font, m_textRun); it.advance(m_textRun.length(), 0); m_width = it.m_runWidthSoFar; diff --git a/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h b/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h index 862937357..0faa04578 100644 --- a/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h +++ b/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h @@ -70,6 +70,7 @@ namespace WebCore { PassRefPtr<TimeRanges> buffered() const; float maxTimeSeekable() const; + // FIXME: bytesLoaded() should be replaced with didLoadingProgress() (by somebody who can find the implementation of this class). unsigned bytesLoaded() const; unsigned totalBytes() const; diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp index 3db393aef..02aa68c74 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -20,21 +20,23 @@ */ #include "config.h" - #include "ImageDecoder.h" -#include <algorithm> -#include <cmath> - #include "BMPImageDecoder.h" #include "GIFImageDecoder.h" #include "ICOImageDecoder.h" +#if PLATFORM(QT) +#include "ImageDecoderQt.h" +#endif #include "JPEGImageDecoder.h" #include "PNGImageDecoder.h" +#include "SharedBuffer.h" #if USE(WEBP) #include "WEBPImageDecoder.h" #endif -#include "SharedBuffer.h" + +#include <algorithm> +#include <cmath> using namespace std; @@ -107,11 +109,18 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaO if (matchesGIFSignature(contents)) return new GIFImageDecoder(alphaOption, gammaAndColorProfileOption); +#if !PLATFORM(QT) || (PLATFORM(QT) && HAVE(LIBPNG)) if (matchesPNGSignature(contents)) return new PNGImageDecoder(alphaOption, gammaAndColorProfileOption); + if (matchesICOSignature(contents) || matchesCURSignature(contents)) + return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption); +#endif + +#if !PLATFORM(QT) || (PLATFORM(QT) && HAVE(LIBJPEG)) if (matchesJPEGSignature(contents)) return new JPEGImageDecoder(alphaOption, gammaAndColorProfileOption); +#endif #if USE(WEBP) if (matchesWebPSignature(contents)) @@ -121,9 +130,9 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaO if (matchesBMPSignature(contents)) return new BMPImageDecoder(alphaOption, gammaAndColorProfileOption); - if (matchesICOSignature(contents) || matchesCURSignature(contents)) - return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption); - +#if PLATFORM(QT) + return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption); +#endif return 0; } diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h index 6ae738a3b..a6bc188e5 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.h +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h @@ -40,9 +40,6 @@ #if USE(SKIA) #include "NativeImageSkia.h" #include "SkColorPriv.h" -#elif PLATFORM(QT) -#include <QPixmap> -#include <QImage> #endif namespace WebCore { @@ -64,7 +61,7 @@ namespace WebCore { DisposeOverwritePrevious // Clear frame to previous framebuffer // contents }; -#if USE(SKIA) || (PLATFORM(QT) && USE(QT_IMAGE_DECODER)) +#if USE(SKIA) typedef uint32_t PixelData; #else typedef unsigned PixelData; @@ -136,19 +133,10 @@ namespace WebCore { { #if USE(SKIA) return m_bitmap.bitmap().getAddr32(x, y); -#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER) - m_image = m_pixmap.toImage(); - m_pixmap = QPixmap(); - return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x; #else return m_bytes + (y * width()) + x; #endif } - -#if PLATFORM(QT) && USE(QT_IMAGE_DECODER) - void setPixmap(const QPixmap& pixmap); -#endif - private: int width() const; int height() const; @@ -180,11 +168,6 @@ namespace WebCore { #if PLATFORM(CHROMIUM) && OS(DARWIN) ColorProfile m_colorProfile; #endif -#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER) - mutable QPixmap m_pixmap; - mutable QImage m_image; - bool m_hasAlpha; - IntSize m_size; #else Vector<PixelData> m_backingStore; PixelData* m_bytes; // The memory is backed by m_backingStore. diff --git a/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp b/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp deleted file mode 100644 index 999ac2903..000000000 --- a/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008, 2009 Google, Inc. - * Copyright (C) 2009 Holger Hans Peter Freyther - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ImageDecoder.h" - -#include "NotImplemented.h" - -namespace WebCore { - -#if USE(QT_IMAGE_DECODER) - -ImageFrame::ImageFrame() - : m_hasAlpha(false) - , m_size() - , m_status(FrameEmpty) - , m_duration(0) - , m_disposalMethod(DisposeNotSpecified) - , m_premultiplyAlpha(true) -{ -} - -ImageFrame& ImageFrame::operator=(const ImageFrame& other) -{ - if (this == &other) - return *this; - - copyBitmapData(other); - setOriginalFrameRect(other.originalFrameRect()); - setStatus(other.status()); - setDuration(other.duration()); - setDisposalMethod(other.disposalMethod()); - setPremultiplyAlpha(other.premultiplyAlpha()); - return *this; -} - -void ImageFrame::clearPixelData() -{ - m_pixmap = QPixmap(); - m_image = QImage(); - m_status = FrameEmpty; - // NOTE: Do not reset other members here; clearFrameBufferCache() - // calls this to free the bitmap data, but other functions like - // initFrameBuffer() and frameComplete() may still need to read - // other metadata out of this frame later. -} - -void ImageFrame::zeroFillPixelData() -{ - if (m_pixmap.isNull() && !m_image.isNull()) { - m_pixmap = QPixmap(m_image.width(), m_image.height()); - m_image = QImage(); - } - m_pixmap.fill(QColor(0, 0, 0, 0)); -} - -bool ImageFrame::copyBitmapData(const ImageFrame& other) -{ - if (this == &other) - return true; - - m_image = other.m_image; - m_pixmap = other.m_pixmap; - m_size = other.m_size; - m_hasAlpha = other.m_hasAlpha; - return true; -} - -bool ImageFrame::setSize(int newWidth, int newHeight) -{ - // setSize() should only be called once, it leaks memory otherwise. - ASSERT(!width() && !height()); - - m_size = IntSize(newWidth, newHeight); - m_image = QImage(); - m_pixmap = QPixmap(newWidth, newHeight); - if (m_pixmap.isNull()) - return false; - - zeroFillPixelData(); - return true; -} - -QPixmap* ImageFrame::asNewNativeImage() const -{ - if (m_pixmap.isNull() && !m_image.isNull()) { - m_pixmap = QPixmap::fromImage(m_image); - m_image = QImage(); - } - return new QPixmap(m_pixmap); -} - -bool ImageFrame::hasAlpha() const -{ - return m_hasAlpha; -} - -void ImageFrame::setHasAlpha(bool alpha) -{ - m_hasAlpha = alpha; -} - -void ImageFrame::setColorProfile(const ColorProfile& colorProfile) -{ - notImplemented(); -} - -void ImageFrame::setStatus(FrameStatus status) -{ - m_status = status; -} - -// The image must not have format 8888 pre multiplied... -void ImageFrame::setPixmap(const QPixmap& pixmap) -{ - m_pixmap = pixmap; - m_image = QImage(); - m_size = pixmap.size(); - m_hasAlpha = pixmap.hasAlphaChannel(); -} - -int ImageFrame::width() const -{ - return m_size.width(); -} - -int ImageFrame::height() const -{ - return m_size.height(); -} - -#else - -QPixmap* ImageFrame::asNewNativeImage() const -{ - QImage::Format fmt; - if (m_hasAlpha) - fmt = m_premultiplyAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32; - else - fmt = QImage::Format_RGB32; - - QImage img(reinterpret_cast<uchar*>(m_bytes), m_size.width(), m_size.height(), sizeof(PixelData) * m_size.width(), fmt); - - return new QPixmap(QPixmap::fromImage(img)); -} - -#endif // USE(QT_IMAGE_DECODER) - -} diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index 1e811961b..d5436163c 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -208,6 +208,13 @@ void NetworkJob::handleNotifyStatusReceived(int status, const String& message) m_response.setHTTPStatusCode(status); m_response.setHTTPStatusText(message); + + if (!isError(m_extendedStatusCode)) + storeCredentials(); + else if (isUnauthorized(m_extendedStatusCode)) { + purgeCredentials(); + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "Authentication failed, purge the stored credentials for this site."); + } } void NetworkJob::notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::HeaderList& headers) @@ -247,6 +254,36 @@ void NetworkJob::notifyMultipartHeaderReceived(const char* key, const char* valu handleNotifyMultipartHeaderReceived(key, value); } +void NetworkJob::notifyAuthReceived(BlackBerry::Platform::NetworkRequest::AuthType authType, const char* realm) +{ + using BlackBerry::Platform::NetworkRequest; + + ProtectionSpaceServerType serverType = ProtectionSpaceServerHTTP; + ProtectionSpaceAuthenticationScheme scheme = ProtectionSpaceAuthenticationSchemeDefault; + switch (authType) { + case NetworkRequest::AuthHTTPBasic: + scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic; + break; + case NetworkRequest::AuthHTTPDigest: + scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest; + break; + case NetworkRequest::AuthHTTPNTLM: + scheme = ProtectionSpaceAuthenticationSchemeNTLM; + break; + case NetworkRequest::AuthFTP: + serverType = ProtectionSpaceServerFTP; + break; + case NetworkRequest::AuthProxy: + serverType = ProtectionSpaceProxyHTTP; + break; + case NetworkRequest::AuthNone: + default: + return; + } + + sendRequestWithCredentials(serverType, scheme, realm); +} + void NetworkJob::notifyStringHeaderReceived(const String& key, const String& value) { if (shouldDeferLoading()) @@ -279,11 +316,7 @@ void NetworkJob::handleNotifyHeaderReceived(const String& key, const String& val m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); return; } - } else if (m_extendedStatusCode == 401 && lowerKey == "www-authenticate") - handleAuthHeader(ProtectionSpaceServerHTTP, value); - else if (m_extendedStatusCode == 407 && lowerKey == "proxy-authenticate" && !BlackBerry::Platform::Client::get()->getProxyAddress().empty()) - handleAuthHeader(ProtectionSpaceProxyHTTP, value); - else if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP)) + } else if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP)) handleFTPHeader(value); m_response.setHTTPHeaderField(key, value); @@ -441,14 +474,6 @@ void NetworkJob::handleNotifyClose(int status) notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusNetworkError, 0); } - // If an HTTP authentication-enabled request is successful, save - // the credentials for later reuse. If the request fails, delete - // the saved credentials. - if (!isError(m_extendedStatusCode)) - storeCredentials(); - else if (isUnauthorized(m_extendedStatusCode)) - purgeCredentials(); - if (shouldReleaseClientResource()) { if (isRedirect(m_extendedStatusCode) && (m_redirectCount >= s_redirectMaximum)) m_extendedStatusCode = BlackBerry::Platform::FilterStream::StatusTooManyRedirects; @@ -528,8 +553,7 @@ bool NetworkJob::startNewJobWithRequest(ResourceRequest& newRequest, bool increa // Pass the ownership of the ResourceHandle to the new NetworkJob. RefPtr<ResourceHandle> handle = m_handle; - m_handle = 0; - m_multipartResponse = nullptr; + cancelJob(); NetworkManager::instance()->startJob(m_playerId, m_pageGroupName, @@ -649,62 +673,6 @@ void NetworkJob::sendMultipartResponseIfNeeded() } } -bool NetworkJob::handleAuthHeader(const ProtectionSpaceServerType space, const String& header) -{ - if (!m_handle) - return false; - - if (!m_handle->getInternal()->m_currentWebChallenge.isNull()) - return false; - - if (header.isEmpty()) - return false; - - if (equalIgnoringCase(header, "ntlm")) - sendRequestWithCredentials(space, ProtectionSpaceAuthenticationSchemeNTLM, "NTLM"); - - // Extract the auth scheme and realm from the header. - size_t spacePos = header.find(' '); - if (spacePos == notFound) { - LOG(Network, "%s-Authenticate field '%s' badly formatted: missing scheme.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data()); - return false; - } - - String scheme = header.left(spacePos); - - ProtectionSpaceAuthenticationScheme protectionSpaceScheme = ProtectionSpaceAuthenticationSchemeDefault; - if (equalIgnoringCase(scheme, "basic")) - protectionSpaceScheme = ProtectionSpaceAuthenticationSchemeHTTPBasic; - else if (equalIgnoringCase(scheme, "digest")) - protectionSpaceScheme = ProtectionSpaceAuthenticationSchemeHTTPDigest; - else { - notImplemented(); - return false; - } - - size_t realmPos = header.findIgnoringCase("realm=", spacePos); - if (realmPos == notFound) { - LOG(Network, "%s-Authenticate field '%s' badly formatted: missing realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data()); - return false; - } - size_t beginPos = realmPos + 6; - String realm = header.right(header.length() - beginPos); - if (realm.startsWith("\"")) { - beginPos += 1; - size_t endPos = header.find("\"", beginPos); - if (endPos == notFound) { - LOG(Network, "%s-Authenticate field '%s' badly formatted: invalid realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data()); - return false; - } - realm = header.substring(beginPos, endPos - beginPos); - } - - // Get the user's credentials and resend the request. - sendRequestWithCredentials(space, protectionSpaceScheme, realm); - - return true; -} - bool NetworkJob::handleFTPHeader(const String& header) { size_t spacePos = header.find(' '); @@ -761,13 +729,18 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge(protectionSpace, credential, 0, m_response, ResourceError()); m_handle->getInternal()->m_currentWebChallenge.setStored(true); } else { + if (m_handle->firstRequest().targetType() == ResourceRequest::TargetIsFavicon) { + // The favicon loading is triggerred after the main resource has been loaded + // and parsed, so if we cancel the authentication challenge when loading the main + // resource, we should also cancel loading the favicon when it starts to + // load. If not we will receive another challenge which may confuse the user. + return false; + } + // CredentialStore is empty. Ask the user via dialog. String username; String password; - if (!m_frame || !m_frame->loader() || !m_frame->loader()->client()) - return false; - if (type == ProtectionSpaceProxyHTTP) { username = BlackBerry::Platform::Client::get()->getProxyUsername().c_str(); password = BlackBerry::Platform::Client::get()->getProxyPassword().c_str(); @@ -776,30 +749,27 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot if (username.isEmpty() || password.isEmpty()) { // Before asking the user for credentials, we check if the URL contains that. if (!m_handle->getInternal()->m_user.isEmpty() && !m_handle->getInternal()->m_pass.isEmpty()) { - username = m_handle->getInternal()->m_user.utf8().data(); - password = m_handle->getInternal()->m_pass.utf8().data(); + username = m_handle->getInternal()->m_user; + password = m_handle->getInternal()->m_pass; // Prevent them from been used again if they are wrong. // If they are correct, they will the put into CredentialStorage. m_handle->getInternal()->m_user = ""; m_handle->getInternal()->m_pass = ""; } else { - Credential inputCredential = m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace); + Credential inputCredential; + if (!m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace, inputCredential)) + return false; username = inputCredential.user(); password = inputCredential.password(); } } - if (username.isEmpty() && password.isEmpty()) - return false; - credential = Credential(username, password, CredentialPersistenceForSession); m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge(protectionSpace, credential, 0, m_response, ResourceError()); } - // FIXME: Resend the resource request. Cloned from handleRedirect(). Not sure - // if we need everything that follows... ResourceRequest newRequest = m_handle->firstRequest(); newRequest.setURL(newURL); newRequest.setMustHandleInternally(true); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index 11bd2aa59..a9a7b881b 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -69,6 +69,7 @@ public: virtual void notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::HeaderList& headers); virtual void notifyMultipartHeaderReceived(const char* key, const char* value); // Exists only to resolve ambiguity between char* and String parameters + virtual void notifyAuthReceived(BlackBerry::Platform::NetworkRequest::AuthType, const char* realm); void notifyStringHeaderReceived(const String& key, const String& value); void handleNotifyHeaderReceived(const String& key, const String& value); void handleNotifyMultipartHeaderReceived(const String& key, const String& value); @@ -122,12 +123,10 @@ private: void handleAbout(); - // The server needs authentication credentials. Search in the - // CredentialStorage or prompt the user via dialog. - bool handleAuthHeader(const ProtectionSpaceServerType, const String& header); - bool handleFTPHeader(const String& header); + // The server needs authentication credentials. Search in the CredentialStorage + // or prompt the user via dialog, then resend the request with the credentials. bool sendRequestWithCredentials(ProtectionSpaceServerType, ProtectionSpaceAuthenticationScheme, const String& realm); void storeCredentials(); diff --git a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp index bceb1da18..89d619c8b 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved. + * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -160,10 +160,10 @@ NetworkJob* NetworkManager::findJobForHandle(PassRefPtr<ResourceHandle> job) { for (unsigned i = 0; i < m_jobs.size(); ++i) { NetworkJob* networkJob = m_jobs[i]; - if (networkJob->handle() == job) { - // We have only one job for one handle. + // We have only one job for one handle (not including cancelled jobs which may hang + // around briefly), so return the first non-cancelled job. + if (!networkJob->isCancelled() && networkJob->handle() == job) return networkJob; - } } return 0; } diff --git a/Source/WebCore/platform/qt/DeviceMotionProviderQt.h b/Source/WebCore/platform/qt/DeviceMotionProviderQt.h index cf3d589e4..18437c626 100644 --- a/Source/WebCore/platform/qt/DeviceMotionProviderQt.h +++ b/Source/WebCore/platform/qt/DeviceMotionProviderQt.h @@ -25,7 +25,7 @@ #include <QAccelerometerFilter> #include <wtf/RefPtr.h> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) using QTM_NAMESPACE::QAccelerometer; using QTM_NAMESPACE::QAccelerometerFilter; using QTM_NAMESPACE::QAccelerometerReading; diff --git a/Source/WebCore/platform/qt/DeviceOrientationProviderQt.h b/Source/WebCore/platform/qt/DeviceOrientationProviderQt.h index 6d3e19902..c7f6d2337 100644 --- a/Source/WebCore/platform/qt/DeviceOrientationProviderQt.h +++ b/Source/WebCore/platform/qt/DeviceOrientationProviderQt.h @@ -25,7 +25,7 @@ #include <QRotationFilter> #include <wtf/RefPtr.h> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) using QTM_NAMESPACE::QRotationFilter; using QTM_NAMESPACE::QRotationReading; using QTM_NAMESPACE::QRotationSensor; diff --git a/Source/WebCore/platform/qt/KURLQt.cpp b/Source/WebCore/platform/qt/KURLQt.cpp index 2e75774f8..86e4ab7b6 100644 --- a/Source/WebCore/platform/qt/KURLQt.cpp +++ b/Source/WebCore/platform/qt/KURLQt.cpp @@ -34,7 +34,7 @@ KURL::KURL(const QUrl& url) KURL::operator QUrl() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) QString str = QString::fromRawData(reinterpret_cast<const QChar*>(m_string.characters()), m_string.length()); QByteArray ba = str.toUtf8(); diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp index 62dcf501f..8bfbf2625 100644 --- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp @@ -38,7 +38,7 @@ #include "NotImplemented.h" #include "Widget.h" #include "QWebPageClient.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QGuiApplication> #include <QScreen> #else @@ -71,7 +71,7 @@ static int screenNumber(Widget* w) int screenDepth(Widget* w) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) return QGuiApplication::screens().value(screenNumber(w))->depth(); #else return QApplication::desktop()->screen(screenNumber(w))->depth(); @@ -80,7 +80,7 @@ int screenDepth(Widget* w) int screenDepthPerComponent(Widget* w) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) int depth = QGuiApplication::primaryScreen()->depth(); // FIXME: Use widget's screen Q_UNUSED(w); @@ -114,7 +114,7 @@ int screenDepthPerComponent(Widget* w) bool screenIsMonochrome(Widget* w) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) Q_UNUSED(w); // FIXME: In Qt 5 colorCount() isn't even implemented beyond returning 256 :) return false; @@ -125,7 +125,7 @@ bool screenIsMonochrome(Widget* w) FloatRect screenRect(Widget* widget) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QRect r = QGuiApplication::screens().value(screenNumber(widget))->geometry(); #else QRect r = QApplication::desktop()->screenGeometry(screenNumber(widget)); @@ -135,7 +135,7 @@ FloatRect screenRect(Widget* widget) FloatRect screenAvailableRect(Widget* widget) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QRect r = QGuiApplication::screens().value(screenNumber(widget))->availableGeometry(); #else QRect r = QApplication::desktop()->availableGeometry(screenNumber(widget)); diff --git a/Source/WebCore/platform/qt/QWebPageClient.h b/Source/WebCore/platform/qt/QWebPageClient.h index 9541c64e2..6c9a1ae6c 100644 --- a/Source/WebCore/platform/qt/QWebPageClient.h +++ b/Source/WebCore/platform/qt/QWebPageClient.h @@ -110,7 +110,7 @@ public: virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*) = 0; #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) virtual QWindow* ownerWindow() const; #endif diff --git a/Source/WebCore/platform/text/TextCheckerClient.h b/Source/WebCore/platform/text/TextCheckerClient.h index eb95bd1de..803bfb88b 100644 --- a/Source/WebCore/platform/text/TextCheckerClient.h +++ b/Source/WebCore/platform/text/TextCheckerClient.h @@ -31,29 +31,12 @@ #include "TextChecking.h" #include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> #include <wtf/Vector.h> #include <wtf/text/WTFString.h> namespace WebCore { -class SpellChecker; -class TextCheckingRequest; - -struct GrammarDetail { - int location; - int length; - Vector<String> guesses; - String userDescription; -}; - -struct TextCheckingResult { - TextCheckingType type; - int location; - int length; - Vector<GrammarDetail> details; - String replacement; -}; - class TextCheckerClient { public: virtual ~TextCheckerClient() {} @@ -73,7 +56,7 @@ public: // provide more accurate correction suggestions. Caller can pass in more text in "context" to aid such spellcheckers on language // identification. Noramlly it's the text surrounding the "word" for which we are getting correction suggestions. virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) = 0; - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) = 0; + virtual void requestCheckingOfString(PassRefPtr<TextCheckingRequest>) = 0; }; } diff --git a/Source/WebCore/platform/text/TextChecking.h b/Source/WebCore/platform/text/TextChecking.h index be9ed5f9e..0742cb32d 100644 --- a/Source/WebCore/platform/text/TextChecking.h +++ b/Source/WebCore/platform/text/TextChecking.h @@ -31,6 +31,8 @@ #ifndef TextChecking_h #define TextChecking_h +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> #include <wtf/text/WTFString.h> namespace WebCore { @@ -68,23 +70,40 @@ enum TextCheckingProcessType { TextCheckingProcessIncremental }; -class TextCheckingRequest { +struct GrammarDetail { + int location; + int length; + Vector<String> guesses; + String userDescription; +}; + +struct TextCheckingResult { + TextCheckingType type; + int location; + int length; + Vector<GrammarDetail> details; + String replacement; +}; + +class TextCheckingRequest : public RefCounted<TextCheckingRequest> { public: - TextCheckingRequest(int sequence, String text, TextCheckingTypeMask mask, TextCheckingProcessType processType) + TextCheckingRequest(int sequence, const String& text, TextCheckingTypeMask mask, TextCheckingProcessType processType) : m_sequence(sequence) , m_text(text) , m_mask(mask) , m_processType(processType) - { - } + { } + + virtual ~TextCheckingRequest() { } + virtual void didSucceed(const Vector<TextCheckingResult>&) = 0; + virtual void didCancel() = 0; - void setSequence(int sequence) { m_sequence = sequence; } int sequence() const { return m_sequence; } String text() const { return m_text; } TextCheckingTypeMask mask() const { return m_mask; } TextCheckingProcessType processType() const { return m_processType; } -private: +protected: int m_sequence; String m_text; TextCheckingTypeMask m_mask; diff --git a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp index ca75f1b0d..0d9d48dbe 100644 --- a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp +++ b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp @@ -76,7 +76,10 @@ namespace WebCore { bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0); if (!createdIterator) m_iterator = new TextBreakIterator(); - setUpIterator(*m_iterator, QTextBoundaryFinder::Grapheme, buffer, length); + if (!setUpIterator(*m_iterator, QTextBoundaryFinder::Grapheme, buffer, length)) { + delete m_iterator; + m_iterator = 0; + } } NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() diff --git a/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp b/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp index 5be1ee903..40ba1c667 100644 --- a/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp +++ b/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp @@ -245,7 +245,7 @@ NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* bu bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0); if (!createdIterator) m_iterator = new CharBreakIterator; - m_iterator.reset(string, length); + m_iterator->reset(buffer, length); } NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() diff --git a/Source/WebCore/platform/win/DragDataWin.cpp b/Source/WebCore/platform/win/DragDataWin.cpp index 46a9073cb..29f0e7671 100644 --- a/Source/WebCore/platform/win/DragDataWin.cpp +++ b/Source/WebCore/platform/win/DragDataWin.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2012 Baidu Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -111,7 +112,24 @@ bool DragData::containsFiles() const unsigned DragData::numberOfFiles() const { - return 0; + if (!m_platformDragData) + return 0; + + STGMEDIUM medium; + if (FAILED(m_platformDragData->GetData(cfHDropFormat(), &medium))) + return 0; + + HDROP hdrop = static_cast<HDROP>(GlobalLock(medium.hGlobal)); + + if (!hdrop) + return 0; + + unsigned numFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, 0, 0); + + DragFinish(hdrop); + GlobalUnlock(medium.hGlobal); + + return numFiles; } void DragData::asFilenames(Vector<String>& result) const diff --git a/Source/WebCore/platform/wx/ClipboardWx.cpp b/Source/WebCore/platform/wx/ClipboardWx.cpp index 8a3a9c8a3..24220b9d7 100644 --- a/Source/WebCore/platform/wx/ClipboardWx.cpp +++ b/Source/WebCore/platform/wx/ClipboardWx.cpp @@ -26,7 +26,9 @@ #include "config.h" #include "ClipboardWx.h" +#include "Editor.h" #include "FileList.h" +#include "Frame.h" #include "HashTable.h" #include "IntPoint.h" #include "NotImplemented.h" @@ -127,9 +129,9 @@ void ClipboardWx::writeURL(const KURL& url, const String& string, Frame* frame) Pasteboard::generalPasteboard()->writeURL(url, string, frame); } -void ClipboardWx::writeRange(Range*, Frame*) +void ClipboardWx::writeRange(Range* range, Frame* frame) { - notImplemented(); + Pasteboard::generalPasteboard()->writeSelection(range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame); } bool ClipboardWx::hasData() diff --git a/Source/WebCore/platform/wx/FileSystemWx.cpp b/Source/WebCore/platform/wx/FileSystemWx.cpp index 1a2edd5a0..d3f7b18fc 100644 --- a/Source/WebCore/platform/wx/FileSystemWx.cpp +++ b/Source/WebCore/platform/wx/FileSystemWx.cpp @@ -91,7 +91,7 @@ bool getFileMetadata(const String& path, FileMetadata& metadata) if (!wxFileExists(path)) return false; wxFileName fileName(path); - metadata.length = fileName.GetSize(); + metadata.length = fileName.GetSize().GetValue(); metadata.modificationTime = fileName.GetModificationTime().GetTicks(); metadata.type = fileName.IsDir() ? FileMetadata::TypeDirectory : FileMetadata::TypeFile; return true; diff --git a/Source/WebCore/platform/wx/PasteboardWx.cpp b/Source/WebCore/platform/wx/PasteboardWx.cpp index 2bd7177f8..752fdaccf 100644 --- a/Source/WebCore/platform/wx/PasteboardWx.cpp +++ b/Source/WebCore/platform/wx/PasteboardWx.cpp @@ -53,7 +53,10 @@ Pasteboard* Pasteboard::generalPasteboard() void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { if (wxTheClipboard->Open()) { - wxTheClipboard->SetData( new wxTextDataObject(frame->editor()->selectedText()) ); +#if wxCHECK_VERSION(2, 9, 4) + wxTheClipboard->SetData(new wxHTMLDataObject(createMarkup(selectedRange, 0, AnnotateForInterchange))); +#endif + wxTheClipboard->SetData(new wxTextDataObject(frame->editor()->selectedText())); wxTheClipboard->Close(); } } @@ -91,11 +94,21 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP { RefPtr<DocumentFragment> fragment = 0; if (wxTheClipboard->Open()) { - if (allowPlainText && wxTheClipboard->IsSupported( wxDF_TEXT )) { - wxTextDataObject data; - wxTheClipboard->GetData( data ); - chosePlainText = true; - fragment = createFragmentFromText(context.get(), data.GetText()); +#if wxCHECK_VERSION(2, 9, 4) + if (wxTheClipboard->IsSupported(wxDF_HTML)) { + wxHTMLDataObject data; + wxTheClipboard->GetData(data); + chosePlainText = false; + fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", FragmentScriptingNotAllowed); + } else +#endif + { + if (allowPlainText && wxTheClipboard->IsSupported( wxDF_TEXT )) { + wxTextDataObject data; + wxTheClipboard->GetData( data ); + chosePlainText = true; + fragment = createFragmentFromText(context.get(), data.GetText()); + } } wxTheClipboard->Close(); } diff --git a/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp b/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp index 93abd320a..6c0d0b349 100644 --- a/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp +++ b/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp @@ -119,6 +119,16 @@ static int webkitgtkXError(Display* xdisplay, XErrorEvent* error) } #endif +static bool moduleMixesGtkSymbols(GModule* module) +{ + void* symbol; +#ifdef GTK_API_VERSION_2 + return g_module_symbol(module, "gtk_application_get_type", &symbol); +#else + return g_module_symbol(module, "gtk_object_get_type", &symbol); +#endif +} + bool PluginPackage::load() { if (m_isLoaded) { @@ -150,6 +160,11 @@ bool PluginPackage::load() return false; } + if (moduleMixesGtkSymbols(m_module)) { + LOG(Plugins, "Ignoring module '%s' to avoid mixing GTK+ 2 and GTK+ 3 symbols.\n", m_path.utf8().data()); + return false; + } + m_isLoaded = true; #if defined(XP_UNIX) diff --git a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp index d8c742914..93bd3db03 100644 --- a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp +++ b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp @@ -834,26 +834,11 @@ void PluginView::plugAddedCallback(GtkSocket* socket, PluginView* view) view->updateWidgetAllocationAndClip(); } -static bool moduleMixesGtkSymbols(GModule* module) -{ - gpointer symbol; -#ifdef GTK_API_VERSION_2 - return g_module_symbol(module, "gtk_application_get_type", &symbol); -#else - return g_module_symbol(module, "gtk_object_get_type", &symbol); -#endif -} - bool PluginView::platformStart() { ASSERT(m_isStarted); ASSERT(m_status == PluginStatusLoadedSuccessfully); - if (moduleMixesGtkSymbols(m_plugin->module())) { - LOG(Plugins, "Module '%s' mixes GTK+ 2 and GTK+ 3 symbols, ignoring plugin.\n", m_plugin->path().utf8().data()); - return false; - } - #if defined(XP_UNIX) if (m_plugin->pluginFuncs()->getvalue) { PluginView::setCurrentPluginView(this); diff --git a/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/Source/WebCore/plugins/qt/PluginPackageQt.cpp index b9824fae0..fbac529ac 100644 --- a/Source/WebCore/plugins/qt/PluginPackageQt.cpp +++ b/Source/WebCore/plugins/qt/PluginPackageQt.cpp @@ -132,7 +132,7 @@ static void initializeGtk(QLibrary* module = 0) bool PluginPackage::isPluginBlacklisted() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) // TODO: enumerate all plugins that are incompatible with Qt5. const QLatin1String pluginBlacklist[] = { QLatin1String("skypebuttons") diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp index 323c55156..eda0504c2 100644 --- a/Source/WebCore/plugins/qt/PluginViewQt.cpp +++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp @@ -79,8 +79,6 @@ #include <runtime/JSLock.h> #include <runtime/JSValue.h> -#define HAVE_QT5 (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - #if HAVE(QT5) #include "QtX11ImageConversion.h" #include <QGuiApplication> diff --git a/Source/WebCore/rendering/AutoTableLayout.cpp b/Source/WebCore/rendering/AutoTableLayout.cpp index 744a12b91..2c3636e04 100644 --- a/Source/WebCore/rendering/AutoTableLayout.cpp +++ b/Source/WebCore/rendering/AutoTableLayout.cpp @@ -50,7 +50,7 @@ void AutoTableLayout::recalcColumn(unsigned effCol) RenderTableCell* maxContributor = 0; for (RenderObject* child = m_table->firstChild(); child; child = child->nextSibling()) { - if (child->isTableCol()) + if (child->isRenderTableCol()) toRenderTableCol(child)->computePreferredLogicalWidths(); else if (child->isTableSection()) { RenderTableSection* section = toRenderTableSection(child); @@ -148,21 +148,19 @@ void AutoTableLayout::fullRecalc() m_layoutStruct.fill(Layout()); m_spanCells.fill(0); - RenderObject* child = m_table->firstChild(); Length groupLogicalWidth; unsigned currentColumn = 0; - while (child && child->isTableCol()) { - RenderTableCol* col = toRenderTableCol(child); - unsigned span = col->span(); - if (col->firstChild()) - groupLogicalWidth = col->style()->logicalWidth(); + for (RenderTableCol* column = m_table->firstColumn(); column; column = column->nextColumn()) { + if (column->isTableColumnGroupWithColumnChildren()) + groupLogicalWidth = column->style()->logicalWidth(); else { - Length colLogicalWidth = col->style()->logicalWidth(); + Length colLogicalWidth = column->style()->logicalWidth(); if (colLogicalWidth.isAuto()) colLogicalWidth = groupLogicalWidth; if ((colLogicalWidth.isFixed() || colLogicalWidth.isPercent()) && colLogicalWidth.isZero()) colLogicalWidth = Length(); unsigned effCol = m_table->colToEffCol(currentColumn); + unsigned span = column->span(); if (!colLogicalWidth.isAuto() && span == 1 && effCol < nEffCols && m_table->spanOfEffCol(effCol) == 1) { m_layoutStruct[effCol].logicalWidth = colLogicalWidth; if (colLogicalWidth.isFixed() && m_layoutStruct[effCol].maxLogicalWidth < colLogicalWidth.value()) @@ -171,14 +169,9 @@ void AutoTableLayout::fullRecalc() currentColumn += span; } - RenderObject* next = child->firstChild(); - if (!next) - next = child->nextSibling(); - if (!next && child->parent()->isTableCol()) { - next = child->parent()->nextSibling(); + // For the last column in a column-group, we invalidate our group logical width. + if (column->isTableColumn() && !column->nextSibling()) groupLogicalWidth = Length(); - } - child = next; } for (unsigned i = 0; i < nEffCols; i++) diff --git a/Source/WebCore/rendering/EllipsisBox.cpp b/Source/WebCore/rendering/EllipsisBox.cpp index 2ccd1c0d3..130103cfe 100644 --- a/Source/WebCore/rendering/EllipsisBox.cpp +++ b/Source/WebCore/rendering/EllipsisBox.cpp @@ -104,28 +104,8 @@ void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& pa context->drawHighlightForText(font, RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style->colorSpace()); } -bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) +bool EllipsisBox::nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint&, const LayoutPoint&, LayoutUnit, LayoutUnit) { - LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft()); - - // Hit test the markup box. - if (m_markupBox) { - RenderStyle* style = m_renderer->style(isFirstLineStyle()); - LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - m_markupBox->x(); - LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()); - if (m_markupBox->nodeAtPoint(request, result, pointInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) { - renderer()->updateHitTestResult(result, pointInContainer - LayoutSize(mtx, mty)); - return true; - } - } - - LayoutRect boundsRect(adjustedLocation, LayoutSize(m_logicalWidth, m_height)); - if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) { - renderer()->updateHitTestResult(result, pointInContainer - toLayoutSize(adjustedLocation)); - if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, boundsRect)) - return true; - } - return false; } diff --git a/Source/WebCore/rendering/FixedTableLayout.cpp b/Source/WebCore/rendering/FixedTableLayout.cpp index 4a495384c..54272b117 100644 --- a/Source/WebCore/rendering/FixedTableLayout.cpp +++ b/Source/WebCore/rendering/FixedTableLayout.cpp @@ -127,40 +127,39 @@ int FixedTableLayout::calcWidthArray(int) // Iterate over the first row in case some are unspecified. RenderTableSection* section = m_table->topNonEmptySection(); - if (section) { - unsigned cCol = 0; - RenderObject* firstRow = section->firstChild(); - RenderObject* child = firstRow->firstChild(); - while (child) { - if (child->isTableCell()) { - RenderTableCell* cell = toRenderTableCell(child); - if (cell->preferredLogicalWidthsDirty()) - cell->computePreferredLogicalWidths(); - - Length w = cell->styleOrColLogicalWidth(); - unsigned span = cell->colSpan(); - int effectiveColWidth = 0; - if (w.isFixed() && w.isPositive()) { - w.setValue(w.value() + cell->borderAndPaddingLogicalWidth()); - effectiveColWidth = w.value(); - } - - unsigned usedSpan = 0; - unsigned i = 0; - while (usedSpan < span && cCol + i < nEffCols) { - float eSpan = m_table->spanOfEffCol(cCol + i); - // Only set if no col element has already set it. - if (m_width[cCol + i].isAuto() && w.type() != Auto) { - m_width[cCol + i] = w; - m_width[cCol + i] *= eSpan / span; - usedWidth += effectiveColWidth * eSpan / span; - } - usedSpan += eSpan; - i++; - } - cCol += i; + if (!section) + return usedWidth; + + unsigned currentColumn = 0; + + RenderObject* firstRow = section->firstChild(); + for (RenderObject* child = firstRow->firstChild(); child; child = child->nextSibling()) { + if (!child->isTableCell()) + continue; + + RenderTableCell* cell = toRenderTableCell(child); + if (cell->preferredLogicalWidthsDirty()) + cell->computePreferredLogicalWidths(); + + Length logicalWidth = cell->styleOrColLogicalWidth(); + unsigned span = cell->colSpan(); + int fixedBorderBoxLogicalWidth = 0; + if (logicalWidth.isFixed() && logicalWidth.isPositive()) { + fixedBorderBoxLogicalWidth = cell->computeBorderBoxLogicalWidth(logicalWidth.value()); + logicalWidth.setValue(fixedBorderBoxLogicalWidth); + } + + unsigned usedSpan = 0; + while (usedSpan < span && currentColumn < nEffCols) { + float eSpan = m_table->spanOfEffCol(currentColumn); + // Only set if no col element has already set it. + if (m_width[currentColumn].isAuto() && logicalWidth.type() != Auto) { + m_width[currentColumn] = logicalWidth; + m_width[currentColumn] *= eSpan / span; + usedWidth += fixedBorderBoxLogicalWidth * eSpan / span; } - child = child->nextSibling(); + usedSpan += eSpan; + ++currentColumn; } } diff --git a/Source/WebCore/rendering/RenderArena.cpp b/Source/WebCore/rendering/RenderArena.cpp index b01f65ddd..d5e3423aa 100644 --- a/Source/WebCore/rendering/RenderArena.cpp +++ b/Source/WebCore/rendering/RenderArena.cpp @@ -60,14 +60,14 @@ static const size_t debugHeaderSize = ARENA_ALIGN(sizeof(RenderArenaDebugHeader) #endif RenderArena::RenderArena(unsigned arenaSize) + : m_totalSize(0) + , m_totalAllocated(0) { // Initialize the arena pool INIT_ARENA_POOL(&m_pool, "RenderArena", arenaSize); // Zero out the recyclers array memset(m_recyclers, 0, sizeof(m_recyclers)); - - m_totalSize = 0; } RenderArena::~RenderArena() diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index e6a73d9a4..157d84bcc 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -108,18 +108,6 @@ typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; static int gDelayUpdateScrollInfo = 0; static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; -// We only create "generated" renderers like one for first-letter and -// before/after pseudo elements if: -// - the firstLetterBlock can have children in the DOM and -// - the block doesn't have any special assumption on its text children. -// This correctly prevents form controls from having such renderers. -static inline bool canHaveGeneratedChildren(RenderObject* renderer) -{ - return (renderer->canHaveChildren() - && (!renderer->isDeprecatedFlexibleBox() - || static_cast<RenderDeprecatedFlexibleBox*>(renderer)->canHaveGeneratedChildren())); -} - bool RenderBlock::s_canPropagateFloatIntoSibling = false; // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code @@ -340,7 +328,7 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty m_lineHeight = -1; // Update pseudos for :before and :after now. - if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveGeneratedChildren(this)) { + if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveGeneratedChildren()) { updateBeforeAfterContent(BEFORE); updateBeforeAfterContent(AFTER); } @@ -1376,29 +1364,8 @@ bool RenderBlock::recomputeLogicalWidth() return oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth(); } -void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight) +void RenderBlock::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) { - ASSERT(needsLayout()); - - if (isInline() && !isInlineBlockOrInlineTable()) // Inline <form>s inside various table elements can - return; // cause us to come in here. Just bail. - - if (!relayoutChildren && simplifiedLayout()) - return; - - LayoutRepainter repainter(*this, everHadLayout() && checkForRepaintDuringLayout()); - - if (recomputeLogicalWidth()) - relayoutChildren = true; - - m_overflow.clear(); - - clearFloats(); - - LayoutUnit previousHeight = logicalHeight(); - setLogicalHeight(ZERO_LAYOUT_UNIT); - bool hasSpecifiedPageLogicalHeight = false; - bool pageLogicalHeightChanged = false; ColumnInfo* colInfo = columnInfo(); if (hasColumns()) { if (!pageLogicalHeight) { @@ -1422,10 +1389,37 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh colInfo->setPaginationUnit(paginationUnit()); } +} + +void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight) +{ + ASSERT(needsLayout()); + + if (isInline() && !isInlineBlockOrInlineTable()) // Inline <form>s inside various table elements can + return; // cause us to come in here. Just bail. + + if (!relayoutChildren && simplifiedLayout()) + return; + + LayoutRepainter repainter(*this, everHadLayout() && checkForRepaintDuringLayout()); + + if (recomputeLogicalWidth()) + relayoutChildren = true; + + m_overflow.clear(); + + clearFloats(); + + LayoutUnit previousHeight = logicalHeight(); + setLogicalHeight(ZERO_LAYOUT_UNIT); + + bool pageLogicalHeightChanged = false; + bool hasSpecifiedPageLogicalHeight = false; + checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightChanged, hasSpecifiedPageLogicalHeight); RenderView* renderView = view(); RenderStyle* styleToUse = style(); - LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); + LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo()); if (inRenderFlowThread()) { // Regions changing widths can force us to relayout our children. @@ -1484,7 +1478,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats()) setLogicalHeight(lowestFloatLogicalBottom() + toAdd); - if (layoutColumns(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher)) + if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher)) return; // Calculate our new height. @@ -3971,7 +3965,7 @@ LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUn if (heightRemaining) *heightRemaining = 1; - FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, logicalTop, left, heightRemaining); + FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), left, heightRemaining); m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); } @@ -4019,7 +4013,7 @@ LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutU *heightRemaining = 1; LayoutUnit rightFloatOffset = fixedOffset; - FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, rightFloatOffset, heightRemaining); + FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), rightFloatOffset, heightRemaining); m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); right = min(right, rightFloatOffset); } @@ -5023,7 +5017,7 @@ LayoutRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const return LayoutRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth); } -bool RenderBlock::layoutColumns(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer& statePusher) +bool RenderBlock::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer& statePusher) { if (!hasColumns()) return false; @@ -5399,14 +5393,14 @@ RenderObject* InlineMinMaxIterator::next() return current; } -static int getBPMWidth(int childValue, Length cssUnit) +static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit) { if (cssUnit.type() != Auto) - return (cssUnit.isFixed() ? cssUnit.value() : childValue); + return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : childValue); return 0; } -static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline) +static LayoutUnit getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline) { RenderStyle* childStyle = child->style(); if (endOfInline) @@ -6005,7 +5999,7 @@ static inline RenderObject* findFirstLetterBlock(RenderBlock* start) RenderObject* firstLetterBlock = start; while (true) { bool canHaveFirstLetterRenderer = firstLetterBlock->style()->hasPseudoStyle(FIRST_LETTER) - && canHaveGeneratedChildren(firstLetterBlock); + && firstLetterBlock->canHaveGeneratedChildren(); if (canHaveFirstLetterRenderer) return firstLetterBlock; @@ -6164,7 +6158,7 @@ void RenderBlock::updateFirstLetter() currChild = currChild->nextSibling(); } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList()) break; - else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && canHaveGeneratedChildren(currChild)) { + else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && currChild->canHaveGeneratedChildren()) { // We found a lower-level node with first-letter, which supersedes the higher-level style firstLetterBlock = currChild; currChild = currChild->firstChild(); diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 2d8cc7b7e..ed80f8960 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -468,6 +468,9 @@ protected: void computeInitialRegionRangeForBlock(); void computeRegionRangeForBlock(); + + virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } @@ -814,7 +817,6 @@ private: void offsetForContents(LayoutPoint&) const; virtual void calcColumnWidth(); - bool layoutColumns(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&); void makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild); bool expandsToEncloseOverhangingFloats() const; @@ -930,6 +932,7 @@ private: protected: // Pagination routines. + virtual bool relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&); // Returns the logicalOffset at the top of the next page. If the offset passed in is already at the top of the current page, // then nextPageLogicalTop with ExcludePageBoundary will still move to the top of the next page. nextPageLogicalTop with diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 04ff3dbe3..d6f460eb3 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -1279,12 +1279,13 @@ void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool bool isFixedPos = style()->position() == FixedPosition; bool hasTransform = hasLayer() && layer()->transform(); - if (hasTransform) { - // If this box has a transform, it acts as a fixed position container for fixed descendants, - // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. - fixed &= isFixedPos; - } else - fixed |= isFixedPos; + // If this box has a transform, it acts as a fixed position container for fixed descendants, + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. + if (hasTransform && !isFixedPos) + fixed = false; + else if (isFixedPos) + fixed = true; + if (wasFixed) *wasFixed = fixed; @@ -1790,8 +1791,8 @@ bool RenderBox::sizesToIntrinsicLogicalWidth(LogicalWidthType widthType) const // For multiline columns, we need to apply the flex-line-pack first, so we can't stretch now. if (!parent()->style()->isColumnFlexDirection() || parent()->style()->flexWrap() != FlexWrapNone) return true; - EFlexAlign itemAlign = style()->flexItemAlign(); - if (itemAlign != AlignStretch && (itemAlign != AlignAuto || parent()->style()->flexAlign() != AlignStretch)) + EAlignItems itemAlign = style()->alignSelf(); + if (itemAlign != AlignStretch && (itemAlign != AlignAuto || parent()->style()->alignItems() != AlignStretch)) return true; } @@ -3834,12 +3835,12 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) LayoutUnit RenderBox::offsetLeft() const { - return offsetTopLeft(topLeftLocation()).x(); + return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); } LayoutUnit RenderBox::offsetTop() const { - return offsetTopLeft(topLeftLocation()).y(); + return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y(); } LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const LayoutPoint& point) const diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 1625f075b..0cbf9913f 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -515,7 +515,7 @@ LayoutSize RenderBoxModelObject::relativePositionOffset() const return offset; } -LayoutPoint RenderBoxModelObject::offsetTopLeft(const LayoutPoint& startPoint) const +LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const LayoutPoint& startPoint) const { // If the element is the HTML body element or does not have an associated box // return 0 and stop this algorithm. @@ -553,15 +553,15 @@ LayoutPoint RenderBoxModelObject::offsetTopLeft(const LayoutPoint& startPoint) c LayoutUnit RenderBoxModelObject::offsetLeft() const { // Note that RenderInline and RenderBox override this to pass a different - // startPoint to offsetTopLeft. - return offsetTopLeft(LayoutPoint()).x(); + // startPoint to adjustedPositionRelativeToOffsetParent. + return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x(); } LayoutUnit RenderBoxModelObject::offsetTop() const { // Note that RenderInline and RenderBox override this to pass a different - // startPoint to offsetTopLeft. - return offsetTopLeft(LayoutPoint()).y(); + // startPoint to adjustedPositionRelativeToOffsetParent. + return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y(); } int RenderBoxModelObject::pixelSnappedOffsetWidth() const diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index 5e2f26b5b..28a50ebdf 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -225,7 +225,7 @@ protected: IntSize m_tileSize; }; - LayoutPoint offsetTopLeft(const LayoutPoint&) const; + LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const; void calculateBackgroundImageGeometry(const FillLayer*, const LayoutRect& paintRect, BackgroundImageGeometry&); void getBorderEdgeInfo(class BorderEdge[], const RenderStyle*, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h index 4d912f430..d0ca6fcbf 100644 --- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h +++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h @@ -49,7 +49,6 @@ public: virtual bool isDeprecatedFlexibleBox() const { return true; } virtual bool isFlexingChildren() const { return m_flexingChildren; } virtual bool isStretchingChildren() const { return m_stretchingChildren; } - virtual bool canHaveGeneratedChildren() const { return true; } void placeChild(RenderBox* child, const LayoutPoint& location); diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 8f0997b85..51c37dd49 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -698,7 +698,9 @@ bool RenderFlexibleBox::hasAutoMarginsInCrossAxis(RenderBox* child) LayoutUnit RenderFlexibleBox::availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, RenderBox* child) { - LayoutUnit childCrossExtent = crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child); + LayoutUnit childCrossExtent = 0; + if (!child->isPositioned()) + childCrossExtent = crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child); return lineCrossAxisExtent - childCrossExtent; } @@ -755,7 +757,8 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, Fle continue; child->clearOverrideSize(); - if (preferredLengthForChild(child).isAuto()) { + // Only need to layout here if we will need to get the logicalHeight of the child in computeNextFlexLine. + if (hasOrthogonalFlow(child) && preferredLengthForChild(child).isAuto()) { if (!relayoutChildren) child->setChildNeedsLayout(true); child->layoutIfNeeded(); @@ -903,7 +906,7 @@ static LayoutUnit initialPackingOffset(LayoutUnit availableFreeSpace, EFlexPack return availableFreeSpace; if (flexPack == PackCenter) return availableFreeSpace / 2; - if (flexPack == PackDistribute) { + if (flexPack == PackSpaceAround) { if (availableFreeSpace > 0 && numberOfChildren) return availableFreeSpace / (2 * numberOfChildren); if (availableFreeSpace < 0) @@ -915,9 +918,9 @@ static LayoutUnit initialPackingOffset(LayoutUnit availableFreeSpace, EFlexPack static LayoutUnit packingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexPack flexPack, unsigned numberOfChildren) { if (availableFreeSpace > 0 && numberOfChildren > 1) { - if (flexPack == PackJustify) + if (flexPack == PackSpaceBetween) return availableFreeSpace / (numberOfChildren - 1); - if (flexPack == PackDistribute) + if (flexPack == PackSpaceAround) return availableFreeSpace / numberOfChildren; } return 0; @@ -932,13 +935,13 @@ void RenderFlexibleBox::setLogicalOverrideSize(RenderBox* child, LayoutUnit chil child->setOverrideWidth(childPreferredSize); } -void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset) +void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode) { ASSERT(child->isPositioned()); child->containingBlock()->insertPositionedObject(child); RenderLayer* childLayer = child->layer(); LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffset; - if (style()->flexDirection() == FlowRowReverse) + if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowReverse) inlinePosition = mainAxisExtent() - mainAxisOffset; childLayer->setStaticInlinePosition(inlinePosition); // FIXME: Not right for regions. @@ -950,11 +953,11 @@ void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout } } -static EFlexAlign flexAlignForChild(RenderBox* child) +static EAlignItems alignmentForChild(RenderBox* child) { - EFlexAlign align = child->style()->flexItemAlign(); + EAlignItems align = child->style()->alignSelf(); if (align == AlignAuto) - align = child->parent()->style()->flexAlign(); + align = child->parent()->style()->alignItems(); if (child->parent()->style()->flexWrap() == FlexWrapReverse) { if (align == AlignStart) @@ -977,25 +980,26 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight(); LayoutUnit totalMainExtent = mainAxisExtent(); - LayoutUnit maxAscent = 0, maxDescent = 0; // Used when flex-align: baseline. + LayoutUnit maxAscent = 0, maxDescent = 0; // Used when align-items: baseline. LayoutUnit maxChildCrossAxisExtent = 0; bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); for (size_t i = 0; i < children.size(); ++i) { RenderBox* child = children[i]; if (child->isPositioned()) { - prepareChildForPositionedLayout(child, mainAxisOffset, crossAxisOffset); + prepareChildForPositionedLayout(child, mainAxisOffset, crossAxisOffset, FlipForRowReverse); mainAxisOffset += packingSpaceBetweenChildren(availableFreeSpace, style()->flexPack(), childSizes.size()); continue; } LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPaddingExtentForChild(child); setLogicalOverrideSize(child, childPreferredSize); + // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. child->setChildNeedsLayout(true); child->layoutIfNeeded(); updateAutoMarginsInMainAxis(child, autoMarginOffset); LayoutUnit childCrossAxisMarginBoxExtent; - if (flexAlignForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child)) { + if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child)) { LayoutUnit ascent = marginBoxAscentForChild(child); LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent; @@ -1070,7 +1074,7 @@ static LayoutUnit initialLinePackingOffset(LayoutUnit availableFreeSpace, EFlexL return availableFreeSpace; if (linePack == LinePackCenter) return availableFreeSpace / 2; - if (linePack == LinePackDistribute) { + if (linePack == LinePackSpaceAround) { if (availableFreeSpace > 0 && numberOfLines) return availableFreeSpace / (2 * numberOfLines); if (availableFreeSpace < 0) @@ -1082,9 +1086,9 @@ static LayoutUnit initialLinePackingOffset(LayoutUnit availableFreeSpace, EFlexL static LayoutUnit linePackingSpaceBetweenChildren(LayoutUnit availableFreeSpace, EFlexLinePack linePack, unsigned numberOfLines) { if (availableFreeSpace > 0 && numberOfLines > 1) { - if (linePack == LinePackJustify) + if (linePack == LinePackSpaceBetween) return availableFreeSpace / (numberOfLines - 1); - if (linePack == LinePackDistribute || linePack == LinePackStretch) + if (linePack == LinePackSpaceAround || linePack == LinePackStretch) return availableFreeSpace / numberOfLines; } return 0; @@ -1115,8 +1119,17 @@ void RenderFlexibleBox::packFlexLines(FlexOrderIterator& iterator, WTF::Vector<L void RenderFlexibleBox::adjustAlignmentForChild(RenderBox* child, LayoutUnit delta) { - LayoutRect oldRect = child->frameRect(); + if (child->isPositioned()) { + LayoutUnit staticInlinePosition = child->layer()->staticInlinePosition(); + LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); + LayoutUnit mainAxis = isColumnFlow() ? staticBlockPosition : staticInlinePosition; + LayoutUnit crossAxis = isColumnFlow() ? staticInlinePosition : staticBlockPosition; + crossAxis += delta; + prepareChildForPositionedLayout(child, mainAxis, crossAxis, NoFlipForRowReverse); + return; + } + LayoutRect oldRect = child->frameRect(); setFlowAwareLocationForChild(child, flowAwareLocationForChild(child) + LayoutSize(0, delta)); // If the child moved, we have to repaint it as well as any floating/positioned @@ -1142,7 +1155,7 @@ void RenderFlexibleBox::alignChildren(FlexOrderIterator& iterator, const WTF::Ve if (updateAutoMarginsInCrossAxis(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child))) continue; - switch (flexAlignForChild(child)) { + switch (alignmentForChild(child)) { case AlignAuto: ASSERT_NOT_REACHED(); break; @@ -1185,7 +1198,7 @@ void RenderFlexibleBox::alignChildren(FlexOrderIterator& iterator, const WTF::Ve LayoutUnit minMarginAfterBaseline = minMarginAfterBaselines[lineNumber]; for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = iterator.next()) { ASSERT(child); - if (flexAlignForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child) && minMarginAfterBaseline) + if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child) && minMarginAfterBaseline) adjustAlignmentForChild(child, minMarginAfterBaseline); } } @@ -1202,6 +1215,7 @@ void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUni child->setLogicalHeight(stretchedLogicalHeight); child->computeLogicalHeight(); + // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. if (child->logicalHeight() != logicalHeightBefore) { child->setOverrideHeight(child->logicalHeight()); child->setLogicalHeight(0); @@ -1224,6 +1238,8 @@ void RenderFlexibleBox::flipForRightToLeftColumn(FlexOrderIterator& iterator) LayoutUnit crossExtent = crossAxisExtent(); for (RenderBox* child = iterator.first(); child; child = iterator.next()) { + if (child->isPositioned()) + continue; LayoutPoint location = flowAwareLocationForChild(child); location.setY(crossExtent - crossAxisExtentForChild(child) - location.y()); setFlowAwareLocationForChild(child, location); @@ -1237,16 +1253,10 @@ void RenderFlexibleBox::flipForWrapReverse(FlexOrderIterator& iterator, const WT for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) { for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = iterator.next()) { ASSERT(child); - LayoutPoint location = flowAwareLocationForChild(child); LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent; LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxisExtent; - location.setY(location.y() + newOffset - originalOffset); - - LayoutRect oldRect = child->frameRect(); - setFlowAwareLocationForChild(child, location); - if (!selfNeedsLayout() && child->checkForRepaintDuringLayout()) - child->repaintDuringLayoutIfMoved(oldRect); + adjustAlignmentForChild(child, newOffset - originalOffset); } } } diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index ae61d631f..d923a53a9 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -54,6 +54,11 @@ private: NegativeFlexibility, }; + enum PositionedLayoutMode { + FlipForRowReverse, + NoFlipForRowReverse, + }; + struct FlexOrderHashTraits; typedef HashSet<int, DefaultHash<int>::Hash, FlexOrderHashTraits> FlexOrderHashSet; @@ -120,7 +125,7 @@ private: void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize&); void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize); - void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset); + void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode); void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexItemList&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, WTF::Vector<LineContext>&); void layoutColumnReverse(const OrderedFlexItemList&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace); void packFlexLines(FlexOrderIterator&, WTF::Vector<LineContext>&); diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 3cffa34d0..507d3b395 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -51,7 +51,7 @@ RenderFlowThread::RenderFlowThread(Node* node) , m_regionsInvalidated(false) , m_regionsHaveUniformLogicalWidth(true) , m_regionsHaveUniformLogicalHeight(true) - , m_overflow(false) + , m_overset(false) , m_regionLayoutUpdateEventTimer(this, &RenderFlowThread::regionLayoutUpdateEventTimerFired) { ASSERT(node->document()->cssRegionsEnabled()); @@ -169,16 +169,8 @@ void RenderFlowThread::layout() region->deleteAllRenderBoxRegionInfo(); - LayoutUnit regionLogicalWidth; - LayoutUnit regionLogicalHeight; - - if (isHorizontalWritingMode()) { - regionLogicalWidth = region->contentWidth(); - regionLogicalHeight = region->contentHeight(); - } else { - regionLogicalWidth = region->contentHeight(); - regionLogicalHeight = region->contentWidth(); - } + LayoutUnit regionLogicalWidth = region->logicalWidthForFlowThreadContent(); + LayoutUnit regionLogicalHeight = region->logicalHeightForFlowThreadContent(); if (!m_hasValidRegions) m_hasValidRegions = true; @@ -199,15 +191,13 @@ void RenderFlowThread::layout() RenderRegion* region = *iter; if (!region->isValid()) continue; - LayoutRect regionRect; - if (isHorizontalWritingMode()) { - regionRect = LayoutRect(style()->direction() == LTR ? ZERO_LAYOUT_UNIT : logicalWidth() - region->contentWidth(), logicalHeight, region->contentWidth(), region->contentHeight()); - logicalHeight += regionRect.height(); - } else { - regionRect = LayoutRect(logicalHeight, style()->direction() == LTR ? ZERO_LAYOUT_UNIT : logicalWidth() - region->contentHeight(), region->contentWidth(), region->contentHeight()); - logicalHeight += regionRect.width(); - } - region->setRegionRect(regionRect); + + LayoutUnit regionLogicalWidth = region->logicalWidthForFlowThreadContent(); + LayoutUnit regionLogicalHeight = region->logicalHeightForFlowThreadContent(); + + LayoutRect regionRect(style()->direction() == LTR ? ZERO_LAYOUT_UNIT : logicalWidth() - regionLogicalWidth, logicalHeight, regionLogicalWidth, regionLogicalHeight); + region->setRegionRect(isHorizontalWritingMode() ? regionRect : regionRect.transposedRect()); + logicalHeight += regionLogicalHeight; } } } @@ -235,7 +225,7 @@ void RenderFlowThread::computeLogicalWidth() if (!region->isValid()) continue; ASSERT(!region->needsLayout()); - logicalWidth = max(isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight(), logicalWidth); + logicalWidth = max(region->logicalWidthForFlowThreadContent(), logicalWidth); } setLogicalWidth(logicalWidth); @@ -245,7 +235,7 @@ void RenderFlowThread::computeLogicalWidth() if (!region->isValid()) continue; - LayoutUnit regionLogicalWidth = isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight(); + LayoutUnit regionLogicalWidth = region->logicalWidthForFlowThreadContent(); if (regionLogicalWidth != logicalWidth) { LayoutUnit logicalLeft = style()->direction() == LTR ? ZERO_LAYOUT_UNIT : logicalWidth - regionLogicalWidth; region->setRenderBoxRegionInfo(this, logicalLeft, regionLogicalWidth, false); @@ -262,7 +252,7 @@ void RenderFlowThread::computeLogicalHeight() if (!region->isValid()) continue; ASSERT(!region->needsLayout()); - logicalHeight += isHorizontalWritingMode() ? region->contentHeight() : region->contentWidth(); + logicalHeight += region->logicalHeightForFlowThreadContent(); } setLogicalHeight(logicalHeight); @@ -729,7 +719,7 @@ void RenderFlowThread::computeOverflowStateForRegions(LayoutUnit oldClientAfterE // With the regions overflow state computed we can also set the overflow for the named flow. RenderRegion* lastReg = lastRegion(); - m_overflow = lastReg && (lastReg->regionState() == RenderRegion::RegionOverflow); + m_overset = lastReg && (lastReg->regionState() == RenderRegion::RegionOverflow); } void RenderFlowThread::regionLayoutUpdateEventTimerFired(Timer<RenderFlowThread>*) diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index f0a269b09..aea741ec1 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -124,7 +124,7 @@ public: void computeOverflowStateForRegions(LayoutUnit oldClientAfterEdge); - bool overflow() const { return m_overflow; } + bool overset() const { return m_overset; } // Check if the object is in region and the region is part of this flow thread. bool objectInFlowRegion(const RenderObject*, const RenderRegion*) const; @@ -172,7 +172,7 @@ protected: bool m_regionsInvalidated; bool m_regionsHaveUniformLogicalWidth; bool m_regionsHaveUniformLogicalHeight; - bool m_overflow; + bool m_overset; bool m_hasRegionsWithStyling; Timer<RenderFlowThread> m_regionLayoutUpdateEventTimer; }; diff --git a/Source/WebCore/rendering/RenderGeometryMap.cpp b/Source/WebCore/rendering/RenderGeometryMap.cpp index 65f189bb1..77e04855d 100644 --- a/Source/WebCore/rendering/RenderGeometryMap.cpp +++ b/Source/WebCore/rendering/RenderGeometryMap.cpp @@ -143,12 +143,13 @@ void RenderGeometryMap::mapToAbsolute(TransformState& transformState) const for (int i = m_mapping.size() - 1; i >= 0; --i) { const RenderGeometryMapStep* currStep = m_mapping[i].get(); - if (currStep->m_hasTransform) { - // If this box has a transform, it acts as a fixed position container for fixed descendants, - // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. - inFixed &= currStep->m_isFixedPosition; - } else - inFixed |= currStep->m_isFixedPosition; + // If this box has a transform, it acts as a fixed position container + // for fixed descendants, which prevents the propagation of 'fixed' + // unless the layer itself is also fixed position. + if (currStep->m_hasTransform && !currStep->m_isFixedPosition) + inFixed = false; + else if (currStep->m_isFixedPosition) + inFixed = true; if (!i) { if (currStep->m_transform) diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index b8928161e..b45bdc338 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -653,7 +653,7 @@ LayoutUnit RenderInline::offsetLeft() const LayoutPoint topLeft; if (InlineBox* firstBox = firstLineBoxIncludingCulling()) topLeft = flooredLayoutPoint(firstBox->topLeft()); - return offsetTopLeft(topLeft).x(); + return adjustedPositionRelativeToOffsetParent(topLeft).x(); } LayoutUnit RenderInline::offsetTop() const @@ -661,7 +661,7 @@ LayoutUnit RenderInline::offsetTop() const LayoutPoint topLeft; if (InlineBox* firstBox = firstLineBoxIncludingCulling()) topLeft = flooredLayoutPoint(firstBox->topLeft()); - return offsetTopLeft(topLeft).y(); + return adjustedPositionRelativeToOffsetParent(topLeft).y(); } static LayoutUnit computeMargin(const RenderInline* renderer, const Length& margin) diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 1085eabc0..adce4c7ee 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -1112,15 +1112,17 @@ bool RenderLayerBacking::paintsIntoWindow() const return false; } -void RenderLayerBacking::setRequiresOwnBackingStore(bool flag) +void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) { - if (flag == m_requiresOwnBackingStore) + if (requiresOwnBacking == m_requiresOwnBackingStore) return; // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects // cached clip rects, so when it changes we have to clear clip rects on descendants. m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects); - m_requiresOwnBackingStore = flag; + m_requiresOwnBackingStore = requiresOwnBacking; + + compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()); } void RenderLayerBacking::setContentsNeedDisplay() diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 2a9d2ab07..c20db84e8 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -124,10 +124,13 @@ public: m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); m_overlapStack.removeLast(); } + + RenderGeometryMap& geometryMap() { return m_geometryMap; } private: Vector<Region> m_overlapStack; HashSet<const RenderLayer*> m_layers; + RenderGeometryMap m_geometryMap; }; struct CompositingState { @@ -400,10 +403,9 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update bool layersChanged = false; if (m_compositingConsultsOverlap) { OverlapMap overlapTestRequestMap; - RenderGeometryMap geometryMap; - computeCompositingRequirements(0, updateRoot, &geometryMap, &overlapTestRequestMap, compState, layersChanged); + computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap, compState, layersChanged); } else - computeCompositingRequirements(0, updateRoot, 0, 0, compState, layersChanged); + computeCompositingRequirements(0, updateRoot, 0, compState, layersChanged); needHierarchyUpdate |= layersChanged; } @@ -420,7 +422,7 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update LOG(Compositing, "\nUpdate %d of %s. Overlap testing is %s\n", m_rootLayerUpdateCount, isMainFrame ? "main frame" : frame->tree()->uniqueName().string().utf8().data(), m_compositingConsultsOverlap ? "on" : "off"); } -#endif +#endif if (needHierarchyUpdate) { // Update the hierarchy of the compositing layers. @@ -578,6 +580,28 @@ void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) } } +// This method assumes that layout is up-to-date, unlike repaintOnCompositingChange(). +void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, const LayoutRect& rect) +{ + RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint(false /*exclude self*/); + if (compositedAncestor) { + ASSERT(compositedAncestor->backing()); + + LayoutPoint offset; + layer->convertToLayerCoords(compositedAncestor, offset); + + LayoutRect repaintRect = rect; + repaintRect.moveBy(offset); + + compositedAncestor->setBackingNeedsRepaintInRect(repaintRect); + } + + // The contents of this layer may be moving from a GraphicsLayer to the window, + // so we need to make sure the window system synchronizes those changes on the screen. + if (compositedAncestor == m_renderView->layer()) + m_renderView->frameView()->setNeedsOneShotDrawingSynchronization(); +} + // The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant // RenderLayers that are rendered by the composited RenderLayer. IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) @@ -597,24 +621,9 @@ void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer* if (!child->isComposited() || parent->renderer()->documentBeingDestroyed()) return; - setCompositingParent(child, 0); - - RenderLayer* compLayer = parent->enclosingCompositingLayerForRepaint(); - if (compLayer) { - ASSERT(compLayer->backing()); - LayoutRect compBounds = child->backing()->compositedBounds(); - - LayoutPoint offset; - child->convertToLayerCoords(compLayer, offset); - compBounds.moveBy(offset); - - compLayer->setBackingNeedsRepaintInRect(compBounds); - - // The contents of this layer may be moving from a GraphicsLayer to the window, - // so we need to make sure the window system synchronizes those changes on the screen. - m_renderView->frameView()->setNeedsOneShotDrawingSynchronization(); - } + repaintInCompositedAncestor(child, child->backing()->compositedBounds()); + setCompositingParent(child, 0); setCompositingLayersNeedRebuild(); } @@ -630,13 +639,13 @@ RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend return 0; } -void RenderLayerCompositor::addToOverlapMap(RenderGeometryMap& geometryMap, OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) +void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) { if (layer->isRootLayer()) return; if (!boundsComputed) { - layerBounds = enclosingIntRect(geometryMap.absoluteRect(layer->localBoundingBox())); + layerBounds = enclosingIntRect(overlapMap.geometryMap().absoluteRect(layer->localBoundingBox())); // Empty rects never intersect, but we need them to for the purposes of overlap testing. if (layerBounds.isEmpty()) layerBounds.setSize(IntSize(1, 1)); @@ -649,18 +658,18 @@ void RenderLayerCompositor::addToOverlapMap(RenderGeometryMap& geometryMap, Over overlapMap.add(layer, clipRect); } -void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometryMap, OverlapMap& overlapMap, RenderLayer* layer, RenderLayer* ancestorLayer) +void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, RenderLayer* layer, RenderLayer* ancestorLayer) { if (!canBeComposited(layer) || overlapMap.contains(layer)) return; // A null ancestorLayer is an indication that 'layer' has already been pushed. if (ancestorLayer) - geometryMap.pushMappingsToAncestor(layer->renderer(), ancestorLayer->renderer()); + overlapMap.geometryMap().pushMappingsToAncestor(layer->renderer(), ancestorLayer->renderer()); IntRect bounds; bool haveComputedBounds = false; - addToOverlapMap(geometryMap, overlapMap, layer, bounds, haveComputedBounds); + addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); #if !ASSERT_DISABLED LayerListMutationDetector mutationChecker(layer); @@ -671,7 +680,7 @@ void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometry size_t listSize = negZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); - addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); + addToOverlapMapRecursive(overlapMap, curLayer, layer); } } } @@ -680,7 +689,7 @@ void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometry size_t listSize = normalFlowList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); - addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); + addToOverlapMapRecursive(overlapMap, curLayer, layer); } } @@ -689,13 +698,13 @@ void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometry size_t listSize = posZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); - addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); + addToOverlapMapRecursive(overlapMap, curLayer, layer); } } } if (ancestorLayer) - geometryMap.popMappingsToAncestor(ancestorLayer->renderer()); + overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer->renderer()); } // Recurse through the layers in z-index and overflow order (which is equivalent to painting order) @@ -707,13 +716,12 @@ void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometry // must be compositing so that its contents render over that child. // This implies that its positive z-index children must also be compositing. // -void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, RenderGeometryMap* geometryMap, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged) +void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged) { layer->updateLayerListsIfNeeded(); - // Should geometryMap be part of the overlap map? - if (geometryMap) - geometryMap->pushMappingsToAncestor(layer->renderer(), ancestorLayer ? ancestorLayer->renderer() : 0); + if (overlapMap) + overlapMap->geometryMap().pushMappingsToAncestor(layer->renderer(), ancestorLayer ? ancestorLayer->renderer() : 0); // Clear the flag layer->setHasCompositingDescendant(false); @@ -724,7 +732,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor IntRect absBounds; if (overlapMap && !overlapMap->isEmpty() && compositingState.m_testingOverlap) { // If we're testing for overlap, we only need to composite if we overlap something that is already composited. - absBounds = enclosingIntRect(geometryMap->absoluteRect(layer->localBoundingBox())); + absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(layer->localBoundingBox())); // Empty rects never intersect, but we need them to for the purposes of overlap testing. if (absBounds.isEmpty()) @@ -751,7 +759,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (overlapMap) overlapMap->pushCompositingContainer(); - if (hasNonAffineTransform(layer->renderer()) || isRunningAcceleratedTransformAnimation(layer->renderer())) { + if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) { // If we have a 3D transform, or are animating transform, then turn overlap testing off. childState.m_testingOverlap = false; } @@ -774,7 +782,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor size_t listSize = negZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); - computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged); // If we have to make a layer for this child, make one now so we can have a contents layer // (since we need to ensure that the -ve z-order child renders underneath our contents). @@ -794,7 +802,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor size_t listSize = normalFlowList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); - computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged); } } @@ -803,7 +811,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor size_t listSize = posZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); - computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged); } } } @@ -820,7 +828,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor // the overlap map. Layers that do not composite will draw into their // compositing ancestor's backing, and so are still considered for overlap. if (overlapMap && childState.m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer()) - addToOverlapMap(*geometryMap, *overlapMap, layer, absBounds, haveComputedBounds); + addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); // If we have a software transform, and we have layers under us, we need to also // be composited. Also, if we have opacity < 1, then we need to be a layer so that @@ -830,7 +838,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor childState.m_compositingAncestor = layer; if (overlapMap) { overlapMap->pushCompositingContainer(); - addToOverlapMapRecursive(*geometryMap, *overlapMap, layer); + addToOverlapMapRecursive(*overlapMap, layer); } willBeComposited = true; } @@ -859,7 +867,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor childState.m_compositingAncestor = layer; if (overlapMap) { overlapMap->pushCompositingContainer(); - addToOverlapMapRecursive(*geometryMap, *overlapMap, layer); + addToOverlapMapRecursive(*overlapMap, layer); } willBeComposited = true; } @@ -891,8 +899,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectionLayer(), CompositingChangeRepaintNow)) layersChanged = true; - if (geometryMap) - geometryMap->popMappingsToAncestor(ancestorLayer ? ancestorLayer->renderer() : 0); + if (overlapMap) + overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer ? ancestorLayer->renderer() : 0); } void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer) @@ -1743,17 +1751,6 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere return true; } -bool RenderLayerCompositor::hasNonAffineTransform(RenderObject* renderer) const -{ - if (!renderer->hasTransform()) - return false; - - if (TransformationMatrix* transform = toRenderBoxModelObject(renderer)->layer()->transform()) - return !transform->isAffine(); - - return false; -} - bool RenderLayerCompositor::isRunningAcceleratedTransformAnimation(RenderObject* renderer) const { if (!(m_compositingTriggers & ChromeClient::AnimationTrigger)) diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 273849352..7aa725e03 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -34,7 +34,6 @@ namespace WebCore { class GraphicsLayer; class RenderEmbeddedObject; -class RenderGeometryMap; class RenderPart; class ScrollingCoordinator; #if ENABLE(VIDEO) @@ -126,6 +125,8 @@ public: // Repaint the appropriate layers when the given RenderLayer starts or stops being composited. void repaintOnCompositingChange(RenderLayer*); + void repaintInCompositedAncestor(RenderLayer*, const LayoutRect&); + // Notify us that a layer has been added or removed void layerWasAdded(RenderLayer* parent, RenderLayer* child); void layerWillBeRemoved(RenderLayer* parent, RenderLayer* child); @@ -239,13 +240,13 @@ private: // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect. void recursiveRepaintLayerRect(RenderLayer*, const IntRect&); - void addToOverlapMap(RenderGeometryMap&, OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed); - void addToOverlapMapRecursive(RenderGeometryMap&, OverlapMap&, RenderLayer*, RenderLayer* ancestorLayer = 0); + void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed); + void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancestorLayer = 0); void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*); // Returns true if any layer's compositing changed - void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, RenderGeometryMap*, OverlapMap*, struct CompositingState&, bool& layersChanged); + void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged); // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer. void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth); @@ -258,7 +259,6 @@ private: void removeCompositedChildren(RenderLayer*); bool layerHas3DContent(const RenderLayer*) const; - bool hasNonAffineTransform(RenderObject*) const; bool isRunningAcceleratedTransformAnimation(RenderObject*) const; bool hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const; diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp index d7f43ff50..536d5fa22 100644 --- a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp +++ b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RenderMultiColumnBlock.h" #include "RenderMultiColumnFlowThread.h" +#include "RenderMultiColumnSet.h" using namespace std; @@ -35,7 +36,8 @@ RenderMultiColumnBlock::RenderMultiColumnBlock(Node* node) : RenderBlock(node) , m_flowThread(0) , m_columnCount(1) - , m_columnWidth(0) + , m_columnWidth(ZERO_LAYOUT_UNIT) + , m_columnHeight(ZERO_LAYOUT_UNIT) { } @@ -75,6 +77,33 @@ bool RenderMultiColumnBlock::recomputeLogicalWidth() return relayoutChildren; } +void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) +{ + // We need to go ahead and set our explicit page height if one exists, so that we can + // avoid doing multiple layout passes. + computeLogicalHeight(); + LayoutUnit newContentLogicalHeight = contentLogicalHeight(); + if (newContentLogicalHeight > ZERO_LAYOUT_UNIT) { + pageLogicalHeight = newContentLogicalHeight; + hasSpecifiedPageLogicalHeight = true; + } + setLogicalHeight(ZERO_LAYOUT_UNIT); + + if (columnHeight() != pageLogicalHeight && everHadLayout()) { + setColumnHeight(pageLogicalHeight); + pageLogicalHeightChanged = true; + } + + // Set up our column sets. + ensureColumnSets(); +} + +bool RenderMultiColumnBlock::relayoutForPagination(bool, LayoutUnit, LayoutStateMaintainer&) +{ + // FIXME: Implement. + return false; +} + void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) { if (!m_flowThread) { @@ -91,6 +120,34 @@ void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* befo m_flowThread->addChild(newChild, beforeChild); } +void RenderMultiColumnBlock::ensureColumnSets() +{ + // This function ensures we have the correct column set information before we get into layout. + // For a simple multi-column layout in continuous media, only one column set child is required. + // Once a column is nested inside an enclosing pagination context, the number of column sets + // required becomes 2n-1, where n is the total number of nested pagination contexts. For example: + // + // Column layout with no enclosing pagination model = 2 * 1 - 1 = 1 column set. + // Columns inside pages = 2 * 2 - 1 = 3 column sets (bottom of first page, all the subsequent pages, then the last page). + // Columns inside columns inside pages = 2 * 3 - 1 = 5 column sets. + // + // In addition, column spans will force a column set to "split" into before/after sets around the spanning region. + // + // Finally, we will need to deal with columns inside regions. If regions have variable widths, then there will need + // to be unique column sets created inside any region whose width is different from its surrounding regions. This is + // actually pretty similar to the spanning case, in that we break up the column sets whenever the width varies. + // + // FIXME: For now just make one column set. This matches the old multi-column code. + // Right now our goal is just feature parity with the old multi-column code so that we can switch over to the + // new code as soon as possible. + if (flowThread() && !firstChild()->isRenderMultiColumnSet()) { + RenderMultiColumnSet* columnSet = new (renderArena()) RenderMultiColumnSet(document(), flowThread()); + columnSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK)); + RenderBlock::addChild(columnSet, firstChild()); + flowThread()->addRegionToThread(columnSet); + } +} + const char* RenderMultiColumnBlock::renderName() const { if (isFloating()) diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.h b/Source/WebCore/rendering/RenderMultiColumnBlock.h index 833c9bf71..bfbfb380b 100644 --- a/Source/WebCore/rendering/RenderMultiColumnBlock.h +++ b/Source/WebCore/rendering/RenderMultiColumnBlock.h @@ -37,24 +37,51 @@ class RenderMultiColumnBlock : public RenderBlock { public: RenderMultiColumnBlock(Node*); + LayoutUnit columnHeight() const { return m_columnHeight; } + void setColumnHeight(LayoutUnit columnHeight) { m_columnHeight = columnHeight; } + + LayoutUnit columnWidth() const { return m_columnWidth; } + unsigned columnCount() const { return m_columnCount; } + private: + virtual bool isRenderMultiColumnBlock() const { return true; } + virtual const char* renderName() const; - virtual bool recomputeLogicalWidth(); - void computeColumnCountAndWidth(); + virtual bool recomputeLogicalWidth() OVERRIDE; + virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) OVERRIDE; + virtual bool relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&) OVERRIDE; virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE; + void computeColumnCountAndWidth(); + + void ensureColumnSets(); + RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; } -private: RenderMultiColumnFlowThread* m_flowThread; - unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default, LayoutUnit m_columnWidth; // since a multi-column block that is split across variable width pages or regions will have different column counts and widths in each. // These values will be cached (eventually) for multi-column blocks. + LayoutUnit m_columnHeight; // The current column height. }; +inline RenderMultiColumnBlock* toRenderMultiColumnBlock(RenderObject* object) +{ + ASSERT(!object || object->isRenderMultiColumnBlock()); + return static_cast<RenderMultiColumnBlock*>(object); +} + +inline const RenderMultiColumnBlock* toRenderMultiColumnBlock(const RenderObject* object) +{ + ASSERT(!object || object->isRenderMultiColumnBlock()); + return static_cast<const RenderMultiColumnBlock*>(object); +} + +// This will catch anyone doing an unnecessary cast. +void toRenderMultiColumnBlock(const RenderMultiColumnBlock*); + } // namespace WebCore #endif // RenderMultiColumnBlock_h diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp index 437aa4264..b25222415 100644 --- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp +++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp @@ -25,14 +25,41 @@ #include "config.h" #include "RenderMultiColumnSet.h" +#include "RenderMultiColumnBlock.h" namespace WebCore { RenderMultiColumnSet::RenderMultiColumnSet(Node* node, RenderFlowThread* flowThread) : RenderRegionSet(node, flowThread) + , m_columnCount(1) + , m_columnWidth(ZERO_LAYOUT_UNIT) + , m_columnHeight(ZERO_LAYOUT_UNIT) { } +void RenderMultiColumnSet::computeLogicalWidth() +{ + // Our logical width starts off matching the column block itself. + // This width will be fixed up after the flow thread lays out once it is determined exactly how many + // columns we ended up holding. + // FIXME: When we add regions support, we'll start it off at the width of the multi-column + // block in that particular region. + setLogicalWidth(parentBox()->contentLogicalWidth()); + + RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent()); + setColumnWidthAndCount(parentBlock->columnWidth(), parentBlock->columnCount()); // FIXME: This will eventually vary if we are contained inside regions. +} + +void RenderMultiColumnSet::computeLogicalHeight() +{ + // Make sure our column height is up to date. + RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent()); + setColumnHeight(parentBlock->columnHeight()); // FIXME: Once we make more than one column set, this will become variable. + + // Our logical height is always just the height of our columns. + setLogicalHeight(columnHeight()); +} + const char* RenderMultiColumnSet::renderName() const { return "RenderMultiColumnSet"; diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.h b/Source/WebCore/rendering/RenderMultiColumnSet.h index f345a8ed3..bbe46ff02 100644 --- a/Source/WebCore/rendering/RenderMultiColumnSet.h +++ b/Source/WebCore/rendering/RenderMultiColumnSet.h @@ -47,8 +47,32 @@ public: virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; } + unsigned columnCount() const { return m_columnCount; } + LayoutUnit columnWidth() const { return m_columnWidth; } + LayoutUnit columnHeight() const { return m_columnHeight; } + + void setColumnWidthAndCount(LayoutUnit width, unsigned count) + { + m_columnWidth = width; + m_columnCount = count; + } + void setColumnHeight(LayoutUnit height) + { + m_columnHeight = height; + } + private: + virtual void computeLogicalWidth() OVERRIDE; + virtual void computeLogicalHeight() OVERRIDE; + + virtual LayoutUnit logicalWidthForFlowThreadContent() const OVERRIDE { return m_columnWidth; } + virtual LayoutUnit logicalHeightForFlowThreadContent() const OVERRIDE { return m_columnHeight; } // FIXME: Will be wrong once we have multiple sets. + virtual const char* renderName() const; + + unsigned m_columnCount; + LayoutUnit m_columnWidth; + LayoutUnit m_columnHeight; }; } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 1cd6d36dc..258477659 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -273,11 +273,11 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) bool needsTable = false; - if (newChild->style()->display() == TABLE_COLUMN_GROUP) - needsTable = !isTable(); - else if (newChild->style()->display() == TABLE_COLUMN) - needsTable = !isTable() && style()->display() != TABLE_COLUMN_GROUP; - else if (newChild->isTableCaption()) + if (newChild->isRenderTableCol()) { + RenderTableCol* newTableColumn = toRenderTableCol(newChild); + bool isColumnInColumnGroup = newTableColumn->isTableColumn() && isRenderTableCol(); + needsTable = !isTable() && !isColumnInColumnGroup; + } else if (newChild->isTableCaption()) needsTable = !isTable(); else if (newChild->isTableSection()) needsTable = !isTable(); @@ -1788,9 +1788,15 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style) if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline)) toRenderView(document()->renderer())->setMaximalOutlineSize(m_style->outlineSize()); + bool doesNotNeedLayout = !m_parent || isText(); + styleDidChange(diff, oldStyle.get()); - if (!m_parent || isText()) + // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when + // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s), + // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition + // in the future as we move renderer changes out of layout and into style changes. + if (doesNotNeedLayout) return; // Now that the layer (if any) has been updated, we need to adjust the diff again, @@ -2640,7 +2646,7 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co linethrough = decorationColor(styleToUse); } } - if (curr->isFloating() || curr->isPositioned() || curr->isRubyText()) + if (curr->isRubyText()) return; curr = curr->parent(); if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuation()) @@ -2900,6 +2906,15 @@ bool RenderObject::canUpdateSelectionOnRootLineBoxes() return containingBlock ? !containingBlock->needsLayout() : true; } +// We only create "generated" child renderers like one for first-letter if: +// - the firstLetterBlock can have children in the DOM and +// - the block doesn't have any special assumption on its text children. +// This correctly prevents form controls from having such renderers. +bool RenderObject::canHaveGeneratedChildren() const +{ + return canHaveChildren(); +} + #if ENABLE(SVG) RenderSVGResourceContainer* RenderObject::toRenderSVGResourceContainer() diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index ed90aac22..58de96b31 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -242,6 +242,7 @@ public: // RenderObject tree manipulation ////////////////////////////////////////// virtual bool canHaveChildren() const { return virtualChildren(); } + virtual bool canHaveGeneratedChildren() const; virtual bool isChildAllowed(RenderObject*, RenderStyle*) const { return true; } virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0); virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild = 0) { return addChild(newChild, beforeChild); } @@ -344,7 +345,7 @@ public: virtual bool isSliderThumb() const { return false; } virtual bool isTable() const { return false; } virtual bool isTableCell() const { return false; } - virtual bool isTableCol() const { return false; } + virtual bool isRenderTableCol() const { return false; } virtual bool isTableCaption() const { return false; } virtual bool isTableRow() const { return false; } virtual bool isTableSection() const { return false; } @@ -362,6 +363,7 @@ public: virtual bool isRenderFlowThread() const { return false; } virtual bool isRenderNamedFlowThread() const { return false; } + virtual bool isRenderMultiColumnBlock() const { return false; } virtual bool isRenderMultiColumnSet() const { return false; } virtual bool isRenderScrollbarPart() const { return false; } @@ -374,7 +376,7 @@ public: bool isHTMLMarquee() const; - bool isTablePart() const { return isTableCell() || isTableCol() || isTableCaption() || isTableRow() || isTableSection(); } + bool isTablePart() const { return isTableCell() || isRenderTableCol() || isTableCaption() || isTableRow() || isTableSection(); } inline bool isBeforeContent() const; inline bool isAfterContent() const; diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index e86761466..ea9d52c13 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -51,7 +51,16 @@ RenderRegion::RenderRegion(Node* node, RenderFlowThread* flowThread) , m_regionState(RegionUndefined) , m_dispatchRegionLayoutUpdateEvent(false) { - ASSERT(node->document()->cssRegionsEnabled()); +} + +LayoutUnit RenderRegion::logicalWidthForFlowThreadContent() const +{ + return m_flowThread->isHorizontalWritingMode() ? contentWidth() : contentHeight(); +} + +LayoutUnit RenderRegion::logicalHeightForFlowThreadContent() const +{ + return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); } LayoutRect RenderRegion::regionOverflowRect() const @@ -148,7 +157,10 @@ void RenderRegion::layout() { RenderReplaced::layout(); if (m_flowThread && isValid()) { - if (regionRect().width() != contentWidth() || regionRect().height() != contentHeight()) + LayoutRect oldRegionRect(regionRect()); + if (!isHorizontalWritingMode()) + oldRegionRect = oldRegionRect.transposedRect(); + if (oldRegionRect.width() != logicalWidthForFlowThreadContent() || oldRegionRect.height() != logicalHeightForFlowThreadContent()) m_flowThread->invalidateRegions(); } diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h index fb9afa467..086c63c98 100644 --- a/Source/WebCore/rendering/RenderRegion.h +++ b/Source/WebCore/rendering/RenderRegion.h @@ -95,6 +95,10 @@ public: void setRegionState(RegionState regionState) { m_regionState = regionState; } void setDispatchRegionLayoutUpdateEvent(bool value) { m_dispatchRegionLayoutUpdateEvent = value; } bool shouldDispatchRegionLayoutUpdateEvent() { return m_dispatchRegionLayoutUpdateEvent; } + + virtual LayoutUnit logicalWidthForFlowThreadContent() const; + virtual LayoutUnit logicalHeightForFlowThreadContent() const; + private: virtual const char* renderName() const { return "RenderRegion"; } diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 86ee85e97..541ef37b5 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -119,7 +119,7 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild) if (child->isTableCaption()) { m_captions.append(toRenderTableCaption(child)); wrapInAnonymousSection = false; - } else if (child->isTableCol()) { + } else if (child->isRenderTableCol()) { m_hasColElements = true; wrapInAnonymousSection = false; } else if (child->isTableSection()) { @@ -360,7 +360,7 @@ void RenderTable::layout() if (collapsing) section->recalcOuterBorder(); ASSERT(!section->needsLayout()); - } else if (child->isTableCol()) { + } else if (child->isRenderTableCol()) { child->layoutIfNeeded(); ASSERT(!child->needsLayout()); } @@ -729,7 +729,7 @@ void RenderTable::appendColumn(unsigned span) RenderTableCol* RenderTable::firstColumn() const { for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableCol()) + if (child->isRenderTableCol()) return toRenderTableCol(child); // We allow only table-captions before columns or column-groups. diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp index 99ec92d7d..950acb4b1 100644 --- a/Source/WebCore/rendering/RenderTableCell.cpp +++ b/Source/WebCore/rendering/RenderTableCell.cpp @@ -260,7 +260,7 @@ LayoutRect RenderTableCell::clippedOverflowRectForRepaint(RenderBoxModelObject* if (!table()->collapseBorders() || table()->needsSectionRecalc()) return RenderBlock::clippedOverflowRectForRepaint(repaintContainer); - bool rtl = !table()->style()->isLeftToRightDirection(); + bool rtl = !styleForCellFlow()->isLeftToRightDirection(); int outlineSize = style()->outlineSize(); int left = max(borderHalfLeft(true), outlineSize); int right = max(borderHalfRight(true), outlineSize); @@ -420,8 +420,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC // For the start border, we need to check, in order of precedence: // (1) Our start border. - int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode()) : 0; - int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode()) : 0; + int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; + int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; CollapsedBorderValue result(style()->borderStart(), includeColor ? style()->visitedDependentColor(startColorProperty) : Color(), BCELL); // (2) The end border of the preceding cell. @@ -450,8 +450,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC result = chooseBorder(result, CollapsedBorderValue(colElt->style()->borderStart(), includeColor ? colElt->style()->visitedDependentColor(startColorProperty) : Color(), BCOL)); if (!result.exists()) return result; - if (colElt->parent()->isTableCol() && !colElt->previousSibling()) { - result = chooseBorder(result, CollapsedBorderValue(colElt->parent()->style()->borderStart(), includeColor ? colElt->parent()->style()->visitedDependentColor(startColorProperty) : Color(), BCOLGROUP)); + if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentBefore()) { + result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->style()->borderStart(), includeColor ? enclosingColumnGroup->style()->visitedDependentColor(startColorProperty) : Color(), BCOLGROUP)); if (!result.exists()) return result; } @@ -491,8 +491,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol // For end border, we need to check, in order of precedence: // (1) Our end border. - int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode()) : 0; - int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode()) : 0; + int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; + int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; CollapsedBorderValue result = CollapsedBorderValue(style()->borderEnd(), includeColor ? style()->visitedDependentColor(endColorProperty) : Color(), BCELL); // (2) The start border of the following cell. @@ -524,8 +524,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol result = chooseBorder(result, CollapsedBorderValue(colElt->style()->borderEnd(), includeColor ? colElt->style()->visitedDependentColor(endColorProperty) : Color(), BCOL)); if (!result.exists()) return result; - if (colElt->parent()->isTableCol() && !colElt->nextSibling()) { - result = chooseBorder(result, CollapsedBorderValue(colElt->parent()->style()->borderEnd(), includeColor ? colElt->parent()->style()->visitedDependentColor(endColorProperty) : Color(), BCOLGROUP)); + if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroupIfAdjacentAfter()) { + result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->style()->borderEnd(), includeColor ? enclosingColumnGroup->style()->visitedDependentColor(endColorProperty) : Color(), BCOLGROUP)); if (!result.exists()) return result; } @@ -564,8 +564,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorder // For before border, we need to check, in order of precedence: // (1) Our before border. - int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode()) : 0; - int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode()) : 0; + int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; + int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; CollapsedBorderValue result = CollapsedBorderValue(style()->borderBefore(), includeColor ? style()->visitedDependentColor(beforeColorProperty) : Color(), BCELL); RenderTableCell* prevCell = table->cellAbove(this); @@ -620,8 +620,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorder result = chooseBorder(result, CollapsedBorderValue(colElt->style()->borderBefore(), includeColor ? colElt->style()->visitedDependentColor(beforeColorProperty) : Color(), BCOL)); if (!result.exists()) return result; - if (colElt->parent()->isTableCol()) { - result = chooseBorder(result, CollapsedBorderValue(colElt->parent()->style()->borderBefore(), includeColor ? colElt->parent()->style()->visitedDependentColor(beforeColorProperty) : Color(), BCOLGROUP)); + if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroup()) { + result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->style()->borderBefore(), includeColor ? enclosingColumnGroup->style()->visitedDependentColor(beforeColorProperty) : Color(), BCOLGROUP)); if (!result.exists()) return result; } @@ -650,8 +650,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderC // For after border, we need to check, in order of precedence: // (1) Our after border. - int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode()) : 0; - int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode()) : 0; + int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; + int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow()->direction(), styleForCellFlow()->writingMode()) : 0; CollapsedBorderValue result = CollapsedBorderValue(style()->borderAfter(), includeColor ? style()->visitedDependentColor(afterColorProperty) : Color(), BCELL); RenderTableCell* nextCell = table->cellBelow(this); @@ -697,8 +697,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderC if (colElt) { result = chooseBorder(result, CollapsedBorderValue(colElt->style()->borderAfter(), includeColor ? colElt->style()->visitedDependentColor(afterColorProperty) : Color(), BCOL)); if (!result.exists()) return result; - if (colElt->parent()->isTableCol()) { - result = chooseBorder(result, CollapsedBorderValue(colElt->parent()->style()->borderAfter(), includeColor ? colElt->parent()->style()->visitedDependentColor(afterColorProperty) : Color(), BCOLGROUP)); + if (RenderTableCol* enclosingColumnGroup = colElt->enclosingColumnGroup()) { + result = chooseBorder(result, CollapsedBorderValue(enclosingColumnGroup->style()->borderAfter(), includeColor ? enclosingColumnGroup->style()->visitedDependentColor(afterColorProperty) : Color(), BCOLGROUP)); if (!result.exists()) return result; } @@ -713,32 +713,32 @@ CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderC return result; } -inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(RenderStyle* tableStyle) const +inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle* styleForCellFlow) const { - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); - return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); + return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); } -inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(RenderStyle* tableStyle) const +inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle* styleForCellFlow) const { - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); - return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); + return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); } -inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(RenderStyle* tableStyle) const +inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle* styleForCellFlow) const { - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); - return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); + return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); } -inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(RenderStyle* tableStyle) const +inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle* styleForCellFlow) const { - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); - return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); + return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); } int RenderTableCell::borderLeft() const @@ -785,41 +785,41 @@ int RenderTableCell::borderAfter() const int RenderTableCell::borderHalfLeft(bool outer) const { - RenderStyle* tableStyle = table()->style(); - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); - return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); + const RenderStyle* styleForCellFlow = this->styleForCellFlow(); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); + return styleForCellFlow->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); } int RenderTableCell::borderHalfRight(bool outer) const { - RenderStyle* tableStyle = table()->style(); - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); - return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); + const RenderStyle* styleForCellFlow = this->styleForCellFlow(); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); + return styleForCellFlow->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); } int RenderTableCell::borderHalfTop(bool outer) const { - RenderStyle* tableStyle = table()->style(); - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); - return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); + const RenderStyle* styleForCellFlow = this->styleForCellFlow(); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); + return styleForCellFlow->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); } int RenderTableCell::borderHalfBottom(bool outer) const { - RenderStyle* tableStyle = table()->style(); - if (tableStyle->isHorizontalWritingMode()) - return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); - return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); + const RenderStyle* styleForCellFlow = this->styleForCellFlow(); + if (styleForCellFlow->isHorizontalWritingMode()) + return styleForCellFlow->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); + return styleForCellFlow->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); } int RenderTableCell::borderHalfStart(bool outer) const { CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor); if (border.exists()) - return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. + return (border.width() + ((styleForCellFlow()->isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. return 0; } @@ -827,7 +827,7 @@ int RenderTableCell::borderHalfEnd(bool outer) const { CollapsedBorderValue border = collapsedEndBorder(DoNotIncludeBorderColor); if (border.exists()) - return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2; + return (border.width() + ((styleForCellFlow()->isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2; return 0; } @@ -835,7 +835,7 @@ int RenderTableCell::borderHalfBefore(bool outer) const { CollapsedBorderValue border = collapsedBeforeBorder(DoNotIncludeBorderColor); if (border.exists()) - return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left. + return (border.width() + ((styleForCellFlow()->isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left. return 0; } @@ -843,7 +843,7 @@ int RenderTableCell::borderHalfAfter(bool outer) const { CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor); if (border.exists()) - return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2; + return (border.width() + ((styleForCellFlow()->isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2; return 0; } @@ -968,11 +968,11 @@ void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo if (!table()->currentBorderValue() || graphicsContext->paintingDisabled()) return; - RenderStyle* tableStyle = table()->style(); - CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(tableStyle); - CollapsedBorderValue rightVal = cachedCollapsedRightBorder(tableStyle); - CollapsedBorderValue topVal = cachedCollapsedTopBorder(tableStyle); - CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(tableStyle); + const RenderStyle* styleForCellFlow = this->styleForCellFlow(); + CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); + CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow); + CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); + CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlow); // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. int topWidth = topVal.width(); diff --git a/Source/WebCore/rendering/RenderTableCell.h b/Source/WebCore/rendering/RenderTableCell.h index 2a5820e9e..d1b0a28a3 100644 --- a/Source/WebCore/rendering/RenderTableCell.h +++ b/Source/WebCore/rendering/RenderTableCell.h @@ -135,6 +135,16 @@ public: return createAnonymousWithParentRenderer(parent); } + // This function is used to unify which table part's style we use for computing direction and + // writing mode. Writing modes are not allowed on row group and row but direction is. + // This means we can safely use the same style in all cases to simplify our code. + // FIXME: Eventually this function should replaced by style() once we support direction + // on all table parts and writing-mode on cells. + const RenderStyle* styleForCellFlow() const + { + return table()->style(); + } + protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); @@ -171,10 +181,10 @@ private: CollapsedBorderValue collapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue collapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; - CollapsedBorderValue cachedCollapsedLeftBorder(RenderStyle*) const; - CollapsedBorderValue cachedCollapsedRightBorder(RenderStyle*) const; - CollapsedBorderValue cachedCollapsedTopBorder(RenderStyle*) const; - CollapsedBorderValue cachedCollapsedBottomBorder(RenderStyle*) const; + CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle*) const; + CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle*) const; + CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle*) const; + CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle*) const; CollapsedBorderValue computeCollapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue computeCollapsedEndBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; diff --git a/Source/WebCore/rendering/RenderTableCol.cpp b/Source/WebCore/rendering/RenderTableCol.cpp index b569eae42..97cd8cc3e 100644 --- a/Source/WebCore/rendering/RenderTableCol.cpp +++ b/Source/WebCore/rendering/RenderTableCol.cpp @@ -71,14 +71,15 @@ void RenderTableCol::updateFromElement() bool RenderTableCol::isChildAllowed(RenderObject* child, RenderStyle* style) const { - return child->isTableCol() && style->display() == TABLE_COLUMN; + // We cannot use isTableColumn here as style() may return 0. + return child->isRenderTableCol() && style->display() == TABLE_COLUMN; } bool RenderTableCol::canHaveChildren() const { // Cols cannot have children. This is actually necessary to fix a bug // with libraries.uc.edu, which makes a <p> be a table-column. - return style()->display() == TABLE_COLUMN_GROUP; + return isTableColumnGroup(); } LayoutRect RenderTableCol::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const @@ -116,6 +117,17 @@ RenderTable* RenderTableCol::table() const return table && table->isTable() ? toRenderTable(table) : 0; } +RenderTableCol* RenderTableCol::enclosingColumnGroup() const +{ + if (!parent()->isRenderTableCol()) + return 0; + + RenderTableCol* parentColumnGroup = toRenderTableCol(parent()); + ASSERT(parentColumnGroup->isTableColumnGroup()); + ASSERT(isTableColumn()); + return parentColumnGroup; +} + RenderTableCol* RenderTableCol::nextColumn() const { // If |this| is a column-group, the next column is the colgroup's first child column. @@ -126,10 +138,10 @@ RenderTableCol* RenderTableCol::nextColumn() const RenderObject* next = nextSibling(); // Failing that, the child is the last column in a column-group, so the next column is the next column/column-group after its column-group. - if (!next && parent()->isTableCol()) + if (!next && parent()->isRenderTableCol()) next = parent()->nextSibling(); - for (; next && !next->isTableCol(); next = next->nextSibling()) { + for (; next && !next->isRenderTableCol(); next = next->nextSibling()) { // We allow captions mixed with columns and column-groups. if (next->isTableCaption()) continue; diff --git a/Source/WebCore/rendering/RenderTableCol.h b/Source/WebCore/rendering/RenderTableCol.h index 2d8f39b8f..62f3288e8 100644 --- a/Source/WebCore/rendering/RenderTableCol.h +++ b/Source/WebCore/rendering/RenderTableCol.h @@ -45,6 +45,24 @@ public: void setSpan(unsigned span) { m_span = span; } bool isTableColumnGroupWithColumnChildren() { return firstChild(); } + bool isTableColumn() const { return style()->display() == TABLE_COLUMN; } + bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; } + + RenderTableCol* enclosingColumnGroup() const; + RenderTableCol* enclosingColumnGroupIfAdjacentBefore() const + { + if (previousSibling()) + return 0; + return enclosingColumnGroup(); + } + + RenderTableCol* enclosingColumnGroupIfAdjacentAfter() const + { + if (nextSibling()) + return 0; + return enclosingColumnGroup(); + } + // Returns the next column or column-group. RenderTableCol* nextColumn() const; @@ -54,7 +72,7 @@ private: virtual const RenderObjectChildList* virtualChildren() const { return children(); } virtual const char* renderName() const { return "RenderTableCol"; } - virtual bool isTableCol() const { return true; } + virtual bool isRenderTableCol() const OVERRIDE { return true; } virtual void updateFromElement(); virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; @@ -74,13 +92,13 @@ private: inline RenderTableCol* toRenderTableCol(RenderObject* object) { - ASSERT(!object || object->isTableCol()); + ASSERT(!object || object->isRenderTableCol()); return static_cast<RenderTableCol*>(object); } inline const RenderTableCol* toRenderTableCol(const RenderObject* object) { - ASSERT(!object || object->isTableCol()); + ASSERT(!object || object->isRenderTableCol()); return static_cast<const RenderTableCol*>(object); } diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index db25e8149..173085c25 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -654,6 +654,7 @@ void RenderTableSection::layoutRows() LayoutRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height()); LayoutPoint cellLocation(0, m_rowPos[rindx]); + // FIXME: Switch to cell's styleForCellFlow() for consistency with RenderTableCell, once it supports row group. if (!style()->isLeftToRightDirection()) cellLocation.setX(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing); else @@ -1010,18 +1011,16 @@ void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) { // We need to handle painting a stack of backgrounds. This stack (from bottom to top) consists of // the column group, column, row group, row, and then the cell. - RenderObject* col = table()->colElement(cell->col()); - RenderObject* colGroup = 0; - if (col && col->parent()->style()->display() == TABLE_COLUMN_GROUP) - colGroup = col->parent(); + RenderTableCol* column = table()->colElement(cell->col()); + RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() : 0; // Column groups and columns first. // FIXME: Columns and column groups do not currently support opacity, and they are being painted "too late" in // the stack, since we have already opened a transparency layer (potentially) for the table row group. // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the // cell. - cell->paintBackgroundsBehindCell(paintInfo, cellPoint, colGroup); - cell->paintBackgroundsBehindCell(paintInfo, cellPoint, col); + cell->paintBackgroundsBehindCell(paintInfo, cellPoint, columnGroup); + cell->paintBackgroundsBehindCell(paintInfo, cellPoint, column); // Paint the row group next. cell->paintBackgroundsBehindCell(paintInfo, cellPoint, this); diff --git a/Source/WebCore/rendering/RenderTextControl.h b/Source/WebCore/rendering/RenderTextControl.h index 0c31ed806..1a48f5dbe 100644 --- a/Source/WebCore/rendering/RenderTextControl.h +++ b/Source/WebCore/rendering/RenderTextControl.h @@ -71,6 +71,7 @@ private: virtual void computePreferredLogicalWidths(); virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } virtual bool avoidsFloats() const { return true; } + virtual bool canHaveGeneratedChildren() const OVERRIDE { return false; } virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index be791440d..3e68594e0 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -809,8 +809,8 @@ public: Length flexPreferredSize() const { return rareNonInheritedData->m_flexibleBox->m_preferredSize; } int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; } EFlexPack flexPack() const { return static_cast<EFlexPack>(rareNonInheritedData->m_flexibleBox->m_flexPack); } - EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); } - EFlexAlign flexItemAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexItemAlign); } + EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); } + EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); } EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); } bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; } bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; } @@ -830,6 +830,7 @@ public: void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); } void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); } + EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); } StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); } EBoxSizing boxSizing() const { return m_box->boxSizing(); } Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; } @@ -1234,6 +1235,7 @@ public: void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); } // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); } + void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); } void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; } void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); } void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); } @@ -1249,8 +1251,8 @@ public: void setFlexPreferredSize(Length l) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_preferredSize, l); } void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); } void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); } - void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); } - void setFlexItemAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexItemAlign, a); } + void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); } + void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); } void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); } void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } void setFlexLinePack(EFlexLinePack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexLinePack, p); } @@ -1568,6 +1570,7 @@ public: static int initialOutlineOffset() { return 0; } static float initialOpacity() { return 1.0f; } static EBoxAlignment initialBoxAlign() { return BSTRETCH; } + static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; } static EBoxDirection initialBoxDirection() { return BNORMAL; } static EBoxLines initialBoxLines() { return SINGLE; } static EBoxOrient initialBoxOrient() { return HORIZONTAL; } @@ -1577,13 +1580,13 @@ public: static unsigned int initialBoxOrdinalGroup() { return 1; } static EBoxSizing initialBoxSizing() { return CONTENT_BOX; } static StyleReflection* initialBoxReflect() { return 0; } - static float initialPositiveFlex() { return 0; } - static float initialNegativeFlex() { return 0; } + static float initialPositiveFlex() { return 1; } + static float initialNegativeFlex() { return 1; } static Length initialFlexPreferredSize() { return Length(Auto); } static int initialFlexOrder() { return 0; } static EFlexPack initialFlexPack() { return PackStart; } - static EFlexAlign initialFlexAlign() { return AlignStretch; } - static EFlexAlign initialFlexItemAlign() { return AlignAuto; } + static EAlignItems initialAlignItems() { return AlignStretch; } + static EAlignItems initialAlignSelf() { return AlignAuto; } static EFlexDirection initialFlexDirection() { return FlowRow; } static EFlexWrap initialFlexWrap() { return FlexWrapNone; } static EFlexLinePack initialFlexLinePack() { return LinePackStretch; } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 55c739a07..73e819489 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -103,6 +103,10 @@ enum EFloat { enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD }; +// Box decoration attributes. Not inherited. + +enum EBoxDecorationBreak { DSLICE, DCLONE }; + // Box attributes. Not inherited. enum EBoxSizing { CONTENT_BOX, BORDER_BOX }; @@ -169,10 +173,10 @@ enum EBoxDirection { BNORMAL, BREVERSE }; // CSS3 Flexbox Properties -enum EFlexPack { PackStart, PackEnd, PackCenter, PackJustify, PackDistribute }; -enum EFlexAlign { AlignAuto, AlignStart, AlignEnd, AlignCenter, AlignStretch, AlignBaseline }; +enum EAlignItems { AlignAuto, AlignStart, AlignEnd, AlignCenter, AlignStretch, AlignBaseline }; +enum EFlexPack { PackStart, PackEnd, PackCenter, PackSpaceBetween, PackSpaceAround }; enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse }; -enum EFlexLinePack { LinePackStart, LinePackEnd, LinePackCenter, LinePackJustify, LinePackDistribute, LinePackStretch }; +enum EFlexLinePack { LinePackStart, LinePackEnd, LinePackCenter, LinePackSpaceBetween, LinePackSpaceAround, LinePackStretch }; enum EFlexWrap { FlexWrapNone, FlexWrap, FlexWrapReverse }; enum ETextSecurity { diff --git a/Source/WebCore/rendering/style/StyleBoxData.cpp b/Source/WebCore/rendering/style/StyleBoxData.cpp index 35711ac25..fb9655c21 100644 --- a/Source/WebCore/rendering/style/StyleBoxData.cpp +++ b/Source/WebCore/rendering/style/StyleBoxData.cpp @@ -35,6 +35,7 @@ StyleBoxData::StyleBoxData() , m_zIndex(0) , m_hasAutoZIndex(true) , m_boxSizing(CONTENT_BOX) + , m_boxDecorationBreak(DSLICE) { } @@ -50,6 +51,7 @@ StyleBoxData::StyleBoxData(const StyleBoxData& o) , m_zIndex(o.m_zIndex) , m_hasAutoZIndex(o.m_hasAutoZIndex) , m_boxSizing(o.m_boxSizing) + , m_boxDecorationBreak(o.m_boxDecorationBreak) { } @@ -64,7 +66,8 @@ bool StyleBoxData::operator==(const StyleBoxData& o) const && m_verticalAlign == o.m_verticalAlign && m_zIndex == o.m_zIndex && m_hasAutoZIndex == o.m_hasAutoZIndex - && m_boxSizing == o.m_boxSizing; + && m_boxSizing == o.m_boxSizing + && m_boxDecorationBreak == o.m_boxDecorationBreak; } } // namespace WebCore diff --git a/Source/WebCore/rendering/style/StyleBoxData.h b/Source/WebCore/rendering/style/StyleBoxData.h index 00bce4e2c..2984d176b 100644 --- a/Source/WebCore/rendering/style/StyleBoxData.h +++ b/Source/WebCore/rendering/style/StyleBoxData.h @@ -58,6 +58,7 @@ public: bool hasAutoZIndex() const { return m_hasAutoZIndex; } EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(m_boxSizing); } + EBoxDecorationBreak boxDecorationBreak() const { return static_cast<EBoxDecorationBreak>(m_boxDecorationBreak); } private: friend class RenderStyle; @@ -79,6 +80,7 @@ private: int m_zIndex; bool m_hasAutoZIndex : 1; unsigned m_boxSizing : 1; // EBoxSizing + unsigned m_boxDecorationBreak : 1; // EBoxDecorationBreak }; } // namespace WebCore diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp index 62a7ee89e..cfe528bd9 100644 --- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp +++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp @@ -36,8 +36,6 @@ StyleFlexibleBoxData::StyleFlexibleBoxData() , m_preferredSize(RenderStyle::initialFlexPreferredSize()) , m_flexOrder(RenderStyle::initialFlexOrder()) , m_flexPack(RenderStyle::initialFlexPack()) - , m_flexAlign(RenderStyle::initialFlexAlign()) - , m_flexItemAlign(RenderStyle::initialFlexItemAlign()) , m_flexDirection(RenderStyle::initialFlexDirection()) , m_flexWrap(RenderStyle::initialFlexWrap()) , m_flexLinePack(RenderStyle::initialFlexLinePack()) @@ -51,8 +49,6 @@ StyleFlexibleBoxData::StyleFlexibleBoxData(const StyleFlexibleBoxData& o) , m_preferredSize(o.m_preferredSize) , m_flexOrder(o.m_flexOrder) , m_flexPack(o.m_flexPack) - , m_flexAlign(o.m_flexAlign) - , m_flexItemAlign(o.m_flexItemAlign) , m_flexDirection(o.m_flexDirection) , m_flexWrap(o.m_flexWrap) , m_flexLinePack(o.m_flexLinePack) @@ -62,9 +58,8 @@ StyleFlexibleBoxData::StyleFlexibleBoxData(const StyleFlexibleBoxData& o) bool StyleFlexibleBoxData::operator==(const StyleFlexibleBoxData& o) const { return m_positiveFlex == o.m_positiveFlex && m_negativeFlex == o.m_negativeFlex && m_preferredSize == o.m_preferredSize - && m_flexOrder == o.m_flexOrder && m_flexPack == o.m_flexPack && m_flexAlign == o.m_flexAlign - && m_flexItemAlign == o.m_flexItemAlign && m_flexDirection == o.m_flexDirection && m_flexWrap == o.m_flexWrap - && m_flexLinePack == o.m_flexLinePack; + && m_flexOrder == o.m_flexOrder && m_flexPack == o.m_flexPack && m_flexDirection == o.m_flexDirection + && m_flexWrap == o.m_flexWrap && m_flexLinePack == o.m_flexLinePack; } } diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h index 1ced849bc..46c08806e 100644 --- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h +++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h @@ -51,8 +51,6 @@ public: int m_flexOrder; unsigned m_flexPack : 3; // EFlexPack - unsigned m_flexAlign : 3; // EFlexAlign - unsigned m_flexItemAlign : 3; // EFlexAlign unsigned m_flexDirection : 2; // EFlexDirection unsigned m_flexWrap : 2; // EFlexWrap unsigned m_flexLinePack : 3; // EFlexLinePack diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp index ca89f5fdb..28c79f30a 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp @@ -59,6 +59,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() , m_pageSizeType(PAGE_SIZE_AUTO) , m_transformStyle3D(RenderStyle::initialTransformStyle3D()) , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility()) + , m_alignItems(RenderStyle::initialAlignItems()) + , m_alignSelf(RenderStyle::initialAlignSelf()) , userDrag(RenderStyle::initialUserDrag()) , textOverflow(RenderStyle::initialTextOverflow()) , marginBeforeCollapse(MCOLLAPSE) @@ -126,6 +128,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited , m_pageSizeType(o.m_pageSizeType) , m_transformStyle3D(o.m_transformStyle3D) , m_backfaceVisibility(o.m_backfaceVisibility) + , m_alignItems(o.m_alignItems) + , m_alignSelf(o.m_alignSelf) , userDrag(o.userDrag) , textOverflow(o.textOverflow) , marginBeforeCollapse(o.marginBeforeCollapse) @@ -199,6 +203,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && m_pageSizeType == o.m_pageSizeType && m_transformStyle3D == o.m_transformStyle3D && m_backfaceVisibility == o.m_backfaceVisibility + && m_alignItems == o.m_alignItems + && m_alignSelf == o.m_alignSelf && userDrag == o.userDrag && textOverflow == o.textOverflow && marginBeforeCollapse == o.marginBeforeCollapse diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h index 19f1efec0..7b801d28d 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -158,6 +158,9 @@ public: unsigned m_transformStyle3D : 1; // ETransformStyle3D unsigned m_backfaceVisibility : 1; // EBackfaceVisibility + unsigned m_alignItems : 3; // EAlignItems + unsigned m_alignSelf : 3; // EAlignItems + unsigned userDrag : 2; // EUserDrag unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..." unsigned marginBeforeCollapse : 2; // EMarginCollapse diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp index 4dc501b80..15d647689 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp @@ -27,6 +27,7 @@ #include "GraphicsContext.h" #include "PatternAttributes.h" #include "RenderSVGRoot.h" +#include "SVGFitToViewBox.h" #include "SVGRenderSupport.h" #include "SVGRenderingContext.h" @@ -215,7 +216,7 @@ bool RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer, if (patternBoundaries.width() <= 0 || patternBoundaries.height() <= 0) return false; - AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), attributes.preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); + AffineTransform viewBoxCTM = SVGFitToViewBox::viewBoxToViewTransform(attributes.viewBox(), attributes.preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); // Apply viewBox/objectBoundingBox transformations. if (!viewBoxCTM.isIdentity()) diff --git a/Source/WebCore/svg/SVGFitToViewBox.cpp b/Source/WebCore/svg/SVGFitToViewBox.cpp index e4df4ff3f..f1f6cf49f 100644 --- a/Source/WebCore/svg/SVGFitToViewBox.cpp +++ b/Source/WebCore/svg/SVGFitToViewBox.cpp @@ -88,26 +88,6 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), viewWidth, viewHeight); } -bool SVGFitToViewBox::parseAttribute(Document* document, const Attribute& attribute) -{ - if (attribute.name() == SVGNames::viewBoxAttr) { - FloatRect viewBox; - if (!attribute.isNull()) - parseViewBox(document, attribute.value(), viewBox); - setViewBoxBaseValue(viewBox); - return true; - } - - if (attribute.name() == SVGNames::preserveAspectRatioAttr) { - SVGPreserveAspectRatio preserveAspectRatio; - preserveAspectRatio.parse(attribute.value()); - setPreserveAspectRatioBaseValue(preserveAspectRatio); - return true; - } - - return false; -} - bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName) { return attrName == SVGNames::viewBoxAttr || attrName == SVGNames::preserveAspectRatioAttr; diff --git a/Source/WebCore/svg/SVGFitToViewBox.h b/Source/WebCore/svg/SVGFitToViewBox.h index d77144500..51452127b 100644 --- a/Source/WebCore/svg/SVGFitToViewBox.h +++ b/Source/WebCore/svg/SVGFitToViewBox.h @@ -22,33 +22,52 @@ #define SVGFitToViewBox_h #if ENABLE(SVG) +#include "Attribute.h" +#include "FloatRect.h" #include "QualifiedName.h" +#include "SVGNames.h" +#include "SVGPreserveAspectRatio.h" #include <wtf/HashSet.h> namespace WebCore { class AffineTransform; -class Attribute; class Document; -class FloatRect; -class SVGPreserveAspectRatio; class SVGFitToViewBox { public: - virtual ~SVGFitToViewBox() { } - - bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight); - bool parseAttribute(Document*, const Attribute&); - bool isKnownAttribute(const QualifiedName&); - void addSupportedAttributes(HashSet<QualifiedName>&); + static bool isKnownAttribute(const QualifiedName&); + static void addSupportedAttributes(HashSet<QualifiedName>&); + + template<class SVGElementTarget> + static bool parseAttribute(SVGElementTarget* target, const Attribute& attribute) + { + ASSERT(target); + ASSERT(target->document()); + if (attribute.name() == SVGNames::viewBoxAttr) { + FloatRect viewBox; + if (!attribute.isNull()) + parseViewBox(target->document(), attribute.value(), viewBox); + target->setViewBoxBaseValue(viewBox); + return true; + } + + if (attribute.name() == SVGNames::preserveAspectRatioAttr) { + SVGPreserveAspectRatio preserveAspectRatio; + preserveAspectRatio.parse(attribute.value()); + target->setPreserveAspectRatioBaseValue(preserveAspectRatio); + return true; + } + + return false; + } - virtual void setViewBoxBaseValue(const FloatRect&) = 0; - virtual void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio&) = 0; + static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); private: - bool parseViewBox(Document*, const String&, FloatRect&); + static bool parseViewBox(Document*, const String&, FloatRect&); }; } // namespace WebCore diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp index 02f7d9a7f..7c676485f 100644 --- a/Source/WebCore/svg/SVGFontFaceElement.cpp +++ b/Source/WebCore/svg/SVGFontFaceElement.cpp @@ -113,7 +113,7 @@ void SVGFontFaceElement::parseAttribute(const Attribute& attribute) { CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attribute.name()); if (propId > 0) { - m_fontFaceRule->properties()->setProperty(propId, attribute.value(), false); + m_fontFaceRule->mutableProperties()->setProperty(propId, attribute.value(), false); rebuildFontFace(); return; } @@ -297,7 +297,7 @@ void SVGFontFaceElement::rebuildFontFace() return; // Parse in-memory CSS rules - m_fontFaceRule->properties()->addParsedProperty(CSSProperty(CSSPropertySrc, list)); + m_fontFaceRule->mutableProperties()->addParsedProperty(CSSProperty(CSSPropertySrc, list)); if (describesParentFont) { // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves. @@ -331,7 +331,7 @@ void SVGFontFaceElement::removedFrom(ContainerNode* rootParent) if (rootParent->inDocument()) { document()->accessSVGExtensions()->unregisterSVGFontFaceElement(this); - m_fontFaceRule->properties()->parseDeclaration(emptyString(), 0); + m_fontFaceRule->mutableProperties()->parseDeclaration(emptyString(), 0); document()->styleResolverChanged(DeferRecalcStyle); } diff --git a/Source/WebCore/svg/SVGMarkerElement.cpp b/Source/WebCore/svg/SVGMarkerElement.cpp index 9f9f197e3..2a6ebb1ef 100644 --- a/Source/WebCore/svg/SVGMarkerElement.cpp +++ b/Source/WebCore/svg/SVGMarkerElement.cpp @@ -39,6 +39,7 @@ const SVGPropertyInfo* SVGMarkerElement::orientTypePropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedEnumeration, + PropertyIsReadWrite, SVGNames::orientAttr, orientTypeIdentifier(), &SVGMarkerElement::synchronizeOrientType, @@ -153,7 +154,7 @@ void SVGMarkerElement::parseAttribute(const Attribute& attribute) setOrientAngleBaseValue(angle); } else if (SVGLangSpace::parseAttribute(attribute) || SVGExternalResourcesRequired::parseAttribute(attribute) - || SVGFitToViewBox::parseAttribute(document(), attribute)) { + || SVGFitToViewBox::parseAttribute(this, attribute)) { } else ASSERT_NOT_REACHED(); @@ -239,14 +240,14 @@ void SVGMarkerElement::synchronizeOrientType(void* contextElement) return; DEFINE_STATIC_LOCAL(AtomicString, autoString, ("auto")); - SVGAnimatedPropertySynchronizer<true>::synchronize(ownerType, orientTypePropertyInfo()->attributeName, autoString); + ownerType->m_orientType.synchronize(ownerType, orientTypePropertyInfo()->attributeName, autoString); } PassRefPtr<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(void* contextElement) { ASSERT(contextElement); SVGMarkerElement* ownerType = static_cast<SVGMarkerElement*>(contextElement); - return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType, true> + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType> (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value); } diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp index f4c01f16c..986f5fe5f 100644 --- a/Source/WebCore/svg/SVGPathElement.cpp +++ b/Source/WebCore/svg/SVGPathElement.cpp @@ -52,6 +52,7 @@ const SVGPropertyInfo* SVGPathElement::dPropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedPath, + PropertyIsReadWrite, SVGNames::dAttr, SVGNames::dAttr.localName(), &SVGPathElement::synchronizeD, @@ -261,7 +262,7 @@ void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) RenderSVGPath* renderer = static_cast<RenderSVGPath*>(this->renderer()); if (attrName == SVGNames::dAttr) { - if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, true>(this, dPropertyInfo())->isAnimating()) { + if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) { SVGPathSegList newList(PathSegUnalteredRole); buildSVGPathSegListFromByteStream(m_pathByteStream.get(), this, newList, UnalteredParsing); m_pathSegList.value = newList; @@ -277,7 +278,7 @@ void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGPathByteStream* SVGPathElement::pathByteStream() const { - SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, true>(this, dPropertyInfo()); + SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo()); if (!property || !property->isAnimating()) return m_pathByteStream.get(); return static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property)->animatedPathByteStream(); @@ -288,13 +289,13 @@ PassRefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(void* con ASSERT(contextElement); SVGPathElement* ownerType = static_cast<SVGPathElement*>(contextElement); - if (SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, true>(ownerType, dPropertyInfo())) + if (SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(ownerType, dPropertyInfo())) return property; // Build initial SVGPathSegList. buildSVGPathSegListFromByteStream(ownerType->m_pathByteStream.get(), ownerType, ownerType->m_pathSegList.value, UnalteredParsing); - return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegList, true> + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegList> (ownerType, dPropertyInfo(), ownerType->m_pathSegList.value); } @@ -304,7 +305,7 @@ void SVGPathElement::synchronizeD(void* contextElement) SVGPathElement* ownerType = static_cast<SVGPathElement*>(contextElement); if (!ownerType->m_pathSegList.shouldSynchronize) return; - SVGAnimatedPropertySynchronizer<true>::synchronize(ownerType, dPropertyInfo()->attributeName, ownerType->m_pathSegList.value.valueAsString()); + ownerType->m_pathSegList.synchronize(ownerType, dPropertyInfo()->attributeName, ownerType->m_pathSegList.value.valueAsString()); } SVGPathSegListPropertyTearOff* SVGPathElement::pathSegList() diff --git a/Source/WebCore/svg/SVGPathSegWithContext.h b/Source/WebCore/svg/SVGPathSegWithContext.h index fccfd6aae..701067227 100644 --- a/Source/WebCore/svg/SVGPathSegWithContext.h +++ b/Source/WebCore/svg/SVGPathSegWithContext.h @@ -39,7 +39,7 @@ public: case PathSegUndefinedRole: return 0; case PathSegUnalteredRole: - return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, true>(m_element.get(), SVGPathElement::dPropertyInfo()); + return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo()); case PathSegNormalizedRole: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! return 0; diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp index b04f3b390..c39e2880a 100644 --- a/Source/WebCore/svg/SVGPatternElement.cpp +++ b/Source/WebCore/svg/SVGPatternElement.cpp @@ -34,6 +34,7 @@ #include "RenderSVGContainer.h" #include "RenderSVGResourcePattern.h" #include "SVGElementInstance.h" +#include "SVGFitToViewBox.h" #include "SVGNames.h" #include "SVGRenderSupport.h" #include "SVGSVGElement.h" @@ -143,7 +144,7 @@ void SVGPatternElement::parseAttribute(const Attribute& attribute) || SVGTests::parseAttribute(attribute) || SVGLangSpace::parseAttribute(attribute) || SVGExternalResourcesRequired::parseAttribute(attribute) - || SVGFitToViewBox::parseAttribute(document(), attribute)) { + || SVGFitToViewBox::parseAttribute(this, attribute)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGPolyElement.cpp b/Source/WebCore/svg/SVGPolyElement.cpp index 57deccb2d..3ae5fe5b6 100644 --- a/Source/WebCore/svg/SVGPolyElement.cpp +++ b/Source/WebCore/svg/SVGPolyElement.cpp @@ -41,6 +41,7 @@ const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedPoints, + PropertyIsReadWrite, SVGNames::pointsAttr, SVGNames::pointsAttr.localName(), &SVGPolyElement::synchronizePoints, @@ -90,7 +91,7 @@ void SVGPolyElement::parseAttribute(const Attribute& attribute) if (!pointsListFromSVGData(newList, value)) document()->accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\""); - if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList, true>(this, pointsPropertyInfo())) + if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newList.size()); m_points.value = newList; @@ -143,14 +144,14 @@ void SVGPolyElement::synchronizePoints(void* contextElement) SVGPolyElement* ownerType = static_cast<SVGPolyElement*>(contextElement); if (!ownerType->m_points.shouldSynchronize) return; - SVGAnimatedPropertySynchronizer<true>::synchronize(ownerType, pointsPropertyInfo()->attributeName, ownerType->m_points.value.valueAsString()); + ownerType->m_points.synchronize(ownerType, pointsPropertyInfo()->attributeName, ownerType->m_points.value.valueAsString()); } PassRefPtr<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(void* contextElement) { ASSERT(contextElement); SVGPolyElement* ownerType = static_cast<SVGPolyElement*>(contextElement); - return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointList, true> + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointList> (ownerType, pointsPropertyInfo(), ownerType->m_points.value); } diff --git a/Source/WebCore/svg/SVGRect.h b/Source/WebCore/svg/SVGRect.h index 379a5bf07..27db37858 100644 --- a/Source/WebCore/svg/SVGRect.h +++ b/Source/WebCore/svg/SVGRect.h @@ -40,7 +40,6 @@ struct SVGPropertyTraits<FloatRect> { builder.append(String::number(type.width())); builder.append(' '); builder.append(String::number(type.height())); - builder.append(' '); return builder.toString(); } }; diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp index 0fbda9d4a..8cde7d516 100644 --- a/Source/WebCore/svg/SVGSVGElement.cpp +++ b/Source/WebCore/svg/SVGSVGElement.cpp @@ -46,13 +46,13 @@ #include "SMILTimeContainer.h" #include "SVGAngle.h" #include "SVGElementInstance.h" +#include "SVGFitToViewBox.h" #include "SVGNames.h" #include "SVGPreserveAspectRatio.h" #include "SVGTransform.h" #include "SVGTransformList.h" #include "SVGViewElement.h" #include "SVGViewSpec.h" -#include "SVGZoomAndPan.h" #include "SVGZoomEvent.h" #include "ScriptEventListener.h" #include "StaticNodeList.h" @@ -103,6 +103,8 @@ PassRefPtr<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Do SVGSVGElement::~SVGSVGElement() { + if (m_viewSpec) + m_viewSpec->resetContextElement(); document()->unregisterForPageCacheSuspensionCallbacks(this); // There are cases where removedFromDocument() is not called. // see ContainerNode::removeAllChildren, called by its destructor. @@ -170,10 +172,10 @@ float SVGSVGElement::screenPixelToMillimeterY() const return pixelUnitToMillimeterY(); } -SVGViewSpec* SVGSVGElement::currentView() const +SVGViewSpec* SVGSVGElement::currentView() { if (!m_viewSpec) - m_viewSpec = adoptPtr(new SVGViewSpec(const_cast<SVGSVGElement*>(this))); + m_viewSpec = SVGViewSpec::create(this); return m_viewSpec.get(); } @@ -269,7 +271,7 @@ void SVGSVGElement::parseAttribute(const Attribute& attribute) else if (SVGTests::parseAttribute(attribute) || SVGLangSpace::parseAttribute(attribute) || SVGExternalResourcesRequired::parseAttribute(attribute) - || SVGFitToViewBox::parseAttribute(document(), attribute) + || SVGFitToViewBox::parseAttribute(this, attribute) || SVGZoomAndPan::parseAttribute(this, attribute)) { } else SVGStyledLocatableElement::parseAttribute(attribute); @@ -525,11 +527,8 @@ bool SVGSVGElement::selfHasRelativeLengths() const FloatRect SVGSVGElement::currentViewBoxRect() const { - if (useCurrentView()) { - if (SVGViewSpec* view = currentView()) // what if we should use it but it is not set? - return view->viewBox(); - return FloatRect(); - } + if (m_useCurrentView) + return m_viewSpec ? m_viewSpec->viewBox() : FloatRect(); FloatRect useViewBox = viewBox(); if (!useViewBox.isEmpty()) @@ -646,71 +645,95 @@ Length SVGSVGElement::intrinsicHeight(ConsiderCSSMode mode) const AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const { - AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight); - if (useCurrentView() && currentView()) { - AffineTransform transform; - if (currentView()->transformBaseValue().concatenate(transform)) - ctm *= transform; - } + if (!m_useCurrentView || !m_viewSpec) + return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight); + + AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatio(), viewWidth, viewHeight); + const SVGTransformList& transformList = m_viewSpec->transformBaseValue(); + if (transformList.isEmpty()) + return ctm; + + AffineTransform transform; + if (transformList.concatenate(transform)) + ctm *= transform; return ctm; } void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* anchorNode) { + RenderObject* renderer = this->renderer(); + SVGViewSpec* view = m_viewSpec.get(); + if (view) + view->reset(); + bool hadUseCurrentView = m_useCurrentView; + m_useCurrentView = false; + if (fragmentIdentifier.startsWith("xpointer(")) { // FIXME: XPointer references are ignored (https://bugs.webkit.org/show_bug.cgi?id=17491) - setUseCurrentView(false); - } else if (fragmentIdentifier.startsWith("svgView(")) { - if (currentView()->parseViewSpec(fragmentIdentifier)) - setUseCurrentView(true); - } else if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { + if (renderer && hadUseCurrentView) + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); + return; + } + + if (fragmentIdentifier.startsWith("svgView(")) { + if (!view) + view = currentView(); // Create the SVGViewSpec. + + if (view->parseViewSpec(fragmentIdentifier)) + m_useCurrentView = true; + else + view->reset(); + + if (renderer && (hadUseCurrentView || m_useCurrentView)) + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); + return; + } + + // Spec: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView + // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport. + // Any view specification attributes included on the given ‘view’ element override the corresponding view specification + // attributes on the closest ancestor ‘svg’ element. + if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { if (SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0) { SVGElement* element = SVGLocatable::nearestViewportElement(viewElement); if (element->hasTagName(SVGNames::svgTag)) { SVGSVGElement* svg = static_cast<SVGSVGElement*>(element); svg->inheritViewAttributes(viewElement); - setUseCurrentView(true); + + if (RenderObject* renderer = svg->renderer()) + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); } } + return; } - if (!hadUseCurrentView) { - if (!m_useCurrentView) - return; - } else if (!m_useCurrentView) - currentView()->setTransformString(emptyString()); - - // Force a layout, otherwise RenderSVGRoots localToBorderBoxTransform won't be rebuild. - if (RenderObject* object = renderer()) - RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); - // FIXME: We need to decide which <svg> to focus on, and zoom to it. // FIXME: We need to actually "highlight" the viewTarget(s). } void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) { + SVGViewSpec* view = currentView(); + m_useCurrentView = true; + if (viewElement->hasAttribute(SVGNames::viewBoxAttr)) - currentView()->setViewBoxBaseValue(viewElement->viewBox()); + view->setViewBoxBaseValue(viewElement->viewBox()); else - currentView()->setViewBoxBaseValue(viewBox()); + view->setViewBoxBaseValue(viewBox()); - SVGPreserveAspectRatio aspectRatio; if (viewElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) - aspectRatio = viewElement->preserveAspectRatioBaseValue(); + view->setPreserveAspectRatioBaseValue(viewElement->preserveAspectRatioBaseValue()); else - aspectRatio = preserveAspectRatioBaseValue(); - currentView()->setPreserveAspectRatioBaseValue(aspectRatio); + view->setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue()); if (viewElement->hasAttribute(SVGNames::zoomAndPanAttr)) - currentView()->setZoomAndPanBaseValue(viewElement->zoomAndPan()); - - if (RenderObject* object = renderer()) - RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); + view->setZoomAndPanBaseValue(viewElement->zoomAndPan()); + else + view->setZoomAndPanBaseValue(zoomAndPan()); } - + void SVGSVGElement::documentWillSuspendForPageCache() { pauseAnimations(); @@ -731,7 +754,7 @@ Element* SVGSVGElement::getElementById(const AtomicString& id) const // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will // be returned. - for (Node* node = traverseNextNode(this); node; node = node->traverseNextNode(this)) { + for (Node* node = firstChild(); node; node = node->traverseNextNode(this)) { if (!node->isElementNode()) continue; diff --git a/Source/WebCore/svg/SVGSVGElement.h b/Source/WebCore/svg/SVGSVGElement.h index 99b6be283..cee47a4e8 100644 --- a/Source/WebCore/svg/SVGSVGElement.h +++ b/Source/WebCore/svg/SVGSVGElement.h @@ -72,9 +72,7 @@ public: float screenPixelToMillimeterY() const; bool useCurrentView() const { return m_useCurrentView; } - void setUseCurrentView(bool currentView) { m_useCurrentView = currentView; } - - SVGViewSpec* currentView() const; + SVGViewSpec* currentView(); enum ConsiderCSSMode { RespectCSSProperties, @@ -191,7 +189,7 @@ private: SVGZoomAndPanType m_zoomAndPan; RefPtr<SMILTimeContainer> m_timeContainer; FloatPoint m_translation; - mutable OwnPtr<SVGViewSpec> m_viewSpec; + RefPtr<SVGViewSpec> m_viewSpec; }; } // namespace WebCore diff --git a/Source/WebCore/svg/SVGSVGElement.idl b/Source/WebCore/svg/SVGSVGElement.idl index 8fcd3d81e..54f4c619f 100644 --- a/Source/WebCore/svg/SVGSVGElement.idl +++ b/Source/WebCore/svg/SVGSVGElement.idl @@ -48,9 +48,8 @@ module svg { readonly attribute float pixelUnitToMillimeterY; readonly attribute float screenPixelToMillimeterX; readonly attribute float screenPixelToMillimeterY; - attribute boolean useCurrentView - /*setter raises(DOMException)*/; - // TODO readonly attribute SVGViewSpec currentView; + readonly attribute boolean useCurrentView; + readonly attribute SVGViewSpec currentView; attribute float currentScale /*setter raises(DOMException)*/; readonly attribute SVGPoint currentTranslate; diff --git a/Source/WebCore/svg/SVGSymbolElement.cpp b/Source/WebCore/svg/SVGSymbolElement.cpp index 9c2f68639..d3a1f3abe 100644 --- a/Source/WebCore/svg/SVGSymbolElement.cpp +++ b/Source/WebCore/svg/SVGSymbolElement.cpp @@ -76,7 +76,7 @@ void SVGSymbolElement::parseAttribute(const Attribute& attribute) return; if (SVGExternalResourcesRequired::parseAttribute(attribute)) return; - if (SVGFitToViewBox::parseAttribute(document(), attribute)) + if (SVGFitToViewBox::parseAttribute(this, attribute)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGTests.cpp b/Source/WebCore/svg/SVGTests.cpp index 991893835..63235a492 100644 --- a/Source/WebCore/svg/SVGTests.cpp +++ b/Source/WebCore/svg/SVGTests.cpp @@ -38,6 +38,7 @@ const SVGPropertyInfo* SVGTests::requiredFeaturesPropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedUnknown, + PropertyIsReadWrite, SVGNames::requiredFeaturesAttr, SVGNames::requiredFeaturesAttr.localName(), &SVGElement::synchronizeRequiredFeatures, @@ -52,6 +53,7 @@ const SVGPropertyInfo* SVGTests::requiredExtensionsPropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedUnknown, + PropertyIsReadWrite, SVGNames::requiredExtensionsAttr, SVGNames::requiredExtensionsAttr.localName(), &SVGElement::synchronizeRequiredExtensions, @@ -66,6 +68,7 @@ const SVGPropertyInfo* SVGTests::systemLanguagePropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedUnknown, + PropertyIsReadWrite, SVGNames::systemLanguageAttr, SVGNames::systemLanguageAttr.localName(), &SVGElement::synchronizeSystemLanguage, @@ -173,7 +176,7 @@ void SVGTests::synchronizeRequiredFeatures(SVGElement* contextElement) if (!m_requiredFeatures.shouldSynchronize) return; AtomicString value(m_requiredFeatures.value.valueAsString()); - SVGAnimatedPropertySynchronizer<true>::synchronize(contextElement, requiredFeaturesPropertyInfo()->attributeName, value); + m_requiredFeatures.synchronize(contextElement, requiredFeaturesPropertyInfo()->attributeName, value); } void SVGTests::synchronizeRequiredExtensions(SVGElement* contextElement) @@ -182,7 +185,7 @@ void SVGTests::synchronizeRequiredExtensions(SVGElement* contextElement) if (!m_requiredExtensions.shouldSynchronize) return; AtomicString value(m_requiredExtensions.value.valueAsString()); - SVGAnimatedPropertySynchronizer<true>::synchronize(contextElement, requiredExtensionsPropertyInfo()->attributeName, value); + m_requiredExtensions.synchronize(contextElement, requiredExtensionsPropertyInfo()->attributeName, value); } void SVGTests::synchronizeSystemLanguage(SVGElement* contextElement) @@ -191,7 +194,7 @@ void SVGTests::synchronizeSystemLanguage(SVGElement* contextElement) if (!m_systemLanguage.shouldSynchronize) return; AtomicString value(m_systemLanguage.value.valueAsString()); - SVGAnimatedPropertySynchronizer<true>::synchronize(contextElement, systemLanguagePropertyInfo()->attributeName, value); + m_systemLanguage.synchronize(contextElement, systemLanguagePropertyInfo()->attributeName, value); } SVGStringList& SVGTests::requiredFeatures() diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp index 612b605e4..8b7041f89 100644 --- a/Source/WebCore/svg/SVGTextContentElement.cpp +++ b/Source/WebCore/svg/SVGTextContentElement.cpp @@ -44,6 +44,7 @@ const SVGPropertyInfo* SVGTextContentElement::textLengthPropertyInfo() static const SVGPropertyInfo* s_propertyInfo = 0; if (!s_propertyInfo) { s_propertyInfo = new SVGPropertyInfo(AnimatedLength, + PropertyIsReadWrite, SVGNames::textLengthAttr, SVGNames::textLengthAttr.localName(), &SVGTextContentElement::synchronizeTextLength, @@ -80,14 +81,14 @@ void SVGTextContentElement::synchronizeTextLength(void* contextElement) if (!ownerType->m_textLength.shouldSynchronize) return; AtomicString value(SVGPropertyTraits<SVGLength>::toString(ownerType->m_specifiedTextLength)); - SVGAnimatedPropertySynchronizer<true>::synchronize(ownerType, textLengthPropertyInfo()->attributeName, value); + ownerType->m_textLength.synchronize(ownerType, textLengthPropertyInfo()->attributeName, value); } PassRefPtr<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(void* contextElement) { ASSERT(contextElement); SVGTextContentElement* ownerType = static_cast<SVGTextContentElement*>(contextElement); - return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLength, true> + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLength> (ownerType, textLengthPropertyInfo(), ownerType->m_textLength.value); } diff --git a/Source/WebCore/svg/SVGViewElement.cpp b/Source/WebCore/svg/SVGViewElement.cpp index dabe9db5c..da4b0d9cf 100644 --- a/Source/WebCore/svg/SVGViewElement.cpp +++ b/Source/WebCore/svg/SVGViewElement.cpp @@ -83,7 +83,7 @@ void SVGViewElement::parseAttribute(const Attribute& attribute) if (SVGExternalResourcesRequired::parseAttribute(attribute)) return; - if (SVGFitToViewBox::parseAttribute(document(), attribute)) + if (SVGFitToViewBox::parseAttribute(this, attribute)) return; if (SVGZoomAndPan::parseAttribute(this, attribute)) return; diff --git a/Source/WebCore/svg/SVGViewElement.h b/Source/WebCore/svg/SVGViewElement.h index 11f58388a..8c92f31bb 100644 --- a/Source/WebCore/svg/SVGViewElement.h +++ b/Source/WebCore/svg/SVGViewElement.h @@ -44,7 +44,6 @@ public: using SVGStyledElement::deref; SVGStringList& viewTarget() { return m_viewTarget; } - SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } diff --git a/Source/WebCore/svg/SVGViewSpec.cpp b/Source/WebCore/svg/SVGViewSpec.cpp index 8bb040055..08ab852f0 100644 --- a/Source/WebCore/svg/SVGViewSpec.cpp +++ b/Source/WebCore/svg/SVGViewSpec.cpp @@ -23,6 +23,8 @@ #include "SVGViewSpec.h" #include "Document.h" +#include "SVGAnimatedTransformList.h" +#include "SVGFitToViewBox.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGSVGElement.h" @@ -30,36 +32,105 @@ namespace WebCore { -// Animated property definitions -DEFINE_ANIMATED_RECT(SVGViewSpec, SVGNames::viewBoxAttr, ViewBox, viewBox) -DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewSpec, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) +// Define custom animated property 'viewBox'. +const SVGPropertyInfo* SVGViewSpec::viewBoxPropertyInfo() +{ + static const SVGPropertyInfo* s_propertyInfo = 0; + if (!s_propertyInfo) { + s_propertyInfo = new SVGPropertyInfo(AnimatedRect, + PropertyIsReadOnly, + SVGNames::viewBoxAttr, + viewBoxIdentifier(), + 0, + &SVGViewSpec::lookupOrCreateViewBoxWrapper); + } + return s_propertyInfo; +} -BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewSpec) - REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) - REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) -END_REGISTER_ANIMATED_PROPERTIES +// Define custom animated property 'preserveAspectRatio'. +const SVGPropertyInfo* SVGViewSpec::preserveAspectRatioPropertyInfo() +{ + static const SVGPropertyInfo* s_propertyInfo = 0; + if (!s_propertyInfo) { + s_propertyInfo = new SVGPropertyInfo(AnimatedPreserveAspectRatio, + PropertyIsReadOnly, + SVGNames::preserveAspectRatioAttr, + preserveAspectRatioIdentifier(), + 0, + &SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper); + } + return s_propertyInfo; +} + + +// Define custom non-animated property 'transform'. +const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo() +{ + static const SVGPropertyInfo* s_propertyInfo = 0; + if (!s_propertyInfo) { + s_propertyInfo = new SVGPropertyInfo(AnimatedTransformList, + PropertyIsReadOnly, + SVGNames::transformAttr, + transformIdentifier(), + 0, + &SVGViewSpec::lookupOrCreateTransformWrapper); + } + return s_propertyInfo; +} SVGViewSpec::SVGViewSpec(SVGElement* contextElement) : m_contextElement(contextElement) , m_zoomAndPan(SVGZoomAndPanMagnify) { ASSERT(m_contextElement); - registerAnimatedPropertiesForSVGViewSpec(); +} + +const AtomicString& SVGViewSpec::viewBoxIdentifier() +{ + DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecViewBoxAttribute")); + return s_identifier; +} + +const AtomicString& SVGViewSpec::preserveAspectRatioIdentifier() +{ + DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecPreserveAspectRatioAttribute")); + return s_identifier; +} + +const AtomicString& SVGViewSpec::transformIdentifier() +{ + DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecTransformAttribute")); + return s_identifier; +} + +void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionCode& ec) +{ + // SVGViewSpec and all of its content is read-only. + ec = NO_MODIFICATION_ALLOWED_ERR; } void SVGViewSpec::setTransformString(const String& transform) { - m_transform.parse(transform); + if (!m_contextElement) + return; + + SVGTransformList newList; + newList.parse(transform); + + if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGElement, SVGAnimatedTransformList>(m_contextElement, transformPropertyInfo())) + static_cast<SVGAnimatedTransformList*>(wrapper)->detachListWrappers(newList.size()); + + m_transform = newList; } -void SVGViewSpec::setViewBoxString(const String& viewBoxStr) +String SVGViewSpec::transformString() const { - FloatRect viewBox; - const UChar* c = viewBoxStr.characters(); - const UChar* end = c + viewBoxStr.length(); - if (!parseViewBox(m_contextElement->document(), c, end, viewBox, false)) - return; - setViewBoxBaseValue(viewBox); + return SVGPropertyTraits<SVGTransformList>::toString(m_transform); +} + +String SVGViewSpec::viewBoxString() const +{ + return SVGPropertyTraits<FloatRect>::toString(viewBoxBaseValue()); } void SVGViewSpec::setPreserveAspectRatioString(const String& preserve) @@ -69,16 +140,54 @@ void SVGViewSpec::setPreserveAspectRatioString(const String& preserve) setPreserveAspectRatioBaseValue(preserveAspectRatio); } -void SVGViewSpec::setViewTargetString(const String& viewTargetString) +String SVGViewSpec::preserveAspectRatioString() const { - m_viewTargetString = viewTargetString; + return SVGPropertyTraits<SVGPreserveAspectRatio>::toString(preserveAspectRatioBaseValue()); } SVGElement* SVGViewSpec::viewTarget() const { + if (!m_contextElement) + return 0; return static_cast<SVGElement*>(m_contextElement->treeScope()->getElementById(m_viewTargetString)); } +SVGTransformListPropertyTearOff* SVGViewSpec::transform() +{ + // Return the animVal here, as its readonly by default - which is exactly what we want here. + return static_cast<SVGTransformListPropertyTearOff*>(static_pointer_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal()); +} + +PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(void* maskedOwnerType) +{ + ASSERT(maskedOwnerType); + SVGViewSpec* ownerType = static_cast<SVGViewSpec*>(maskedOwnerType); + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox); +} + +PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(void* maskedOwnerType) +{ + ASSERT(maskedOwnerType); + SVGViewSpec* ownerType = static_cast<SVGViewSpec*>(maskedOwnerType); + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio>(ownerType->contextElement(), preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio); +} + +PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(void* maskedOwnerType) +{ + ASSERT(maskedOwnerType); + SVGViewSpec* ownerType = static_cast<SVGViewSpec*>(maskedOwnerType); + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformList>(ownerType->contextElement(), transformPropertyInfo(), ownerType->m_transform); +} + +void SVGViewSpec::reset() +{ + m_zoomAndPan = SVGZoomAndPanMagnify; + m_transform.clear(); + m_viewBox = FloatRect(); + m_preserveAspectRatio = SVGPreserveAspectRatio(); + m_viewTargetString = emptyString(); +} + static const UChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'}; static const UChar viewBoxSpec[] = {'v', 'i', 'e', 'w', 'B', 'o', 'x'}; static const UChar preserveAspectRatioSpec[] = {'p', 'r', 'e', 's', 'e', 'r', 'v', 'e', 'A', 's', 'p', 'e', 'c', 't', 'R', 'a', 't', 'i', 'o'}; @@ -91,7 +200,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) const UChar* currViewSpec = viewSpec.characters(); const UChar* end = currViewSpec + viewSpec.length(); - if (currViewSpec >= end) + if (currViewSpec >= end || !m_contextElement) return false; if (!skipString(currViewSpec, end, svgViewSpec, WTF_ARRAY_LENGTH(svgViewSpec))) @@ -108,7 +217,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) return false; currViewSpec++; FloatRect viewBox; - if (!parseViewBox(m_contextElement->document(), currViewSpec, end, viewBox, false)) + if (!SVGFitToViewBox::parseViewBox(m_contextElement->document(), currViewSpec, end, viewBox, false)) return false; setViewBoxBaseValue(viewBox); if (currViewSpec >= end || *currViewSpec != ')') diff --git a/Source/WebCore/svg/SVGViewSpec.h b/Source/WebCore/svg/SVGViewSpec.h index 1e4c27158..94456db31 100644 --- a/Source/WebCore/svg/SVGViewSpec.h +++ b/Source/WebCore/svg/SVGViewSpec.h @@ -30,42 +30,91 @@ namespace WebCore { class SVGElement; +class SVGTransformListPropertyTearOff; -class SVGViewSpec : public SVGZoomAndPan, - public SVGFitToViewBox { - WTF_MAKE_NONCOPYABLE(SVGViewSpec); +class SVGViewSpec : public RefCounted<SVGViewSpec> + , public SVGZoomAndPan + , public SVGFitToViewBox { public: - SVGViewSpec(SVGElement*); + virtual ~SVGViewSpec() { } - bool parseViewSpec(const String&); + using RefCounted<SVGViewSpec>::ref; + using RefCounted<SVGViewSpec>::deref; - void setTransformString(const String&); - SVGTransformList transform() const { return m_transform; } - SVGTransformList transformBaseValue() const { return m_transform; } + static PassRefPtr<SVGViewSpec> create(SVGElement* contextElement) + { + return adoptRef(new SVGViewSpec(contextElement)); + } - void setViewBoxString(const String&); + bool parseViewSpec(const String&); + void reset(); + + SVGElement* viewTarget() const; + String viewBoxString() const; void setPreserveAspectRatioString(const String&); + String preserveAspectRatioString() const; - void setViewTargetString(const String&); + void setTransformString(const String&); + String transformString() const; + + void setViewTargetString(const String& string) { m_viewTargetString = string; } String viewTargetString() const { return m_viewTargetString; } - SVGElement* viewTarget() const; SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } + void setZoomAndPan(unsigned short zoomAndPan) { setZoomAndPanBaseValue(zoomAndPan); } void setZoomAndPan(unsigned short, ExceptionCode&); void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } + SVGElement* contextElement() const { return m_contextElement; } + void resetContextElement() { m_contextElement = 0; } + + // Custom non-animated 'transform' property. + SVGTransformListPropertyTearOff* transform(); + SVGTransformList transformBaseValue() const { return m_transform; } + + // Custom animated 'viewBox' property. + PassRefPtr<SVGAnimatedRect> viewBoxAnimated() + { + return static_pointer_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this)); + } + + FloatRect& viewBox() { return m_viewBox; } + FloatRect viewBoxBaseValue() const { return m_viewBox; } + void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; } + + // Custom animated 'preserveAspectRatio' property. + PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() + { + return static_pointer_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this)); + } + + SVGPreserveAspectRatio& preserveAspectRatio() { return m_preserveAspectRatio; } + SVGPreserveAspectRatio preserveAspectRatioBaseValue() const { return m_preserveAspectRatio; } + void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } + private: - SVGElement* m_contextElement; + SVGViewSpec(SVGElement*); - BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGViewSpec) - DECLARE_ANIMATED_RECT(ViewBox, viewBox) - DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) - END_DECLARE_ANIMATED_PROPERTIES + static const SVGPropertyInfo* transformPropertyInfo(); + static const SVGPropertyInfo* viewBoxPropertyInfo(); + static const SVGPropertyInfo* preserveAspectRatioPropertyInfo(); + + static const AtomicString& transformIdentifier(); + static const AtomicString& viewBoxIdentifier(); + static const AtomicString& preserveAspectRatioIdentifier(); + + static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTransformWrapper(void* contextElement); + static PassRefPtr<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(void* contextElement); + static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(void* contextElement); + + SVGElement* m_contextElement; + SVGZoomAndPanType m_zoomAndPan; SVGTransformList m_transform; + FloatRect m_viewBox; + SVGPreserveAspectRatio m_preserveAspectRatio; String m_viewTargetString; - SVGZoomAndPanType m_zoomAndPan; }; } // namespace WebCore diff --git a/Source/WebCore/svg/SVGViewSpec.idl b/Source/WebCore/svg/SVGViewSpec.idl index e4ba46b23..ec545d14b 100644 --- a/Source/WebCore/svg/SVGViewSpec.idl +++ b/Source/WebCore/svg/SVGViewSpec.idl @@ -25,16 +25,26 @@ module svg { + // SVGViewSpec intentionally doesn't inherit from SVGZoomAndPan & SVGFitToViewBox on the IDLs. + // It would require that any of those classes would be RefCounted, and we want to avoid that. interface [ - Conditional=SVG - ] SVGViewSpec : SVGZoomAndPan, SVGFitToViewBox - { + Conditional=SVG, + JSGenerateToJSObject + ] SVGViewSpec { readonly attribute SVGTransformList transform; - readonly attribute SVGElement viewTarget; - readonly attribute DOMString viewBoxString; - readonly attribute DOMString preserveAspectRatioString; - readonly attribute DOMString transformString; - readonly attribute DOMString viewTargetString; + readonly attribute SVGElement viewTarget; + readonly attribute DOMString viewBoxString; + readonly attribute DOMString preserveAspectRatioString; + readonly attribute DOMString transformString; + readonly attribute DOMString viewTargetString; + + // SVGZoomAndPan + attribute unsigned short zoomAndPan + setter raises(DOMException); + + // SVGFitToViewBox + readonly attribute SVGAnimatedRect viewBox; + readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; }; } diff --git a/Source/WebCore/svg/properties/SVGAnimatedProperty.h b/Source/WebCore/svg/properties/SVGAnimatedProperty.h index c64bac531..6dfdac6dd 100644 --- a/Source/WebCore/svg/properties/SVGAnimatedProperty.h +++ b/Source/WebCore/svg/properties/SVGAnimatedProperty.h @@ -36,6 +36,8 @@ public: const QualifiedName& attributeName() const { return m_attributeName; } AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; } bool isAnimating() const { return m_isAnimating; } + bool isReadOnly() const { return m_isReadOnly; } + void setIsReadOnly() { m_isReadOnly = true; } void commitChange() { @@ -66,66 +68,33 @@ public: ASSERT(!m_isAnimating); } - // lookupOrCreateWrapper & helper methods. - template<typename TearOffType, typename PropertyType, bool isDerivedFromSVGElement> - struct LookupOrCreateHelper; - - template<typename TearOffType, typename PropertyType> - struct LookupOrCreateHelper<TearOffType, PropertyType, false> { - static PassRefPtr<TearOffType> lookupOrCreateWrapper(void*, const SVGPropertyInfo*, PropertyType&) - { - ASSERT_NOT_REACHED(); - return PassRefPtr<TearOffType>(); - } - }; - - template<typename TearOffType, typename PropertyType> - struct LookupOrCreateHelper<TearOffType, PropertyType, true> { - static PassRefPtr<TearOffType> lookupOrCreateWrapper(SVGElement* element, const SVGPropertyInfo* info, PropertyType& property) - { - ASSERT(info); - SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); - RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key); - if (!wrapper) { - wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); - animatedPropertyCache()->set(key, wrapper.get()); - } - return static_pointer_cast<TearOffType>(wrapper); - } - }; - - template<typename OwnerType, typename TearOffType, typename PropertyType, bool isDerivedFromSVGElement> + template<typename OwnerType, typename TearOffType, typename PropertyType> static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property) { - return LookupOrCreateHelper<TearOffType, PropertyType, isDerivedFromSVGElement>::lookupOrCreateWrapper(element, info, property); + ASSERT(info); + SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); + RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key); + if (!wrapper) { + wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); + if (info->animatedPropertyState == PropertyIsReadOnly) + wrapper->setIsReadOnly(); + animatedPropertyCache()->set(key, wrapper.get()); + } + return static_pointer_cast<TearOffType>(wrapper); } - // lookupWrapper & helper methods. - template<typename TearOffType, bool isDerivedFromSVGElement> - struct LookupHelper; - - template<typename TearOffType> - struct LookupHelper<TearOffType, false> { - static TearOffType* lookupWrapper(const void*, const SVGPropertyInfo*) - { - return 0; - } - }; - - template<typename TearOffType> - struct LookupHelper<TearOffType, true> { - static TearOffType* lookupWrapper(const SVGElement* element, const SVGPropertyInfo* info) - { - ASSERT(info); - SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(element), info->propertyIdentifier); - return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); - } - }; + template<typename OwnerType, typename TearOffType> + static TearOffType* lookupWrapper(OwnerType* element, const SVGPropertyInfo* info) + { + ASSERT(info); + SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); + return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); + } - template<typename OwnerType, typename TearOffType, bool isDerivedFromSVGElement> + template<typename OwnerType, typename TearOffType> static TearOffType* lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info) { - return LookupHelper<TearOffType, isDerivedFromSVGElement>::lookupWrapper(element, info); + return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info); } protected: @@ -134,6 +103,7 @@ protected: , m_attributeName(attributeName) , m_animatedPropertyType(animatedPropertyType) , m_isAnimating(false) + , m_isReadOnly(false) { } @@ -150,6 +120,7 @@ private: protected: bool m_isAnimating; + bool m_isReadOnly; }; } diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h index 2b69c13e3..2adb8b66f 100644 --- a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h +++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h @@ -23,30 +23,13 @@ #define SVGAnimatedPropertyMacros_h #if ENABLE(SVG) +#include "SVGAnimatedProperty.h" #include "SVGAttributeToPropertyMap.h" #include "SVGPropertyTraits.h" #include <wtf/StdLibExtras.h> namespace WebCore { -// IsDerivedFromSVGElement implementation -template<typename OwnerType> -struct IsDerivedFromSVGElement { - static const bool value = true; -}; - -class SVGTests; -template<> -struct IsDerivedFromSVGElement<SVGTests> { - static const bool value = false; -}; - -class SVGViewSpec; -template<> -struct IsDerivedFromSVGElement<SVGViewSpec> { - static const bool value = false; -}; - // SVGSynchronizableAnimatedProperty implementation template<typename PropertyType> struct SVGSynchronizableAnimatedProperty { @@ -70,6 +53,22 @@ struct SVGSynchronizableAnimatedProperty { { } + void synchronize(SVGElement* ownerElement, const QualifiedName& attrName, const AtomicString& value) + { + // If the attribute already exists on the element, we change the + // Attribute directly to avoid a call to Element::attributeChanged + // that could cause the SVGElement to erroneously reset its properties. + // svg/dom/SVGStringList-basics.xhtml exercises this behavior. + ElementAttributeData* attributeData = ownerElement->ensureUpdatedAttributeData(); + Attribute* old = attributeData->getAttributeItem(attrName); + if (old && value.isNull()) + attributeData->removeAttribute(old->name(), ownerElement); + else if (!old && !value.isNull()) + attributeData->addAttribute(Attribute(attrName, value), ownerElement); + else if (old && !value.isNull()) + old->setValue(value); + } + PropertyType value; bool shouldSynchronize : 1; }; @@ -102,6 +101,7 @@ static void registerAnimatedPropertiesFor##OwnerType() \ const SVGPropertyInfo* OwnerType::LowerProperty##PropertyInfo() { \ DEFINE_STATIC_LOCAL(const SVGPropertyInfo, s_propertyInfo, \ (AnimatedPropertyTypeEnum, \ + PropertyIsReadWrite, \ DOMAttribute, \ SVGDOMAttributeIdentifier, \ &OwnerType::synchronize##UpperProperty, \ @@ -124,7 +124,7 @@ public: \ static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \ PropertyType& LowerProperty() const \ { \ - if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType, IsDerivedFromSVGElement<UseOwnerType>::value>(this, LowerProperty##PropertyInfo())) { \ + if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \ if (wrapper->isAnimating()) \ return wrapper->currentAnimatedValue(); \ } \ @@ -153,14 +153,14 @@ private: \ if (!m_##LowerProperty.shouldSynchronize) \ return; \ AtomicString value(SVGPropertyTraits<PropertyType>::toString(m_##LowerProperty.value)); \ - SVGAnimatedPropertySynchronizer<IsDerivedFromSVGElement<UseOwnerType>::value>::synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \ + m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \ } \ \ static PassRefPtr<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrapper(void* maskedOwnerType) \ { \ ASSERT(maskedOwnerType); \ UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \ - return SVGAnimatedProperty::lookupOrCreateWrapper<UseOwnerType, TearOffType, PropertyType, IsDerivedFromSVGElement<UseOwnerType>::value>(ownerType, LowerProperty##PropertyInfo(), ownerType->m_##LowerProperty.value); \ + return SVGAnimatedProperty::lookupOrCreateWrapper<UseOwnerType, TearOffType, PropertyType>(ownerType, LowerProperty##PropertyInfo(), ownerType->m_##LowerProperty.value); \ } \ \ static void synchronize##UpperProperty(void* maskedOwnerType) \ @@ -179,7 +179,7 @@ private: \ DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \ { \ - if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType, IsDerivedFromSVGElement<UseOwnerType>::value>(this, LowerProperty##PropertyInfo())) \ + if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) \ wrapper->detachListWrappers(newListSize); \ } diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h b/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h deleted file mode 100644 index 887bc181a..000000000 --- a/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) Research In Motion Limited 2010. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGAnimatedPropertySynchronizer_h -#define SVGAnimatedPropertySynchronizer_h - -#if ENABLE(SVG) -#include "SVGElement.h" - -namespace WebCore { - -// Helper template used for synchronizing SVG <-> XML properties -template<bool isDerivedFromSVGElement> -struct SVGAnimatedPropertySynchronizer; - -template<> -struct SVGAnimatedPropertySynchronizer<true> { - static void synchronize(SVGElement* ownerElement, const QualifiedName& attrName, const AtomicString& value) - { - // If the attribute already exists on the element, we change the - // Attribute directly to avoid a call to Element::attributeChanged - // that could cause the SVGElement to erroneously reset its properties. - // svg/dom/SVGStringList-basics.xhtml exercises this behavior. - ElementAttributeData* attributeData = ownerElement->ensureUpdatedAttributeData(); - Attribute* old = attributeData->getAttributeItem(attrName); - if (old && value.isNull()) - attributeData->removeAttribute(old->name(), ownerElement); - else if (!old && !value.isNull()) - attributeData->addAttribute(Attribute(attrName, value), ownerElement); - else if (old && !value.isNull()) - old->setValue(value); - } -}; - -template<> -struct SVGAnimatedPropertySynchronizer<false> { - static void synchronize(void*, const QualifiedName&, const AtomicString&) - { - // no-op, for types not inheriting from Element, thus nothing to synchronize - } -}; - -}; - -#endif -#endif diff --git a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h b/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h index 8e4cd577e..3203c4db8 100644 --- a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h +++ b/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h @@ -21,15 +21,13 @@ #define SVGAttributeToPropertyMap_h #if ENABLE(SVG) -#include "QualifiedName.h" -#include "SVGAnimatedPropertySynchronizer.h" +#include "SVGPropertyInfo.h" #include <wtf/HashMap.h> namespace WebCore { class SVGAnimatedProperty; class SVGElement; -struct SVGPropertyInfo; class SVGAttributeToPropertyMap { public: diff --git a/Source/WebCore/svg/properties/SVGListProperty.h b/Source/WebCore/svg/properties/SVGListProperty.h index db3def7bb..aed4ad49e 100644 --- a/Source/WebCore/svg/properties/SVGListProperty.h +++ b/Source/WebCore/svg/properties/SVGListProperty.h @@ -415,8 +415,6 @@ public: return newItem.release(); } - virtual SVGPropertyRole role() const { return m_role; } - PropertyType& values() { ASSERT(m_values); diff --git a/Source/WebCore/svg/properties/SVGListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGListPropertyTearOff.h index 415df822b..c3bba4be1 100644 --- a/Source/WebCore/svg/properties/SVGListPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGListPropertyTearOff.h @@ -37,6 +37,7 @@ public: typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff; typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache; + using Base::m_role; using Base::m_values; using Base::m_wrappers; @@ -115,6 +116,15 @@ protected: { } + virtual bool isReadOnly() const + { + if (m_role == AnimValRole) + return true; + if (m_animatedProperty && m_animatedProperty->isReadOnly()) + return true; + return false; + } + virtual void commitChange() { ASSERT(m_values); diff --git a/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h index 3fccebf19..4f41af397 100644 --- a/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h @@ -126,6 +126,17 @@ private: SVGPathElement* contextElement() const; + using Base::m_role; + + virtual bool isReadOnly() const + { + if (m_role == AnimValRole) + return true; + if (m_animatedProperty && m_animatedProperty->isReadOnly()) + return true; + return false; + } + virtual void commitChange() { ASSERT(m_values); diff --git a/Source/WebCore/svg/properties/SVGProperty.h b/Source/WebCore/svg/properties/SVGProperty.h index 609e264b1..69394e3f5 100644 --- a/Source/WebCore/svg/properties/SVGProperty.h +++ b/Source/WebCore/svg/properties/SVGProperty.h @@ -35,7 +35,7 @@ class SVGProperty : public RefCounted<SVGProperty> { public: virtual ~SVGProperty() { } - virtual SVGPropertyRole role() const = 0; + virtual bool isReadOnly() const = 0; virtual void commitChange() = 0; }; diff --git a/Source/WebCore/svg/properties/SVGPropertyInfo.h b/Source/WebCore/svg/properties/SVGPropertyInfo.h index 579312808..c2f733476 100644 --- a/Source/WebCore/svg/properties/SVGPropertyInfo.h +++ b/Source/WebCore/svg/properties/SVGPropertyInfo.h @@ -28,6 +28,11 @@ namespace WebCore { class SVGAnimatedProperty; +enum AnimatedPropertyState { + PropertyIsReadWrite, + PropertyIsReadOnly +}; + enum AnimatedPropertyType { AnimatedAngle, AnimatedBoolean, @@ -53,10 +58,11 @@ struct SVGPropertyInfo { typedef void (*SynchronizeProperty)(void*); typedef PassRefPtr<SVGAnimatedProperty> (*LookupOrCreateWrapperForAnimatedProperty)(void*); - SVGPropertyInfo(AnimatedPropertyType newType, const QualifiedName& newAttributeName, + SVGPropertyInfo(AnimatedPropertyType newType, AnimatedPropertyState newState, const QualifiedName& newAttributeName, const AtomicString& newPropertyIdentifier, SynchronizeProperty newSynchronizeProperty, LookupOrCreateWrapperForAnimatedProperty newLookupOrCreateWrapperForAnimatedProperty) : animatedPropertyType(newType) + , animatedPropertyState(newState) , attributeName(newAttributeName) , propertyIdentifier(newPropertyIdentifier) , synchronizeProperty(newSynchronizeProperty) @@ -65,6 +71,7 @@ struct SVGPropertyInfo { } AnimatedPropertyType animatedPropertyType; + AnimatedPropertyState animatedPropertyState; const QualifiedName& attributeName; const AtomicString& propertyIdentifier; SynchronizeProperty synchronizeProperty; diff --git a/Source/WebCore/svg/properties/SVGPropertyTearOff.h b/Source/WebCore/svg/properties/SVGPropertyTearOff.h index c7739ef2a..07dbd10f0 100644 --- a/Source/WebCore/svg/properties/SVGPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGPropertyTearOff.h @@ -96,7 +96,14 @@ public: m_animatedProperty->commitChange(); } - virtual SVGPropertyRole role() const { return m_role; } + virtual bool isReadOnly() const + { + if (m_role == AnimValRole) + return true; + if (m_animatedProperty && m_animatedProperty->isReadOnly()) + return true; + return false; + } protected: SVGPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& value) diff --git a/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h index 863537883..b39aaf3c1 100644 --- a/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h @@ -33,6 +33,7 @@ public: typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType; typedef SVGPropertyTearOff<ListItemType> ListItemTearOff; + using Base::m_role; using Base::m_values; static PassRefPtr<SVGStaticListPropertyTearOff<PropertyType> > create(SVGElement* contextElement, PropertyType& values) @@ -84,6 +85,11 @@ private: { } + virtual bool isReadOnly() const + { + return m_role == AnimValRole; + } + virtual void commitChange() { ASSERT(m_values); diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index d99335b91..60304aa65 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -101,6 +101,11 @@ InternalSettings::InternalSettings(Frame* frame) , m_originalEditingBehavior(settings()->editingBehaviorType()) , m_originalFixedPositionCreatesStackingContext(settings()->fixedPositionCreatesStackingContext()) , m_originalSyncXHRInDocumentsEnabled(settings()->syncXHRInDocumentsEnabled()) +#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) + , m_originalJavaScriptProfilingEnabled(page() && page()->inspectorController() && page()->inspectorController()->profilerEnabled()) +#endif + , m_originalWindowFocusRestricted(settings()->windowFocusRestricted()) + , m_originalDeviceSupportsTouch(settings()->deviceSupportsTouch()) { } @@ -115,6 +120,12 @@ void InternalSettings::restoreTo(Settings* settings) settings->setEditingBehaviorType(m_originalEditingBehavior); settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext); settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled); +#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) + if (page() && page()->inspectorController()) + page()->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); +#endif + settings->setWindowFocusRestricted(m_originalWindowFocusRestricted); + settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch); } Settings* InternalSettings::settings() const @@ -251,6 +262,12 @@ void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode #endif } +void InternalSettings::setDeviceSupportsTouch(bool enabled, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + settings()->setDeviceSupportsTouch(enabled); +} + typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode); static void setFontFamily(Settings* settings, const String& family, const String& script, SetFontFamilyFunction setter) { @@ -360,4 +377,26 @@ void InternalSettings::setSyncXHRInDocumentsEnabled(bool creates, ExceptionCode& settings()->setSyncXHRInDocumentsEnabled(creates); } +void InternalSettings::setJavaScriptProfilingEnabled(bool enabled, ExceptionCode& ec) +{ +#if ENABLE(INSPECTOR) + if (!page() || !page()->inspectorController()) { + ec = INVALID_ACCESS_ERR; + return; + } + + page()->inspectorController()->setProfilerEnabled(enabled); +#else + UNUSED_PARAM(enabled); + UNUSED_PARAM(ec); + return; +#endif +} + +void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + settings()->setWindowFocusRestricted(restricted); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index 92b1bdfeb..affef0790 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -63,6 +63,7 @@ public: void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&); void setPerTileDrawingEnabled(bool enabled, ExceptionCode&); void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&); + void setDeviceSupportsTouch(bool enabled, ExceptionCode&); void setShadowDOMEnabled(bool enabled, ExceptionCode&); void setStandardFontFamily(const String& family, const String& script, ExceptionCode&); void setSerifFontFamily(const String& family, const String& script, ExceptionCode&); @@ -78,9 +79,12 @@ public: void setEditingBehavior(const String&, ExceptionCode&); void setFixedPositionCreatesStackingContext(bool, ExceptionCode&); void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&); + void setWindowFocusRestricted(bool, ExceptionCode&); void restoreTo(Settings*); + void setJavaScriptProfilingEnabled(bool enabled, ExceptionCode&); + private: InternalSettings(Frame*); @@ -97,6 +101,11 @@ private: EditingBehaviorType m_originalEditingBehavior; bool m_originalFixedPositionCreatesStackingContext; bool m_originalSyncXHRInDocumentsEnabled; +#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) + bool m_originalJavaScriptProfilingEnabled; +#endif + bool m_originalWindowFocusRestricted; + bool m_originalDeviceSupportsTouch; }; } // namespace WebCore diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index 2ef35f2ab..53c517638 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -41,6 +41,7 @@ module window { boolean unifiedTextCheckingEnabled() raises (DOMException); void setPageScaleFactor(in float scaleFactor, in long x, in long y) raises(DOMException); void setTouchEventEmulationEnabled(in boolean enabled) raises(DOMException); + void setDeviceSupportsTouch(in boolean enabled) raises(DOMException); void setShadowDOMEnabled(in boolean enabled) raises(DOMException); void setStandardFontFamily(in DOMString family, in DOMString script) raises(DOMException); void setSerifFontFamily(in DOMString family, in DOMString script) raises(DOMException); @@ -56,6 +57,8 @@ module window { void setEditingBehavior(in DOMString behavior) raises(DOMException); void setFixedPositionCreatesStackingContext(in boolean creates) raises(DOMException); void setSyncXHRInDocumentsEnabled(in boolean enabled) raises(DOMException); + void setJavaScriptProfilingEnabled(in boolean creates) raises(DOMException); + void setWindowFocusRestricted(in boolean restricted) raises(DOMException); }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 842e8e144..f4ad3f68b 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -60,6 +60,7 @@ #include "ShadowRoot.h" #include "SpellChecker.h" #include "TextIterator.h" +#include "TextRun.h" #include "TreeScope.h" #if ENABLE(INPUT_TYPE_COLOR) @@ -592,6 +593,13 @@ void Internals::reset(Document* document) if (document->frame() == page->mainFrame()) setUserPreferredLanguages(Vector<String>()); } + + resetDefaultsToConsistentValues(); +} + +void Internals::resetDefaultsToConsistentValues() +{ + TextRun::setAllowsRoundingHacks(false); } bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) @@ -1050,6 +1058,10 @@ void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const controller->resumeAnimations(); } +void Internals::allowRoundingHacks() const +{ + TextRun::setAllowsRoundingHacks(true); +} #if ENABLE(FULLSCREEN_API) void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element) diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index 8e010e986..6fa4a45c6 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -168,6 +168,8 @@ public: void suspendAnimations(Document*, ExceptionCode&) const; void resumeAnimations(Document*, ExceptionCode&) const; + void allowRoundingHacks() const; + #if ENABLE(INSPECTOR) unsigned numberOfLiveNodes() const; unsigned numberOfLiveDocuments() const; @@ -184,6 +186,7 @@ public: private: explicit Internals(Document*); DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); + void resetDefaultsToConsistentValues(); RefPtr<InternalSettings> m_settings; }; diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index ef9ed753d..aa10858bb 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -137,6 +137,8 @@ module window { void suspendAnimations(in Document document) raises (DOMException); void resumeAnimations(in Document document) raises (DOMException); + void allowRoundingHacks(); + #if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS void setBatteryStatus(in Document document, in DOMString eventType, in boolean charging, in double chargingTime, in double dischargingTime, in double level) raises (DOMException); #endif diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index ec3627150..ae67e33ef 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,68 @@ +2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE][EFL] Remove unneeded include path + https://bugs.webkit.org/show_bug.cgi?id=87927 + + Reviewed by Kenneth Rohde Christiansen. + + Though *wtf* directory was moved to Source/WTF, PlatformEfl.cmake is still including the previous + path. In addition, files on EFL port are using <wtf/gobject/XXX> directly in #include line. + So, EFL port doesn't need to include ${JAVASCRIPTCORE_DIR}/wtf/gobject path anymore. + + * PlatformEfl.cmake: Remove '${JAVASCRIPTCORE_DIR}/wtf/gobject' path from include path list. + +2012-05-30 Konrad Piascik <kpiascik@rim.com> + + [BlackBerry] Add an Accelerated Compositing layer for Web Inspector DOM highlight. + https://bugs.webkit.org/show_bug.cgi?id=81001 + + Reviewed by Antonio Gomes + + Added new InspectorOverlay class + + * PlatformBlackBerry.cmake: + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebKit-side implementation of SelectionOverlay + https://bugs.webkit.org/show_bug.cgi?id=87605 + + Reviewed by Rob Buis. + + Add SelectionOverlay to the build system. + + PR #160263 + + * PlatformBlackBerry.cmake: + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87603 + + Reviewed by Rob Buis. + + Add WebOverlay related files to the build system. + + PR #156812 + + * PlatformBlackBerry.cmake: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add a default tap highlight + https://bugs.webkit.org/show_bug.cgi?id=87569 + + Reviewed by Rob Buis. + + Add DefaultTapHighlight to the build system + + Reviewed internally by Mike Lattanzio and Mike Fenton. + + PR #154329 + + * PlatformBlackBerry.cmake: + 2012-05-24 Crystal Zhang <haizhang@rim.com> [BlackBerry] Implement select popup and remove old hook to air popup diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index ef935212d..b5620273a 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -47,13 +47,16 @@ ADD_DEFINITIONS(-DUSER_PROCESSES) LIST(APPEND WebKit_SOURCES blackberry/Api/BackingStore.cpp blackberry/Api/BlackBerryGlobal.cpp - blackberry/Api/WebString.cpp + blackberry/Api/WebAnimation.cpp blackberry/Api/WebKitMIMETypeConverter.cpp blackberry/Api/WebKitTextCodec.cpp + blackberry/Api/WebOverlay.cpp + blackberry/Api/WebOverlayOverride.cpp blackberry/Api/WebPage.cpp blackberry/Api/WebPageCompositor.cpp blackberry/Api/WebPageGroupLoadDeferrer.cpp blackberry/Api/WebSettings.cpp + blackberry/Api/WebString.cpp blackberry/Api/WebViewportArguments.cpp blackberry/WebCoreSupport/AboutData.cpp blackberry/WebCoreSupport/AutofillManager.cpp @@ -72,6 +75,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp + blackberry/WebCoreSupport/InspectorOverlay.cpp blackberry/WebCoreSupport/JavaScriptDebuggerBlackBerry.cpp blackberry/WebCoreSupport/NotificationPresenterImpl.cpp blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp @@ -80,12 +84,14 @@ LIST(APPEND WebKit_SOURCES blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp blackberry/WebKitSupport/BackingStoreTile.cpp blackberry/WebKitSupport/BackingStoreClient.cpp + blackberry/WebKitSupport/DefaultTapHighlight.cpp blackberry/WebKitSupport/DOMSupport.cpp blackberry/WebKitSupport/FrameLayers.cpp blackberry/WebKitSupport/InPageSearchManager.cpp blackberry/WebKitSupport/InputHandler.cpp blackberry/WebKitSupport/RenderQueue.cpp blackberry/WebKitSupport/SelectionHandler.cpp + blackberry/WebKitSupport/SelectionOverlay.cpp blackberry/WebKitSupport/SurfacePool.cpp blackberry/WebKitSupport/TouchEventHandler.cpp blackberry/WebKitSupport/FatFingers.cpp diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index a630bacc5..54663cd47 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -10,7 +10,6 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBKIT_DIR}/efl/ewk" "${WEBKIT_DIR}/efl/WebCoreSupport" "${JAVASCRIPTCORE_DIR}/ForwardingHeaders" - "${JAVASCRIPTCORE_DIR}/wtf/gobject" "${WEBCORE_DIR}/platform/efl" "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/graphics/efl" diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 929cd9921..619c43968 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -1028,8 +1028,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) m_suspendBackingStoreUpdates ? "true" : "false"); #endif - bool blittingDirectlyToCompositingWindow = isOpenGLCompositing(); - BackingStoreGeometry* currentState = frontState(); TileMap currentMap = currentState->tileMap(); @@ -1078,7 +1076,11 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) BlackBerry::Platform::Graphics::Buffer* nativeBuffer = tile->backBuffer()->nativeBuffer(); - if (blittingDirectlyToCompositingWindow) { + // This code is only needed for EGLImage code path, and only effective if we are swapping the render target. + // This combination is only true if there's a GLES2Usage window. + // FIXME: Use an EGL fence instead, PR152132 + Window* window = m_webPage->client()->window(); + if (window && window->windowUsage() == Window::GLES2Usage) { pthread_mutex_lock(&m_blitGenerationLock); while (m_blitGeneration == tile->backBuffer()->blitGeneration()) { int err = pthread_cond_timedwait(&m_blitGenerationCond, &m_blitGenerationLock, &m_currentBlitEnd); @@ -1532,8 +1534,6 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, } } - bool blittingDirectlyToCompositingWindow = isOpenGLCompositing(); - #if USE(ACCELERATED_COMPOSITING) if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) { WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(WebCore::FloatRect(WebCore::IntRect(contents))); @@ -1542,7 +1542,7 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, paintDefaultBackground(contents, transformation, false /*flush*/); } - if (!blittingDirectlyToCompositingWindow) + if (!isOpenGLCompositing()) blendCompositingSurface(dstRect); #endif @@ -1604,7 +1604,11 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, invalidateWindow(dstRect); - if (blittingDirectlyToCompositingWindow && !blittedTiles.isEmpty()) { + // This code is only needed for EGLImage code path, and only effective if we are swapping the render target. + // This combination is only true if there's a GLES2Usage window. + // FIXME: Use an EGL fence instead + Window* window = m_webPage->client()->window(); + if (window && window->windowUsage() == Window::GLES2Usage && !blittedTiles.isEmpty()) { pthread_mutex_lock(&m_blitGenerationLock); ++m_blitGeneration; @@ -1623,6 +1627,73 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, } } +#if USE(ACCELERATED_COMPOSITING) +void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRenderer, const WebCore::TransformationMatrix& transform, const WebCore::FloatRect& contents) +{ + const Platform::IntRect transformedContentsRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedContentsSize()); + Platform::IntRect transformedContents = enclosingIntRect(m_webPage->d->m_transformationMatrix->mapRect(contents)); + transformedContents.intersect(transformedContentsRect); + if (transformedContents.isEmpty()) + return; + + if (!isActive()) + return; + + if (m_webPage->d->compositorDrawsRootLayer()) + return; + + BackingStoreGeometry* currentState = frontState(); + TileMap currentMap = currentState->tileMap(); + + Platform::IntRectRegion transformedContentsRegion = transformedContents; + Platform::IntRectRegion backingStoreRegion = currentState->backingStoreRect(); + Platform::IntRectRegion checkeredRegion + = Platform::IntRectRegion::subtractRegions(transformedContentsRegion, backingStoreRegion); + + // Blit checkered to those parts that are not covered by the backingStoreRect. + IntRectList checkeredRects = checkeredRegion.rects(); + for (size_t i = 0; i < checkeredRects.size(); ++i) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(checkeredRects.at(i)))); + + // Get the list of tile rects that makeup the content. + TileRectList tileRectList = mapFromTransformedContentsToTiles(transformedContents, currentState); + for (size_t i = 0; i < tileRectList.size(); ++i) { + TileRect tileRect = tileRectList[i]; + TileIndex index = tileRect.first; + Platform::IntRect dirtyTileRect = tileRect.second; + BackingStoreTile* tile = currentMap.get(index); + TileBuffer* tileBuffer = tile->frontBuffer(); + + // This dirty rect is in tile coordinates, but it needs to be in + // transformed contents coordinates. + Platform::IntRect dirtyRect = mapFromTilesToTransformedContents(tileRect, currentState->backingStoreRect()); + + if (!dirtyRect.intersects(transformedContents)) + continue; + + TileRect wholeTileRect; + wholeTileRect.first = index; + wholeTileRect.second = this->tileRect(); + + Platform::IntRect wholeRect = mapFromTilesToTransformedContents(wholeTileRect, currentState->backingStoreRect()); + + bool committed = tile->isCommitted(); + + if (!committed) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect))); + else { + layerRenderer->compositeBuffer(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(wholeRect)), tileBuffer->nativeBuffer(), 1.0f); + + // Intersect the rendered region. + Platform::IntRectRegion notRenderedRegion = Platform::IntRectRegion::subtractRegions(dirtyTileRect, tileBuffer->renderedRegion()); + IntRectList notRenderedRects = notRenderedRegion.rects(); + for (size_t i = 0; i < notRenderedRects.size(); ++i) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(notRenderedRects.at(i)))); + } + } +} +#endif + Platform::IntRect BackingStorePrivate::blitTileRect(TileBuffer* tileBuffer, const TileRect& tileRect, const Platform::IntPoint& origin, @@ -2372,7 +2443,8 @@ void BackingStorePrivate::renderContents(BlackBerry::Platform::Graphics::Buffer* if (m_webPage->d->m_page->inspectorController()->enabled()) { WebCore::IntPoint scrollPosition = m_client->frame()->view()->scrollPosition(); graphicsContext.translate(scrollPosition.x(), scrollPosition.y()); - m_webPage->d->m_page->inspectorController()->drawHighlight(graphicsContext); + if (m_webPage->d->m_inspectorOverlay) + m_webPage->d->m_inspectorOverlay->paintWebFrame(graphicsContext); } #endif diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index fa80a319a..36c2f638b 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -32,6 +32,8 @@ namespace WebCore { class IntRect; +class FloatRect; +class LayerRenderer; class TransformationMatrix; } @@ -196,8 +198,15 @@ public: Platform::IntRect blitTileRect(TileBuffer*, const TileRect&, const Platform::IntPoint&, const WebCore::TransformationMatrix&, BackingStoreGeometry*); #if USE(ACCELERATED_COMPOSITING) + // Use instead of blitContents if you need more control over OpenGL state. + // Note that contents is expressed in untransformed content coordinates. + // Preconditions: You have to call prepareFrame and setViewport on the LayerRenderer before + // calling this. + void compositeContents(WebCore::LayerRenderer*, const WebCore::TransformationMatrix&, const WebCore::FloatRect& contents); + void blendCompositingSurface(const Platform::IntRect& dstRect); void clearCompositingSurface(); + bool drawLayersOnCommitIfNeeded(); void drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect); // WebPage will call this when drawing layers to tell us we don't need to diff --git a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h index 03eb5bbc5..ce6dd2743 100644 --- a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h +++ b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h @@ -25,6 +25,7 @@ #include <JavaScriptCore/JSObjectRef.h> namespace WebCore { +class Credential; class Frame; class DOMWrapperWorld; class NavigationAction; @@ -81,6 +82,7 @@ public: virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction) = 0; virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, int insertAction) = 0; virtual bool isSelectTrailingWhitespaceEnabled() const = 0; + virtual bool didReceiveAuthenticationChallenge(WebCore::Credential&) = 0; }; } diff --git a/Source/WebKit/blackberry/Api/WebAnimation.cpp b/Source/WebKit/blackberry/Api/WebAnimation.cpp new file mode 100644 index 000000000..11b0ddd56 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebAnimation.h" + +#if USE(ACCELERATED_COMPOSITING) +#include "GraphicsLayer.h" +#include "LayerCompositingThread.h" +#include "LayerWebKitThread.h" +#include "WebAnimation_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebAnimation WebAnimation::fadeAnimation(const WebString& name, float from, float to, double duration) +{ + WebAnimation tmp; + tmp.d->name = String(name.impl()); + tmp.d->animation = Animation::create(); + tmp.d->animation->setDuration(duration); + tmp.d->keyframes = KeyframeValueList(AnimatedPropertyOpacity); + tmp.d->keyframes.insert(new FloatAnimationValue(0, from)); + tmp.d->keyframes.insert(new FloatAnimationValue(1.0, to)); + + return tmp; +} + +WebString WebAnimation::name() const +{ + return d->name.impl(); +} + +WebAnimation::WebAnimation() + : d(new WebAnimationPrivate) +{ +} + +WebAnimation::WebAnimation(const WebAnimation& o) +: d(new WebAnimationPrivate) +{ + *d = *o.d; +} + +WebAnimation::~WebAnimation() +{ + delete d; +} + +WebAnimation& WebAnimation::operator=(const WebAnimation& o) +{ + *d = *o.d; + return *this; +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebAnimation.h b/Source/WebKit/blackberry/Api/WebAnimation.h new file mode 100644 index 000000000..7e9297db5 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebAnimation_h +#define WebAnimation_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimationPrivate; + +/** + * Represents an animation running on an overlay. + * + * WebAnimation is not thread safe, but it is reentrant. This means that + * instances can be created on different threads, but must be used on the + * thread where they were created. + */ +class BLACKBERRY_EXPORT WebAnimation { +public: + static WebAnimation fadeAnimation(const WebString& name, float from, float to, double duration); + + WebAnimation(); + WebAnimation(const WebAnimation&); + ~WebAnimation(); + + WebAnimation& operator=(const WebAnimation&); + + WebString name() const; + +protected: + friend class WebOverlay; + friend class WebOverlayOverride; + friend class WebOverlayPrivate; + + WebAnimationPrivate* d; +}; + +} +} + +#endif // WebAnimation_h diff --git a/Source/WebKit/blackberry/Api/WebAnimation_p.h b/Source/WebKit/blackberry/Api/WebAnimation_p.h new file mode 100644 index 000000000..08ca9aff3 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation_p.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebAnimation_p_h +#define WebAnimation_p_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "Animation.h" +#include "GraphicsLayer.h" +#include "GraphicsLayerClient.h" +#include "IntSize.h" +#include "LayerAnimation.h" + +#include <wtf/text/WTFString.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; + +class WebAnimationPrivate { +public: + WebAnimationPrivate() + : keyframes(WebCore::AnimatedPropertyInvalid) + { + } + + String name; + RefPtr<WebCore::Animation> animation; + WebCore::KeyframeValueList keyframes; +}; + +} +} + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // WebAnimation_p_h diff --git a/Source/WebKit/blackberry/Api/WebOverlay.cpp b/Source/WebKit/blackberry/Api/WebOverlay.cpp new file mode 100644 index 000000000..f8bdbead4 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay.cpp @@ -0,0 +1,786 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebOverlay.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerWebKitThread.h" +#include "NotImplemented.h" +#include "PlatformContextSkia.h" +#include "TextureCacheCompositingThread.h" +#include "WebAnimation.h" +#include "WebAnimation_p.h" +#include "WebOverlayClient.h" +#include "WebOverlayOverride.h" +#include "WebOverlay_p.h" +#include "WebPageCompositorClient.h" +#include "WebPageCompositor_p.h" +#include "WebPage_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> +#include <GLES2/gl2.h> +#include <SkDevice.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebOverlay::WebOverlay() + : d(0) +{ + if (Platform::webKitThreadMessageClient()->isCurrentThread()) { + d = new WebOverlayPrivateWebKitThread; + d->q = this; + } else if (Platform::userInterfaceThreadMessageClient()->isCurrentThread()) { + d = new WebOverlayPrivateCompositingThread; + d->q = this; + } +} + +WebOverlay::WebOverlay(GraphicsLayerClient* client) + : d(0) +{ + d = new WebOverlayPrivateWebKitThread(client); + d->q = this; +} + +WebOverlay::~WebOverlay() +{ + delete d; +} + +Platform::FloatPoint WebOverlay::position() const +{ + return d->position(); +} + +void WebOverlay::setPosition(const Platform::FloatPoint& position) +{ + d->setPosition(position); +} + +Platform::FloatPoint WebOverlay::anchorPoint() const +{ + return d->anchorPoint(); +} + +void WebOverlay::setAnchorPoint(const Platform::FloatPoint& anchor) +{ + d->setAnchorPoint(anchor); +} + +Platform::FloatSize WebOverlay::size() const +{ + return d->size(); +} + +void WebOverlay::setSize(const Platform::FloatSize& size) +{ + d->setSize(size); +} + +bool WebOverlay::sizeIsScaleInvariant() const +{ + return d->sizeIsScaleInvariant(); +} + +void WebOverlay::setSizeIsScaleInvariant(bool invariant) +{ + d->setSizeIsScaleInvariant(invariant); +} + +Platform::TransformationMatrix WebOverlay::transform() const +{ + // FIXME: There is no WebCore::TranformationMatrix interoperability + // with Platform::TransformationMatrix + TransformationMatrix transform = d->transform(); + return reinterpret_cast<const Platform::TransformationMatrix&>(transform); +} + +void WebOverlay::setTransform(const Platform::TransformationMatrix& transform) +{ + d->setTransform(reinterpret_cast<const TransformationMatrix&>(transform)); +} + +float WebOverlay::opacity() const +{ + return d->opacity(); +} + +void WebOverlay::setOpacity(float opacity) +{ + d->setOpacity(opacity); +} + +void WebOverlay::addAnimation(const WebAnimation& animation) +{ + d->addAnimation(animation.d->name, animation.d->animation.get(), animation.d->keyframes); +} + +void WebOverlay::removeAnimation(const WebString& name) +{ + d->removeAnimation(String(PassRefPtr<StringImpl>(name.impl()))); +} + +WebOverlay* WebOverlay::parent() const +{ + return d->parent; +} + +bool WebOverlay::addChild(WebOverlay* overlay) +{ + if (overlay->d->nativeThread != d->nativeThread) + return false; + + overlay->d->parent = this; + d->addChild(overlay->d); + return true; +} + +void WebOverlay::removeFromParent() +{ + d->removeFromParent(); + d->parent = 0; +} + +void WebOverlay::setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize) +{ + d->setContentsToImage(data, imageSize); +} + +void WebOverlay::setContentsToColor(int r, int g, int b, int a) +{ + d->setContentsToColor(Color(r, g, b, a)); +} + +void WebOverlay::setDrawsContent(bool drawsContent) +{ + d->setDrawsContent(drawsContent); +} + +void WebOverlay::invalidate() +{ + d->invalidate(); +} + +void WebOverlay::setClient(WebOverlayClient* client) +{ + d->setClient(client); +} + +WebOverlayOverride* WebOverlay::override() +{ + // Must be called on UI thread + if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + return 0; + + return d->override(); +} + +void WebOverlay::resetOverrides() +{ + d->resetOverrides(); +} + +WebPagePrivate* WebOverlayPrivate::page() const +{ + if (m_page) + return m_page; + + if (parent) + return parent->d->page(); + + return 0; +} + +WebOverlayOverride* WebOverlayPrivate::override() +{ + // Page might have changed if we were removed from the page and added to + // some other page. + if (m_override) + m_override->d->setPage(page()); + return m_override.get(); +} + +void WebOverlayPrivate::drawContents(SkCanvas* canvas) +{ + if (!client) + return; + + client->drawOverlayContents(q, canvas); +} + +void WebOverlayPrivate::scheduleCompositingRun() +{ + if (WebPagePrivate* page = this->page()) { + if (WebPageCompositorClient* compositorClient = page->compositor()->client()) { + double animationTime = compositorClient->requestAnimationFrame(); + compositorClient->invalidate(animationTime); + return; + } + + page->blitVisibleContents(); + } +} + +WebOverlayPrivateWebKitThread::WebOverlayPrivateWebKitThread(GraphicsLayerClient* client) + : m_layer(GraphicsLayer::create(client ? client : this)) +{ + m_layerCompositingThread = m_layer->platformLayer()->layerCompositingThread(); +} + +WebOverlayOverride* WebOverlayPrivateWebKitThread::override() +{ + if (!m_override) { + WebOverlayPrivate* tmp = new WebOverlayPrivateCompositingThread(m_layerCompositingThread.get()); + m_override = adoptPtr(new WebOverlayOverride(tmp, true)); + } + + return WebOverlayPrivate::override(); +} + +FloatPoint WebOverlayPrivateWebKitThread::position() const +{ + return m_layer->position(); +} + +void WebOverlayPrivateWebKitThread::setPosition(const FloatPoint& position) +{ + m_layer->setPosition(position); +} + +FloatPoint WebOverlayPrivateWebKitThread::anchorPoint() const +{ + FloatPoint3D anchor = m_layer->anchorPoint(); + return FloatPoint(anchor.x(), anchor.y()); +} + +void WebOverlayPrivateWebKitThread::setAnchorPoint(const FloatPoint& anchor) +{ + m_layer->setAnchorPoint(FloatPoint3D(anchor.x(), anchor.y(), 0)); +} + +FloatSize WebOverlayPrivateWebKitThread::size() const +{ + return m_layer->size(); +} + +void WebOverlayPrivateWebKitThread::setSize(const FloatSize& size) +{ + m_layer->setSize(size); +} + +bool WebOverlayPrivateWebKitThread::sizeIsScaleInvariant() const +{ + return m_layer->platformLayer()->sizeIsScaleInvariant(); +} + +void WebOverlayPrivateWebKitThread::setSizeIsScaleInvariant(bool invariant) +{ + m_layer->platformLayer()->setSizeIsScaleInvariant(invariant); +} + +TransformationMatrix WebOverlayPrivateWebKitThread::transform() const +{ + return m_layer->transform(); +} + +void WebOverlayPrivateWebKitThread::setTransform(const TransformationMatrix& transform) +{ + m_layer->setTransform(transform); +} + +float WebOverlayPrivateWebKitThread::opacity() const +{ + return m_layer->opacity(); +} + +void WebOverlayPrivateWebKitThread::setOpacity(float opacity) +{ + m_layer->setOpacity(opacity); +} + +void WebOverlayPrivateWebKitThread::addAnimation(const String& name, Animation* animation, const KeyframeValueList& keyframes) +{ + IntSize size(m_layer->size().width(), m_layer->size().height()); + m_layer->addAnimation(keyframes, size, animation, name, 0); +} + +void WebOverlayPrivateWebKitThread::removeAnimation(const String& name) +{ + m_layer->removeAnimation(name); +} + +void WebOverlayPrivateWebKitThread::addChild(WebOverlayPrivate* overlay) +{ + m_layer->addChild(static_cast<WebOverlayPrivateWebKitThread*>(overlay)->m_layer.get()); +} + +void WebOverlayPrivateWebKitThread::removeFromParent() +{ + m_layer->removeFromParent(); +} + +void WebOverlayPrivateWebKitThread::setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) +{ + notImplemented(); +} + +void WebOverlayPrivateWebKitThread::setContentsToColor(const Color&) +{ + notImplemented(); +} + +void WebOverlayPrivateWebKitThread::setDrawsContent(bool drawsContent) +{ + m_layer->setDrawsContent(drawsContent); +} + +void WebOverlayPrivateWebKitThread::clear() +{ + setSize(FloatSize(0, 0)); +} + +void WebOverlayPrivateWebKitThread::invalidate() +{ + m_layer->setNeedsDisplay(); +} + +void WebOverlayPrivateWebKitThread::resetOverrides() +{ + if (Platform::webKitThreadMessageClient()->isCurrentThread()) + m_layer->platformLayer()->clearOverride(); + else if (Platform::userInterfaceThreadMessageClient()->isCurrentThread()) { + m_layerCompositingThread->clearOverride(); + scheduleCompositingRun(); + } +} + +void WebOverlayPrivateWebKitThread::notifySyncRequired(const WebCore::GraphicsLayer*) +{ + if (WebPagePrivate* page = this->page()) + page->scheduleRootLayerCommit(); +} + +void WebOverlayPrivateWebKitThread::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& c, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) +{ + drawContents(c.platformContext()->canvas()); +} + +WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient() + : m_drawsContent(false) + , m_layerCompositingThread(0) + , m_client(0) +{ +} + +void WebOverlayLayerCompositingThreadClient::setDrawsContent(bool drawsContent) +{ + m_drawsContent = drawsContent; +} + +void WebOverlayLayerCompositingThreadClient::invalidate() +{ + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& contents) +{ + m_contents = contents; + m_color = Color(); + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& color) +{ + m_contents = SkBitmap(); + m_color = color; + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*) +{ + delete this; +} + +void WebOverlayLayerCompositingThreadClient::layerVisibilityChanged(LayerCompositingThread*, bool visible) +{ +} + +void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread*) +{ + if (m_contents.isNull() && !m_color.isValid() && !m_drawsContent) + return; + + if (m_texture && m_texture->textureId()) + return; + + if (m_color.isValid()) { + m_texture = textureCacheCompositingThread()->textureForColor(m_color); + return; + } + + if (m_drawsContent) { + if (!m_client || !m_owner) + return; + + if (m_contents.isNull()) { + m_contents.setConfig(SkBitmap::kARGB_8888_Config, m_layerCompositingThread->bounds().width(), m_layerCompositingThread->bounds().height()); + m_contents.allocPixels(); + } + + SkDevice device(m_contents); + SkCanvas canvas(&device); + m_client->drawOverlayContents(m_owner, &canvas); + canvas.flush(); + } + + m_texture = Texture::create(); + m_texture->protect(IntSize(m_contents.width(), m_contents.height())); + IntRect bitmapRect(0, 0, m_contents.width(), m_contents.height()); + m_texture->updateContents(m_contents, bitmapRect, bitmapRect, false); +} + +void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double /*scale*/, int positionLocation, int texCoordLocation) +{ + if (!m_texture || !m_texture->textureId()) + return; + + glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); + glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &layer->getTransformedBounds()); + float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; + glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + +void WebOverlayLayerCompositingThreadClient::deleteTextures(LayerCompositingThread*) +{ + m_texture.clear(); +} + +WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread(PassRefPtr<LayerCompositingThread> layerCompositingThread) + : m_layerCompositingThreadClient(0) +{ + m_layerCompositingThread = layerCompositingThread; +} + +WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread() + : m_layerCompositingThreadClient(new WebOverlayLayerCompositingThreadClient) +{ + m_layerCompositingThread = LayerCompositingThread::create(LayerData::CustomLayer, m_layerCompositingThreadClient); + m_layerCompositingThreadClient->setLayer(m_layerCompositingThread.get()); +} + +WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread() +{ + if (m_layerCompositingThreadClient) + m_layerCompositingThreadClient->setClient(0, 0); +} + +void WebOverlayPrivateCompositingThread::setClient(WebOverlayClient* client) +{ + WebOverlayPrivate::setClient(client); + if (m_layerCompositingThreadClient) + m_layerCompositingThreadClient->setClient(q, client); +} + +WebOverlayOverride* WebOverlayPrivateCompositingThread::override() +{ + if (!m_override) + m_override = adoptPtr(new WebOverlayOverride(this, false)); + + return WebOverlayPrivate::override(); +} + +FloatPoint WebOverlayPrivateCompositingThread::position() const +{ + return m_layerCompositingThread->position(); +} + +void WebOverlayPrivateCompositingThread::setPosition(const FloatPoint& position) +{ + m_layerCompositingThread->setPosition(position); + scheduleCompositingRun(); +} + +FloatPoint WebOverlayPrivateCompositingThread::anchorPoint() const +{ + return m_layerCompositingThread->anchorPoint(); +} + +void WebOverlayPrivateCompositingThread::setAnchorPoint(const FloatPoint& anchor) +{ + m_layerCompositingThread->setAnchorPoint(anchor); + scheduleCompositingRun(); +} + +FloatSize WebOverlayPrivateCompositingThread::size() const +{ + IntSize bounds = m_layerCompositingThread->bounds(); + return FloatSize(bounds.width(), bounds.height()); +} + +void WebOverlayPrivateCompositingThread::setSize(const FloatSize& size) +{ + m_layerCompositingThread->setBounds(IntSize(size.width(), size.height())); + scheduleCompositingRun(); +} + +bool WebOverlayPrivateCompositingThread::sizeIsScaleInvariant() const +{ + return m_layerCompositingThread->sizeIsScaleInvariant(); +} + +void WebOverlayPrivateCompositingThread::setSizeIsScaleInvariant(bool invariant) +{ + m_layerCompositingThread->setSizeIsScaleInvariant(invariant); + scheduleCompositingRun(); +} + +TransformationMatrix WebOverlayPrivateCompositingThread::transform() const +{ + return m_layerCompositingThread->transform(); +} + +void WebOverlayPrivateCompositingThread::setTransform(const TransformationMatrix& transform) +{ + m_layerCompositingThread->setTransform(transform); + scheduleCompositingRun(); +} + +float WebOverlayPrivateCompositingThread::opacity() const +{ + return m_layerCompositingThread->opacity(); +} + +void WebOverlayPrivateCompositingThread::setOpacity(float opacity) +{ + m_layerCompositingThread->setOpacity(opacity); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::addAnimation(const String& name, Animation* animation, const KeyframeValueList& keyframes) +{ + IntSize boxSize = m_layerCompositingThread->bounds(); + RefPtr<LayerAnimation> layerAnimation = LayerAnimation::create(keyframes, boxSize, animation, name, 0.0); + + // FIXME: Unfortunately WebPageCompositorClient::requestAnimationFrame uses a different time coordinate system + // than accelerated animations, so we can't use the time returned by WebPageCompositorClient::requestAnimationFrame() + // for starttime. + layerAnimation->setStartTime(currentTime()); + + m_layerCompositingThread->addAnimation(layerAnimation.get()); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::removeAnimation(const String& name) +{ + m_layerCompositingThread->removeAnimation(name); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::addChild(WebOverlayPrivate* overlay) +{ + m_layerCompositingThread->addSublayer(overlay->layerCompositingThread()); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::removeFromParent() +{ + if (m_layerCompositingThread->superlayer() == page()->m_compositor->compositingThreadOverlayLayer()) + page()->m_compositor->removeOverlay(m_layerCompositingThread.get()); + else + m_layerCompositingThread->removeFromSuperlayer(); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* data, const IntSize& imageSize) +{ + if (!m_layerCompositingThreadClient) + return; + + const SkBitmap& oldContents = m_layerCompositingThreadClient->contents(); + if (!oldContents.isNull()) { + SkAutoLockPixels lock(oldContents); + if (data == oldContents.getPixels()) + return; + } + + SkBitmap contents; + contents.setConfig(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); + contents.setPixels(const_cast<unsigned char*>(data)); + + m_layerCompositingThreadClient->setContents(contents); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::setContentsToColor(const Color& color) +{ + if (!m_layerCompositingThreadClient) + return; + + m_layerCompositingThreadClient->setContentsToColor(color); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::setDrawsContent(bool drawsContent) +{ + if (!m_layerCompositingThreadClient) + return; + + m_layerCompositingThreadClient->setDrawsContent(drawsContent); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::clear() +{ + m_layerCompositingThread->deleteTextures(); +} + +void WebOverlayPrivateCompositingThread::invalidate() +{ + if (!m_layerCompositingThreadClient || !m_layerCompositingThreadClient->drawsContent()) + return; + + m_layerCompositingThreadClient->invalidate(); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::resetOverrides() +{ + m_layerCompositingThread->clearOverride(); + scheduleCompositingRun(); +} + +} +} +#else // USE(ACCELERATED_COMPOSITING) +namespace BlackBerry { +namespace WebKit { + +WebOverlay::WebOverlay() +{ +} + +WebOverlay::~WebOverlay() +{ +} + +Platform::FloatPoint WebOverlay::position() const +{ + return Platform::FloatPoint(); +} + +void WebOverlay::setPosition(const Platform::FloatPoint&) +{ +} + +Platform::FloatPoint WebOverlay::anchorPoint() const +{ + return Platform::FloatPoint(); +} + +void WebOverlay::setAnchorPoint(const Platform::FloatPoint&) +{ +} + +Platform::FloatSize WebOverlay::size() const +{ + return Platform::FloatSize(); +} + +void WebOverlay::setSize(const Platform::FloatSize&) +{ +} + +Platform::TransformationMatrix WebOverlay::transform() const +{ + return Platform::TransformationMatrix(); +} + +void WebOverlay::setTransform(const Platform::TransformationMatrix&) +{ +} + +float WebOverlay::opacity() const +{ + return 1.0f; +} + +void WebOverlay::setOpacity(float) +{ +} + +WebOverlay* WebOverlay::parent() const +{ + return 0; +} + +bool WebOverlay::addChild(WebOverlay*) +{ + return false; +} + +void WebOverlay::removeFromParent() +{ +} + +void WebOverlay::addAnimation(const WebAnimation&) +{ +} + +void WebOverlay::removeAnimation(const WebString&) +{ +} + +void WebOverlay::setContentsToImage(const unsigned char*, const Platform::IntSize&) +{ +} + +void WebOverlay::setContentsToColor(int, int, int, int) +{ +} + +void WebOverlay::setDrawsContent(bool) +{ +} + +void WebOverlay::invalidate() +{ +} + +void WebOverlay::setClient(WebOverlayClient*) +{ +} + +WebOverlayOverride* WebOverlay::override() +{ +} + +void WebOverlay::resetOverrides() +{ +} + +} +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebOverlay.h b/Source/WebKit/blackberry/Api/WebOverlay.h new file mode 100644 index 000000000..5fe80c423 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlay_h +#define WebOverlay_h + +#include "BlackBerryGlobal.h" +#include "WebOverlayOverride.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace WebCore { +class GraphicsLayerClient; +} + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; +class WebOverlayClient; +class WebOverlayOverride; +class WebOverlayPrivate; +class WebPage; +class WebString; + +/** + * Represents an overlay that is rendered superimposed on a web page. + * + * The WebOverlay is not thread safe, but it is reentrant when used on either + * the WebKit or the compositing thread. This means that overlays can be + * on either of these threads, but each instance must only be used on the + * thread where it was created. The only exception is the override mechanism. + * + * The WebOverlayOverride object returned by WebOverlay::override() can be used + * to override the values of specific properties from the UI thread. + * + * They have the following semantics: If they are called for a specific overlay + * on the UI thread, the value set will override any value set on the WK thread + * until you call resetOverrides(). resetOverrides() is thread safe. + */ +class BLACKBERRY_EXPORT WebOverlay { +public: + WebOverlay(); + WebOverlay(WebCore::GraphicsLayerClient*); + virtual ~WebOverlay(); + + // The position of the layer (the location of its top-left corner in its parent). + Platform::FloatPoint position() const; + void setPosition(const Platform::FloatPoint&); + + // Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point + // affects the origin of the transforms. + Platform::FloatPoint anchorPoint() const; + void setAnchorPoint(const Platform::FloatPoint&); + + // The size of the layer. + Platform::FloatSize size() const; + void setSize(const Platform::FloatSize&); + + // Whether the layer is scaled together with the web page. + bool sizeIsScaleInvariant() const; + void setSizeIsScaleInvariant(bool); + + // Transform can be used to rotate the layer, among other things. + Platform::TransformationMatrix transform() const; + void setTransform(const Platform::TransformationMatrix&); + + // Opacity. Can also be used to temporarily hide a layer. + float opacity() const; + void setOpacity(float); + + // Adds/removes an animation + // Note that WebAnimation and WebString are not thread safe and have to be + // created on the thread where they'll be used. + void addAnimation(const WebAnimation&); + void removeAnimation(const WebString& name); + + WebOverlay* parent() const; + bool addChild(WebOverlay*); + void removeFromParent(); + + void setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize); + void setContentsToColor(int r, int g, int b, int a); + void setDrawsContent(bool); + + // Will result in a future call to WebOverlayClient::drawContents, if the layer draws custom contents. + void invalidate(); + + // The client can be used to draw layer contents using Skia. + void setClient(WebOverlayClient*); + + // Must be called on UI thread. + WebOverlayOverride* override(); + + /** + * Thread safe. Next time the attributes are changed on the WK thread, make + * those values override any set on the UI thread. + */ + void resetOverrides(); + +private: + friend class WebPage; + friend class WebOverlayPrivate; + + // Disable copy constructor and operator=. + WebOverlay(const WebOverlay&); + WebOverlay& operator=(const WebOverlay&); + + WebOverlayPrivate* d; +}; + +} +} + +#endif // WebOverlay_h diff --git a/Source/WebKit/blackberry/Api/WebOverlayClient.h b/Source/WebKit/blackberry/Api/WebOverlayClient.h new file mode 100644 index 000000000..bfeb263cd --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayClient.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlayClient_h +#define WebOverlayClient_h + +#include "BlackBerryGlobal.h" + +class SkCanvas; + +namespace BlackBerry { +namespace WebKit { + +class WebOverlay; + +/** + */ +class BLACKBERRY_EXPORT WebOverlayClient { +public: + virtual ~WebOverlayClient() { } + + virtual void drawOverlayContents(WebOverlay*, SkCanvas*) = 0; +}; + +} +} + +#endif // WebOverlayClient_h diff --git a/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp b/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp new file mode 100644 index 000000000..89e2233fb --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebOverlayOverride.h" + +#if USE(ACCELERATED_COMPOSITING) +#include "WebAnimation.h" +#include "WebAnimation_p.h" +#include "WebOverlay_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebOverlayOverride::WebOverlayOverride(WebOverlayPrivate* d, bool owned) + : d(d) + , m_owned(owned) +{ +} + +WebOverlayOverride::~WebOverlayOverride() +{ + if (m_owned) + delete d; +} + +void WebOverlayOverride::setPosition(const Platform::FloatPoint& position) +{ + d->setPosition(position); +} + +void WebOverlayOverride::setAnchorPoint(const Platform::FloatPoint& anchor) +{ + d->setAnchorPoint(anchor); +} + +void WebOverlayOverride::setSize(const Platform::FloatSize& size) +{ + d->setSize(size); +} + +void WebOverlayOverride::setTransform(const Platform::TransformationMatrix& transform) +{ + d->setTransform(reinterpret_cast<const TransformationMatrix&>(transform)); +} + +void WebOverlayOverride::setOpacity(float opacity) +{ + d->setOpacity(opacity); +} + +void WebOverlayOverride::addAnimation(const WebAnimation& animation) +{ + d->addAnimation(animation.d->name, animation.d->animation.get(), animation.d->keyframes); +} + +void WebOverlayOverride::removeAnimation(const WebString& name) +{ + d->removeAnimation(String(PassRefPtr<StringImpl>(name.impl()))); +} + +} +} +#else // USE(ACCELERATED_COMPOSITING) +namespace BlackBerry { +namespace WebKit { + +WebOverlayOverride::WebOverlayOverride(WebOverlayPrivate*, bool) +{ +} + +WebOverlayOverride::~WebOverlayOverride() +{ +} + +void WebOverlayOverride::setPosition(const Platform::FloatPoint&) +{ +} + +void WebOverlayOverride::setAnchorPoint(const Platform::FloatPoint&) +{ +} + +void WebOverlayOverride::setSize(const Platform::FloatSize&) +{ +} + +void WebOverlayOverride::setTransform(const Platform::TransformationMatrix&) +{ +} + +void WebOverlayOverride::setOpacity(float) +{ +} + +void WebOverlayOverride::addAnimation(const WebAnimation&) +{ +} + +void WebOverlayOverride::removeAnimation(const WebString&) +{ +} + +} +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebOverlayOverride.h b/Source/WebKit/blackberry/Api/WebOverlayOverride.h new file mode 100644 index 000000000..09c9a3496 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayOverride.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlayOverride_h +#define WebOverlayOverride_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; +class WebOverlayPrivate; +class WebString; + +/** + * Compositing thread only + * + * Note that the WebAnimation and WebString classes are not thread safe, but + * reentrant, and have to be created on the thread where they'll be used. + */ +class BLACKBERRY_EXPORT WebOverlayOverride { +public: + // Don't use this, call WebOverlay::override() instead + WebOverlayOverride(WebOverlayPrivate*, bool owned); + ~WebOverlayOverride(); + + void setPosition(const Platform::FloatPoint&); + void setAnchorPoint(const Platform::FloatPoint&); + void setSize(const Platform::FloatSize&); + void setTransform(const Platform::TransformationMatrix&); + void setOpacity(float); + + void addAnimation(const WebAnimation&); + void removeAnimation(const WebString& name); + +private: + friend class WebOverlayPrivate; + + // Disable copy constructor and operator= + WebOverlayOverride(const WebOverlayOverride&); + WebOverlayOverride& operator=(const WebOverlayOverride&); + + WebOverlayPrivate* d; + bool m_owned; +}; + +} +} + +#endif // WebOverlayOverride_h diff --git a/Source/WebKit/blackberry/Api/WebOverlay_p.h b/Source/WebKit/blackberry/Api/WebOverlay_p.h new file mode 100644 index 000000000..35c4a4b20 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay_p.h @@ -0,0 +1,267 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlay_p_h +#define WebOverlay_p_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "GraphicsLayer.h" +#include "LayerCompositingThread.h" +#include "Texture.h" +#include "WebOverlayOverride.h" + +#include <SkBitmap.h> +#include <pthread.h> +#include <wtf/OwnPtr.h> +#include <wtf/RefPtr.h> + +class SkCanvas; + +namespace WTF { +class String; +} + +namespace WebCore { +class Animation; +class KeyframeValueList; +} + +namespace BlackBerry { +namespace WebKit { + +class WebOverlay; +class WebOverlayClient; +class WebPagePrivate; + +class WebOverlayPrivate { +public: + WebOverlayPrivate() + : q(0) + , parent(0) + , m_page(0) + { + nativeThread = pthread_self(); + } + + virtual ~WebOverlayPrivate() + { + ASSERT(pthread_self() == nativeThread); + } + + WebPagePrivate* page() const; + void setPage(WebPagePrivate* page) { m_page = page; } + + virtual void setClient(WebOverlayClient* c) { client = c; } + + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const = 0; + virtual void setPosition(const WebCore::FloatPoint&) = 0; + + virtual WebCore::FloatPoint anchorPoint() const = 0; + virtual void setAnchorPoint(const WebCore::FloatPoint&) = 0; + + virtual WebCore::FloatSize size() const = 0; + virtual void setSize(const WebCore::FloatSize&) = 0; + + virtual bool sizeIsScaleInvariant() const = 0; + virtual void setSizeIsScaleInvariant(bool) = 0; + + virtual WebCore::TransformationMatrix transform() const = 0; + virtual void setTransform(const WebCore::TransformationMatrix&) = 0; + + virtual float opacity() const = 0; + virtual void setOpacity(float) = 0; + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&) = 0; + virtual void removeAnimation(const WTF::String&) = 0; + + virtual void addChild(WebOverlayPrivate*) = 0; + virtual void removeFromParent() = 0; + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) = 0; + virtual void setContentsToColor(const WebCore::Color&) = 0; + virtual void setDrawsContent(bool) = 0; + + virtual void clear() = 0; + virtual void invalidate() = 0; + void drawContents(SkCanvas*); + + virtual void resetOverrides() = 0; + + void scheduleCompositingRun(); + + // Never 0 + WebCore::LayerCompositingThread* layerCompositingThread() const { return m_layerCompositingThread.get(); } + + // Can be 0 + virtual WebCore::GraphicsLayer* graphicsLayer() const { return 0; } + + WebOverlay* q; + WebOverlayClient* client; + WebOverlay* parent; + pthread_t nativeThread; + +protected: + RefPtr<WebCore::LayerCompositingThread> m_layerCompositingThread; + OwnPtr<WebOverlayOverride> m_override; + WebPagePrivate* m_page; +}; + +class WebOverlayPrivateWebKitThread : public WebOverlayPrivate, public WebCore::GraphicsLayerClient { +public: + WebOverlayPrivateWebKitThread(WebCore::GraphicsLayerClient* = 0); + + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const; + virtual void setPosition(const WebCore::FloatPoint&); + + virtual WebCore::FloatPoint anchorPoint() const; + virtual void setAnchorPoint(const WebCore::FloatPoint&); + + virtual WebCore::FloatSize size() const; + virtual void setSize(const WebCore::FloatSize&); + + virtual bool sizeIsScaleInvariant() const; + virtual void setSizeIsScaleInvariant(bool); + + virtual WebCore::TransformationMatrix transform() const; + virtual void setTransform(const WebCore::TransformationMatrix&); + + virtual float opacity() const; + virtual void setOpacity(float); + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&); + virtual void removeAnimation(const WTF::String& name); + + virtual void addChild(WebOverlayPrivate*); + virtual void removeFromParent(); + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToColor(const WebCore::Color&); + virtual void setDrawsContent(bool); + + virtual void clear(); + virtual void invalidate(); + + virtual void resetOverrides(); + + virtual WebCore::GraphicsLayer* graphicsLayer() const { return m_layer.get(); } + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + +private: + OwnPtr<WebCore::GraphicsLayer> m_layer; +}; + +// The LayerCompositingThreadClient's life cycle is tied to the LayerCompositingThread, +// so it needs to be a separate object from the WebOverlayPrivateCompositingThread. +class WebOverlayLayerCompositingThreadClient : public WebCore::LayerCompositingThreadClient { +public: + WebOverlayLayerCompositingThreadClient(); + virtual ~WebOverlayLayerCompositingThreadClient() { } + + void setLayer(WebCore::LayerCompositingThread* layer) { m_layerCompositingThread = layer; } + void setClient(WebOverlay* owner, WebOverlayClient* client) { m_owner = owner; m_client = client; } + + bool drawsContent() const { return m_drawsContent; } + void setDrawsContent(bool); + void invalidate(); + + const SkBitmap& contents() const { return m_contents; } + void setContents(const SkBitmap&); + + void setContentsToColor(const WebCore::Color&); + + // LayerCompositingThreadClient + virtual void layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*); + virtual void layerVisibilityChanged(WebCore::LayerCompositingThread*, bool visible); + virtual void uploadTexturesIfNeeded(WebCore::LayerCompositingThread*); + virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation); + virtual void deleteTextures(WebCore::LayerCompositingThread*); + +private: + RefPtr<WebCore::Texture> m_texture; + bool m_drawsContent; + SkBitmap m_contents; + WebCore::Color m_color; + WebCore::LayerCompositingThread* m_layerCompositingThread; + WebOverlay* m_owner; + WebOverlayClient* m_client; +}; + +class WebOverlayPrivateCompositingThread : public WebOverlayPrivate { +public: + WebOverlayPrivateCompositingThread(PassRefPtr<WebCore::LayerCompositingThread>); + WebOverlayPrivateCompositingThread(); + ~WebOverlayPrivateCompositingThread(); + + virtual void setClient(WebOverlayClient*); + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const; + virtual void setPosition(const WebCore::FloatPoint&); + + virtual WebCore::FloatPoint anchorPoint() const; + virtual void setAnchorPoint(const WebCore::FloatPoint&); + + virtual WebCore::FloatSize size() const; + virtual void setSize(const WebCore::FloatSize&); + + virtual bool sizeIsScaleInvariant() const; + virtual void setSizeIsScaleInvariant(bool); + + virtual WebCore::TransformationMatrix transform() const; + virtual void setTransform(const WebCore::TransformationMatrix&); + + virtual float opacity() const; + virtual void setOpacity(float); + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&); + virtual void removeAnimation(const WTF::String& name); + + virtual void addChild(WebOverlayPrivate*); + virtual void removeFromParent(); + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToColor(const WebCore::Color&); + virtual void setDrawsContent(bool); + + virtual void clear(); + virtual void invalidate(); + + virtual void resetOverrides(); + +private: + WebOverlayLayerCompositingThreadClient* m_layerCompositingThreadClient; +}; + +} +} + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // WebOverlay_p_h diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 684279e30..c9a6c5bf9 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -42,6 +42,7 @@ #include "Database.h" #include "DatabaseSync.h" #include "DatabaseTracker.h" +#include "DefaultTapHighlight.h" #include "DeviceMotionClientBlackBerry.h" #include "DeviceOrientationClientBlackBerry.h" #include "DragClientBlackBerry.h" @@ -74,6 +75,7 @@ #include "InspectorBackendDispatcher.h" #include "InspectorClientBlackBerry.h" #include "InspectorController.h" +#include "InspectorOverlay.h" #include "JavaScriptDebuggerBlackBerry.h" #include "LayerWebKitThread.h" #include "NetworkManager.h" @@ -100,6 +102,7 @@ #include "ScriptValue.h" #include "ScrollTypes.h" #include "SelectionHandler.h" +#include "SelectionOverlay.h" #include "Settings.h" #include "Storage.h" #include "StorageNamespace.h" @@ -116,6 +119,8 @@ #include "WebDOMDocument.h" #endif #include "WebKitVersion.h" +#include "WebOverlay.h" +#include "WebOverlay_p.h" #include "WebPageClient.h" #include "WebSocket.h" #include "WebViewportArguments.h" @@ -155,8 +160,8 @@ #endif #if ENABLE(ACCELERATED_2D_CANVAS) -#include "SharedGraphicsContext3D.h" #include "GrContext.h" +#include "SharedGraphicsContext3D.h" #endif #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -504,6 +509,11 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_webSettings = WebSettings::createFromStandardSettings(); m_webSettings->setUserAgentString(defaultUserAgent()); +#if USE(ACCELERATED_COMPOSITING) + m_tapHighlight = DefaultTapHighlight::create(this); + m_selectionOverlay = SelectionOverlay::create(this); +#endif + // FIXME: We explicitly call setDelegate() instead of passing ourself in createFromStandardSettings() // so that we only get one didChangeSettings() callback when we set the page group name. This causes us // to make a copy of the WebSettings since some WebSettings method make use of the page group name. @@ -551,6 +561,14 @@ void WebPagePrivate::init(const WebString& pageGroupName) #if ENABLE(WEB_TIMING) m_page->settings()->setMemoryInfoEnabled(true); #endif + +#if USE(ACCELERATED_COMPOSITING) + // The compositor will be needed for overlay rendering, so create it + // unconditionally. It will allocate OpenGL objects lazily, so this incurs + // no overhead in the unlikely case where the compositor is not needed. + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + createMethodCallMessage(&WebPagePrivate::createCompositor, this)); +#endif } class DeferredTaskLoadManualScript: public DeferredTask<&WebPagePrivate::m_wouldLoadManualScript> { @@ -879,8 +897,10 @@ void WebPagePrivate::setLoadState(LoadState state) #endif #if USE(ACCELERATED_COMPOSITING) - if (isAcceleratedCompositingActive() && !compositorDrawsRootLayer()) - syncDestroyCompositorOnCompositingThread(); + if (isAcceleratedCompositingActive()) { + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + Platform::createMethodCallMessage(&WebPagePrivate::destroyLayerResources, this)); + } #endif m_previousContentsSize = IntSize(); m_backingStore->d->resetRenderQueue(); @@ -2120,26 +2140,32 @@ bool WebPagePrivate::isActive() const return m_client->isActive(); } -Credential WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace) +bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, Credential& inputCredential) { WebString username; WebString password; +#if ENABLE_DRT + if (m_dumpRenderTree) + return m_dumpRenderTree->didReceiveAuthenticationChallenge(inputCredential); +#endif + #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) if (!m_webSettings->isPrivateBrowsingEnabled()) credentialManager().autofillAuthenticationChallenge(protectionSpace, username, password); #endif - m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password); + bool isConfirmed = m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password); #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) - Credential inputCredential(username, password, CredentialPersistencePermanent); - if (!m_webSettings->isPrivateBrowsingEnabled()) - credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential)); + Credential credential(username, password, CredentialPersistencePermanent); + if (!m_webSettings->isPrivateBrowsingEnabled() && isConfirmed) + credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, credential)); #else - Credential inputCredential(username, password, CredentialPersistenceNone); + Credential credential(username, password, CredentialPersistenceNone); #endif - return inputCredential; + inputCredential = credential; + return isConfirmed; } PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew) @@ -2234,7 +2260,7 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy } if (node->isTextNode()) { - Text* curText = static_cast<Text*>(node.get()); + Text* curText = toText(node.get()); if (!curText->wholeText().isEmpty()) context.setText(curText->wholeText().utf8().data()); } @@ -3192,6 +3218,8 @@ void WebPagePrivate::updateDelegatedOverlays(bool dispatched) // Must be called on the WebKit thread. if (m_selectionHandler->isSelectionActive()) m_selectionHandler->selectionPositionChanged(true /* visualChangeOnly */); + if (m_inspectorOverlay) + m_inspectorOverlay->update(); } else if (m_selectionHandler->isSelectionActive()) { // Don't bother dispatching to webkit thread if selection and tap highlight are not active. @@ -3333,8 +3361,10 @@ void WebPage::resetVirtualViewportOnCommitted(bool reset) IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments() { static const ViewportArguments defaultViewportArguments; - if (m_viewportArguments == defaultViewportArguments) + if (m_viewportArguments == defaultViewportArguments) { + m_page->setDeviceScaleFactor(1.0); return IntSize(); + } int desktopWidth = defaultMaxLayoutSize().width(); int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width(); @@ -3372,8 +3402,7 @@ void WebPagePrivate::didReceiveTouchEventMode(TouchEventMode mode) void WebPagePrivate::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) { - static ViewportArguments defaultViewportArguments; - if (arguments == defaultViewportArguments) + if (arguments == m_viewportArguments) return; m_viewportArguments = arguments; @@ -5453,8 +5482,15 @@ void WebPage::notifyFullScreenVideoExited(bool done) { UNUSED_PARAM(done); #if ENABLE(VIDEO) - if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get())) - mediaElement->exitFullscreen(); + if (d->m_webSettings->fullScreenVideoCapable()) { + if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get())) + mediaElement->exitFullscreen(); + } else { +#if ENABLE(FULLSCREEN_API) + if (Element* element = static_cast<Element*>(d->m_fullscreenVideoNode.get())) + element->document()->webkitCancelFullScreen(); +#endif + } #endif } @@ -5582,7 +5618,7 @@ void WebPagePrivate::drawLayersOnCommit() void WebPagePrivate::scheduleRootLayerCommit() { - if (!m_frameLayers || !m_frameLayers->hasLayer()) + if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) return; m_needsCommit = true; @@ -5618,14 +5654,33 @@ LayerRenderingResults WebPagePrivate::lastCompositingResults() const return LayerRenderingResults(); } -void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor) +GraphicsLayer* WebPagePrivate::overlayLayer() +{ + // The overlay layer has no GraphicsLayerClient, it's just a container + // for various overlays. + if (!m_overlayLayer) + m_overlayLayer = GraphicsLayer::create(0); + + return m_overlayLayer.get(); +} + +void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext) { using namespace BlackBerry::Platform; // The m_compositor member has to be modified during a sync call for thread // safe access to m_compositor and its refcount. if (!userInterfaceThreadMessageClient()->isCurrentThread()) { - userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor)); + // We depend on the current thread being the WebKit thread when it's not the Compositing thread. + // That seems extremely likely to be the case, but let's assert just to make sure. + ASSERT(webKitThreadMessageClient()->isCurrentThread()); + + // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), + // and the compositing context must be set on the WebKit thread. How convenient! + if (compositingContext != EGL_NO_CONTEXT) + BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + + userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext)); return; } @@ -5647,16 +5702,34 @@ void WebPagePrivate::commitRootLayer(const IntRect& layoutRectForCompositing, WTF_PRETTY_FUNCTION, m_compositor.get()); #endif - if (!m_frameLayers || !m_compositor) + if (!m_compositor) return; - if (m_frameLayers->rootLayer() && m_frameLayers->rootLayer()->layerCompositingThread() != m_compositor->rootLayer()) - m_compositor->setRootLayer(m_frameLayers->rootLayer()->layerCompositingThread()); + // Frame layers + LayerWebKitThread* rootLayer = 0; + if (m_frameLayers) + rootLayer = m_frameLayers->rootLayer(); + + if (rootLayer && rootLayer->layerCompositingThread() != m_compositor->rootLayer()) + m_compositor->setRootLayer(rootLayer->layerCompositingThread()); + + // Overlay layers + LayerWebKitThread* overlayLayer = 0; + if (m_overlayLayer) + overlayLayer = m_overlayLayer->platformLayer(); + + if (overlayLayer && overlayLayer->layerCompositingThread() != m_compositor->overlayLayer()) + m_compositor->setOverlayLayer(overlayLayer->layerCompositingThread()); m_compositor->setLayoutRectForCompositing(layoutRectForCompositing); m_compositor->setContentsSizeForCompositing(contentsSizeForCompositing); m_compositor->setDrawsRootLayer(drawsRootLayer); - m_compositor->commit(m_frameLayers->rootLayer()); + + if (rootLayer) + rootLayer->commitOnCompositingThread(); + + if (overlayLayer) + overlayLayer->commitOnCompositingThread(); } bool WebPagePrivate::commitRootLayerIfNeeded() @@ -5677,7 +5750,7 @@ bool WebPagePrivate::commitRootLayerIfNeeded() if (!m_needsCommit) return false; - if (!m_frameLayers || !m_frameLayers->hasLayer()) + if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) return false; FrameView* view = m_mainFrame->view(); @@ -5702,8 +5775,13 @@ bool WebPagePrivate::commitRootLayerIfNeeded() if (m_rootLayerCommitTimer->isActive()) m_rootLayerCommitTimer->stop(); - m_frameLayers->commitOnWebKitThread(currentScale()); + double scale = currentScale(); + if (m_frameLayers && m_frameLayers->hasLayer()) + m_frameLayers->commitOnWebKitThread(scale); + updateDelegatedOverlays(); + if (m_overlayLayer) + m_overlayLayer->platformLayer()->commitOnWebKitThread(scale); // Stash the visible content rect according to webkit thread // This is the rectangle used to layout fixed positioned elements, @@ -5848,22 +5926,11 @@ bool WebPagePrivate::createCompositor() m_compositor = WebPageCompositorPrivate::create(this, 0); m_compositor->setContext(m_ownedContext.get()); - if (!m_compositor->hardwareCompositing()) { - destroyCompositor(); - return false; - } - return true; } void WebPagePrivate::destroyCompositor() { - // We shouldn't release the compositor unless we created and own the - // context. If the compositor was created from the WebPageCompositor API, - // keep it around and reuse it later. - if (!m_ownedContext) - return; - // m_compositor is a RefPtr, so it may live on beyond this point. // Disconnect the compositor from us m_compositor->setPage(0); @@ -5986,6 +6053,60 @@ void WebPagePrivate::exitFullscreenForNode(Node* node) #endif } +#if ENABLE(FULLSCREEN_API) +// TODO: We should remove this helper class when we decide to support all elements. +static bool containsVideoTags(Element* element) +{ + for (Node* node = element->firstChild(); node; node = node->traverseNextNode(element)) { + if (node->hasTagName(HTMLNames::videoTag)) + return true; + } + return false; +} + +void WebPagePrivate::enterFullScreenForElement(Element* element) +{ +#if ENABLE(VIDEO) + // TODO: We should not check video tag when we decide to support all elements. + if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element))) + return; + if (m_webSettings->fullScreenVideoCapable()) { + // The Browser chrome has its own fullscreen video widget it wants to + // use, and this is a video element. The only reason that + // webkitWillEnterFullScreenForElement() and + // webkitDidEnterFullScreenForElement() are still called in this case + // is so that exitFullScreenForElement() gets called later. + enterFullscreenForNode(element); + } else { + // No fullscreen video widget has been made available by the Browser + // chrome, or this is not a video element. The webkitRequestFullScreen + // Javascript call is often made on a div element. + // This is where we would hide the browser's chrome if we wanted to. + client()->fullscreenStart(); + m_fullscreenVideoNode = element; + } +#endif +} + +void WebPagePrivate::exitFullScreenForElement(Element* element) +{ +#if ENABLE(VIDEO) + // TODO: We should not check video tag when we decide to support all elements. + if (!element || !element->hasTagName(HTMLNames::videoTag)) + return; + if (m_webSettings->fullScreenVideoCapable()) { + // The Browser chrome has its own fullscreen video widget. + exitFullscreenForNode(element); + } else { + // This is where we would restore the browser's chrome + // if hidden above. + client()->fullscreenStop(); + m_fullscreenVideoNode = 0; + } +#endif +} +#endif + void WebPagePrivate::didChangeSettings(WebSettings* webSettings) { Settings* coreSettings = m_page->settings(); @@ -6154,6 +6275,66 @@ const String& WebPagePrivate::defaultUserAgent() return *defaultUserAgent; } +WebTapHighlight* WebPage::tapHighlight() const +{ + return d->m_tapHighlight.get(); +} + +void WebPage::setTapHighlight(WebTapHighlight* tapHighlight) +{ + d->m_tapHighlight = adoptPtr(tapHighlight); +} + +WebSelectionOverlay* WebPage::selectionOverlay() const +{ + return d->m_selectionOverlay.get(); +} + +void WebPage::addOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + if (overlay->d->graphicsLayer()) { + overlay->d->setPage(d); + d->overlayLayer()->addChild(overlay->d->graphicsLayer()); + } +#endif +} + +void WebPage::removeOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + if (overlay->d->graphicsLayer()->parent() != d->overlayLayer()) + return; + + overlay->removeFromParent(); + overlay->d->clear(); + overlay->d->setPage(0); +#endif +} + +void WebPage::addCompositingThreadOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (!d->compositor()) + return; + + overlay->d->setPage(d); + d->compositor()->addOverlay(overlay->d->layerCompositingThread()); +#endif +} + +void WebPage::removeCompositingThreadOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (d->compositor()) + d->compositor()->removeOverlay(overlay->d->layerCompositingThread()); + overlay->d->clear(); + overlay->d->setPage(0); +#endif +} + void WebPage::popupOpened(PagePopupBlackBerry* webPopup) { ASSERT(!d->m_selectPopup); @@ -6181,5 +6362,23 @@ void WebPagePrivate::setParentPopup(PagePopupBlackBerry* webPopup) m_parentPopup = webPopup; } +void WebPagePrivate::setInspectorOverlayClient(WebCore::InspectorOverlay::InspectorOverlayClient* inspectorOverlayClient) +{ + if (inspectorOverlayClient) { + if (!m_inspectorOverlay) + m_inspectorOverlay = WebCore::InspectorOverlay::create(this, inspectorOverlayClient); + else + m_inspectorOverlay->setClient(inspectorOverlayClient); + m_inspectorOverlay->update(); + scheduleRootLayerCommit(); + } else { + if (m_inspectorOverlay) { + m_inspectorOverlay->clear(); + m_inspectorOverlay = nullptr; + scheduleRootLayerCommit(); + } + } +} + } } diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 86f31e46b..bcf387f43 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -62,11 +62,14 @@ class BackingStore; class BackingStoreClient; class BackingStorePrivate; class RenderQueue; +class WebOverlay; class WebPageClient; class WebPageCompositor; class WebPageGroupLoadDeferrer; class WebPagePrivate; +class WebSelectionOverlay; class WebSettings; +class WebTapHighlight; class WebViewportArguments; enum JavaScriptDataType { JSUndefined = 0, JSNull, JSBoolean, JSNumber, JSString, JSObject, JSException, JSDataTypeMax }; @@ -334,6 +337,20 @@ public: void setUserViewportArguments(const WebViewportArguments&); void resetUserViewportArguments(); + WebTapHighlight* tapHighlight() const; + void setTapHighlight(WebTapHighlight*); + + WebSelectionOverlay* selectionOverlay() const; + + // Adds an overlay that can be modified on the WebKit thread, and + // whose attributes can be overridden on the compositing thread. + void addOverlay(WebOverlay*); + void removeOverlay(WebOverlay*); + + // Adds an overlay that can only be modified on the compositing thread. + void addCompositingThreadOverlay(WebOverlay*); + void removeCompositingThreadOverlay(WebOverlay*); + // Popup client void initPopupWebView(BlackBerry::WebKit::WebPage*); void popupOpened(WebCore::PagePopupBlackBerry* webPopup); @@ -342,6 +359,7 @@ public: WebCore::PagePopupBlackBerry* popup(); void autofillTextField(const std::string&); + private: virtual ~WebPage(); diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 4c1020563..8ee102852 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -132,9 +132,6 @@ public: virtual void notifyContentRendered(const Platform::IntRect&) = 0; virtual void notifyScreenRotated() = 0; - virtual void drawTapHighlight(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll) = 0; - virtual void hideTapHighlight() = 0; - virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle) = 0; virtual void inputFocusLost() = 0; virtual void inputTextChanged() = 0; @@ -210,7 +207,7 @@ public: virtual void animateBlockZoom(const Platform::FloatPoint& finalPoint, double finalScale) = 0; virtual void setPreventsScreenIdleDimming(bool noDimming) = 0; - virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; + virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0; virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0; @@ -234,6 +231,7 @@ public: virtual bool downloadAllowed(const char* url) = 0; virtual void downloadRequested(Platform::FilterStream*, const WebString& suggestedFilename) = 0; + virtual int fullscreenStart() = 0; virtual int fullscreenStart(const char* contextName, Platform::Graphics::Window*, unsigned x, unsigned y, unsigned width, unsigned height) = 0; virtual int fullscreenStop() = 0; diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp index da629adae..22dc1ffc8 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp +++ b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp @@ -32,8 +32,10 @@ #include <BlackBerryPlatformExecutableMessage.h> #include <BlackBerryPlatformMessage.h> #include <BlackBerryPlatformMessageClient.h> +#include <EGL/egl.h> #include <GenericTimerClient.h> #include <ThreadTimerClient.h> +#include <wtf/CurrentTime.h> using namespace WebCore; @@ -59,38 +61,57 @@ void WebPageCompositorPrivate::setContext(Platform::Graphics::GLES2Context* cont return; m_context = context; - if (!m_context) { + if (!m_context) m_layerRenderer.clear(); - return; - } - - m_layerRenderer = LayerRenderer::create(m_context); - m_layerRenderer->setRootLayer(m_rootLayer.get()); -} - -bool WebPageCompositorPrivate::hardwareCompositing() const -{ - return m_layerRenderer && m_layerRenderer->hardwareCompositing(); } void WebPageCompositorPrivate::setRootLayer(LayerCompositingThread* rootLayer) { m_rootLayer = rootLayer; +} - if (m_layerRenderer) - m_layerRenderer->setRootLayer(m_rootLayer.get()); +void WebPageCompositorPrivate::setOverlayLayer(LayerCompositingThread* overlayLayer) +{ + m_overlayLayer = overlayLayer; } -void WebPageCompositorPrivate::commit(LayerWebKitThread* rootLayer) +void WebPageCompositorPrivate::prepareFrame(double animationTime) { - if (!rootLayer) + if (!m_context) return; - rootLayer->commitOnCompositingThread(); + // The LayerRenderer is involved in rendering the BackingStore when + // WebPageCompositor is used to render the web page. The presence of a + // WebPageCompositorClient (m_client) indicates this is the case, so + // create a LayerRenderer if there are layers or if there's a client. + if (!m_rootLayer && !m_overlayLayer && !m_compositingThreadOverlayLayer && !m_client) + return; + + if (!m_layerRenderer) { + m_layerRenderer = LayerRenderer::create(m_context); + if (!m_layerRenderer->hardwareCompositing()) { + m_layerRenderer.clear(); + return; + } + } + + // Unfortunately, we have to use currentTime() because the animations are + // started in that time coordinate system. + animationTime = currentTime(); + if (m_rootLayer) + m_layerRenderer->prepareFrame(animationTime, m_rootLayer.get()); + if (m_overlayLayer) + m_layerRenderer->prepareFrame(animationTime, m_overlayLayer.get()); + if (m_compositingThreadOverlayLayer) + m_layerRenderer->prepareFrame(animationTime, m_compositingThreadOverlayLayer.get()); } -void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& transformedContents) +void WebPageCompositorPrivate::render(const IntRect& targetRect, const IntRect& clipRect, const TransformationMatrix& transformIn, const FloatRect& transformedContents, const FloatRect& /*viewport*/) { + // m_layerRenderer should have been created in prepareFrame + if (!m_layerRenderer) + return; + // It's not safe to call into the BackingStore if the compositor hasn't been set yet. // For thread safety, we have to do it using a round-trip to the WebKit thread, so the // embedder might call this before the round-trip to WebPagePrivate::setCompositor() is @@ -98,12 +119,35 @@ void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& tra if (m_webPage->compositor() != this) return; - // The BackingStore is the root layer - if (BackingStore* backingStore = m_webPage->m_backingStore) - backingStore->d->blitContents(dstRect, transformedContents, true); - else { - FloatRect contents = m_webPage->mapFromTransformedFloatRect(FloatRect(transformedContents)); - drawLayers(dstRect, contents); + m_layerRenderer->setClearSurfaceOnDrawLayers(false); + + FloatRect contents = m_webPage->mapFromTransformedFloatRect(transformedContents); + + m_layerRenderer->setViewport(targetRect, clipRect, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing); + + TransformationMatrix transform(transformIn); + transform *= *m_webPage->m_transformationMatrix; + + if (!drawsRootLayer()) + m_webPage->m_backingStore->d->compositeContents(m_layerRenderer.get(), transform, contents); + + compositeLayers(transform); +} + +void WebPageCompositorPrivate::compositeLayers(const TransformationMatrix& transform) +{ + if (m_rootLayer) + m_layerRenderer->compositeLayers(transform, m_rootLayer.get()); + if (m_overlayLayer) + m_layerRenderer->compositeLayers(transform, m_overlayLayer.get()); + if (m_compositingThreadOverlayLayer) + m_layerRenderer->compositeLayers(transform, m_compositingThreadOverlayLayer.get()); + + m_lastCompositingResults = m_layerRenderer->lastRenderingResults(); + + if (m_lastCompositingResults.needsAnimationFrame) { + Platform::AnimationFrameRateController::instance()->addClient(this); + m_webPage->updateDelegatedOverlays(); } } @@ -114,6 +158,12 @@ bool WebPageCompositorPrivate::drawsRootLayer() const bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRect& contents) { + // Is there anything to draw? + if (!m_rootLayer && !m_overlayLayer && !m_compositingThreadOverlayLayer) + return false; + + // prepareFrame creates the LayerRenderer if needed + prepareFrame(currentTime()); if (!m_layerRenderer) return false; @@ -122,13 +172,22 @@ bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRec shouldClear = shouldClear || !backingStore->d->isOpenGLCompositing(); m_layerRenderer->setClearSurfaceOnDrawLayers(shouldClear); - m_layerRenderer->drawLayers(contents, m_layoutRectForCompositing, m_contentsSizeForCompositing, dstRect); - m_lastCompositingResults = m_layerRenderer->lastRenderingResults(); + // OpenGL window coordinates origin is at the lower left corner of the surface while + // WebKit uses upper left as the origin of the window coordinate system. The passed in 'dstRect' + // is in WebKit window coordinate system. Here we setup the viewport to the corresponding value + // in OpenGL window coordinates. + int viewportY = std::max(0, m_context->surfaceSize().height() - dstRect.maxY()); + IntRect viewport = IntRect(dstRect.x(), viewportY, dstRect.width(), dstRect.height()); - if (m_lastCompositingResults.needsAnimationFrame) { - Platform::AnimationFrameRateController::instance()->addClient(this); - m_webPage->updateDelegatedOverlays(); - } + m_layerRenderer->setViewport(viewport, viewport, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing); + + // WebKit uses row vectors which are multiplied by the matrix on the left (i.e. v*M) + // Transformations are composed on the left so that M1.xform(M2) means M2*M1 + // We therefore start with our (othogonal) projection matrix, which will be applied + // as the last transformation. + TransformationMatrix transform = LayerRenderer::orthoMatrix(0, contents.width(), contents.height(), 0, -1000, 1000); + transform.translate3d(-contents.x(), -contents.y(), 0); + compositeLayers(transform); return true; } @@ -169,6 +228,24 @@ void WebPageCompositorPrivate::compositorDestroyed() m_client = 0; } +void WebPageCompositorPrivate::addOverlay(LayerCompositingThread* layer) +{ + if (!m_compositingThreadOverlayLayer) + m_compositingThreadOverlayLayer = LayerCompositingThread::create(LayerData::CustomLayer, 0); + m_compositingThreadOverlayLayer->addSublayer(layer); +} + +void WebPageCompositorPrivate::removeOverlay(LayerCompositingThread* layer) +{ + if (layer->superlayer() != m_compositingThreadOverlayLayer) + return; + + layer->removeFromSuperlayer(); + + if (m_compositingThreadOverlayLayer && m_compositingThreadOverlayLayer->getSublayers().isEmpty()) + m_compositingThreadOverlayLayer.clear(); +} + WebPageCompositor::WebPageCompositor(WebPage* page, WebPageCompositorClient* client) { using namespace BlackBerry::Platform; @@ -183,7 +260,7 @@ WebPageCompositor::WebPageCompositor(WebPage* page, WebPageCompositorClient* cli // This ensures that the compositor will be around for as long as it's // needed. Unfortunately RefPtr<T> is not public, so we have declare to // resort to manual refcounting. - webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp)); + webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp, eglGetCurrentContext())); } WebPageCompositor::~WebPageCompositor() @@ -192,7 +269,7 @@ WebPageCompositor::~WebPageCompositor() // If we're being destroyed before the page, send a message to disconnect us if (d->page()) - webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0))); + webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0), EGL_NO_CONTEXT)); d->compositorDestroyed(); d->deref(); } @@ -202,15 +279,21 @@ WebPageCompositorClient* WebPageCompositor::client() const return d->client(); } -void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double timestamp) +void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double animationTime) { d->setContext(context); + d->prepareFrame(animationTime); } -void WebPageCompositor::render(Platform::Graphics::GLES2Context* context, const Platform::IntRect& dstRect, const Platform::IntRect& contents) +void WebPageCompositor::render(Platform::Graphics::GLES2Context* context, + const Platform::IntRect& targetRect, + const Platform::IntRect& clipRect, + const Platform::TransformationMatrix& transform, + const Platform::FloatRect& contents, + const Platform::FloatRect& viewport) { d->setContext(context); - d->render(dstRect, contents); + d->render(targetRect, clipRect, TransformationMatrix(reinterpret_cast<const TransformationMatrix&>(transform)), contents, viewport); } void WebPageCompositor::cleanup(Platform::Graphics::GLES2Context* context) @@ -252,7 +335,12 @@ void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context*, double) { } -void WebPageCompositor::render(Platform::Graphics::GLES2Context*, const Platform::IntRect&, const Platform::IntRect&) +void WebPageCompositor::render(Platform::Graphics::GLES2Context*, + const Platform::IntRect&, + const Platform::IntRect&, + const Platform::TransformationMatrix&, + const Platform::FloatRect&, + const Platform::FloatRect&) { } diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor.h b/Source/WebKit/blackberry/Api/WebPageCompositor.h index 11bf2841f..913f506ed 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositor.h @@ -39,10 +39,14 @@ public: WebPageCompositorClient* client() const; - void prepareFrame(Platform::Graphics::GLES2Context*, double timestamp); - - // FIXME: dstRect should be a Platform::TransformationMatrix instead. PR142628 - void render(Platform::Graphics::GLES2Context*, const Platform::IntRect& dstRect, const Platform::IntRect& contents); + void prepareFrame(Platform::Graphics::GLES2Context*, double animationTime); + + void render(Platform::Graphics::GLES2Context*, + const Platform::IntRect& targetRect, + const Platform::IntRect& clipRect, + const Platform::TransformationMatrix&, + const Platform::FloatRect& contents, + const Platform::FloatRect& viewport); void cleanup(Platform::Graphics::GLES2Context*); diff --git a/Source/WebKit/blackberry/Api/WebPageCompositorClient.h b/Source/WebKit/blackberry/Api/WebPageCompositorClient.h index 00497ee8a..70dd8289f 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositorClient.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositorClient.h @@ -32,7 +32,6 @@ public: virtual double requestAnimationFrame() = 0; virtual void invalidate(double animationFrameTimestamp) = 0; - virtual void requestCleanup() = 0; }; } // namespace WebKit diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h index cb41e1164..4d563c2fe 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h @@ -50,7 +50,13 @@ public: ~WebPageCompositorPrivate(); - bool hardwareCompositing() const; + // Public API + void prepareFrame(double animationTime); + void render(const WebCore::IntRect& targetRect, + const WebCore::IntRect& clipRect, + const WebCore::TransformationMatrix&, + const WebCore::FloatRect& contents, // This is public API, thus takes transformed contents + const WebCore::FloatRect& viewport); Platform::Graphics::GLES2Context* context() const { return m_context; } void setContext(Platform::Graphics::GLES2Context*); @@ -58,12 +64,11 @@ public: WebCore::LayerCompositingThread* rootLayer() const { return m_rootLayer.get(); } void setRootLayer(WebCore::LayerCompositingThread*); - void commit(WebCore::LayerWebKitThread* rootLayerProxy); + WebCore::LayerCompositingThread* overlayLayer() const { return m_overlayLayer.get(); } + void setOverlayLayer(WebCore::LayerCompositingThread*); - // This is mapped from the public API, thus takes transformed contents - void render(const WebCore::IntRect& dstRect, const WebCore::IntRect& transformedContents); + WebCore::LayerCompositingThread* compositingThreadOverlayLayer() const { return m_compositingThreadOverlayLayer.get(); } - // Returns true if the WebPageCompositor draws the root layer, false if the BackingStore draws the root layer bool drawsRootLayer() const; void setDrawsRootLayer(bool drawsRootLayer) { m_drawsRootLayer = drawsRootLayer; } @@ -86,17 +91,23 @@ public: WebPageCompositorClient* client() const { return m_client; } void compositorDestroyed(); + void addOverlay(WebCore::LayerCompositingThread*); + void removeOverlay(WebCore::LayerCompositingThread*); + protected: WebPageCompositorPrivate(WebPagePrivate*, WebPageCompositorClient*); private: void animationFrameChanged(); + void compositeLayers(const WebCore::TransformationMatrix&); WebPageCompositorClient* m_client; WebPagePrivate* m_webPage; Platform::Graphics::GLES2Context* m_context; OwnPtr<WebCore::LayerRenderer> m_layerRenderer; RefPtr<WebCore::LayerCompositingThread> m_rootLayer; + RefPtr<WebCore::LayerCompositingThread> m_overlayLayer; + RefPtr<WebCore::LayerCompositingThread> m_compositingThreadOverlayLayer; WebCore::IntRect m_layoutRectForCompositing; WebCore::IntSize m_contentsSizeForCompositing; WebCore::LayerRenderingResults m_lastCompositingResults; diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index c688c6de6..309bf5323 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -20,9 +20,11 @@ #define WebPage_p_h #include "ChromeClient.h" +#include "InspectorOverlay.h" #if USE(ACCELERATED_COMPOSITING) #include "GLES2Context.h" #include "LayerRenderer.h" +#include <EGL/egl.h> #endif #include "KURL.h" #include "PageClientBlackBerry.h" @@ -32,6 +34,7 @@ #include "ViewportArguments.h" #include "WebPage.h" #include "WebSettings.h" +#include "WebTapHighlight.h" #include <BlackBerryPlatformMessage.h> @@ -39,9 +42,12 @@ namespace WebCore { class AutofillManager; class DOMWrapperWorld; class Document; +class Element; class Frame; class GeolocationControllerClientBlackBerry; +class GraphicsLayerBlackBerry; class JavaScriptDebuggerBlackBerry; +class LayerWebKitThread; class Node; class Page; class PluginView; @@ -181,12 +187,16 @@ public: virtual int showAlertDialog(WebPageClient::AlertType atype); virtual bool isActive() const; virtual bool isVisible() const { return m_visible; } - virtual WebCore::Credential authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&); + virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&); virtual SaveCredentialType notifyShouldSaveCredential(bool); // Called from within WebKit via ChromeClientBlackBerry. void enterFullscreenForNode(WebCore::Node*); void exitFullscreenForNode(WebCore::Node*); +#if ENABLE(FULLSCREEN_API) + void enterFullScreenForElement(WebCore::Element*); + void exitFullScreenForElement(WebCore::Element*); +#endif void contentsSizeChanged(const WebCore::IntSize&); void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; } void layoutFinished(); @@ -368,6 +378,7 @@ public: void rootLayerCommitTimerFired(WebCore::Timer<WebPagePrivate>*); bool commitRootLayerIfNeeded(); WebCore::LayerRenderingResults lastCompositingResults() const; + WebCore::GraphicsLayer* overlayLayer(); // WebKit thread, plumbed through from ChromeClientBlackBerry. void setRootLayerWebKitThread(WebCore::Frame*, WebCore::LayerWebKitThread*); @@ -383,7 +394,7 @@ public: void commitRootLayer(const WebCore::IntRect&, const WebCore::IntSize&, bool); bool isAcceleratedCompositingActive() const { return m_compositor; } WebPageCompositorPrivate* compositor() const { return m_compositor.get(); } - void setCompositor(PassRefPtr<WebPageCompositorPrivate>); + void setCompositor(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext); bool createCompositor(); void destroyCompositor(); void syncDestroyCompositorOnCompositingThread(); @@ -422,12 +433,16 @@ public: void deferredTasksTimerFired(WebCore::Timer<WebPagePrivate>*); + void setInspectorOverlayClient(WebCore::InspectorOverlay::InspectorOverlayClient*); + WebPage* m_webPage; WebPageClient* m_client; WebCore::Page* m_page; WebCore::Frame* m_mainFrame; RefPtr<WebCore::Node> m_currentContextNode; WebSettings* m_webSettings; + OwnPtr<WebTapHighlight> m_tapHighlight; + OwnPtr<WebSelectionOverlay> m_selectionOverlay; #if ENABLE(JAVASCRIPT_DEBUGGER) OwnPtr<WebCore::JavaScriptDebuggerBlackBerry> m_scriptDebugger; @@ -516,6 +531,7 @@ public: #if USE(ACCELERATED_COMPOSITING) bool m_isAcceleratedCompositingActive; OwnPtr<FrameLayers> m_frameLayers; // WebKit thread only. + OwnPtr<WebCore::GraphicsLayer> m_overlayLayer; // Compositing thread only, used only when the WebKit layer created the context. // If the API client created the context, this will be null. @@ -542,6 +558,7 @@ public: RefPtr<WebCore::DOMWrapperWorld> m_isolatedWorld; bool m_hasInRegionScrollableAreas; bool m_updateDelegatedOverlaysDispatched; + OwnPtr<WebCore::InspectorOverlay> m_inspectorOverlay; // There is no need to initialize the following members in WebPagePrivate's constructor, // because they are only used by WebPageTasks and the tasks will initialize them when diff --git a/Source/WebKit/blackberry/Api/WebSelectionOverlay.h b/Source/WebKit/blackberry/Api/WebSelectionOverlay.h new file mode 100644 index 000000000..5858edf71 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebSelectionOverlay.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebSelectionOverlay_h +#define WebSelectionOverlay_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformIntRectRegion.h> + +namespace BlackBerry { +namespace WebKit { + +class BLACKBERRY_EXPORT WebSelectionOverlay { +public: + virtual ~WebSelectionOverlay() { } + + virtual void draw(const Platform::IntRectRegion&) = 0; + virtual void hide() = 0; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // WebSelectionOverlay_h diff --git a/Source/WebKit/blackberry/Api/WebTapHighlight.h b/Source/WebKit/blackberry/Api/WebTapHighlight.h new file mode 100644 index 000000000..4a1183d10 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebTapHighlight.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebTapHighlight_h +#define WebTapHighlight_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformIntRectRegion.h> + +namespace BlackBerry { +namespace WebKit { + +class BLACKBERRY_EXPORT WebTapHighlight { +public: + virtual ~WebTapHighlight() { } + + virtual void draw(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll) = 0; + virtual void hide() = 0; + + virtual bool shouldHideAfterScroll() const = 0; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // WebTapHighlight_h diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 93583a78a..4af41fcb1 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,767 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore::EditorClientBlackBerry::requestCheckingOfString): + * WebCoreSupport/EditorClientBlackBerry.h: + (EditorClientBlackBerry): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebGL and 2D canvas output not available to WebPageCompositor + https://bugs.webkit.org/show_bug.cgi?id=88012 + + Reviewed by George Staikos. + + Properly set up resource sharing between WebKit thread EGL contexts and + the compositing thread EGL context, so the texture ID produced by WebGL + and 2D canvas makes sense to the compositing context. + + There's no public API to supply an EGLContext yet, so we're lucky that + the embedder never makes its context un-current. Just grab the current + context on the compositing thread and use that as the compositing + context. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositor::WebPageCompositor): + (BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor): + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-31 George Staikos <staikos@webkit.org> + + [Blackberry] Initialize the select client and delete the pointer + in the destructor so it doesn't leak. Fixes test crashes. + https://bugs.webkit.org/show_bug.cgi?id=87992 + + Reviewed by Rob Buis. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::InputHandler): + (BlackBerry::WebKit::InputHandler::~InputHandler): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Crash when destroying WebOverlay with active WebOverlayOverride + https://bugs.webkit.org/show_bug.cgi?id=87968 + + Reviewed by Rob Buis. + + The override object is using a compositing thread WebOverlayPrivate + object with no client because the layer doesn't delegate drawing to the + WebOverlayPrivate, it's only used to modify the override properties on + the underlying compositing thread layer. + + Since the m_layerCompositingThreadClient is optional, we have to add + null checks. + + * Api/WebOverlay.cpp: + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate): + +2012-05-31 Chris Guan <chris.guan@torchmobile.com.cn> + + [Blackberry] WebKit's fullscreen mode needs to notify page client. + https://bugs.webkit.org/show_bug.cgi?id=87337 + + Reviewed by Antonio Gomes. + + Move "fullScreenVideoCapable" into webpagePrivate to make code + clean for "fullScreenForElement/Node" of cromeClientBlackberry, + All Video checks and code path selections are in webpagePrivate now. + For some UX and secure reasons, we could not apply fullscreen capacity + for all elements, So we use client's fullscreenStart/Stop only for + those video elements and those elements containing video tags. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::webContext): + (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited): + (WebKit): + (BlackBerry::WebKit::containsVideoTags): + (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement): + (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::enterFullScreenForElement): + (WebCore::ChromeClientBlackBerry::exitFullScreenForElement): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Crash when closing web page if selection is active + https://bugs.webkit.org/show_bug.cgi?id=87962 + + Reviewed by Antonio Gomes. + + The embedder may try to remove a layer from the compositor at a stage + where the compositor has been set to 0. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + +2012-05-30 Konrad Piascik <kpiascik@rim.com> + + [BlackBerry] Add an Accelerated Compositing layer for Web Inspector DOM highlight. + https://bugs.webkit.org/show_bug.cgi?id=81001 + + Reviewed by Antonio Gomes. + + Implemented InspectorOverlay using WebOverlayAPI. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::renderContents): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::updateDelegatedOverlays): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayerIfNeeded): + (BlackBerry::WebKit::WebPagePrivate::setInspectorOverlayClient): + (WebKit): + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/InspectorClientBlackBerry.cpp: + (WebCore::InspectorClientBlackBerry::highlight): + (WebCore::InspectorClientBlackBerry::hideHighlight): + (WebCore::InspectorClientBlackBerry::paintInspectorOverlay): + (WebCore): + * WebCoreSupport/InspectorClientBlackBerry.h: + (InspectorClientBlackBerry): + * WebCoreSupport/InspectorOverlay.cpp: Added. + (WebCore): + (WebCore::InspectorOverlay::create): + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::notifySyncRequired): + (WebCore::InspectorOverlay::paintContents): + (WebCore::InspectorOverlay::showDebugBorders): + (WebCore::InspectorOverlay::showRepaintCounter): + (WebCore::InspectorOverlay::contentsVisible): + (WebCore::InspectorOverlay::~InspectorOverlay): + (WebCore::InspectorOverlay::clear): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::paintWebFrame): + (WebCore::InspectorOverlay::invalidateWebFrame): + * WebCoreSupport/InspectorOverlay.h: Added. + (WebKit): + (WebCore): + (InspectorOverlay): + (InspectorOverlayClient): + (WebCore::InspectorOverlay::setClient): + (WebCore::InspectorOverlay::notifyAnimationStarted): + +2012-05-30 Sean Wang <Xuewen.Wang@torchmobile.com.cn> + + [BlackBerry] Browser crashed when selecting in textarea + https://bugs.webkit.org/show_bug.cgi?id=87484 + + The function FatFingers::checkForText() uses host node's whole text + to checkFingerIntersection(). We should not give the text of shadow + nodes to it. + + Reviewed by Antonio Gomes. + + * WebKitSupport/FatFingers.cpp: + (BlackBerry::WebKit::FatFingers::getNodesFromRect): Avoid returning + shadow nodes when the context is Text node. + +2012-05-30 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder + https://bugs.webkit.org/show_bug.cgi?id=80400 + + Get rid of QT_IMAGE_DECODER flag. + + Reviewed by Simon Hausmann. + + * WebCoreSupport/AboutDataEnableFeatures.in: + +2012-05-29 Max Feil <mfeil@rim.com> + + [BlackBerry] The Page's deviceScaleFactor() is not being properly maintained + https://bugs.webkit.org/show_bug.cgi?id=87817 + + Reviewed by Antonio Gomes. + + This bug fix in WebKit/blackberry is needed by the changes for + fullscreen media control sizing in WebCore (bug 87551). The sizing + of controls depends on the page's deviceScaleFactor(), which was + not being maintained properly due to errors in logic. Viewport + changes from non-default to default were being erroneously + thrown out. Also, when the viewport did change back to default + the deviceScaleFactor was not being updated. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments): + (BlackBerry::WebKit::WebPagePrivate::dispatchViewportPropertiesDidChange): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay build fixes and bug fixes + https://bugs.webkit.org/show_bug.cgi?id=87780 + + Reviewed by Rob Buis. + + Fix build when accelerated compositing disabled, or debug build. + + Also fix a bug where the selection overlay would not disappear properly + because of a typo in WebPage::removeOverlay(). Also convert said method + to early return style. + + Debug build fixes contributed by Ming Xie. + + * Api/WebOverlay.cpp: + (BlackBerry::WebKit::WebOverlay::addAnimation): + (BlackBerry::WebKit::WebOverlay::setContentsToImage): + (WebKit): + (BlackBerry::WebKit::WebOverlay::setContentsToColor): + (BlackBerry::WebKit::WebOverlay::setDrawsContent): + (BlackBerry::WebKit::WebOverlay::invalidate): + (BlackBerry::WebKit::WebOverlay::setClient): + (BlackBerry::WebKit::WebOverlay::override): + (BlackBerry::WebKit::WebOverlay::resetOverrides): + * Api/WebOverlayOverride.cpp: + (BlackBerry::WebKit::WebOverlayOverride::WebOverlayOverride): + * Api/WebOverlay_p.h: + (BlackBerry::WebKit::WebOverlayPrivate::~WebOverlayPrivate): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::removeOverlay): + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + +2012-05-29 Yong Li <yoli@rim.com> + + [BlackBerry] Add malloc info to about:memory page + https://bugs.webkit.org/show_bug.cgi?id=87676 + + Reviewed by Rob Buis. + + Detailed malloc info can tell us how much memory + in the heaps is being in use. + + * WebCoreSupport/AboutData.cpp: + (WebCore::memoryPage): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Make DefaultTapHighlight use the new WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87604 + + Reviewed by Antonio Gomes. + + Also add a new method to allow the embedder to use the default tap + highlight instead of replacing it with a custom one just to keep track + of the "shouldHideAfterScroll" flag. + + PR #160262. + + * Api/WebTapHighlight.h: + * WebKitSupport/DefaultTapHighlight.cpp: + (BlackBerry::WebKit::DefaultTapHighlight::DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::draw): + (BlackBerry::WebKit::DefaultTapHighlight::hide): + (BlackBerry::WebKit::DefaultTapHighlight::paintContents): + * WebKitSupport/DefaultTapHighlight.h: + (BlackBerry::WebKit::DefaultTapHighlight::shouldHideAfterScroll): + (DefaultTapHighlight): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebKit-side implementation of SelectionOverlay + https://bugs.webkit.org/show_bug.cgi?id=87605 + + Reviewed by Rob Buis. + + Leverage the new WebOverlay API to move SelectionOverlay to the WebKit + library, so we always draw selection regardless of which embedder is + integrating WebKit. + + PR #160263 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPage::selectionOverlay): + (WebKit): + * Api/WebPage.h: + (WebKit): + * Api/WebPage_p.h: + (WebPagePrivate): + * Api/WebSelectionOverlay.h: Added. + (WebKit): + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + * WebKitSupport/SelectionOverlay.cpp: Added. + (WebKit): + (BlackBerry::WebKit::SelectionOverlay::SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::~SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::draw): + (BlackBerry::WebKit::SelectionOverlay::hide): + (BlackBerry::WebKit::SelectionOverlay::notifySyncRequired): + (BlackBerry::WebKit::SelectionOverlay::paintContents): + * WebKitSupport/SelectionOverlay.h: Added. + (WebKit): + (SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::create): + (BlackBerry::WebKit::SelectionOverlay::notifyAnimationStarted): + (BlackBerry::WebKit::SelectionOverlay::showDebugBorders): + (BlackBerry::WebKit::SelectionOverlay::showRepaintCounter): + (BlackBerry::WebKit::SelectionOverlay::contentsVisible): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87603 + + Reviewed by Rob Buis. + + This new API makes it possible to leverage the BlackBerry accelerated + compositing implementation to draw, transform and fluidly animate + overlays in the embedding library or application. + + A WebOverlay has an affinity for the thread where it was created. If + the current thread is the WebKit thread, use WebPage::addOverlay() to + add it to the page, and manipulate it only from the WebKit thread, with + exception of the "override" functionality which can be used from the + compositing thread. If the current thread is the compositing thread, + use WebPage::addCompositingThreadOverlay() to add it to the page, and + only manipulate it on the compositing thread. + + A WebOverlay can be painted using Skia, or its contents can be set to + an image or a solid color. + + PR #156812 + + * Api/WebAnimation.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebAnimation::fadeAnimation): + (BlackBerry::WebKit::WebAnimation::name): + (BlackBerry::WebKit::WebAnimation::WebAnimation): + (BlackBerry::WebKit::WebAnimation::~WebAnimation): + (BlackBerry::WebKit::WebAnimation::operator=): + * Api/WebAnimation.h: Added. + (WebKit): + * Api/WebAnimation_p.h: Added. + (WebKit): + (WebAnimationPrivate): + (BlackBerry::WebKit::WebAnimationPrivate::WebAnimationPrivate): + * Api/WebOverlay.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebOverlay::WebOverlay): + (BlackBerry::WebKit::WebOverlay::~WebOverlay): + (BlackBerry::WebKit::WebOverlay::position): + (BlackBerry::WebKit::WebOverlay::setPosition): + (BlackBerry::WebKit::WebOverlay::anchorPoint): + (BlackBerry::WebKit::WebOverlay::setAnchorPoint): + (BlackBerry::WebKit::WebOverlay::size): + (BlackBerry::WebKit::WebOverlay::setSize): + (BlackBerry::WebKit::WebOverlay::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlay::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlay::transform): + (BlackBerry::WebKit::WebOverlay::setTransform): + (BlackBerry::WebKit::WebOverlay::opacity): + (BlackBerry::WebKit::WebOverlay::setOpacity): + (BlackBerry::WebKit::WebOverlay::addAnimation): + (BlackBerry::WebKit::WebOverlay::removeAnimation): + (BlackBerry::WebKit::WebOverlay::parent): + (BlackBerry::WebKit::WebOverlay::addChild): + (BlackBerry::WebKit::WebOverlay::removeFromParent): + (BlackBerry::WebKit::WebOverlay::setContentsToImage): + (BlackBerry::WebKit::WebOverlay::setContentsToColor): + (BlackBerry::WebKit::WebOverlay::setDrawsContent): + (BlackBerry::WebKit::WebOverlay::invalidate): + (BlackBerry::WebKit::WebOverlay::setClient): + (BlackBerry::WebKit::WebOverlay::override): + (BlackBerry::WebKit::WebOverlay::resetOverrides): + (BlackBerry::WebKit::WebOverlayPrivate::page): + (BlackBerry::WebKit::WebOverlayPrivate::override): + (BlackBerry::WebKit::WebOverlayPrivate::drawContents): + (BlackBerry::WebKit::WebOverlayPrivate::scheduleCompositingRun): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::WebOverlayPrivateWebKitThread): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::override): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::position): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setPosition): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::anchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::size): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setSize): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::transform): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setTransform): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::opacity): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setOpacity): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::addAnimation): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::removeAnimation): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::addChild): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::removeFromParent): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::clear): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::invalidate): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::resetOverrides): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::notifySyncRequired): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::paintContents): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::~WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setDrawsContent): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::invalidate): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContents): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::layerCompositingThreadDestroyed): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::layerVisibilityChanged): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawTextures): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::deleteTextures): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::override): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::position): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setPosition): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::anchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::size): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setSize): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::transform): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setTransform): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::opacity): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setOpacity): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::addAnimation): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeAnimation): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::addChild): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeFromParent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::clear): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::resetOverrides): + * Api/WebOverlay.h: Added. + (WebCore): + (WebKit): + * Api/WebOverlayClient.h: Added. + (WebKit): + * Api/WebOverlayOverride.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebOverlayOverride::WebOverlayOverride): + (BlackBerry::WebKit::WebOverlayOverride::~WebOverlayOverride): + (BlackBerry::WebKit::WebOverlayOverride::setPosition): + (BlackBerry::WebKit::WebOverlayOverride::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayOverride::setSize): + (BlackBerry::WebKit::WebOverlayOverride::setTransform): + (BlackBerry::WebKit::WebOverlayOverride::setOpacity): + (BlackBerry::WebKit::WebOverlayOverride::addAnimation): + (BlackBerry::WebKit::WebOverlayOverride::removeAnimation): + * Api/WebOverlayOverride.h: Added. + (WebKit): + * Api/WebOverlay_p.h: Added. + (WTF): + (WebCore): + (WebKit): + (WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::~WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::setPage): + (BlackBerry::WebKit::WebOverlayPrivate::setClient): + (BlackBerry::WebKit::WebOverlayPrivate::layerCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivate::graphicsLayer): + (WebOverlayPrivateWebKitThread): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::graphicsLayer): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::notifyAnimationStarted): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showDebugBorders): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showRepaintCounter): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::contentsVisible): + (WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setLayer): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawsContent): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::contents): + (WebOverlayPrivateCompositingThread): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::addOverlay): + (WebKit): + (BlackBerry::WebKit::WebPage::removeOverlay): + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + * Api/WebPage.h: + (WebKit): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (WebKit): + (BlackBerry::WebKit::WebPageCompositorPrivate::compositeLayers): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + (BlackBerry::WebKit::WebPageCompositorPrivate::addOverlay): + (BlackBerry::WebKit::WebPageCompositorPrivate::removeOverlay): + * Api/WebPageCompositor_p.h: + (BlackBerry::WebKit::WebPageCompositorPrivate::compositingThreadOverlayLayer): + (WebPageCompositorPrivate): + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail + https://bugs.webkit.org/show_bug.cgi?id=80135 + + Reviewed by Rob Buis. + + RIM PR: 145660 + Fixed a regression introduced by r111810, which used the wrong + credential object. + + Added the interface function didReceivedAuthenticaitonChallenge() + in interface class DumpRenderTreeClient; + Called m_dumpRenderTree->didReceiveAuthenticationChallenge() in + WebPagePrivate::authenticationChallenge() when DRT is enabled. + + Test: reuse existing test cases: + http/tests/loading/basic-credentials-sent-automatically.html + http/tests/loading/basic-auth-resend-wrong-credentials.html + + Resubmit the patch reverted by r115104 after the digest infinite loop + issue for BlackBerry porting get identified and fixed. + + Internally reviewed by Joe Mason <jmason@rim.com> + + * Api/DumpRenderTreeClient.h: + (WebCore): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Always create a compositor + https://bugs.webkit.org/show_bug.cgi?id=87598 + + Reviewed by Rob Buis. + + There will likely be compositing layers either due to web content or + due to overlays. + + Defer initialization of OpenGL objects (i.e., delay creation of the + LayerRenderer object) until we actually need to draw and there are such + layers, to avoid initializing OpenGL in the unlikely case that there + are no compositing layers or overlay layers. + + PR #156811 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPagePrivate::createCompositor): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setContext): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + * Api/WebPageCompositor_p.h: + (WebPageCompositorPrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Dangling pointer in WebPagePrivate::setCompositor() message + https://bugs.webkit.org/show_bug.cgi?id=87590 + + Reviewed by Rob Buis. + + A crash would be seen in GuardedPointerBase::getWithGuardLocked when + attempting to unpickle and execute serialized call to setCompositor. + + The problem was that the message had been created with a dangling + pointer as the target. The web page failed to inform its compositor + that it was being destroyed due to an early return in + WebPagePrivate::destroyCompositor. + + The root cause was that a method called "destroyCompositor" was being + called in two situations, when navigating to a new page as well as when + actually deleting the web page. And in one case, we really only wanted + to free up some memory by clearing textures, while in the other case we + really did want to destroy the compositor. + + Fixed by calling a method to release textures when that's what we want + to do, and calling a method to destroy the compositor when that's what + we want to do, and making that latter method unconditional. + + Reviewed internally by Jeff Rogers. + + PR #156765 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + (BlackBerry::WebKit::WebPagePrivate::destroyCompositor): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add a default tap highlight + https://bugs.webkit.org/show_bug.cgi?id=87569 + + Reviewed by Rob Buis. + + We used to require the embedder to implement tap highlight drawing. + Now, a default tap highlight, implemented using the recently added + accelerated compositing overlay layer support, can be used instead. + + The tap highlight appears instantly but fades out when hidden. + + The default tap highlight can be overridden using the new + WebPage::setTapHighlight() method. + + Reviewed internally by Mike Lattanzio and Mike Fenton. + + PR #154329 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPage::tapHighlight): + (WebKit): + (BlackBerry::WebKit::WebPage::setTapHighlight): + * Api/WebPage.h: + (WebKit): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * Api/WebTapHighlight.h: Added. + (WebKit): + * WebKitSupport/DefaultTapHighlight.cpp: Added. + (WebKit): + (BlackBerry::WebKit::fadeAnimationName): + (BlackBerry::WebKit::DefaultTapHighlight::DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::~DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::draw): + (BlackBerry::WebKit::DefaultTapHighlight::hide): + (BlackBerry::WebKit::DefaultTapHighlight::notifySyncRequired): + (BlackBerry::WebKit::DefaultTapHighlight::paintContents): + * WebKitSupport/DefaultTapHighlight.h: Added. + (WebKit): + (DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::create): + (BlackBerry::WebKit::DefaultTapHighlight::notifyAnimationStarted): + (BlackBerry::WebKit::DefaultTapHighlight::showDebugBorders): + (BlackBerry::WebKit::DefaultTapHighlight::showRepaintCounter): + (BlackBerry::WebKit::DefaultTapHighlight::contentsVisible): + * WebKitSupport/TouchEventHandler.cpp: + (BlackBerry::WebKit::TouchEventHandler::drawTapHighlight): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add an overlay layer + https://bugs.webkit.org/show_bug.cgi?id=87567 + + Reviewed by Antonio Gomes. + + The overlay layer allows us to have compositing layers even though the + web page is not currently using accelerated compositing. + + These layers can be used to implement tap highlight, inspector overlay + and more. + + Reviewed internally by Filip Spacek. + + PR #154335 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::scheduleRootLayerCommit): + (BlackBerry::WebKit::WebPagePrivate::overlayLayer): + (WebKit): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayer): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayerIfNeeded): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setOverlayLayer): + (WebKit): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + * Api/WebPageCompositor_p.h: + (BlackBerry::WebKit::WebPageCompositorPrivate::overlayLayer): + (WebPageCompositorPrivate): + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Update WebPageCompositor::render() API + https://bugs.webkit.org/show_bug.cgi?id=87565 + + Reviewed by Rob Buis. + + The new API allows the embedder to specify the root transform and many + OpenGL related parameters to be used when rendering the web page. + + To honor the transform, we have to implement a way to composite the + BackingStore output using a generic transform. This method, + BackingStorePrivate::compositeContents(), uses a strategy that differs + from blitContents(), because that one is optimized for software + blitting, while this one is optimized for GPU rendering. Specifically, + instead of drawing the checkerboard first, and the rendered subregions + of the tile afterward, we draw the whole tile in one call, and then + draw checkered regions on top, if any. + + Removed the blit generation condvar from the new code paths for drawing + BackingStore output using a transform, since the condvar is ineffective + in preventing flicker when we're not in charge of swapping the window. + Instead, another synchronization solution will be implemented in the + future. + + Reviewed internally by Filip Spacek. + Some parts reviewed internally by Jacky Jiang and others by + Mike Lattanzio. + + PR #151887, #154334 + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::compositeContents): + * Api/BackingStore_p.h: + (WebCore): + (BackingStorePrivate): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setContext): + (BlackBerry::WebKit::WebPageCompositorPrivate::setRootLayer): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + (BlackBerry::WebKit::WebPageCompositor::prepareFrame): + (BlackBerry::WebKit::WebPageCompositor::render): + * Api/WebPageCompositor.h: + * Api/WebPageCompositorClient.h: + * Api/WebPageCompositor_p.h: + (WebPageCompositorPrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Plumb through the return value of makeCurrent to caller + https://bugs.webkit.org/show_bug.cgi?id=87564 + + Reviewed by Rob Buis. + + This way the caller can take appropriate action if makeCurrent fails, + for example because we're running out of memory. + + Reviewed internally by George Staikos. + + PR #149721 + + * WebKitSupport/GLES2Context.cpp: + (BlackBerry::WebKit::GLES2Context::makeCurrent): + 2012-05-27 Arvid Nilsson <anilsson@rim.com> [BlackBerry] Crash when deleting WebPageCompositor diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp index 6c79d54f9..e217742da 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp @@ -19,13 +19,15 @@ #include "config.h" #include "AboutData.h" +#include "CString.h" #include "MemoryCache.h" #include "SurfacePool.h" #include "WebKitVersion.h" +#include <process.h> #include <BlackBerryPlatformSettings.h> +#include <sys/stat.h> #include <sys/utsname.h> -#include <wtf/Platform.h> namespace WebCore { @@ -195,31 +197,57 @@ String memoryPage() // generate cache information MemoryCache* cacheInc = memoryCache(); - MemoryCache::Statistics stat = cacheInc->getStatistics(); + MemoryCache::Statistics cacheStat = cacheInc->getStatistics(); page += String("<h2>Cache Information</h2>") + "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>"; MemoryCache::TypeStatistic total; - total.count = stat.images.count + stat.cssStyleSheets.count - + stat.scripts.count + stat.xslStyleSheets.count + stat.fonts.count; + total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count + + cacheStat.scripts.count + cacheStat.xslStyleSheets.count + cacheStat.fonts.count; total.size = cacheInc->totalSize(); - total.liveSize = stat.images.liveSize + stat.cssStyleSheets.liveSize - + stat.scripts.liveSize + stat.xslStyleSheets.liveSize + stat.fonts.liveSize; - total.decodedSize = stat.images.decodedSize - + stat.cssStyleSheets.decodedSize + stat.scripts.decodedSize - + stat.xslStyleSheets.decodedSize + stat.fonts.decodedSize; + total.liveSize = cacheStat.images.liveSize + cacheStat.cssStyleSheets.liveSize + + cacheStat.scripts.liveSize + cacheStat.xslStyleSheets.liveSize + cacheStat.fonts.liveSize; + total.decodedSize = cacheStat.images.decodedSize + + cacheStat.cssStyleSheets.decodedSize + cacheStat.scripts.decodedSize + + cacheStat.xslStyleSheets.decodedSize + cacheStat.fonts.decodedSize; page += cacheTypeStatisticToHTMLTr("Total", total); - page += cacheTypeStatisticToHTMLTr("Images", stat.images); - page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", stat.cssStyleSheets); - page += cacheTypeStatisticToHTMLTr("Scripts", stat.scripts); + page += cacheTypeStatisticToHTMLTr("Images", cacheStat.images); + page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", cacheStat.cssStyleSheets); + page += cacheTypeStatisticToHTMLTr("Scripts", cacheStat.scripts); #if ENABLE(XSLT) - page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", stat.xslStyleSheets); + page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", cacheStat.xslStyleSheets); #endif - page += cacheTypeStatisticToHTMLTr("Fonts", stat.fonts); + page += cacheTypeStatisticToHTMLTr("Fonts", cacheStat.fonts); - page += "</table></body></html>"; + page += "</table>"; + +#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD + struct mallinfo mallocInfo = mallinfo(); + + page += String("<h2>Malloc Information</h2>") + "<table align=\"center\" rules=\"all\">"; + + page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks); + page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks); + page += numberToHTMLTr("Size of the arena", mallocInfo.arena); + page += numberToHTMLTr("Number of big blocks in use", mallocInfo.ordblks); + page += numberToHTMLTr("Number of small blocks in use", mallocInfo.smblks); + page += numberToHTMLTr("Number of header blocks in use", mallocInfo.hblks); + page += numberToHTMLTr("Space in header block headers", mallocInfo.hblkhd); + page += numberToHTMLTr("Space in small blocks in use", mallocInfo.usmblks); + page += numberToHTMLTr("Memory in free small blocks", mallocInfo.fsmblks); + page += numberToHTMLTr("Space in big blocks in use", mallocInfo.uordblks); + page += numberToHTMLTr("Memory in free big blocks", mallocInfo.fordblks); + + struct stat processInfo; + if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) + page += numberToHTMLTr("Process total mapped memory", processInfo.st_size); + + page += "</table>"; +#endif + + page += "</body></html>"; return page; } diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 32e973868..8a0adf79d 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -107,7 +107,6 @@ PLUGIN_PROXY_FOR_VIDEO POINTER_LOCK PROGRESS_TAG PURGEABLE_MEMORY -QT_IMAGE_DECODER QUOTA REGEXP_TRACING REGISTER_PROTOCOL_HANDLER diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index d2340879d..4199639d4 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -36,6 +36,7 @@ #include "FrameLoader.h" #include "Geolocation.h" #include "GeolocationControllerClientBlackBerry.h" +#include "GraphicsLayer.h" #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HitTestResult.h" @@ -726,32 +727,14 @@ bool ChromeClientBlackBerry::supportsFullScreenForElement(const WebCore::Element void ChromeClientBlackBerry::enterFullScreenForElement(WebCore::Element* element) { element->document()->webkitWillEnterFullScreenForElement(element); - if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) { - // The Browser chrome has its own fullscreen video widget it wants to - // use, and this is a video element. The only reason that - // webkitWillEnterFullScreenForElement() and - // webkitDidEnterFullScreenForElement() are still called in this case - // is so that exitFullScreenForElement() gets called later. - enterFullscreenForNode(element); - } else { - // No fullscreen video widget has been made available by the Browser - // chrome, or this is not a video element. The webkitRequestFullScreen - // Javascript call is often made on a div element. - // This is where we would hide the browser's chrome if we wanted to. - } + m_webPagePrivate->enterFullScreenForElement(element); element->document()->webkitDidEnterFullScreenForElement(element); } void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element* element) { element->document()->webkitWillExitFullScreenForElement(element); - if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) { - // The Browser chrome has its own fullscreen video widget. - exitFullscreenForNode(element); - } else { - // This is where we would restore the browser's chrome - // if hidden above. - } + m_webPagePrivate->exitFullScreenForElement(element); element->document()->webkitDidExitFullScreenForElement(element); } #endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp index ee314c933..d1ed4f4df 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp @@ -565,7 +565,7 @@ void EditorClientBlackBerry::checkGrammarOfString(const UChar*, int, WTF::Vector notImplemented(); } -void EditorClientBlackBerry::requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) +void EditorClientBlackBerry::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { notImplemented(); } diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h index 70c62959b..25a8728f5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h @@ -86,7 +86,7 @@ public: virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail, 0u>&, int*, int*); virtual void getGuessesForWord(const String&, const String&, Vector<String>&); - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&); + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); virtual TextCheckerClient* textChecker(); virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp index d9688ff6a..1df776462 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp @@ -22,7 +22,10 @@ #include "BackingStore.h" #include "Frame.h" +#include "GraphicsContext.h" +#include "InspectorController.h" #include "NotImplemented.h" +#include "Page.h" #include "RenderObject.h" #include "WebPageClient.h" #include "WebPage_p.h" @@ -42,17 +45,16 @@ void InspectorClientBlackBerry::inspectorDestroyed() void InspectorClientBlackBerry::highlight() { - hideHighlight(); + m_webPagePrivate->setInspectorOverlayClient(this); + if (!m_webPagePrivate->isAcceleratedCompositingActive()) + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); } void InspectorClientBlackBerry::hideHighlight() { - if (!m_webPagePrivate->mainFrame() || !m_webPagePrivate->mainFrame()->document() || !m_webPagePrivate->mainFrame()->document()->documentElement() - || !m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()) - return; - - // FIXME: Potentially slow hack, but invalidating everything should work since the actual highlight is drawn by BackingStorePrivate::renderContents(). - m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); + m_webPagePrivate->setInspectorOverlayClient(0); + if (!m_webPagePrivate->isAcceleratedCompositingActive()) + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); } void InspectorClientBlackBerry::openInspectorFrontend(InspectorController*) @@ -92,4 +94,11 @@ void InspectorClientBlackBerry::updateInspectorStateCookie(const String& cookie) notImplemented(); }; +void InspectorClientBlackBerry::paintInspectorOverlay(GraphicsContext& gc) +{ + InspectorController* inspectorController = m_webPagePrivate->m_page->inspectorController(); + if (inspectorController) + inspectorController->drawHighlight(gc); +} + } // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h index a6a404a7a..3f6f207dd 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h @@ -21,6 +21,7 @@ #define InspectorClientBlackBerry_h #include "InspectorClient.h" +#include "InspectorOverlay.h" #include "PlatformString.h" #include <wtf/HashMap.h> @@ -32,7 +33,7 @@ class WebPagePrivate; namespace WebCore { -class InspectorClientBlackBerry : public InspectorClient { +class InspectorClientBlackBerry : public InspectorClient, public InspectorOverlay::InspectorOverlayClient { public: InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); virtual void inspectorDestroyed(); @@ -50,6 +51,7 @@ public: virtual bool canClearBrowserCache() { return true; } virtual void clearBrowserCookies(); virtual bool canClearBrowserCookies() { return true; } + virtual void paintInspectorOverlay(WebCore::GraphicsContext&); virtual void updateInspectorStateCookie(const String&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp new file mode 100644 index 000000000..c568f1341 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "InspectorOverlay.h" + +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "GraphicsLayer.h" +#include "Page.h" +#include "Settings.h" +#include "WebPage_p.h" + + +namespace WebCore { + +PassOwnPtr<InspectorOverlay> InspectorOverlay::create(BlackBerry::WebKit::WebPagePrivate* page, InspectorOverlayClient* client) +{ + return adoptPtr(new InspectorOverlay(page, client)); +} + +InspectorOverlay::InspectorOverlay(BlackBerry::WebKit::WebPagePrivate* page, InspectorOverlayClient* client) + : m_webPage(page) + , m_client(client) +{ +} + +#if USE(ACCELERATED_COMPOSITING) +void InspectorOverlay::notifySyncRequired(const GraphicsLayer*) +{ + m_webPage->scheduleRootLayerCommit(); +} + +void InspectorOverlay::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& inClip) +{ + context.save(); + IntPoint scrollPosition = m_webPage->focusedOrMainFrame()->view()->scrollPosition(); + context.translate(scrollPosition.x(), scrollPosition.y()); + m_client->paintInspectorOverlay(context); + context.restore(); +} + +bool InspectorOverlay::showDebugBorders(const GraphicsLayer*) const +{ + return m_webPage->m_page->settings()->showDebugBorders(); +} + +bool InspectorOverlay::showRepaintCounter(const GraphicsLayer*) const +{ + return m_webPage->m_page->settings()->showRepaintCounter(); +} + +bool InspectorOverlay::contentsVisible(const GraphicsLayer*, const IntRect& contentRect) const +{ + return true; +} +#endif + +InspectorOverlay::~InspectorOverlay() { } + +void InspectorOverlay::clear() +{ + invalidateWebFrame(); + +#if USE(ACCELERATED_COMPOSITING) + if (m_overlay) { + m_overlay->removeFromParent(); + m_overlay = nullptr; + } +#endif +} + +void InspectorOverlay::update() +{ + invalidateWebFrame(); + +#if USE(ACCELERATED_COMPOSITING) + if (!m_overlay) { + m_overlay = adoptPtr(new BlackBerry::WebKit::WebOverlay(this)); + const IntSize size = m_webPage->viewportSize(); + m_overlay->setSize(FloatSize(size.width(), size.height())); + m_webPage->m_webPage->addOverlay(m_overlay.get()); + } + + m_overlay->setDrawsContent(true); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +#endif +} + +void InspectorOverlay::paintWebFrame(GraphicsContext& gc) +{ + if (!m_webPage->isAcceleratedCompositingActive()) + m_client->paintInspectorOverlay(gc); +} + +void InspectorOverlay::invalidateWebFrame() +{ + // InspectorOverlayClient does the actual painting of the overlay. + // Here we just make sure to invalidate. + if (!m_webPage->isAcceleratedCompositingActive()) { + // FIXME: able to invalidate a smaller rect. + // FIXME: Is it important to just invalidate a smaller rect given that + // this is not on a critical codepath? In order to do so, we'd + // have to take scrolling into account. + const IntSize size = m_webPage->viewportSize(); + IntRect damagedRect(0, 0, size.width(), size.height()); + } +} + +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h new file mode 100644 index 000000000..7f91e3541 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef InspectorOverlay_h +#define InspectorOverlay_h + +#include "WebOverlay.h" +#include <GraphicsLayerClient.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { +class GraphicsContext; +class GraphicsLayer; + + +class InspectorOverlay : public WebCore::GraphicsLayerClient { +public: + class InspectorOverlayClient { + public: + virtual void paintInspectorOverlay(GraphicsContext&) = 0; + }; + + static PassOwnPtr<InspectorOverlay> create(BlackBerry::WebKit::WebPagePrivate*, InspectorOverlayClient*); + + ~InspectorOverlay(); + + void setClient(InspectorOverlayClient* client) { m_client = client; } + + void clear(); + void update(); + void paintWebFrame(GraphicsContext&); + +#if USE(ACCELERATED_COMPOSITING) + virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const GraphicsLayer*); + virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip); + virtual bool showDebugBorders(const GraphicsLayer*) const; + virtual bool showRepaintCounter(const GraphicsLayer*) const; + + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const; +#endif + +private: + InspectorOverlay(BlackBerry::WebKit::WebPagePrivate*, InspectorOverlayClient*); + void invalidateWebFrame(); + + BlackBerry::WebKit::WebPagePrivate* m_webPage; + InspectorOverlayClient* m_client; + OwnPtr<BlackBerry::WebKit::WebOverlay> m_overlay; +}; + +} // namespace WebCore + + +#endif /* InspectorOverlay_h */ diff --git a/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp new file mode 100644 index 000000000..4cc565e63 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "DefaultTapHighlight.h" + +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformContextSkia.h" +#include "WebAnimation.h" +#include "WebPage_p.h" + +#include <BlackBerryPlatformMessageClient.h> + +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +const double ActiveTextFadeAnimationDuration = 0.3; + +static const char* fadeAnimationName() { return "fade"; } + +DefaultTapHighlight::DefaultTapHighlight(WebPagePrivate* page) + : m_page(page) + , m_visible(false) + , m_shouldHideAfterScroll(false) +{ +} + +DefaultTapHighlight::~DefaultTapHighlight() +{ +} + +void DefaultTapHighlight::draw(const Platform::IntRectRegion& region, int red, int green, int blue, int alpha, bool hideAfterScroll) +{ + ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); + + m_region = region; + m_color = Color(red, green, blue, std::min(128, alpha)); + m_shouldHideAfterScroll = hideAfterScroll; + FloatRect rect = IntRect(m_region.extents()); + if (rect.isEmpty()) + return; + + m_visible = true; + + if (!m_overlay) { + m_overlay = adoptPtr(new WebOverlay(this)); + m_page->m_webPage->addOverlay(m_overlay.get()); + } + + m_overlay->resetOverrides(); + m_overlay->setPosition(rect.location()); + m_overlay->setSize(rect.size()); + m_overlay->setDrawsContent(true); + m_overlay->removeAnimation(fadeAnimationName()); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +} + +void DefaultTapHighlight::hide() +{ + if (!m_overlay) + return; + + // Since WebAnimation is not thread safe, we create a new one each time instead of reusing the same object on different + // threads (that would introduce race conditions). + WebAnimation fadeAnimation = WebAnimation::fadeAnimation(fadeAnimationName(), 1.0, 0.0, ActiveTextFadeAnimationDuration); + + // Normally, this method is called on the WebKit thread, but it can also be + // called from the compositing thread. + if (BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()) { + if (!m_visible) + return; + m_visible = false; + m_overlay->addAnimation(fadeAnimation); + } else if (BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + m_overlay->override()->addAnimation(fadeAnimation); +} + +void DefaultTapHighlight::notifySyncRequired(const GraphicsLayer*) +{ + m_page->scheduleRootLayerCommit(); +} + +void DefaultTapHighlight::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& /*inClip*/) +{ + std::vector<Platform::IntRect> rects = m_region.rects(); + Platform::IntRect rect = m_region.extents(); + SkRegion overlayRegion; + + unsigned rectCount = m_region.numRects(); + if (!rectCount) + return; + + for (unsigned i = 0; i < rectCount; ++i) { + Platform::IntRect rectToPaint = rects[i]; + SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); + overlayRegion.op(r, SkRegion::kUnion_Op); + } + + SkPath pathToPaint; + overlayRegion.getBoundaryPath(&pathToPaint); + + Path path(pathToPaint); + c.save(); + c.translate(-rect.x(), -rect.y()); + + // Draw tap highlight + c.setFillColor(m_color, ColorSpaceDeviceRGB); + c.fillPath(path); + Color darker = Color(m_color.red(), m_color.green(), m_color.blue()); // Get rid of alpha. + c.setStrokeColor(darker, ColorSpaceDeviceRGB); + c.setStrokeThickness(1); + c.strokePath(path); + c.restore(); +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h new file mode 100644 index 000000000..fdf632a50 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DefaultTapHighlight_h +#define DefaultTapHighlight_h + +#include "BlackBerryGlobal.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "Color.h" +#include "GraphicsLayerClient.h" +#include "WebOverlay.h" +#include "WebTapHighlight.h" + +#include <BlackBerryPlatformIntRectRegion.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { + +class WebPagePrivate; + +class DefaultTapHighlight : public WebTapHighlight, public WebCore::GraphicsLayerClient { +public: + static PassOwnPtr<DefaultTapHighlight> create(WebPagePrivate* page) + { + return adoptPtr(new DefaultTapHighlight(page)); + } + + virtual ~DefaultTapHighlight(); + + virtual void draw(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll); + virtual void hide(); + + virtual bool shouldHideAfterScroll() const { return m_shouldHideAfterScroll; } + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + + +private: + DefaultTapHighlight(WebPagePrivate*); + + WebPagePrivate* m_page; + OwnPtr<WebOverlay> m_overlay; + BlackBerry::Platform::IntRectRegion m_region; + WebCore::Color m_color; + bool m_visible; + bool m_shouldHideAfterScroll; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // DefaultTapHighlight_h diff --git a/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp b/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp index fe7f848d7..d9fa43b1e 100644 --- a/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp @@ -492,7 +492,10 @@ void FatFingers::getNodesFromRect(Document* document, const IntPoint& contentPos getPaddings(topPadding, rightPadding, bottomPadding, leftPadding); HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping); - HitTestResult result(contentPos, topPadding, rightPadding, bottomPadding, leftPadding, HitTestShadowDOM); + // The user functions checkForText() and findIntersectingRegions() uses the Node.wholeText() to checkFingerIntersection() + // not the text in its shadow tree. + ShadowContentFilterPolicy allowShadow = m_targetType == Text ? DoNotAllowShadowContent : AllowShadowContent; + HitTestResult result(contentPos, topPadding, rightPadding, bottomPadding, leftPadding, allowShadow); document->renderView()->layer()->hitTest(request, result); intersectedNodes = result.rectBasedTestResult(); diff --git a/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp b/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp index 06507acac..7812da8df 100644 --- a/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp @@ -100,8 +100,7 @@ Platform::IntSize GLES2Context::surfaceSize() const bool GLES2Context::makeCurrent() { - Platform::Graphics::makeBufferCurrent(buffer(), Platform::Graphics::GLES2); - return true; + return Platform::Graphics::makeBufferCurrent(buffer(), Platform::Graphics::GLES2); } bool GLES2Context::swapBuffers() diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index af2db171f..5d5906c76 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -120,11 +120,13 @@ InputHandler::InputHandler(WebPagePrivate* page) , m_composingTextEnd(0) , m_pendingKeyboardVisibilityChange(NoChange) , m_delayKeyboardVisibilityChange(false) + , m_selectClient(0) { } InputHandler::~InputHandler() { + delete m_selectClient; } static BlackBerryInputType convertInputType(const HTMLInputElement* inputElement) diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index da43f2ca4..51c9b72c3 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -32,6 +32,7 @@ #include "TouchEventHandler.h" #include "WebPageClient.h" #include "WebPage_p.h" +#include "WebSelectionOverlay.h" #include "htmlediting.h" #include "visible_units.h" @@ -924,6 +925,8 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) DEBUG_SELECTION(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height()); + if (m_webPage->m_selectionOverlay) + m_webPage->m_selectionOverlay->draw(visibleSelectionRegion); m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch()); } diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp new file mode 100644 index 000000000..9480e8415 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "SelectionOverlay.h" + +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformContextSkia.h" +#include "RenderTheme.h" +#include "WebPage_p.h" + +#include <BlackBerryPlatformMessageClient.h> + +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +SelectionOverlay::SelectionOverlay(WebPagePrivate* page) + : m_page(page) +{ +} + +SelectionOverlay::~SelectionOverlay() +{ +} + +void SelectionOverlay::draw(const Platform::IntRectRegion& region) +{ + ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); + + m_region = region; + FloatRect rect = IntRect(m_region.extents()); + if (rect.isEmpty()) { + hide(); + return; + } + + if (!m_overlay) + m_overlay = adoptPtr(new WebOverlay(this)); + + m_page->m_webPage->addOverlay(m_overlay.get()); + m_overlay->resetOverrides(); + m_overlay->setPosition(rect.location()); + m_overlay->setSize(rect.size()); + m_overlay->setDrawsContent(true); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +} + +void SelectionOverlay::hide() +{ + if (!m_overlay) + return; + + // Normally, this method is called on the WebKit thread, but it can also be + // called from the compositing thread. + if (BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()) + m_page->m_webPage->removeOverlay(m_overlay.get()); + else if (BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + m_overlay->override()->setOpacity(0); +} + +void SelectionOverlay::notifySyncRequired(const GraphicsLayer*) +{ + m_page->scheduleRootLayerCommit(); +} + +void SelectionOverlay::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& inClip) +{ + std::vector<Platform::IntRect> rects = m_region.rects(); + Platform::IntRect rect = m_region.extents(); + SkRegion windowRegion; + + unsigned rectCount = m_region.numRects(); + if (!rectCount) + return; + + IntRect clip(inClip); + clip.move(rect.x(), rect.y()); + for (unsigned i = 0; i < rectCount; ++i) { + IntRect rectToPaint = rects[i]; + rectToPaint.intersect(clip); + SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); + windowRegion.op(r, SkRegion::kUnion_Op); + } + + SkPath pathToPaint; + windowRegion.getBoundaryPath(&pathToPaint); + + Path path(pathToPaint); + c.save(); + c.translate(-rect.x(), -rect.y()); + + // Draw selection overlay + Color color = RenderTheme::defaultTheme()->activeSelectionBackgroundColor(); + c.setFillColor(color, ColorSpaceDeviceRGB); + c.fillPath(path); + + c.restore(); +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h new file mode 100644 index 000000000..aad159f10 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SelectionOverlay_h +#define SelectionOverlay_h + +#include "BlackBerryGlobal.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "Color.h" +#include "GraphicsLayerClient.h" +#include "WebOverlay.h" +#include "WebSelectionOverlay.h" + +#include <BlackBerryPlatformIntRectRegion.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { + +class WebPagePrivate; + +class SelectionOverlay : public WebSelectionOverlay, public WebCore::GraphicsLayerClient { +public: + static PassOwnPtr<SelectionOverlay> create(WebPagePrivate* page) + { + return adoptPtr(new SelectionOverlay(page)); + } + + virtual ~SelectionOverlay(); + + virtual void draw(const Platform::IntRectRegion&); + virtual void hide(); + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + + +private: + SelectionOverlay(WebPagePrivate*); + + WebPagePrivate* m_page; + OwnPtr<WebOverlay> m_overlay; + BlackBerry::Platform::IntRectRegion m_region; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // SelectionOverlay_h diff --git a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp index f468464ed..32952356f 100644 --- a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp @@ -44,6 +44,7 @@ #include "RenderedDocumentMarker.h" #include "SelectionHandler.h" #include "WebPage_p.h" +#include "WebTapHighlight.h" #include <wtf/MathExtras.h> @@ -389,12 +390,9 @@ void TouchEventHandler::drawTapHighlight() Color highlightColor = element->renderStyle()->tapHighlightColor(); - m_webPage->m_client->drawTapHighlight(region, - highlightColor.red(), - highlightColor.green(), - highlightColor.blue(), - highlightColor.alpha(), - shouldHideTapHighlightRightAfterScrolling); + m_webPage->m_tapHighlight->draw(region, + highlightColor.red(), highlightColor.green(), highlightColor.blue(), highlightColor.alpha(), + shouldHideTapHighlightRightAfterScrolling); } } diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 2baa8ecc1..09ed0651b 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,790 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Removed a port specific fix which was introduced at r117572. + + Reviewed by Ryosuke Niwa. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::frameWillDetachPage): + (WebKit::EditorClientImpl::requestCheckingOfString): + * src/EditorClientImpl.h: + (WebCore): + (EditorClientImpl): + * src/WebTextCheckingCompletionImpl.cpp: + (WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText): + (WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText): + * src/WebTextCheckingCompletionImpl.h: + (WebKit::WebTextCheckingCompletionImpl::WebTextCheckingCompletionImpl): + (WebTextCheckingCompletionImpl): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119146. + http://trac.webkit.org/changeset/119146 + https://bugs.webkit.org/show_bug.cgi?id=88035 + + android breakage fixed in http://crrev.com/139945 (Requested + by fischman on #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Migrate to WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=87788 + + Reviewed by James Robinson. + + * src/WebLayer.cpp: + (WebKit::WebLayer::setSublayerTransform): + (WebKit::WebLayer::setTransform): + * tests/CCAnimationTestCommon.cpp: + (WebKitTests::FakeTransformTransition::getValue): + * tests/CCAnimationTestCommon.h: + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + (WebKitTests::TEST_F): + * tests/CCKeyframedAnimationCurveTest.cpp: + * tests/CCLayerAnimationControllerTest.cpp: + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): + (WTF::setLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest): + (WTF::setTestLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest): + (WTF::CCLayerTreeHostTestManySurfaces::beginTest): + * tests/CCLayerTreeTestCommon.h: + (WebKitTests): + * tests/CCMathUtilTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::createRoot): + (WebKitTests::CCOcclusionTrackerTest::createLayer): + (WebKitTests::CCOcclusionTrackerTest::createSurface): + (WebKitTests::CCOcclusionTrackerTest::createDrawingLayer): + (WebKitTests::CCOcclusionTrackerTest::createReplicaLayer): + (WebKitTests::CCOcclusionTrackerTest::createDrawingSurface): + (CCOcclusionTrackerTest): + (WebKitTests::CCOcclusionTrackerTest::setBaseProperties): + (WebKitTests::CCOcclusionTrackerTest::setProperties): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/FloatQuadTest.cpp: + * tests/LayerChromiumTest.cpp: + * tests/LinkHighlightTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] Single thread proxy should not tick animations unless the layer renderer has been initialized + https://bugs.webkit.org/show_bug.cgi?id=87873 + + Reviewed by James Robinson. + + When the layer renderer fails to initialize, be sure to stop the animation timer. + + * tests/CCLayerTreeHostTest.cpp: + (CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::create): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::texture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::usedTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF): + (WTF::TestHooks::didRecreateContext): + (TestHooks): + (WTF::TestHooks::createContext): + (CCLayerTreeHostTest): + (WTF::CCLayerTreeHostTest::clearEndTestTask): + (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest): + (EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::~EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::clearTest): + (WTF::CCLayerTreeHostTest::EndTestTask::run): + (WTF::CCLayerTreeHostTest::runTest): + (WTF::CCLayerTreeHostTest::endTestAfterDelay): + (FakeWebGraphicsContext3DMakeCurrentFails): + (WTF::FakeWebGraphicsContext3DMakeCurrentFails::makeContextCurrent): + (CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::beginTest): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::animateLayers): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::didRecreateContext): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::afterTest): + (WTF::TEST_F): + +2012-05-15 Brett Wilson <brettw@chromium.org> + + Hook up GTK IsKeyPad flag for keyboard events, and preserve this flag + on all platforms when converting back to a WebKeyboardEvent. + + https://bugs.webkit.org/show_bug.cgi?id=86514 + + Reviewed by Dimitri Glazkov. + + * src/WebInputEventConversion.cpp: + (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder): + * src/gtk/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + * tests/WebInputEventFactoryTestGtk.cpp: + +2012-05-31 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-31 James Robinson <jamesr@chromium.org> + + [chromium] Assertion failures during compositor startup in lost context situations + https://bugs.webkit.org/show_bug.cgi?id=87912 + + Reviewed by Adrienne Walker. + + Adds a unit test verifying that even if we lose our context during or before initialization we get through the + rest of the path without failing ASSERT()s. + + * tests/LayerRendererChromiumTest.cpp: + (LoseContextOnFirstGetContext): + (LoseContextOnFirstGetContext::LoseContextOnFirstGetContext): + (TEST): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119125. + http://trac.webkit.org/changeset/119125 + https://bugs.webkit.org/show_bug.cgi?id=88007 + + Will break android build if rolled (Requested by rafaelw_ on + #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::bytesLoaded): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Dana Jansens <danakj@chromium.org> + + [chromium] Move drawing code for RenderSurfaces into LayerRendererChromium + https://bugs.webkit.org/show_bug.cgi?id=87877 + + Reviewed by James Robinson. + + * tests/CCRenderSurfaceTest.cpp: + (WebCore::TEST): + +2012-05-31 Ami Fischman <fischman@chromium.org> + + Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress() + https://bugs.webkit.org/show_bug.cgi?id=86113 + + Reviewed by Eric Carlson. + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] create WebTransformOperation interface for chromium platform + https://bugs.webkit.org/show_bug.cgi?id=87510 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/WebTransformOperationsTest.cpp: Added. + (TEST): + (checkProgress): + +2012-05-31 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: [Chromium] Cannot bring Inspector to front when paused on breakpoint + https://bugs.webkit.org/show_bug.cgi?id=87871 + + Reviewed by Yury Semikhatsky. + + When input events handling is suppressed (due to the JS being paused on a breakpoint), we should report + these events as NOT handled by the WebKit, so that the browser can handle them appropriately + (on MacOS, switching between the application windows is done through the default key event handler, so if you run + event.preventDefault() for all keydown events in a handler, the Chromium window switch will not occur on Cmd+`). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + +2012-05-31 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-30 Peter Beverloo <peter@chromium.org> + + [Chromium] Automatically install 64-bit linker for Android + https://bugs.webkit.org/show_bug.cgi?id=79780 + + Reviewed by Adam Barth. + + Change the Android-specific dependencies to inherit their revision from + Chromium's DEPS file, like many other dependencies do, solving the + versioning problem that we're running in to right now. These are listed + in Chromium's main DEPS file starting Chromium r139529. + + * DEPS: + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + Build fix for Chromium Linux (Tests) after r119073. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add MemoryUsageSupport::processMemorySizesInBytes + https://bugs.webkit.org/show_bug.cgi?id=87830 + + Reviewed by James Robinson. + + * public/platform/WebKitPlatformSupport.h: pulled getProcessMemorySize up + to the Source/Platform/chromium/public/Platform.h + * src/PlatformSupport.cpp: + +2012-05-31 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r119062 and r119064. + http://trac.webkit.org/changeset/119062 + http://trac.webkit.org/changeset/119064 + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Broke build on Lion, SnowLoepard, Chromium Windows, and + Chromium Linux 32 + + * WebKit.gypi: + * tests/DecimalTest.cpp: Removed. + +2012-05-30 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix min/max bounds error in CCMathUtil.cpp + https://bugs.webkit.org/show_bug.cgi?id=87915 + + Reviewed by James Robinson. + + * tests/CCMathUtilTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-30 Ami Fischman <fischman@chromium.org> + + Roll chromium DEPS from r139300 to r139542. Unreviewed. + https://bugs.webkit.org/show_bug.cgi?id=87868 + + * DEPS: + +2012-05-30 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call fileUtilities methods directly + https://bugs.webkit.org/show_bug.cgi?id=87852 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118986. + http://trac.webkit.org/changeset/118986 + https://bugs.webkit.org/show_bug.cgi?id=87914 + + Caused several IndexedDB browser_test failures on Chromium + canary builders (Requested by rafaelw_ on #webkit). + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Dominic Mazzoni <dmazzoni@google.com> + + AX: Chromium WebAccessibilityObject should check if an AccessibilityObject is detached + https://bugs.webkit.org/show_bug.cgi?id=87778 + + Reviewed by Adam Barth. + + Pretty simple - all places that previously just checked for null + now also check if the wrapped AccessibilityObject is detached. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::isDetached): + (WebKit): + (WebKit::WebAccessibilityObject::axID): + (WebKit::WebAccessibilityObject::accessibilityDescription): + (WebKit::WebAccessibilityObject::actionVerb): + (WebKit::WebAccessibilityObject::canSetFocusAttribute): + (WebKit::WebAccessibilityObject::canSetValueAttribute): + (WebKit::WebAccessibilityObject::isValid): + (WebKit::WebAccessibilityObject::childCount): + (WebKit::WebAccessibilityObject::childAt): + (WebKit::WebAccessibilityObject::firstChild): + (WebKit::WebAccessibilityObject::focusedChild): + (WebKit::WebAccessibilityObject::lastChild): + (WebKit::WebAccessibilityObject::nextSibling): + (WebKit::WebAccessibilityObject::parentObject): + (WebKit::WebAccessibilityObject::previousSibling): + (WebKit::WebAccessibilityObject::canSetSelectedAttribute): + (WebKit::WebAccessibilityObject::isAnchor): + (WebKit::WebAccessibilityObject::isAriaReadOnly): + (WebKit::WebAccessibilityObject::isButtonStateMixed): + (WebKit::WebAccessibilityObject::isChecked): + (WebKit::WebAccessibilityObject::isCollapsed): + (WebKit::WebAccessibilityObject::isControl): + (WebKit::WebAccessibilityObject::isEnabled): + (WebKit::WebAccessibilityObject::isFocused): + (WebKit::WebAccessibilityObject::isHovered): + (WebKit::WebAccessibilityObject::isIndeterminate): + (WebKit::WebAccessibilityObject::isLinked): + (WebKit::WebAccessibilityObject::isLoaded): + (WebKit::WebAccessibilityObject::isMultiSelectable): + (WebKit::WebAccessibilityObject::isOffScreen): + (WebKit::WebAccessibilityObject::isPasswordField): + (WebKit::WebAccessibilityObject::isPressed): + (WebKit::WebAccessibilityObject::isReadOnly): + (WebKit::WebAccessibilityObject::isRequired): + (WebKit::WebAccessibilityObject::isSelected): + (WebKit::WebAccessibilityObject::isSelectedOptionActive): + (WebKit::WebAccessibilityObject::isVertical): + (WebKit::WebAccessibilityObject::isVisible): + (WebKit::WebAccessibilityObject::isVisited): + (WebKit::WebAccessibilityObject::accessKey): + (WebKit::WebAccessibilityObject::ariaHasPopup): + (WebKit::WebAccessibilityObject::ariaLiveRegionAtomic): + (WebKit::WebAccessibilityObject::ariaLiveRegionBusy): + (WebKit::WebAccessibilityObject::ariaLiveRegionRelevant): + (WebKit::WebAccessibilityObject::ariaLiveRegionStatus): + (WebKit::WebAccessibilityObject::boundingBoxRect): + (WebKit::WebAccessibilityObject::estimatedLoadingProgress): + (WebKit::WebAccessibilityObject::helpText): + (WebKit::WebAccessibilityObject::headingLevel): + (WebKit::WebAccessibilityObject::hierarchicalLevel): + (WebKit::WebAccessibilityObject::hitTest): + (WebKit::WebAccessibilityObject::keyboardShortcut): + (WebKit::WebAccessibilityObject::performDefaultAction): + (WebKit::WebAccessibilityObject::roleValue): + (WebKit::WebAccessibilityObject::selectionEnd): + (WebKit::WebAccessibilityObject::selectionStart): + (WebKit::WebAccessibilityObject::setFocused): + (WebKit::WebAccessibilityObject::stringValue): + (WebKit::WebAccessibilityObject::title): + (WebKit::WebAccessibilityObject::titleUIElement): + (WebKit::WebAccessibilityObject::url): + (WebKit::WebAccessibilityObject::valueDescription): + (WebKit::WebAccessibilityObject::valueForRange): + (WebKit::WebAccessibilityObject::maxValueForRange): + (WebKit::WebAccessibilityObject::minValueForRange): + (WebKit::WebAccessibilityObject::node): + (WebKit::WebAccessibilityObject::document): + (WebKit::WebAccessibilityObject::hasComputedStyle): + (WebKit::WebAccessibilityObject::computedStyleDisplay): + (WebKit::WebAccessibilityObject::accessibilityIsIgnored): + (WebKit::WebAccessibilityObject::lineBreaks): + (WebKit::WebAccessibilityObject::columnCount): + (WebKit::WebAccessibilityObject::rowCount): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + Simplify TransformationMatrix rotation code to improve precision + https://bugs.webkit.org/show_bug.cgi?id=86666 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebKitTests::TEST): + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-30 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Merge shared code in CCOcclusionTrackerTest + https://bugs.webkit.org/show_bug.cgi?id=87798 + + Reviewed by Adrienne Walker. + + This patch simple uses a different existing macro function so that + the same thing doesn't exist in multiple places, and so that the + naming is more consistent with gtest's conventions. + + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaDoesOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithMask::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestMinimumTrackingSize::runMyTest): + +2012-05-30 Tony Chang <tony@chromium.org> + + [chromium] port webframe_unittest.cc to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=87796 + + Reviewed by James Robinson. + + Move WebFrameTest.GetContentAsPlainText and WebFrameTest.GetFullHtmlOfPage to webkit_unit_tests. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): Add tests. + +2012-05-30 Jochen Eisinger <jochen@chromium.org> + + Match Firefox restrictions to window.blur and window.focus + https://bugs.webkit.org/show_bug.cgi?id=86969 + + Reviewed by Adam Barth. + + Allow window.focus() during the dispatch of the click event on + notifications. + + * src/WebNotification.cpp: + (WebKit::WebNotification::dispatchClickEvent): + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-29 Alec Flett <alecflett@chromium.org> + + IndexedDB: Align codes and names for IDB-specific and DOM-specific errors/exceptions + https://bugs.webkit.org/show_bug.cgi?id=87276 + + Reviewed by Tony Chang. + + * public/WebIDBDatabaseException.h: + * src/AssertMatchingEnums.cpp: + +2012-05-29 Rafael Weinstein <rafaelw@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Dana Jansens <danakj@chromium.org> + + [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect + https://bugs.webkit.org/show_bug.cgi?id=87677 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * features.gypi: + +2012-05-29 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Hironori Bono <hbono@chromium.org> + + Use WebSpellCheckClient::spellcheck to retrieve suggestions. + https://bugs.webkit.org/show_bug.cgi?id=87690 + + Reviewed by Hajime Morita. + + This change uses WebSpellCheckClient::spellcheck as a fallback method to + retrieve suggestions when a marker does not have any suggestions. (It consumes + lots of CPU power to get suggestions for misspelled word, i.e. Chromium cannot + afford to attach suggestions to all spelling markers.) + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Retrieve suggestions if markers do not have any. + +2012-05-28 Takashi Toyoshima <toyoshim@chromium.org> + + [WebSocket] Receiving reserved close codes, 1005, 1006, and 1015 must appear as code=1006 and wasClean=false + https://bugs.webkit.org/show_bug.cgi?id=87084 + + Reviewed by Kent Tamura. + + Update close event codes corresponding to WebSocketChannel::CloseEventCode. + + * public/WebSocket.h: Update on newly defined close event codes + +2012-05-28 MORITA Hajime <morrita@google.com> + + Rename FrameLoaderClient::shadowDOMAllowed() to allowShadowDOM() + https://bugs.webkit.org/show_bug.cgi?id=87101 + + Reviewed by Kentaro Hara. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowShadowDOM): + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + +2012-05-28 Rob Flack <flackr@chromium.org> + + [chromium] Only increase size of Combo Box Options when displayed on touch screen + https://bugs.webkit.org/show_bug.cgi?id=85921 + + Reviewed by Adam Barth. + + Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::defaultDeviceScaleFactor): + (WebKit): + (WebKit::WebSettingsImpl::setDeviceSupportsTouch): + (WebKit::WebSettingsImpl::deviceSupportsTouch): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutofillSuggestions): + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + (WebKit::SelectPopupMenuTest::TearDown): + (SelectPopupMenuTest): + (WebKit::TEST_F): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed private APIs that were only being used by DRT. + + * public/WebDevToolsAgent.h: + (WebDevToolsAgent): + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + (WebDevToolsAgentImpl): + +2012-05-28 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-28 Peter Beverloo <peter@chromium.org> + + [Chromium] Build fix for the Android bot, set CXX_target at gyp generation-time + https://bugs.webkit.org/show_bug.cgi?id=87649 + + Unreviewed build fix. + + Chromium Android builds were broken because v8 tried to compile files + for target with the "-m32" flag. This was caused by a v8 check falling + back to using "which g++" to find the right compiler, whereas it should + have used the $CXX_target environment variable. This isn't being set + for Android builds. + + * gyp_webkit: Set the CXX_target environment variable. Annotate the fix + with a FIXME comment too. + +2012-05-28 Keishi Hattori <keishi@webkit.org> + + Expose value localization function of HTMLInputElement + https://bugs.webkit.org/show_bug.cgi?id=84356 + + Reviewed by Kent Tamura. + + * public/WebInputElement.h: + (WebInputElement): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::localizeValue): + (WebKit): + +2012-05-28 MORITA Hajime <morrita@google.com> + + Unreviewed Mac Chromium build fix. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowStyleScoped): + +2012-05-28 MORITA Hajime <morrita@google.com> + + https://bugs.webkit.org/show_bug.cgi?id=87609 + [Chromium] FrameLoaderClient::allowStyleScoped() should be implemented interms of WebPermissionClient + + Reviewed by Kent Tamura. + + Added allowStyleScoped() implementation which is essentially same as shadowDOMAllowed(). + + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + 2012-05-25 Ryosuke Niwa <rniwa@webkit.org> Roll chromium DEPS from r139156 to r139184. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index e12c78f59..67371f99f 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '139184' + 'chromium_rev': '139747' } deps = { @@ -167,10 +167,12 @@ deps_os = { From('chromium_deps', 'src/third_party/openssl'), }, 'android': { - 'third_party/freetype': - 'https://git.chromium.org/chromium/src/third_party/freetype.git', 'tools/android': - Var('chromium_svn')+'/tools/android@'+Var('chromium_rev'), + Var('chromium_svn') + '/tools/android@' + Var('chromium_rev'), + 'third_party/freetype': + From('chromium_deps', 'src/third_party/freetype'), + 'third_party/aosp': + From('chromium_deps', 'src/third_party/aosp'), }, } diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a688bbcc..1c11f2d79 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -95,6 +95,7 @@ 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', + 'tests/DecimalTest.cpp', 'tests/DragImageTest.cpp', 'tests/DrawingBufferChromiumTest.cpp', 'tests/EventListenerTest.cpp', @@ -152,6 +153,7 @@ 'tests/WebSocketDeflaterTest.cpp', 'tests/WebSocketExtensionDispatcherTest.cpp', 'tests/WebTransformationMatrixTest.cpp', + 'tests/WebTransformOperationsTest.cpp', 'tests/WebURLRequestTest.cpp', 'tests/WebURLResponseTest.cpp', 'tests/WebViewTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index a0d6329c6..f773cc4bc 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -41,6 +41,7 @@ 'ENABLE_CSS_EXCLUSIONS=1', 'ENABLE_CSS_FILTERS=1', 'ENABLE_CSS_IMAGE_SET=1', + 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', 'ENABLE_CSS_SHADERS=1', 'ENABLE_CSS_VARIABLES=0', diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit index 36f0f431b..fb720d97a 100755 --- a/Source/WebKit/chromium/gyp_webkit +++ b/Source/WebKit/chromium/gyp_webkit @@ -87,6 +87,9 @@ if __name__ == '__main__': envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh') exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))])) else: + # FIXME: v8 requires the CXX_target variable to determine whether -m32 should be + # set. The current Android build set-up is not sustainable and breaks too often. + os.environ['CXX_target'] = glob.glob('%s/*-g++' % os.environ.get('ANDROID_TOOLCHAIN'))[0] args.remove('--no-envsetup-recursion') # Add includes. diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index c52b830a9..029f43872 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityObject.h +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -69,6 +69,7 @@ public: WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; bool isNull() const { return m_private.isNull(); } + WEBKIT_EXPORT bool isDetached() const; // Static methods for enabling accessibility. WEBKIT_EXPORT static void enableAccessibility(); diff --git a/Source/WebKit/chromium/public/WebDevToolsAgent.h b/Source/WebKit/chromium/public/WebDevToolsAgent.h index 0a66db362..9f1d53f1b 100644 --- a/Source/WebKit/chromium/public/WebDevToolsAgent.h +++ b/Source/WebKit/chromium/public/WebDevToolsAgent.h @@ -68,7 +68,6 @@ public: // Exposed for LayoutTestController. virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; - virtual void setJavaScriptProfilingEnabled(bool) = 0; class MessageDescriptor { public: diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseException.h b/Source/WebKit/chromium/public/WebIDBDatabaseException.h index 81b838667..b0e63d426 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseException.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseException.h @@ -35,7 +35,7 @@ namespace WebKit { enum WebIDBDatabaseException { WebIDBDatabaseExceptionDataError = 1205, - WebIDBDatabaseExceptionQuotaError = 1211, + WebIDBDatabaseExceptionQuotaError = 1218, }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h index 913740d66..fbc350012 100644 --- a/Source/WebKit/chromium/public/WebInputElement.h +++ b/Source/WebKit/chromium/public/WebInputElement.h @@ -96,6 +96,9 @@ namespace WebKit { WEBKIT_EXPORT WebNodeCollection dataListOptions() const; + // Return the localized value for this input type. + WEBKIT_EXPORT WebString localizeValue(const WebString&) const; + WEBKIT_EXPORT bool isSpeechInputEnabled() const; WEBKIT_EXPORT SpeechInputState getSpeechInputState() const; WEBKIT_EXPORT void startSpeechInput(); diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h index 3312f5f21..444a2cc90 100644 --- a/Source/WebKit/chromium/public/WebMediaPlayer.h +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -144,7 +144,7 @@ public: virtual NetworkState networkState() const = 0; virtual ReadyState readyState() const = 0; - virtual unsigned long long bytesLoaded() const = 0; + virtual bool didLoadingProgress() const = 0; virtual unsigned long long totalBytes() const = 0; virtual bool hasSingleSecurityOrigin() const = 0; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index d9016847a..ccf3303c7 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -67,6 +67,7 @@ public: virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; virtual void setFontBoostingEnabled(bool) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; virtual void setJavaScriptEnabled(bool) = 0; virtual void setWebSecurityEnabled(bool) = 0; virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h index f2a140cfa..e3db32427 100644 --- a/Source/WebKit/chromium/public/WebSocket.h +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -55,7 +55,12 @@ public: CloseEventCodeFrameTooLarge = 1004, CloseEventCodeNoStatusRcvd = 1005, CloseEventCodeAbnormalClosure = 1006, - CloseEventCodeInvalidUTF8 = 1007, + CloseEventCodeInvalidFramePayloadData = 1007, + CloseEventCodePolicyViolation = 1008, + CloseEventCodeMessageTooBig = 1009, + CloseEventCodeMandatoryExt = 1010, + CloseEventCodeInternalError = 1011, + CloseEventCodeTLSHandshake = 1015, CloseEventCodeMinimumUserDefined = 3000, CloseEventCodeMaximumUserDefined = 4999 }; diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 908152149..f69c62ff2 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -115,11 +115,6 @@ public: virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } - // Returns private and shared usage, in bytes. Private bytes is the amount of - // memory currently allocated to this process that cannot be shared. Returns - // false on platform specific error conditions. - virtual bool getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) { return false; } - protected: ~WebKitPlatformSupport() { } }; diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 375428923..94985b20c 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -458,7 +458,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInExistingDocuments, Inject COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, InjectInSubsequentDocuments); COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionDataError, IDBDatabaseException::DATA_ERR); -COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::QUOTA_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::IDB_QUOTA_EXCEEDED_ERR); #if ENABLE(INDEXED_DATABASE) COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::InvalidType, IDBKey::InvalidType); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 5871f44e1..d400e7c2b 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -290,8 +290,13 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( suggestions.append(descriptions); } } - data.dictionarySuggestions = suggestions; data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + if (!suggestions.isEmpty()) + data.dictionarySuggestions = suggestions; + else if (m_webView->spellCheckClient()) { + int misspelledOffset, misspelledLength; + m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); + } } } } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index c004c3fc3..417fe9429 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -90,17 +90,6 @@ void EditorClientImpl::pageDestroyed() void EditorClientImpl::frameWillDetachPage(WebCore::Frame* frame) { - HashSet<WebTextCheckingCompletionImpl*> validRequests; - - for (HashSet<WebTextCheckingCompletionImpl*>::iterator i = m_pendingTextChecks.begin(); - i != m_pendingTextChecks.end(); ++i) { - if (frame->editor()->spellChecker() == (*i)->spellChecker()) - (*i)->invalidate(); - else - validRequests.add(*i); - } - - m_pendingTextChecks.swap(validRequests); } bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) @@ -752,19 +741,12 @@ void EditorClientImpl::checkSpellingOfString(const UChar* text, int length, *misspellingLength = spellLength; } -void EditorClientImpl::requestCheckingOfString(SpellChecker* sender, const WebCore::TextCheckingRequest& request) +void EditorClientImpl::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) { - if (!m_webView->spellCheckClient()) - return; - - WebTextCheckingCompletionImpl* completion = new WebTextCheckingCompletionImpl(request.sequence(), sender, this); - m_pendingTextChecks.add(completion); - m_webView->spellCheckClient()->requestCheckingOfText(request.text(), completion); -} - -void EditorClientImpl::didCheckString(WebTextCheckingCompletionImpl* completion) -{ - m_pendingTextChecks.remove(completion); + if (m_webView->spellCheckClient()) { + String text = request->text(); + m_webView->spellCheckClient()->requestCheckingOfText(text, new WebTextCheckingCompletionImpl(request)); + } } String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 47e8c508f..3ee9ebaaa 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -40,7 +40,6 @@ namespace WebCore { class Frame; class HTMLInputElement; -class SpellChecker; } namespace WebKit { @@ -113,12 +112,10 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&); + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); virtual WebCore::TextCheckerClient* textChecker() { return this; } - void didCheckString(WebTextCheckingCompletionImpl*); - private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); @@ -146,8 +143,6 @@ private: SpellCheckForcedOff }; int m_spellCheckThisFieldStatus; - - WTF::HashSet<WebTextCheckingCompletionImpl*> m_pendingTextChecks; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index c42979ca3..de3f22789 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -239,7 +239,16 @@ bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings, return enabledPerSettings; } -bool FrameLoaderClientImpl::shadowDOMAllowed(bool enabledAsRuntimeFeature) +bool FrameLoaderClientImpl::allowShadowDOM(bool enabledAsRuntimeFeature) +{ + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->permissionClient()) + return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature); + + return enabledAsRuntimeFeature; +} + +bool FrameLoaderClientImpl::allowStyleScoped(bool enabledAsRuntimeFeature) { WebViewImpl* webview = m_webFrame->viewImpl(); if (webview && webview->permissionClient()) diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index f798ac2ef..236a01b65 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -199,7 +199,8 @@ public: virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL); virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); - virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowShadowDOM(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowStyleScoped(bool enabledAsRuntimeFeature) OVERRIDE; virtual void didNotAllowScript(); virtual void didNotAllowPlugins(); diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 7cc7f5a6e..b6266fea1 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -302,92 +302,6 @@ bool PlatformSupport::cookiesEnabled(const Document* document) // File ------------------------------------------------------------------------ -bool PlatformSupport::fileExists(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->fileExists(path); -} - -bool PlatformSupport::deleteFile(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteFile(path); -} - -bool PlatformSupport::deleteEmptyDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); -} - -bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result) -{ - WebFileInfo webFileInfo; - if (!webKitPlatformSupport()->fileUtilities()->getFileInfo(path, webFileInfo)) - return false; - result.modificationTime = webFileInfo.modificationTime; - result.length = webFileInfo.length; - result.type = static_cast<FileMetadata::Type>(webFileInfo.type); - return true; -} - -String PlatformSupport::directoryName(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->directoryName(path); -} - -String PlatformSupport::pathByAppendingComponent(const String& path, const String& component) -{ - return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component); -} - -bool PlatformSupport::makeAllDirectories(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path); -} - -String PlatformSupport::getAbsolutePath(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->getAbsolutePath(path); -} - -bool PlatformSupport::isDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->isDirectory(path); -} - -KURL PlatformSupport::filePathToURL(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->filePathToURL(path); -} - -PlatformFileHandle PlatformSupport::openFile(const String& path, FileOpenMode mode) -{ - return WebKit::Platform::current()->fileUtilities()->openFile(path, mode); -} - -void PlatformSupport::closeFile(PlatformFileHandle& handle) -{ - WebKit::Platform::current()->fileUtilities()->closeFile(handle); -} - -long long PlatformSupport::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) -{ - return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin); -} - -bool PlatformSupport::truncateFile(PlatformFileHandle handle, long long offset) -{ - return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset); -} - -int PlatformSupport::readFromFile(PlatformFileHandle handle, char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length); -} - -int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length); -} - #if ENABLE(FILE_SYSTEM) PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() { @@ -836,11 +750,6 @@ void PlatformSupport::notifyJSOutOfMemory(Frame* frame) webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); } -bool PlatformSupport::getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) -{ - return webKitPlatformSupport()->getProcessMemorySize(privateBytes, sharedBytes); -} - int PlatformSupport::screenHorizontalDPI(Widget* widget) { WebWidgetClient* client = toWebWidgetClient(widget); diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index f556dbdf4..1eb69d28f 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -82,9 +82,17 @@ bool WebAccessibilityObject::accessibilityEnabled() return AXObjectCache::accessibilityEnabled(); } -int WebAccessibilityObject::axID() const +bool WebAccessibilityObject::isDetached() const { if (m_private.isNull()) + return true; + + return m_private->isDetached(); +} + +int WebAccessibilityObject::axID() const +{ + if (isDetached()) return -1; m_private->updateBackingStore(); @@ -93,7 +101,7 @@ int WebAccessibilityObject::axID() const WebString WebAccessibilityObject::accessibilityDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -102,7 +110,7 @@ WebString WebAccessibilityObject::accessibilityDescription() const WebString WebAccessibilityObject::actionVerb() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -111,7 +119,7 @@ WebString WebAccessibilityObject::actionVerb() const bool WebAccessibilityObject::canSetFocusAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -120,7 +128,7 @@ bool WebAccessibilityObject::canSetFocusAttribute() const bool WebAccessibilityObject::canSetValueAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -129,7 +137,7 @@ bool WebAccessibilityObject::canSetValueAttribute() const bool WebAccessibilityObject::isValid() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -138,7 +146,7 @@ bool WebAccessibilityObject::isValid() const unsigned WebAccessibilityObject::childCount() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -147,7 +155,7 @@ unsigned WebAccessibilityObject::childCount() const WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -159,7 +167,7 @@ WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const WebAccessibilityObject WebAccessibilityObject::firstChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -168,7 +176,7 @@ WebAccessibilityObject WebAccessibilityObject::firstChild() const WebAccessibilityObject WebAccessibilityObject::focusedChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -181,7 +189,7 @@ WebAccessibilityObject WebAccessibilityObject::focusedChild() const WebAccessibilityObject WebAccessibilityObject::lastChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -191,7 +199,7 @@ WebAccessibilityObject WebAccessibilityObject::lastChild() const WebAccessibilityObject WebAccessibilityObject::nextSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -200,7 +208,7 @@ WebAccessibilityObject WebAccessibilityObject::nextSibling() const WebAccessibilityObject WebAccessibilityObject::parentObject() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -210,7 +218,7 @@ WebAccessibilityObject WebAccessibilityObject::parentObject() const WebAccessibilityObject WebAccessibilityObject::previousSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -219,7 +227,7 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const bool WebAccessibilityObject::canSetSelectedAttribute() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -228,7 +236,7 @@ bool WebAccessibilityObject::canSetSelectedAttribute() const bool WebAccessibilityObject::isAnchor() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -237,7 +245,7 @@ bool WebAccessibilityObject::isAnchor() const bool WebAccessibilityObject::isAriaReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -246,7 +254,7 @@ bool WebAccessibilityObject::isAriaReadOnly() const bool WebAccessibilityObject::isButtonStateMixed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -255,7 +263,7 @@ bool WebAccessibilityObject::isButtonStateMixed() const bool WebAccessibilityObject::isChecked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -264,7 +272,7 @@ bool WebAccessibilityObject::isChecked() const bool WebAccessibilityObject::isCollapsed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -273,7 +281,7 @@ bool WebAccessibilityObject::isCollapsed() const bool WebAccessibilityObject::isControl() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -282,7 +290,7 @@ bool WebAccessibilityObject::isControl() const bool WebAccessibilityObject::isEnabled() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -291,7 +299,7 @@ bool WebAccessibilityObject::isEnabled() const bool WebAccessibilityObject::isFocused() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -300,7 +308,7 @@ bool WebAccessibilityObject::isFocused() const bool WebAccessibilityObject::isHovered() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -309,7 +317,7 @@ bool WebAccessibilityObject::isHovered() const bool WebAccessibilityObject::isIndeterminate() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -318,7 +326,7 @@ bool WebAccessibilityObject::isIndeterminate() const bool WebAccessibilityObject::isLinked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -327,7 +335,7 @@ bool WebAccessibilityObject::isLinked() const bool WebAccessibilityObject::isLoaded() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -336,7 +344,7 @@ bool WebAccessibilityObject::isLoaded() const bool WebAccessibilityObject::isMultiSelectable() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -345,7 +353,7 @@ bool WebAccessibilityObject::isMultiSelectable() const bool WebAccessibilityObject::isOffScreen() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -354,7 +362,7 @@ bool WebAccessibilityObject::isOffScreen() const bool WebAccessibilityObject::isPasswordField() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -363,7 +371,7 @@ bool WebAccessibilityObject::isPasswordField() const bool WebAccessibilityObject::isPressed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -372,7 +380,7 @@ bool WebAccessibilityObject::isPressed() const bool WebAccessibilityObject::isReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -381,7 +389,7 @@ bool WebAccessibilityObject::isReadOnly() const bool WebAccessibilityObject::isRequired() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -390,7 +398,7 @@ bool WebAccessibilityObject::isRequired() const bool WebAccessibilityObject::isSelected() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -399,7 +407,7 @@ bool WebAccessibilityObject::isSelected() const bool WebAccessibilityObject::isSelectedOptionActive() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -408,7 +416,7 @@ bool WebAccessibilityObject::isSelectedOptionActive() const bool WebAccessibilityObject::isVertical() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -417,7 +425,7 @@ bool WebAccessibilityObject::isVertical() const bool WebAccessibilityObject::isVisible() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -426,7 +434,7 @@ bool WebAccessibilityObject::isVisible() const bool WebAccessibilityObject::isVisited() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -435,7 +443,7 @@ bool WebAccessibilityObject::isVisited() const WebString WebAccessibilityObject::accessKey() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -444,7 +452,7 @@ WebString WebAccessibilityObject::accessKey() const bool WebAccessibilityObject::ariaHasPopup() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -453,7 +461,7 @@ bool WebAccessibilityObject::ariaHasPopup() const bool WebAccessibilityObject::ariaLiveRegionAtomic() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -462,7 +470,7 @@ bool WebAccessibilityObject::ariaLiveRegionAtomic() const bool WebAccessibilityObject::ariaLiveRegionBusy() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -471,7 +479,7 @@ bool WebAccessibilityObject::ariaLiveRegionBusy() const WebString WebAccessibilityObject::ariaLiveRegionRelevant() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -480,7 +488,7 @@ WebString WebAccessibilityObject::ariaLiveRegionRelevant() const WebString WebAccessibilityObject::ariaLiveRegionStatus() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -489,7 +497,7 @@ WebString WebAccessibilityObject::ariaLiveRegionStatus() const WebRect WebAccessibilityObject::boundingBoxRect() const { - if (m_private.isNull()) + if (isDetached()) return WebRect(); m_private->updateBackingStore(); @@ -498,7 +506,7 @@ WebRect WebAccessibilityObject::boundingBoxRect() const double WebAccessibilityObject::estimatedLoadingProgress() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -507,7 +515,7 @@ double WebAccessibilityObject::estimatedLoadingProgress() const WebString WebAccessibilityObject::helpText() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -516,7 +524,7 @@ WebString WebAccessibilityObject::helpText() const int WebAccessibilityObject::headingLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -525,7 +533,7 @@ int WebAccessibilityObject::headingLevel() const int WebAccessibilityObject::hierarchicalLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -534,7 +542,7 @@ int WebAccessibilityObject::hierarchicalLevel() const WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -552,7 +560,7 @@ WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) co WebString WebAccessibilityObject::keyboardShortcut() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -581,7 +589,7 @@ WebString WebAccessibilityObject::keyboardShortcut() const bool WebAccessibilityObject::performDefaultAction() const { - if (m_private.isNull()) + if (isDetached()) return false; UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); @@ -592,7 +600,7 @@ bool WebAccessibilityObject::performDefaultAction() const WebAccessibilityRole WebAccessibilityObject::roleValue() const { - if (m_private.isNull()) + if (isDetached()) return WebKit::WebAccessibilityRoleUnknown; m_private->updateBackingStore(); @@ -601,7 +609,7 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const unsigned WebAccessibilityObject::selectionEnd() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -610,7 +618,7 @@ unsigned WebAccessibilityObject::selectionEnd() const unsigned WebAccessibilityObject::selectionStart() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -619,13 +627,13 @@ unsigned WebAccessibilityObject::selectionStart() const void WebAccessibilityObject::setFocused(bool on) const { - if (!m_private.isNull()) + if (!isDetached()) m_private->setFocused(on); } WebString WebAccessibilityObject::stringValue() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -634,7 +642,7 @@ WebString WebAccessibilityObject::stringValue() const WebString WebAccessibilityObject::title() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -643,7 +651,7 @@ WebString WebAccessibilityObject::title() const WebAccessibilityObject WebAccessibilityObject::titleUIElement() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -652,7 +660,7 @@ WebAccessibilityObject WebAccessibilityObject::titleUIElement() const WebURL WebAccessibilityObject::url() const { - if (m_private.isNull()) + if (isDetached()) return WebURL(); m_private->updateBackingStore(); @@ -661,7 +669,7 @@ WebURL WebAccessibilityObject::url() const WebString WebAccessibilityObject::valueDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -670,7 +678,7 @@ WebString WebAccessibilityObject::valueDescription() const float WebAccessibilityObject::valueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -679,7 +687,7 @@ float WebAccessibilityObject::valueForRange() const float WebAccessibilityObject::maxValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -688,7 +696,7 @@ float WebAccessibilityObject::maxValueForRange() const float WebAccessibilityObject::minValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -697,7 +705,7 @@ float WebAccessibilityObject::minValueForRange() const WebNode WebAccessibilityObject::node() const { - if (m_private.isNull()) + if (isDetached()) return WebNode(); m_private->updateBackingStore(); @@ -711,7 +719,7 @@ WebNode WebAccessibilityObject::node() const WebDocument WebAccessibilityObject::document() const { - if (m_private.isNull()) + if (isDetached()) return WebDocument(); m_private->updateBackingStore(); @@ -725,7 +733,7 @@ WebDocument WebAccessibilityObject::document() const bool WebAccessibilityObject::hasComputedStyle() const { - if (m_private.isNull()) + if (isDetached()) return false; Document* document = m_private->document(); @@ -741,7 +749,7 @@ bool WebAccessibilityObject::hasComputedStyle() const WebString WebAccessibilityObject::computedStyleDisplay() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); Document* document = m_private->document(); @@ -761,7 +769,7 @@ WebString WebAccessibilityObject::computedStyleDisplay() const bool WebAccessibilityObject::accessibilityIsIgnored() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -770,7 +778,7 @@ bool WebAccessibilityObject::accessibilityIsIgnored() const bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -794,7 +802,7 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const unsigned WebAccessibilityObject::columnCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -806,7 +814,7 @@ unsigned WebAccessibilityObject::columnCount() const unsigned WebAccessibilityObject::rowCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index d39ff8af9..6f72f13fd 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -560,15 +560,6 @@ void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& ic->evaluateForTestInFrontend(callId, script); } -void WebDevToolsAgentImpl::setJavaScriptProfilingEnabled(bool enabled) -{ - InspectorController* ic = inspectorController(); - if (enabled) - ic->enableProfiler(); - else - ic->disableProfiler(); -} - WebString WebDevToolsAgent::inspectorProtocolVersion() { return WebCore::inspectorProtocolVersion(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h index 1c8e025e8..edbee1471 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -84,7 +84,6 @@ public: virtual void dispatchOnInspectorBackend(const WebString& message); virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); - virtual void setJavaScriptProfilingEnabled(bool); virtual void setProcessId(long); // InspectorClient implementation. diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp index c454b485d..ea580b4dc 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp @@ -47,7 +47,7 @@ void WebIDBDatabaseError::assign(const WebIDBDatabaseError& value) void WebIDBDatabaseError::assign(unsigned short code, const WebString& message) { - m_private = IDBDatabaseError::createWithoutOffset(code, message); + m_private = IDBDatabaseError::create(code, message); } void WebIDBDatabaseError::reset() @@ -57,7 +57,7 @@ void WebIDBDatabaseError::reset() unsigned short WebIDBDatabaseError::code() const { - return m_private->code(); + return m_private->idbCode(); } WebString WebIDBDatabaseError::message() const diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c58e90704..c1453de66 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -183,6 +183,11 @@ WebNodeCollection WebInputElement::dataListOptions() const return WebNodeCollection(); } +WebString WebInputElement::localizeValue(const WebString& proposedValue) const +{ + return constUnwrap<HTMLInputElement>()->localizeValue(proposedValue); +} + bool WebInputElement::isSpeechInputEnabled() const { #if ENABLE(INPUT_SPEECH) diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index a45cae102..58df5093b 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -441,7 +441,11 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) type = WebInputEvent::Char; else return; // Skip all other keyboard events. + modifiers = getWebInputModifiers(event); + if (event.keyLocation() & KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) + modifiers |= WebInputEvent::IsKeyPad; + timeStampSeconds = event.timeStamp() / millisPerSecond; windowsKeyCode = event.keyCode(); diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index bd022b724..6b1029814 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -38,20 +38,21 @@ #include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -TransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) +WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) { double data[16]; matrix.asColMajord(data); - return TransformationMatrix(data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15]); + return WebTransformationMatrix(data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], + data[12], data[13], data[14], data[15]); } -SkMatrix44 skMatrix44FromTransformationMatrix(const TransformationMatrix& matrix) +SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) { SkMatrix44 skMatrix; skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); @@ -231,7 +232,7 @@ void WebLayer::setSublayerTransform(const SkMatrix44& matrix) void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) { - m_private->setSublayerTransform(matrix.toWebCoreTransform()); + m_private->setSublayerTransform(matrix); } SkMatrix44 WebLayer::sublayerTransform() const @@ -246,7 +247,7 @@ void WebLayer::setTransform(const SkMatrix44& matrix) void WebLayer::setTransform(const WebTransformationMatrix& matrix) { - m_private->setTransform(matrix.toWebCoreTransform()); + m_private->setTransform(matrix); } SkMatrix44 WebLayer::transform() const diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 2411d9c79..44e51cd87 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -593,11 +593,9 @@ unsigned WebMediaPlayerClientImpl::totalBytes() const return 0; } -unsigned WebMediaPlayerClientImpl::bytesLoaded() const +bool WebMediaPlayerClientImpl::didLoadingProgress() const { - if (m_webMediaPlayer) - return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded()); - return 0; + return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress(); } void WebMediaPlayerClientImpl::setSize(const IntSize& size) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 72170f750..0888d5eee 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -122,7 +122,7 @@ public: virtual int dataRate() const; virtual bool totalBytesKnown() const; virtual unsigned totalBytes() const; - virtual unsigned bytesLoaded() const; + virtual bool didLoadingProgress() const; virtual void setSize(const WebCore::IntSize&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&); diff --git a/Source/WebKit/chromium/src/WebNotification.cpp b/Source/WebKit/chromium/src/WebNotification.cpp index f6e981d3c..54209fd97 100644 --- a/Source/WebKit/chromium/src/WebNotification.cpp +++ b/Source/WebKit/chromium/src/WebNotification.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "Notification.h" #include "UserGestureIndicator.h" +#include "WindowFocusAllowedIndicator.h" #include "platform/WebString.h" #include "WebTextDirection.h" @@ -136,8 +137,8 @@ void WebNotification::dispatchCloseEvent(bool /* byUser */) void WebNotification::dispatchClickEvent() { - // Make sure clicks on notifications are treated as user gestures. UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + WindowFocusAllowedIndicator windowFocusAllowed; dispatchEvent(eventNames().clickEvent); } diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index ffb8c9bfe..c51fffbf7 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -118,6 +118,21 @@ void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor) m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor); } +int WebSettingsImpl::defaultDeviceScaleFactor() +{ + return m_settings->defaultDeviceScaleFactor(); +} + +void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch) +{ + m_settings->setDeviceSupportsTouch(deviceSupportsTouch); +} + +bool WebSettingsImpl::deviceSupportsTouch() +{ + return m_settings->deviceSupportsTouch(); +} + void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor) { m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 033784039..c28908441 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -55,9 +55,12 @@ public: virtual void setMinimumFontSize(int); virtual void setMinimumLogicalFontSize(int); virtual void setDefaultDeviceScaleFactor(int); + virtual int defaultDeviceScaleFactor(); virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); virtual void setFontBoostingEnabled(bool); virtual void setDefaultTextEncodingName(const WebString&); + virtual void setDeviceSupportsTouch(bool); + virtual bool deviceSupportsTouch(); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); virtual void setJavaScriptCanOpenWindowsAutomatically(bool); diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index d7a9be01c..b81ea578b 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -52,28 +52,14 @@ static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingR void WebTextCheckingCompletionImpl::didFinishCheckingText(const WebVector<WebTextCheckingResult>& results) { - if (m_spellChecker) { - m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results)); - m_editorClient->didCheckString(this); - } - + m_request->didSucceed(toCoreResults(results)); delete this; } void WebTextCheckingCompletionImpl::didCancelCheckingText() { - if (m_spellChecker) { - m_spellChecker->didCheckCanceled(m_identifier); - m_editorClient->didCheckString(this); - } - + m_request->didCancel(); delete this; } -void WebTextCheckingCompletionImpl::invalidate() -{ - m_spellChecker = 0; - m_editorClient = 0; -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h index 06e34addc..cd114132e 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h @@ -31,11 +31,9 @@ #ifndef WebTextCheckingCompletionImpl_h #define WebTextCheckingCompletionImpl_h +#include "TextChecking.h" #include "WebTextCheckingCompletion.h" - -namespace WebCore { -class SpellChecker; -} +#include <wtf/RefPtr.h> namespace WebKit { @@ -43,25 +41,18 @@ class EditorClientImpl; class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion { public: - WebTextCheckingCompletionImpl(int identifier, WebCore::SpellChecker* spellchecker, EditorClientImpl* editorClient) - : m_identifier(identifier) - , m_spellChecker(spellchecker) - , m_editorClient(editorClient) + explicit WebTextCheckingCompletionImpl(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) + : m_request(request) { } - virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&); - virtual void didCancelCheckingText(); - - void invalidate(); - WebCore::SpellChecker* spellChecker() const { return m_spellChecker; } + virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) OVERRIDE; + virtual void didCancelCheckingText() OVERRIDE; private: virtual ~WebTextCheckingCompletionImpl() { } - int m_identifier; - WebCore::SpellChecker* m_spellChecker; - EditorClientImpl* m_editorClient; + WTF::RefPtr<WebCore::TextCheckingRequest> m_request; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a8931b120..dacfa152e 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -1678,8 +1678,9 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_doingDragAndDrop) return true; + // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately. if (m_ignoreInputEvents) - return true; + return false; m_currentInputEvent = &inputEvent; @@ -2955,10 +2956,10 @@ void WebViewImpl::applyAutofillSuggestions( if (!m_autofillPopup) { PopupContainerSettings popupSettings = autofillPopupSettings; - popupSettings.defaultDeviceScaleFactor = - m_page->settings()->defaultDeviceScaleFactor(); + popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor(); if (!popupSettings.defaultDeviceScaleFactor) popupSettings.defaultDeviceScaleFactor = 1; + popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch(); m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), PopupContainer::Suggestion, popupSettings); diff --git a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index b82ea52b3..72db521d5 100644 --- a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -79,6 +79,12 @@ void resetClickCountState() gLastClickButton = WebKit::WebMouseEvent::ButtonNone; } +bool isKeyPadKeyval(guint keyval) +{ + // Keypad keyvals all fall into one range. + return keyval >= GDK_KP_Space && keyval <= GDK_KP_9; +} + } // namespace namespace WebKit { @@ -365,7 +371,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) result.setKeyIdentifierFromWindowsKeyCode(); - // FIXME: Do we need to set IsAutoRepeat or IsKeyPad? + // FIXME: Do we need to set IsAutoRepeat? + if (isKeyPadKeyval(event->keyval)) + result.modifiers |= WebInputEvent::IsKeyPad; return result; } diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index 36f79818e..0e8c1a401 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -99,9 +99,9 @@ FakeTransformTransition::~FakeTransformTransition() { } -WebCore::TransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const +WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const { - return WebCore::TransformationMatrix(); + return WebKit::WebTransformationMatrix(); } PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h index 776b75c8d..4384117d3 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h @@ -25,6 +25,7 @@ #ifndef CCAnimationTestCommon_h #define CCAnimationTestCommon_h +#include "IntSize.h" #include "cc/CCAnimationCurve.h" #include "cc/CCLayerAnimationController.h" @@ -53,7 +54,7 @@ public: virtual ~FakeTransformTransition(); virtual double duration() const OVERRIDE { return m_duration; } - virtual WebCore::TransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; + virtual WebKit::WebTransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; @@ -86,13 +87,13 @@ public: virtual int id() const OVERRIDE { return 0; } virtual void setOpacityFromAnimation(float opacity) OVERRIDE { m_opacity = opacity; } virtual float opacity() const OVERRIDE { return m_opacity; } - virtual void setTransformFromAnimation(const WebCore::TransformationMatrix& transform) OVERRIDE { m_transform = transform; } - virtual const WebCore::TransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) OVERRIDE { m_transform = transform; } + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } virtual const WebCore::IntSize& bounds() const OVERRIDE { return m_bounds; } private: float m_opacity; - WebCore::TransformationMatrix m_transform; + WebKit::WebTransformationMatrix m_transform; WebCore::IntSize m_bounds; }; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index bbea971dd..56d85fafa 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -46,7 +46,7 @@ namespace { void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; @@ -291,7 +291,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix rotation; + WebTransformationMatrix rotation; rotation.rotate(45); // Note carefully, the anchor is actually part of layer->position(). By setting anchor @@ -332,7 +332,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix transform; + WebTransformationMatrix transform; transform.applyPerspective(1); transform.translate3d(-150, -50, 0); transform.rotate3d(0, 45, 0); @@ -789,7 +789,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -928,7 +928,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -988,7 +988,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index 15b554a06..ad1ae74ca 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -31,18 +31,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } // Tests that a float animation with one keyframe works as expected. @@ -191,10 +191,8 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) expectTranslateX(4, curve->getValue(0.5, layerSize)); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - TransformationMatrix value = curve->getValue(1, layerSize); - TransformationMatrix::DecomposedType decomposedType; - value.decompose(decomposedType); - EXPECT_TRUE(decomposedType.translateX >= 4 && decomposedType.translateX <= 6); + WebTransformationMatrix value = curve->getValue(1, layerSize); + EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6); expectTranslateX(6, curve->getValue(1.5, layerSize)); expectTranslateX(6, curve->getValue(2, layerSize)); diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index 827194bbc..dbed02c74 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -35,18 +35,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Vector.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property) diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index f5259e1cf..827c9adaa 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -86,7 +86,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) IntRect arbitraryIntRect = IntRect(arbitraryIntPoint, arbitraryIntSize); FloatRect arbitraryFloatRect = FloatRect(arbitraryFloatPoint, FloatSize(1.234f, 5.678f)); Color arbitraryColor = Color(10, 20, 30); - TransformationMatrix arbitraryTransform; + WebTransformationMatrix arbitraryTransform; arbitraryTransform.scale3d(0.1, 0.2, 0.3); WebFilterOperations arbitraryFilters; arbitraryFilters.append(WebFilterOperation::createOpacityFilter(0.5)); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index f5eae7f84..105c7186e 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCLayerTreeHostCommon.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -139,7 +141,7 @@ TEST(CCLayerIteratorTest, simpleTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -186,7 +188,7 @@ TEST(CCLayerIteratorTest, complexTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -245,7 +247,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index 65db549ba..d231e1259 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -46,11 +48,11 @@ TEST(CCLayerSorterTest, BasicOverlap) float weight = 0; // Trivial test, with one layer directly obscuring the other. - TransformationMatrix neg4Translate; + WebTransformationMatrix neg4Translate; neg4Translate.translate3d(0, 0, -4); CCLayerSorter::LayerShape front(2, 2, neg4Translate); - TransformationMatrix neg5Translate; + WebTransformationMatrix neg5Translate; neg5Translate.translate3d(0, 0, -5); CCLayerSorter::LayerShape back(2, 2, neg5Translate); @@ -63,7 +65,7 @@ TEST(CCLayerSorterTest, BasicOverlap) EXPECT_EQ(1, weight); // One layer translated off to the right. No overlap should be detected. - TransformationMatrix rightTranslate; + WebTransformationMatrix rightTranslate; rightTranslate.translate3d(10, 0, -5); CCLayerSorter::LayerShape backRight(2, 2, rightTranslate); overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); @@ -80,14 +82,15 @@ TEST(CCLayerSorterTest, RightAngleOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Two layers forming a right angle with a perspective viewing transform. - TransformationMatrix leftFaceMatrix; - leftFaceMatrix.rotate3d(0, 1, 0, -90).translateRight3d(-1, 0, -5); + WebTransformationMatrix leftFaceMatrix; + leftFaceMatrix.rotate3d(0, 1, 0, -90); + leftFaceMatrix.translateRight3d(-1, 0, -5); CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); @@ -101,17 +104,18 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Intersecting layers. An explicit order will be returned based on relative z // values at the overlapping features but the weight returned should be zero. - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); - TransformationMatrix throughMatrix; - throughMatrix.rotate3d(0, 1, 0, 45).translateRight3d(0, 0, -4); + WebTransformationMatrix throughMatrix; + throughMatrix.rotate3d(0, 1, 0, 45); + throughMatrix.translateRight3d(0, 0, -4); CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); @@ -136,15 +140,15 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) // C is in front of A and behind B (not what you'd expect by comparing centers). // A and B don't overlap, so they're incomparable. - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); CCLayerSorter::LayerShape layerA(8, 20, transformA); - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); CCLayerSorter::LayerShape layerB(8, 20, transformB); - TransformationMatrix transformC; + WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); CCLayerSorter::LayerShape layerC(8, 20, transformC); @@ -167,10 +171,10 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // where w < 0. If the code uses the invalid value, it will think that a layer has // different bounds than it really does, which can cause things to sort incorrectly. - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1); - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); @@ -178,7 +182,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // visible on the left half of the projection plane, in front of layerA. When it is // not clipped, its bounds will actually incorrectly appear much smaller and the // correct sorting dependency will not be found. - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); @@ -216,9 +220,9 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); - TransformationMatrix BehindMatrix; + WebTransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); - TransformationMatrix FrontMatrix; + WebTransformationMatrix FrontMatrix; FrontMatrix.translate3d(0, 0, 1); layer1->setBounds(IntSize(10, 10)); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 17e570199..fce9046c7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -29,20 +29,21 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTreeTestCommon.h" #include "LayerChromium.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCMathUtil.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const TransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) +void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) { layer->setTransform(transform); layer->setSublayerTransform(sublayerTransform); @@ -54,16 +55,16 @@ void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatr void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); } -TransformationMatrix remove3DComponentOfMatrix(const TransformationMatrix& mat) +WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat) { - TransformationMatrix ret = mat; + WebTransformationMatrix ret = mat; ret.setM13(0); ret.setM23(0); ret.setM31(0); @@ -98,7 +99,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) parent->addChild(child); child->addChild(grandChild); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); @@ -120,12 +121,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // value of LayerChromium::position() changes if the anchor changes, even though the layer is not actually located in a // different position. When we initialize layers for testing here, we need to initialize that unintutive position value. - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. - TransformationMatrix arbitraryTranslation; + WebTransformationMatrix arbitraryTranslation; arbitraryTranslation.translate(10.0, 20.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -134,7 +135,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 6.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -148,7 +149,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 4: A change in "actual" position affects both the draw transform and screen space transform. - TransformationMatrix positionTransform; + WebTransformationMatrix positionTransform; positionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -157,7 +158,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by // using a scale transform, because scale and translation are not commutative. - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.scale3d(2.0, 2.0, 1.0); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -165,9 +166,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(5.0, 0.0); - TransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); @@ -185,7 +186,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -194,7 +195,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) child->addChild(grandChild); // Case 1: parent's anchorPoint should not affect child or grandChild. - TransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; + WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); grandChildTranslationToCenter.translate(38.0, 39.0); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); @@ -207,7 +208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); // Case 2: parent's position affects child and grandChild. - TransformationMatrix parentPositionTransform; + WebTransformationMatrix parentPositionTransform; parentPositionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); @@ -219,11 +220,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform()); // Case 3: parent's local transform affects child and grandchild - TransformationMatrix parentLayerTransform; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -237,14 +238,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // scaling is used here again so that the correct sequence of transforms is properly tested. // Note that preserves3D is false, but the sublayer matrix should retain its 3D properties when given to child. // But then, the child also does not preserve3D. When it gives its hierarchy to the grandChild, it should be flattened to 2D. - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); // Sublayer matrix is applied to the center of the parent layer. parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); + WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -278,18 +279,18 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); // Child's render surface should not exist yet. @@ -331,22 +332,22 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(3.0, 3.0, 1.0); - TransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; + WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); @@ -408,20 +409,20 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // // x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative). // y component has a translation by 1.0 for every ancestor, which indicates the "depth" of the layer in the hierarchy. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(2.5, 0.0); - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 5.0); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(-2.0, 5.0, 1.0); - TransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); - TransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); - TransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); + WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); + WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); @@ -531,7 +532,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0.9f); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); @@ -560,7 +561,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -588,7 +589,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setForceRenderSurface(true); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -628,7 +629,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // clipRect, and they should never get scheduled on the list of renderSurfaces. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -677,7 +678,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -749,7 +750,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) // this clipping should be avoided and we should keep the grandChild // in the renderSurfaceLayerList. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -813,7 +814,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -871,7 +872,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) // have a clipRect of their own layer bounds, however, if masksToBounds was true. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -972,9 +973,9 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) // Also put an animated opacity on a layer without descendants. addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); // In combination with descendantDrawsContent and masksToBounds, an animated transform forces the layer to have a new renderSurface. @@ -1089,7 +1090,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) // Test the calculateVisibleRect() function works correctly for identity transforms. IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); @@ -1115,7 +1116,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1145,7 +1146,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1192,7 +1193,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface. layerToSurfaceTransform.makeIdentity(); @@ -1220,7 +1221,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Even though the layer is twice as large as the surface, due to perspective // foreshortening, the layer will fit fully in the surface when its translated @@ -1262,7 +1263,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // This sequence of transforms effectively rotates the layer about the y-axis at the // center of the layer. @@ -1286,7 +1287,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // The layer is positioned so that the right half of the layer should be in front of // the camera, while the other half is behind the surface's projection plane. The @@ -1294,7 +1295,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) // center of the layer. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); - layerToSurfaceTransform.translate3d(-1, 0, 1); + layerToSurfaceTransform.translate3d(-2, 0, 1); layerToSurfaceTransform.rotate3d(0, 45, 0); // Sanity check that this transform does indeed cause w < 0 when applying the @@ -1320,7 +1321,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped. IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); layerToSurfaceTransform.translate3d(0, 0, -5); @@ -1348,7 +1349,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) // that 3d transforms still apply in this case, but they are "flattened" to each // parent layer according to current W3C spec. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1379,7 +1380,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1446,7 +1447,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) { // Verify the behavior of back-face culling when preserves-3d transform style is used. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1479,7 +1480,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1549,7 +1550,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) // treated as "unknown" so we can not be sure that their back face is really showing. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> animatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1571,7 +1572,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) childOfAnimatingSurface->setDoubleSided(false); animatingChild->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1634,7 +1635,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin // Verify the behavior of back-face culling for a renderSurface that is created // when it flattens its subtree, and its parent has preserves-3d. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1651,7 +1652,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin frontFacingSurface->setDoubleSided(false); backFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 1275ec854..b996006ae 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -32,6 +32,7 @@ #include "CCTiledLayerTestCommon.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "ContentLayerChromium.h" +#include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" #include "TextureManager.h" @@ -43,6 +44,7 @@ #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCScopedThreadProxy.h" +#include "cc/CCSingleThreadProxy.h" #include "cc/CCTextureUpdater.h" #include "cc/CCThreadTask.h" #include "cc/CCTimingFunction.h" @@ -71,6 +73,52 @@ using namespace WTF; namespace { +class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { +public: + static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) + { + return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); + } + + virtual WebGLId createTexture() + { + WebGLId texture = m_textures.size() + 1; + m_textures.append(texture); + return texture; + } + + virtual void deleteTexture(WebGLId texture) + { + for (size_t i = 0; i < m_textures.size(); i++) { + if (m_textures[i] == texture) { + m_textures.remove(i); + break; + } + } + } + + virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) + { + m_usedTextures.add(texture); + } + + int numTextures() const { return static_cast<int>(m_textures.size()); } + int texture(int i) const { return m_textures[i]; } + void resetTextures() { m_textures.clear(); } + + int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } + bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } + void resetUsedTextures() { m_usedTextures.clear(); } + +private: + explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) + { + } + + Vector<WebGLId> m_textures; + HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; +}; + // Used by test stubs to notify the test when something interesting happens. class TestHooks : public CCLayerAnimationDelegate { public: @@ -83,7 +131,7 @@ public: virtual void applyScrollAndScale(const IntSize&, float) { } virtual void updateAnimations(double monotonicTime) { } virtual void layout() { } - virtual void didRecreateContext(bool succeded) { } + virtual void didRecreateContext(bool succeeded) { } virtual void didCommit() { } virtual void didCommitAndDrawFrame() { } virtual void scheduleComposite() { } @@ -91,6 +139,16 @@ public: // Implementation of CCLayerAnimationDelegate virtual void notifyAnimationStarted(double time) { } virtual void notifyAnimationFinished(double time) { } + + virtual PassRefPtr<GraphicsContext3D> createContext() + { + GraphicsContext3D::Attributes attrs; + WebGraphicsContext3D::Attributes webAttrs; + webAttrs.alpha = attrs.alpha; + + OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + } }; // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. @@ -206,52 +264,6 @@ private: bool m_didAddAnimationWasCalled; }; -class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { -public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) - { - return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); - } - - virtual WebGLId createTexture() - { - WebGLId texture = m_textures.size() + 1; - m_textures.append(texture); - return texture; - } - - virtual void deleteTexture(WebGLId texture) - { - for (size_t i = 0; i < m_textures.size(); i++) { - if (m_textures[i] == texture) { - m_textures.remove(i); - break; - } - } - } - - virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) - { - m_usedTextures.add(texture); - } - - int numTextures() const { return static_cast<int>(m_textures.size()); } - int texture(int i) const { return m_textures[i]; } - void resetTextures() { m_textures.clear(); } - - int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } - bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } - void resetUsedTextures() { m_usedTextures.clear(); } - -private: - explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) - { - } - - Vector<WebGLId> m_textures; - HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; -}; - // Implementation of CCLayerTreeHost callback interface. class MockLayerTreeHostClient : public CCLayerTreeHostClient { public: @@ -285,12 +297,7 @@ public: virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE { - GraphicsContext3D::Attributes attrs; - WebGraphicsContext3D::Attributes webAttrs; - webAttrs.alpha = attrs.alpha; - - OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + return m_testHooks->createContext(); } virtual void willCommit() OVERRIDE @@ -343,6 +350,7 @@ public: virtual void beginTest() = 0; void endTest(); + void endTestAfterDelay(int delayMilliseconds); void postSetNeedsAnimateToMainThread() { @@ -395,6 +403,11 @@ public: m_timeoutTask = 0; } + void clearEndTestTask() + { + m_endTestTask = 0; + } + CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } @@ -406,6 +419,7 @@ protected: , m_finished(false) , m_scheduled(false) , m_started(false) + , m_endTestTask(0) { } void doBeginTest(); @@ -597,6 +611,34 @@ protected: CCLayerTreeHostTest* m_test; }; + class EndTestTask : public WebThread::Task { + public: + explicit EndTestTask(CCLayerTreeHostTest* test) + : m_test(test) + { + } + + virtual ~EndTestTask() + { + if (m_test) + m_test->clearEndTestTask(); + } + + void clearTest() + { + m_test = 0; + } + + virtual void run() + { + if (m_test) + m_test->endTest(); + } + + private: + CCLayerTreeHostTest* m_test; + }; + virtual void runTest(bool threaded) { if (threaded) { @@ -621,6 +663,9 @@ protected: if (m_timeoutTask) m_timeoutTask->clearTest(); + if (m_endTestTask) + m_endTestTask->clearTest(); + ASSERT_FALSE(m_layerTreeHost.get()); m_client.clear(); if (m_timedOut) { @@ -648,6 +693,7 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; TimeoutTask* m_timeoutTask; BeginTask* m_beginTask; + EndTestTask* m_endTestTask; }; void CCLayerTreeHostTest::doBeginTest() @@ -686,6 +732,17 @@ void CCLayerTreeHostTest::endTest() } } +void CCLayerTreeHostTest::endTestAfterDelay(int delayMilliseconds) +{ + // If we are called from the CCThread, re-call endTest on the main thread. + if (!isMainThread()) + m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTestAfterDelay, delayMilliseconds)); + else { + m_endTestTask = new EndTestTask(this); + WebKit::Platform::current()->currentThread()->postDelayedTask(m_endTestTask, delayMilliseconds); + } +} + class CCLayerTreeHostTestThreadOnly : public CCLayerTreeHostTest { public: void runTestThreaded() @@ -1389,6 +1446,56 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) +class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { +public: + virtual bool makeContextCurrent() { return false; } +}; + +// Ensures that we do not animate +class CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation() + { + } + + virtual void beginTest() + { + // This will cause the animation timer to be set which will fire in + // CCSingleThreadProxy::animationTimerDelay() seconds. + postAddAnimationToMainThread(); + } + + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + { + ASSERT_NOT_REACHED(); + } + + virtual void didRecreateContext(bool succeeded) + { + EXPECT_FALSE(succeeded); + + // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds + // (use ceil just to be sure). If the timer was not disabled, we will + // attempt to call CCSingleThreadProxy::compositeImmediately and the + // test will fail. + endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000)); + } + + virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE + { + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow); + } + + virtual void afterTest() + { + } +}; + +TEST_F(CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread) +{ + runTest(false); +} + // Ensures that main thread animations have their start times synchronized with impl thread animations. class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly { public: @@ -1985,21 +2092,21 @@ public: // The root render surface is the size of the viewport. EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); - TransformationMatrix scaleTransform; + WebTransformationMatrix scaleTransform; scaleTransform.scale(impl->settings().deviceScaleFactor); // The root layer is scaled by 2x. - TransformationMatrix rootScreenSpaceTransform = scaleTransform; - TransformationMatrix rootDrawTransform = scaleTransform; + WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; + WebTransformationMatrix rootDrawTransform = scaleTransform; rootDrawTransform.translate(root->bounds().width() * 0.5, root->bounds().height() * 0.5); EXPECT_EQ(rootDrawTransform, root->drawTransform()); EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); // The child is at position 2,2, so translate by 2,2 before applying the scale by 2x. - TransformationMatrix childScreenSpaceTransform = scaleTransform; + WebTransformationMatrix childScreenSpaceTransform = scaleTransform; childScreenSpaceTransform.translate(2, 2); - TransformationMatrix childDrawTransform = scaleTransform; + WebTransformationMatrix childDrawTransform = scaleTransform; childDrawTransform.translate(2, 2); childDrawTransform.translate(child->bounds().width() * 0.5, child->bounds().height() * 0.5); @@ -2113,7 +2220,7 @@ TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) runTest(true); } -static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { layer->removeAllChildren(); if (parent) @@ -2141,7 +2248,7 @@ public: m_layerTreeHost->setRootLayer(m_parent); m_layerTreeHost->setViewportSize(IntSize(10, 20)); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false); @@ -2301,7 +2408,7 @@ private: Region m_occludedScreenSpace; }; -static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque); layer->clearOccludedScreenSpace(); @@ -2319,8 +2426,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2521,8 +2628,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2607,7 +2714,7 @@ public: { // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. Region occluded; - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; Vector<RefPtr<TestLayerChromium> > layers; Vector<RefPtr<TestLayerChromium> > children; int numSurfaces = 20; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h index 75e487a4a..5c01c8049 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h @@ -41,7 +41,7 @@ namespace WebKitTests { EXPECT_EQ((expected).size().height(), (actual).size().height()) // This is a macro instead of a function so that we get useful line numbers where a test failed. -// Even though TransformationMatrix values are double precision, there are many other floating-point values used that affect +// Even though WebTransformationMatrix values are double precision, there are many other floating-point values used that affect // the transforms, and so we only expect them to be accurate up to floating-point precision. #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); \ diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 3909677a5..44a68b9eb 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -26,18 +26,20 @@ #include "cc/CCMathUtil.h" -#include "TransformationMatrix.h" - +#include "CCLayerTreeTestCommon.h" +#include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); EXPECT_FALSE(transform.isBackFaceVisible()); @@ -58,7 +60,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) { - TransformationMatrix layerSpaceToProjectionPlane; + WebTransformationMatrix layerSpaceToProjectionPlane; // This tests if isBackFaceVisible works properly under perspective transforms. // Specifically, layers that may have their back face visible in orthographic @@ -104,7 +106,7 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) // In this case, the m33() element of the transform becomes zero, which could cause a // divide-by-zero when projecting points/quads. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); transform.setM33(0); @@ -116,4 +118,38 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) EXPECT_TRUE(projectedRect.isEmpty()); } +TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) +{ + HomogeneousCoordinate h1(-100, -100, 0, 1); + HomogeneousCoordinate h2(-10, -10, 0, 1); + HomogeneousCoordinate h3(10, 10, 0, -1); + HomogeneousCoordinate h4(100, 100, 0, -1); + + // The bounds of the enclosing clipped rect should be -100 to -10 for both x and y. + // However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + +TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) +{ + FloatPoint vertices[3]; + int numVertices = 3; + + vertices[0] = FloatPoint(-10, -100); + vertices[1] = FloatPoint(-100, -10); + vertices[2] = FloatPoint(-30, -30); + + // The bounds of the enclosing rect should be -100 to -10 for both x and y. However, + // if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingRectOfVertices(vertices, numVertices); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 976dc3f29..80317a008 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -27,30 +27,26 @@ #include "cc/CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCLayerTreeTestCommon.h" #include "CCOcclusionTrackerTestCommon.h" #include "LayerChromium.h" #include "Region.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostCommon.h" +#include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKit; using namespace WebKitTests; -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); - namespace { class TestContentLayerChromium : public LayerChromium { @@ -177,7 +173,7 @@ protected: CCLayerTreeHost::setNeedsFilterContext(false); } - typename Types::ContentLayerType* createRoot(const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -188,7 +184,7 @@ protected: return layerPtr; } - typename Types::LayerType* createLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerPtrType layer(Types::createLayer()); typename Types::LayerType* layerPtr = layer.get(); @@ -197,7 +193,7 @@ protected: return layerPtr; } - typename Types::LayerType* createSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerType* layer = createLayer(parent, transform, position, bounds); WebFilterOperations filters; @@ -206,7 +202,7 @@ protected: return layer; } - typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -226,7 +222,7 @@ protected: return layerPtr; } - typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -244,7 +240,7 @@ protected: return layerPtr; } - typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque); WebFilterOperations filters; @@ -336,24 +332,24 @@ protected: m_layerIterator = m_layerIteratorBegin; } - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; private: - void setBaseProperties(typename Types::LayerType* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { layer->setTransform(transform); - layer->setSublayerTransform(TransformationMatrix()); + layer->setSublayerTransform(WebTransformationMatrix()); layer->setAnchorPoint(FloatPoint(0, 0)); layer->setPosition(position); layer->setBounds(bounds); } - void setProperties(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(LayerChromium* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); } - void setProperties(CCLayerImpl* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(CCLayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); @@ -449,9 +445,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -469,14 +465,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -487,7 +483,7 @@ class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types, protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -502,9 +498,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -522,14 +518,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -540,7 +536,7 @@ class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(20, 20); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -553,9 +549,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); @@ -573,25 +569,25 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); } }; @@ -603,7 +599,7 @@ class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -620,9 +616,9 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -642,9 +638,9 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -696,7 +692,7 @@ class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -715,16 +711,16 @@ protected: this->visitLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(child, occlusion); @@ -745,18 +741,18 @@ protected: EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); // This is the little piece not occluded by child2 - EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); // This extends past both sides of child2, so it will be the original rect. - EXPECT_EQ_RECT(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). - EXPECT_EQ_RECT(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. - EXPECT_EQ_RECT(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); + EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); @@ -773,13 +769,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); @@ -792,21 +788,21 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); - EXPECT_EQ_RECT(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); - EXPECT_EQ_RECT(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); // This rect is mostly occluded by |child2|. - EXPECT_EQ_RECT(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); // This rect extends past top/right ends of |child2|. - EXPECT_EQ_RECT(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); // This rect extends past left/right ends of |child2|. - EXPECT_EQ_RECT(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); + EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer|: 100 @@ -842,12 +838,12 @@ class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTes protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(95); childTransform.translate(-250, -250); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(10, 10); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -859,14 +855,14 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); @@ -891,13 +887,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); - EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); + EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); } }; @@ -908,7 +904,7 @@ class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -927,9 +923,9 @@ protected: this->visitLayer(layer1, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -939,17 +935,17 @@ protected: EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -957,10 +953,10 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer1| and |layer2|: @@ -996,7 +992,7 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrack protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -1014,9 +1010,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterContributingSurface(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1034,15 +1030,15 @@ protected: occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000)); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); @@ -1052,14 +1048,14 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); @@ -1105,12 +1101,12 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public protected: void runMyTest() { - TransformationMatrix child1Transform; + WebTransformationMatrix child1Transform; child1Transform.translate(250, 250); child1Transform.rotate(-90); child1Transform.translate(-250, -250); - TransformationMatrix child2Transform; + WebTransformationMatrix child2Transform; child2Transform.translate(250, 250); child2Transform.rotate(90); child2Transform.translate(-250, -250); @@ -1128,9 +1124,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1143,15 +1139,15 @@ protected: this->enterContributingSurface(child2, occlusion); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); @@ -1161,16 +1157,16 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); - EXPECT_EQ_RECT(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); - EXPECT_EQ_RECT(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); @@ -1212,7 +1208,7 @@ class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types, opaqu protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -1255,16 +1251,16 @@ protected: this->visitLayer(opaqueLayer, occlusion); this->enterContributingSurface(opaqueLayer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // And it gets translated to the parent surface. this->leaveContributingSurface(opaqueLayer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The blur layer needs to throw away any occlusion from outside its subtree. @@ -1281,9 +1277,9 @@ protected: // But the opaque layer's occlusion is preserved on the parent. this->leaveContributingSurface(blurLayer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1305,16 +1301,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1336,16 +1332,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_EQ_RECT(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1368,16 +1364,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The replica should not be occluding the parent, since it has a mask applied to it. - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1422,7 +1418,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1466,7 +1462,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1583,11 +1579,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1626,11 +1622,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1799,7 +1795,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1815,7 +1811,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1831,7 +1827,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1848,7 +1844,7 @@ class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.rotate3d(0, 30, 0); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -1860,7 +1856,7 @@ protected: this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1871,7 +1867,7 @@ class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(150, 150); transform.applyPerspective(400); transform.rotate3d(1, 0, 0, -30); @@ -1887,7 +1883,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1899,7 +1895,7 @@ protected: void runMyTest() { // This test is based on the platform/chromium/compositing/3d-corners.html layout test. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(250, 50); transform.applyPerspective(10); transform.translate(-250, -50); @@ -1930,7 +1926,7 @@ class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusion protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 110); @@ -1959,7 +1955,7 @@ class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusio protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 99); @@ -2012,27 +2008,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2064,27 +2060,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2122,7 +2118,7 @@ protected: this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); this->leaveContributingSurface(surface2, occlusion); @@ -2130,53 +2126,53 @@ protected: // surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only. // It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); // The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it // can't be occluded. - EXPECT_EQ_RECT(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); // The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->enterContributingSurface(surface, occlusion); // The contributing |surface| is animating so it can't be occluded. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->enterLayer(layer, occlusion); // The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it. - EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(layer, occlusion); this->enterLayer(parent, occlusion); // The |layer| is animating in the screen and in its target, so no occlusion is added. - EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2187,7 +2183,7 @@ class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus protected: void runMyTest() { - TransformationMatrix surfaceTransform; + WebTransformationMatrix surfaceTransform; surfaceTransform.translate(300, 300); surfaceTransform.scale(2); surfaceTransform.translate(-150, -150); @@ -2204,9 +2200,9 @@ protected: this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Clear any stored occlusion. @@ -2216,9 +2212,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2240,9 +2236,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2266,22 +2262,22 @@ protected: // |topmost| occludes the replica, but not the surface itself. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is not occluded so it shouldn't think it is. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2304,23 +2300,23 @@ protected: // |topmost| occludes the surface, but not the entire surface's replica. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is occluded, but only the top 10px of the replica. - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2345,23 +2341,23 @@ protected: this->visitLayer(overReplica, occlusion); this->visitLayer(overSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface and replica are occluded different amounts. - EXPECT_EQ_RECT(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2385,18 +2381,18 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surfaceChild, occlusion); // surfaceChild increases the occlusion in the screen by a narrow sliver. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); // In its own surface, surfaceChild is at 0,0 as is its occlusion. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2406,26 +2402,65 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect // does not get clipped away inappropriately. - EXPECT_EQ_RECT(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50))); this->leaveContributingSurface(surfaceChild, occlusion); // When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also. this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_EQ_RECT(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); template<class Types, bool opaqueLayers> +class CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor : public CCOcclusionTrackerTest<Types, opaqueLayers> { +protected: + void runMyTest() + { + // This test verifies that the top-most surface is considered occluded outside of its scissor rect and outside the screen's scissor rect. + + typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); + typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); + this->calcDrawEtc(parent); + + { + // Make a screen scissor rect that is larger than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + + this->visitLayer(surface, occlusion); + + // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. + this->enterContributingSurface(surface, occlusion); + // Make sure the parent's clipRect clips the unoccluded region of the child surface. + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + this->resetLayerIterator(); + { + // Make a screen scissor rect that is smaller than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); + + this->visitLayer(surface, occlusion); + + // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. + this->enterContributingSurface(surface, occlusion); + // Make sure the screen scissor rect clips the unoccluded region of the child surface. + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + } +}; + +ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor); + +template<class Types, bool opaqueLayers> class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> { protected: void runMyTest() @@ -2444,17 +2479,17 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface. this->visitLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2463,13 +2498,13 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. - EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100))); this->leaveContributingSurface(surfaceChild, occlusion); this->visitLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2480,7 +2515,7 @@ class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order. @@ -2517,28 +2552,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_EQ_RECT(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); - - EXPECT_EQ_RECT(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); + + EXPECT_INT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2546,9 +2581,9 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); IntRect outsetRect; @@ -2557,44 +2592,44 @@ protected: // Nothing in the blur outsets for the filteredSurface is occluded. outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Nothing in the blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); } }; @@ -2605,7 +2640,7 @@ class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them. @@ -2632,9 +2667,9 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); - EXPECT_EQ_RECT(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(filteredSurface2, occlusion); @@ -2647,7 +2682,7 @@ protected: // Test expectations in the target. IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetBottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom) * 2); - EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); // Test expectations in the screen. Take the ceiling of half of the outsets. outsetTop = (outsetTop + 1) / 2; @@ -2656,7 +2691,7 @@ protected: outsetLeft = (outsetLeft + 1) / 2; expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetBottom) * 2); - EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); } }; @@ -2703,28 +2738,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_EQ_RECT(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); - - EXPECT_EQ_RECT(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); + + EXPECT_INT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2732,7 +2767,7 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterContributingSurface(clippingSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); IntRect outsetRect; @@ -2743,45 +2778,45 @@ protected: outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); } }; @@ -2792,7 +2827,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each. @@ -2827,9 +2862,9 @@ protected: IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2841,7 +2876,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order. @@ -2875,9 +2910,9 @@ protected: IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2889,7 +2924,7 @@ class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order. @@ -2976,17 +3011,17 @@ protected: // The small layer is not tracked because it is too small. this->visitLayer(small, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The large layer is tracked as it is large enough. this->visitLayer(large, occlusion); - EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 634a25c7a..1a119d708 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -33,8 +33,10 @@ #include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -55,7 +57,7 @@ private: typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) { OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); @@ -105,7 +107,7 @@ static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> > CCQuadList quadList; \ Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \ Vector<CCLayerImpl*> renderSurfaceLayerList; \ - TransformationMatrix childTransform; \ + WebTransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ IntSize childSize = IntSize(200, 200); \ @@ -115,8 +117,8 @@ TEST(CCQuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -132,8 +134,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -149,7 +151,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -166,7 +168,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -185,7 +187,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -222,7 +224,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) // Make the root layer's quad have extent (99.1, 99.1) -> (200.9, 200.9) to make // sure it doesn't get culled due to transform rounding. - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(99.1, 99.1); rootTransform.scale(1.018); @@ -251,7 +253,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) childTransform.translate(100.1, 100.1); childTransform.scale(0.982); - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(100, 100); rootRect = childRect = IntRect(0, 0, 100, 100); @@ -276,7 +278,7 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) childTransform.translate(100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -295,7 +297,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -315,7 +317,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) childTransform.translate(50, 10); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -335,7 +337,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) childTransform.translate(50, 49); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -356,7 +358,7 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -379,11 +381,11 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) DECLARE_AND_INITIALIZE_TEST_QUADS // Use a small rotation so as to not disturb the geometry significantly. - TransformationMatrix parentTransform; + WebTransformationMatrix parentTransform; parentTransform.rotate(1); OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -399,8 +401,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -416,8 +418,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -433,8 +435,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -450,8 +452,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -467,8 +469,8 @@ TEST(CCQuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index 7dac005d2..5cbe7fc54 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -26,14 +26,15 @@ #include "cc/CCRenderSurface.h" -#include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -77,7 +78,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); - TransformationMatrix dummyMatrix; + WebTransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); // The rest of the surface properties are either internal and should not cause change, @@ -86,9 +87,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setOriginTransform(dummyMatrix)); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setSkipsDraw(true)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerList()); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setMaskLayer(dummyMask.get())); } TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) @@ -103,8 +102,8 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - TransformationMatrix draw; - TransformationMatrix origin; + WebTransformationMatrix draw; + WebTransformationMatrix origin; draw.translate(30, 40); diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp new file mode 100644 index 000000000..db69edd38 --- /dev/null +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -0,0 +1,971 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Decimal.h" + +#include <gtest/gtest.h> +#include <wtf/MathExtras.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +std::ostream& operator<<(std::ostream& os, const Decimal& decimal) +{ + Decimal::EncodedData data = decimal.value(); + return os + << "encode(" << String::number(data.coefficient()).ascii().data() + << ", " << String::number(data.exponent()).ascii().data() + << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive") + << ")=" << decimal.toString().ascii().data(); +} + +} // namespace WebCore + +using namespace WebCore; + +// Simulate WebCore/html/StepRange +class DecimalStepRange { +public: + Decimal maximum; + Decimal minimum; + Decimal step; + + DecimalStepRange(const Decimal& minimum, const Decimal& maximum, const Decimal& step) + : maximum(maximum) + , minimum(minimum) + , step(step) + { + } + + Decimal clampValue(Decimal value) const + { + const Decimal result = minimum + ((value - minimum) / step).round() * step; + ASSERT(result.isFinite()); + return result > maximum ? result - step : result; + } +}; + +class DecimalTest : public ::testing::Test { +protected: + typedef Decimal::Sign Sign; + protected: static const Sign Positive = Decimal::Positive; + protected: static const Sign Negative = Decimal::Negative; + + Decimal encode(uint64_t coefficient, int exponent, Sign sign) + { + return Decimal(sign, exponent, coefficient); + } + + protected: Decimal fromString(const String& string) + { + return Decimal::fromString(string); + } + + protected: String stepDown(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value -= stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } + + protected: String stepUp(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value += stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } +}; + +TEST_F(DecimalTest, Abs) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs()); + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs()); + + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs()); + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs()); + + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Positive).abs()); + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Negative).abs()); + + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Positive).abs()); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Negative).abs()); + + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Positive).abs()); + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Negative).abs()); + + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Positive).abs()); + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Negative).abs()); +} + +TEST_F(DecimalTest, AbsBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).abs()); + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Positive).abs()); + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).abs()); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).abs()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().abs()); +} + +TEST_F(DecimalTest, Add) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) + Decimal(0)); + EXPECT_EQ(Decimal(1), Decimal(2) + Decimal(-1)); + EXPECT_EQ(Decimal(1), Decimal(-1) + Decimal(2)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(99) + Decimal(1)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-50) + Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), Decimal(1) + encode(1, 50, Positive)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), encode(1, 10, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), Decimal(1) + encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, 1022, Positive), encode(1, 1022, Positive) + encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(std::numeric_limits<uint64_t>::max(), 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, AddSmallExponent) +{ + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(Infinity, Infinity + Infinity); + EXPECT_EQ(NaN, Infinity + MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + MinusInfinity); + + EXPECT_EQ(Infinity, Infinity + Ten); + EXPECT_EQ(Infinity, Ten + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + Ten); + EXPECT_EQ(MinusInfinity, Ten + MinusInfinity); + + EXPECT_EQ(NaN, NaN + NaN); + EXPECT_EQ(NaN, NaN + Ten); + EXPECT_EQ(NaN, Ten + NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, Ceiling) +{ + EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).ceiling()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).ceiling()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().ceiling()); +} + +TEST_F(DecimalTest, Compare) +{ + EXPECT_TRUE(Decimal(0) == Decimal(0)); + EXPECT_TRUE(Decimal(0) != Decimal(1)); + EXPECT_TRUE(Decimal(0) < Decimal(1)); + EXPECT_TRUE(Decimal(0) <= Decimal(0)); + EXPECT_TRUE(Decimal(0) > Decimal(-1)); + EXPECT_TRUE(Decimal(0) >= Decimal(0)); + + EXPECT_FALSE(Decimal(1) == Decimal(2)); + EXPECT_FALSE(Decimal(1) != Decimal(1)); + EXPECT_FALSE(Decimal(1) < Decimal(0)); + EXPECT_FALSE(Decimal(1) <= Decimal(0)); + EXPECT_FALSE(Decimal(1) > Decimal(2)); + EXPECT_FALSE(Decimal(1) >= Decimal(2)); +} + +TEST_F(DecimalTest, CompareBigExponent) +{ + EXPECT_TRUE(encode(1, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_TRUE(encode(1, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) >= encode(1, 1000, Negative)); + + EXPECT_FALSE(encode(2, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_FALSE(encode(2, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) >= encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, CompareSmallExponent) +{ + EXPECT_TRUE(encode(1, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_TRUE(encode(1, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) >= encode(1, -1000, Negative)); + + EXPECT_FALSE(encode(2, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_FALSE(encode(2, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) >= encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, CompareSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + + EXPECT_TRUE(Zero == Zero); + EXPECT_FALSE(Zero != Zero); + EXPECT_FALSE(Zero < Zero); + EXPECT_TRUE(Zero <= Zero); + EXPECT_FALSE(Zero > Zero); + EXPECT_TRUE(Zero >= Zero); + + EXPECT_TRUE(Zero == MinusZero); + EXPECT_FALSE(Zero != MinusZero); + EXPECT_FALSE(Zero < MinusZero); + EXPECT_TRUE(Zero <= MinusZero); + EXPECT_FALSE(Zero > MinusZero); + EXPECT_TRUE(Zero >= MinusZero); + + EXPECT_TRUE(MinusZero == Zero); + EXPECT_FALSE(MinusZero != Zero); + EXPECT_FALSE(MinusZero < Zero); + EXPECT_TRUE(MinusZero <= Zero); + EXPECT_FALSE(MinusZero > Zero); + EXPECT_TRUE(MinusZero >= Zero); + + EXPECT_TRUE(MinusZero == MinusZero); + EXPECT_FALSE(MinusZero != MinusZero); + EXPECT_FALSE(MinusZero < MinusZero); + EXPECT_TRUE(MinusZero <= MinusZero); + EXPECT_FALSE(MinusZero > MinusZero); + EXPECT_TRUE(MinusZero >= MinusZero); + + EXPECT_TRUE(Infinity == Infinity); + EXPECT_FALSE(Infinity != Infinity); + EXPECT_FALSE(Infinity < Infinity); + EXPECT_TRUE(Infinity <= Infinity); + EXPECT_FALSE(Infinity > Infinity); + EXPECT_TRUE(Infinity >= Infinity); + + EXPECT_FALSE(Infinity == Ten); + EXPECT_TRUE(Infinity != Ten); + EXPECT_FALSE(Infinity < Ten); + EXPECT_FALSE(Infinity <= Ten); + EXPECT_TRUE(Infinity > Ten); + EXPECT_TRUE(Infinity >= Ten); + + EXPECT_FALSE(Infinity == MinusInfinity); + EXPECT_TRUE(Infinity != MinusInfinity); + EXPECT_FALSE(Infinity < MinusInfinity); + EXPECT_FALSE(Infinity <= MinusInfinity); + EXPECT_TRUE(Infinity > MinusInfinity); + EXPECT_TRUE(Infinity >= MinusInfinity); + + EXPECT_FALSE(Infinity == NaN); + EXPECT_FALSE(Infinity != NaN); + EXPECT_FALSE(Infinity < NaN); + EXPECT_FALSE(Infinity <= NaN); + EXPECT_FALSE(Infinity > NaN); + EXPECT_FALSE(Infinity >= NaN); + + EXPECT_FALSE(MinusInfinity == Infinity); + EXPECT_TRUE(MinusInfinity != Infinity); + EXPECT_TRUE(MinusInfinity < Infinity); + EXPECT_TRUE(MinusInfinity <= Infinity); + EXPECT_FALSE(MinusInfinity > Infinity); + EXPECT_FALSE(MinusInfinity >= Infinity); + + EXPECT_FALSE(MinusInfinity == Ten); + EXPECT_TRUE(MinusInfinity != Ten); + EXPECT_TRUE(MinusInfinity < Ten); + EXPECT_TRUE(MinusInfinity <= Ten); + EXPECT_FALSE(MinusInfinity > Ten); + EXPECT_FALSE(MinusInfinity >= Ten); + + EXPECT_TRUE(MinusInfinity == MinusInfinity); + EXPECT_FALSE(MinusInfinity != MinusInfinity); + EXPECT_FALSE(MinusInfinity < MinusInfinity); + EXPECT_TRUE(MinusInfinity <= MinusInfinity); + EXPECT_FALSE(MinusInfinity > MinusInfinity); + EXPECT_TRUE(MinusInfinity >= MinusInfinity); + + EXPECT_FALSE(MinusInfinity == NaN); + EXPECT_FALSE(MinusInfinity != NaN); + EXPECT_FALSE(MinusInfinity < NaN); + EXPECT_FALSE(MinusInfinity <= NaN); + EXPECT_FALSE(MinusInfinity > NaN); + EXPECT_FALSE(MinusInfinity >= NaN); + + EXPECT_FALSE(NaN == Infinity); + EXPECT_FALSE(NaN != Infinity); + EXPECT_FALSE(NaN < Infinity); + EXPECT_FALSE(NaN <= Infinity); + EXPECT_FALSE(NaN > Infinity); + EXPECT_FALSE(NaN >= Infinity); + + EXPECT_FALSE(NaN == Ten); + EXPECT_FALSE(NaN != Ten); + EXPECT_FALSE(NaN < Ten); + EXPECT_FALSE(NaN <= Ten); + EXPECT_FALSE(NaN > Ten); + EXPECT_FALSE(NaN >= Ten); + + EXPECT_FALSE(NaN == MinusInfinity); + EXPECT_FALSE(NaN != MinusInfinity); + EXPECT_FALSE(NaN < MinusInfinity); + EXPECT_FALSE(NaN <= MinusInfinity); + EXPECT_FALSE(NaN > MinusInfinity); + EXPECT_FALSE(NaN >= MinusInfinity); + + EXPECT_TRUE(NaN == NaN); + EXPECT_FALSE(NaN != NaN); + EXPECT_FALSE(NaN < NaN); + EXPECT_TRUE(NaN <= NaN); + EXPECT_FALSE(NaN > NaN); + EXPECT_TRUE(NaN >= NaN); +} + +TEST_F(DecimalTest, Division) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) / Decimal(1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) / Decimal(-1)); + EXPECT_EQ(encode(5, -1, Negative), Decimal(-1) / Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) / Decimal(1)); + EXPECT_EQ(Decimal(1), Decimal(-50) / Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(3333333333333333), -16, Positive), Decimal(1) / Decimal(3)); + EXPECT_EQ(encode(UINT64_C(12345678901234), -1, Positive), encode(UINT64_C(12345678901234), 0, Positive) / Decimal(10)); +} + +TEST_F(DecimalTest, DivisionBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 1022, Positive) / encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) / encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, DivisionSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) / encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, DivisionSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + const Decimal MinusTen(-10); + + EXPECT_EQ(NaN, Zero / Zero); + EXPECT_EQ(NaN, Zero / MinusZero); + EXPECT_EQ(NaN, MinusZero / Zero); + EXPECT_EQ(NaN, MinusZero / MinusZero); + + EXPECT_EQ(Infinity, Ten / Zero); + EXPECT_EQ(MinusInfinity, Ten / MinusZero); + EXPECT_EQ(MinusInfinity, MinusTen / Zero); + EXPECT_EQ(Infinity, MinusTen / MinusZero); + + EXPECT_EQ(Infinity, Infinity / Zero); + EXPECT_EQ(MinusInfinity, Infinity / MinusZero); + EXPECT_EQ(MinusInfinity, MinusInfinity / Zero); + EXPECT_EQ(Infinity, MinusInfinity / MinusZero); + + EXPECT_EQ(NaN, Infinity / Infinity); + EXPECT_EQ(NaN, Infinity / MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity / Infinity); + EXPECT_EQ(NaN, MinusInfinity / MinusInfinity); + + EXPECT_EQ(Zero, Ten / Infinity); + EXPECT_EQ(MinusZero, Ten / MinusInfinity); + EXPECT_EQ(MinusZero, MinusTen / Infinity); + EXPECT_EQ(Zero, MinusTen / MinusInfinity); + + EXPECT_EQ(NaN, NaN / NaN); + EXPECT_EQ(NaN, NaN / Ten); + EXPECT_EQ(NaN, Ten / NaN); + + EXPECT_EQ(NaN, NaN / Infinity); + EXPECT_EQ(NaN, NaN / MinusInfinity); + EXPECT_EQ(NaN, Infinity / NaN); + EXPECT_EQ(NaN, MinusInfinity / NaN); +} + +TEST_F(DecimalTest, EncodedData) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative)); + EXPECT_EQ(Decimal(1), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive)); + EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive)); +} + +TEST_F(DecimalTest, Floor) +{ + EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor()); +} + +TEST_F(DecimalTest, FloorBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).floor()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).floor()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().floor()); +} + +TEST_F(DecimalTest, FromInt32) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0)); + EXPECT_EQ(encode(1, 0, Positive), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-1)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(100)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-100)); + EXPECT_EQ(encode(0x7FFFFFFF, 0, Positive), Decimal(std::numeric_limits<int32_t>::max())); + EXPECT_EQ(encode(0x80000000u, 0, Negative), Decimal(std::numeric_limits<int32_t>::min())); +} + +TEST_F(DecimalTest, FromString) +{ + EXPECT_EQ(encode(0, 0, Positive), fromString("0")); + EXPECT_EQ(encode(0, 0, Negative), fromString("-0")); + EXPECT_EQ(Decimal(1), fromString("1")); + EXPECT_EQ(encode(1, 0, Negative), fromString("-1")); + EXPECT_EQ(Decimal(1), fromString("01")); + EXPECT_EQ(encode(3, 0, Positive), fromString("+3")); + EXPECT_EQ(encode(0, 3, Positive), fromString("0E3")); + EXPECT_EQ(encode(5, -1, Positive), fromString(".5")); + EXPECT_EQ(encode(100, 0, Positive), fromString("100")); + EXPECT_EQ(encode(100, 0, Negative), fromString("-100")); + EXPECT_EQ(encode(123, -2, Positive), fromString("1.23")); + EXPECT_EQ(encode(123, -2, Negative), fromString("-1.23")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E10")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E+10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E+10")); + EXPECT_EQ(encode(123, -12, Positive), fromString("1.23E-10")); + EXPECT_EQ(encode(123, -12, Negative), fromString("-1.23E-10")); + EXPECT_EQ(encode(5, -7, Positive), fromString("0.0000005")); + EXPECT_EQ(encode(0, 0, Positive), fromString("0e9999")); + EXPECT_EQ(encode(123, -3, Positive), fromString("0.123")); + EXPECT_EQ(encode(0, -2, Positive), fromString("00.00")); + EXPECT_EQ(encode(1, 2, Positive), fromString("1E2")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1E20000")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-20000")); + EXPECT_EQ(encode(1000, 1023, Positive), fromString("1E1026")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-1026")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1234567890E1036")); + + // 2^1024 + const uint64_t leadingDigitsOf2PowerOf1024 = UINT64_C(17976931348623159); + EXPECT_EQ(encode(leadingDigitsOf2PowerOf1024, 292, Positive), fromString("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216")); +} + +// These strings are look like proper number, but we don't accept them. +TEST_F(DecimalTest, FromStringLikeNumber) +{ + EXPECT_EQ(Decimal::nan(), fromString(" 123 ")); + EXPECT_EQ(Decimal::nan(), fromString("1,234")); +} + +// fromString doesn't support infinity and NaN. +TEST_F(DecimalTest, FromStringSpecialValues) +{ + EXPECT_EQ(Decimal::nan(), fromString("INF")); + EXPECT_EQ(Decimal::nan(), fromString("Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-infinity")); + EXPECT_EQ(Decimal::nan(), fromString("NaN")); + EXPECT_EQ(Decimal::nan(), fromString("nan")); + EXPECT_EQ(Decimal::nan(), fromString("+NaN")); + EXPECT_EQ(Decimal::nan(), fromString("+nan")); + EXPECT_EQ(Decimal::nan(), fromString("-NaN")); + EXPECT_EQ(Decimal::nan(), fromString("-nan")); +} + +TEST_F(DecimalTest, fromStringTruncated) +{ + EXPECT_EQ(Decimal::nan(), fromString("x")); + EXPECT_EQ(Decimal::nan(), fromString("0.")); + EXPECT_EQ(Decimal::nan(), fromString("1x")); + + EXPECT_EQ(Decimal::nan(), fromString("1Ex")); + EXPECT_EQ(Decimal::nan(), fromString("1E2x")); + EXPECT_EQ(Decimal::nan(), fromString("1E+x")); +} + +TEST_F(DecimalTest, Multiplication) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) * Decimal(0)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) * Decimal(-1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1)); + EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50)); +} + +TEST_F(DecimalTest, MultiplicationBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) * encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 22, Positive), encode(1, 1022, Positive) * encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) * encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + const Decimal MinusTen(-10); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + + EXPECT_EQ(Infinity, Infinity * Infinity); + EXPECT_EQ(MinusInfinity, Infinity * MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusInfinity); + + EXPECT_EQ(NaN, Infinity * Zero); + EXPECT_EQ(NaN, Zero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * Zero); + EXPECT_EQ(NaN, MinusInfinity * Zero); + + EXPECT_EQ(NaN, Infinity * MinusZero); + EXPECT_EQ(NaN, MinusZero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + + EXPECT_EQ(Infinity, Infinity * Ten); + EXPECT_EQ(Infinity, Ten * Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Ten); + EXPECT_EQ(MinusInfinity, Ten * MinusInfinity); + + EXPECT_EQ(MinusInfinity, Infinity * MinusTen); + EXPECT_EQ(MinusInfinity, MinusTen * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusTen); + EXPECT_EQ(Infinity, MinusTen * MinusInfinity); + + EXPECT_EQ(NaN, NaN * NaN); + EXPECT_EQ(NaN, NaN * Ten); + EXPECT_EQ(NaN, Ten * NaN); + + EXPECT_EQ(NaN, NaN * Infinity); + EXPECT_EQ(NaN, NaN * MinusInfinity); + EXPECT_EQ(NaN, Infinity * NaN); + EXPECT_EQ(NaN, MinusInfinity * NaN); +} + +TEST_F(DecimalTest, Negate) +{ + EXPECT_EQ(encode(0, 0, Negative), -encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), -encode(0, 0, Negative)); + + EXPECT_EQ(encode(0, 10, Negative), -encode(0, 10, Positive)); + EXPECT_EQ(encode(0, 10, Positive), -encode(0, 10, Negative)); + + EXPECT_EQ(encode(0, -10, Negative), -encode(0, -10, Positive)); + EXPECT_EQ(encode(0, -10, Positive), -encode(0, -10, Negative)); + + EXPECT_EQ(encode(1, 0, Negative), -encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), -encode(1, 0, Negative)); + + EXPECT_EQ(encode(1, 10, Negative), -encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 10, Positive), -encode(1, 10, Negative)); + + EXPECT_EQ(encode(1, -10, Negative), -encode(1, -10, Positive)); + EXPECT_EQ(encode(1, -10, Positive), -encode(1, -10, Negative)); +} + +TEST_F(DecimalTest, NegateBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Negative), -encode(1, 1000, Positive)); + EXPECT_EQ(encode(1, 1000, Positive), -encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, NegateSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Negative), -encode(1, -1000, Positive)); + EXPECT_EQ(encode(1, -1000, Positive), -encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, NegateSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Negative), -Decimal::infinity(Positive)); + EXPECT_EQ(Decimal::infinity(Positive), -Decimal::infinity(Negative)); + EXPECT_EQ(Decimal::nan(), -Decimal::nan()); +} + +TEST_F(DecimalTest, Predicates) +{ + EXPECT_TRUE(Decimal::zero(Positive).isFinite()); + EXPECT_TRUE(Decimal::zero(Positive).isPositive()); + EXPECT_FALSE(Decimal::zero(Positive).isNegative()); + EXPECT_FALSE(Decimal::zero(Positive).isSpecial()); + EXPECT_TRUE(Decimal::zero(Positive).isZero()); + + EXPECT_TRUE(Decimal::zero(Negative).isFinite()); + EXPECT_FALSE(Decimal::zero(Negative).isPositive()); + EXPECT_TRUE(Decimal::zero(Negative).isNegative()); + EXPECT_FALSE(Decimal::zero(Negative).isSpecial()); + EXPECT_TRUE(Decimal::zero(Negative).isZero()); + + EXPECT_TRUE(Decimal(123).isFinite()); + EXPECT_TRUE(Decimal(123).isPositive()); + EXPECT_FALSE(Decimal(123).isNegative()); + EXPECT_FALSE(Decimal(123).isSpecial()); + EXPECT_FALSE(Decimal(123).isZero()); + + EXPECT_TRUE(Decimal(-123).isFinite()); + EXPECT_FALSE(Decimal(-123).isPositive()); + EXPECT_TRUE(Decimal(-123).isNegative()); + EXPECT_FALSE(Decimal(-123).isSpecial()); + EXPECT_FALSE(Decimal(-123).isZero()); +} + +TEST_F(DecimalTest, PredicatesSpecialValues) +{ + EXPECT_FALSE(Decimal::infinity(Positive).isFinite()); + EXPECT_TRUE(Decimal::infinity(Positive).isPositive()); + EXPECT_FALSE(Decimal::infinity(Positive).isNegative()); + EXPECT_TRUE(Decimal::infinity(Positive).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Positive).isZero()); + + EXPECT_FALSE(Decimal::infinity(Negative).isFinite()); + EXPECT_FALSE(Decimal::infinity(Negative).isPositive()); + EXPECT_TRUE(Decimal::infinity(Negative).isNegative()); + EXPECT_TRUE(Decimal::infinity(Negative).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Negative).isZero()); + + EXPECT_FALSE(Decimal::nan().isFinite()); + EXPECT_TRUE(Decimal::nan().isSpecial()); + EXPECT_FALSE(Decimal::nan().isZero()); +} + +// LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer) +{ + EXPECT_EQ(String("10"), stepDown("0", "100", "10", "19", 1)); + EXPECT_EQ(String("90"), stepUp("0", "99", "10", "89", 1)); + EXPECT_EQ(String("1"), stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3 + EXPECT_EQ(String("0.01"), stepUp("0", "0.01", "0.0033333333333333333", "0", 3)); // step=1/300 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.1", "0", 10)); +} + +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding) +{ + EXPECT_EQ(String("5.015"), stepUp("0", "100", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("0", "100", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("0", "100", "0.005", "5.005", 12)); + + EXPECT_EQ(String("5.015"), stepUp("4", "9", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("4", "9", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("4", "9", "0.005", "5.005", 12)); +} + +TEST_F(DecimalTest, RealWorldExampleRangeStepUpStepDown) +{ + EXPECT_EQ(String("1e+38"), stepUp("0", "1E38", "1", "1E38", 9)); + EXPECT_EQ(String("1e+38"), stepDown("0", "1E38", "1", "1E38", 9)); +} + +TEST_F(DecimalTest, Remainder) +{ + EXPECT_EQ(encode(9, -1, Negative), encode(21, -1, Positive).remainder(3)); + EXPECT_EQ(Decimal(1), Decimal(10).remainder(3)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-10).remainder(3)); + EXPECT_EQ(encode(2, -1, Positive), encode(102, -1, Positive).remainder(1)); + EXPECT_EQ(encode(1, -1, Positive), Decimal(10).remainder(encode(3, -1, Positive))); + EXPECT_EQ(encode(3, -1, Negative), encode(36, -1, Positive).remainder(encode(13, -1, Positive))); + EXPECT_EQ(encode(1, 87, Positive), (encode(1234, 100, Positive).remainder(Decimal(3)))); +} + +TEST_F(DecimalTest, RemainderBigExponent) +{ + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 1022, Positive))); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive).remainder(encode(1, -1000, Positive))); +} + +TEST_F(DecimalTest, RemainderSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, -1022, Positive))); +} + +TEST_F(DecimalTest, RemainderSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(1)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(1)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(3)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(3)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(3)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Positive))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Negative))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::nan())); +} + +TEST_F(DecimalTest, Round) +{ + EXPECT_EQ(Decimal(1), (Decimal(9) / Decimal(10)).round()); + EXPECT_EQ(Decimal(25), (Decimal(5) / fromString("0.200")).round()); + EXPECT_EQ(Decimal(3), (Decimal(5) / Decimal(2)).round()); + EXPECT_EQ(Decimal(1), (Decimal(2) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(10) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(1) / fromString("0.3")).round()); + EXPECT_EQ(Decimal(10), (Decimal(1) / fromString("0.1")).round()); + EXPECT_EQ(Decimal(5), (Decimal(1) / fromString("0.2")).round()); + EXPECT_EQ(Decimal(10), (fromString("10.2") / 1).round()); + EXPECT_EQ(encode(1234, 100, Positive), encode(1234, 100, Positive).round()); +} + +TEST_F(DecimalTest, RoundSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).round()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).round()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().round()); +} + +TEST_F(DecimalTest, Subtract) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) - Decimal(0)); + EXPECT_EQ(encode(3, 0, Positive), Decimal(2) - Decimal(-1)); + EXPECT_EQ(encode(3, 0, Negative), Decimal(-1) - Decimal(2)); + EXPECT_EQ(encode(98, 0, Positive), Decimal(99) - Decimal(1)); + EXPECT_EQ(encode(0, 0, Positive), Decimal(-50) - Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) - Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Negative), Decimal(1) - encode(1, 50, Positive)); +} + +TEST_F(DecimalTest, SubtractBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, 1022, Positive) - encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, SubtractSmallExponent) +{ + EXPECT_EQ(encode(UINT64_C(10000000000000000), -16, Negative), encode(1, -1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) - encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, SubtractSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(NaN, Infinity - Infinity); + EXPECT_EQ(Infinity, Infinity - MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Infinity); + EXPECT_EQ(NaN, MinusInfinity - MinusInfinity); + + EXPECT_EQ(Infinity, Infinity - Ten); + EXPECT_EQ(MinusInfinity, Ten - Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Ten); + EXPECT_EQ(Infinity, Ten - MinusInfinity); + + EXPECT_EQ(NaN, NaN - NaN); + EXPECT_EQ(NaN, NaN - Ten); + EXPECT_EQ(NaN, Ten - NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, ToString) +{ + EXPECT_EQ(String("0"), Decimal::zero(Positive).toString()); + EXPECT_EQ(String("-0"), Decimal::zero(Negative).toString()); + EXPECT_EQ(String("1"), Decimal(1).toString()); + EXPECT_EQ(String("-1"), Decimal(-1).toString()); + EXPECT_EQ(String("1234567"), Decimal(1234567).toString()); + EXPECT_EQ(String("-1234567"), Decimal(-1234567).toString()); + EXPECT_EQ(String("0.5"), encode(5, -1, Positive).toString()); + EXPECT_EQ(String("-0.5"), encode(5, -1, Negative).toString()); + EXPECT_EQ(String("12.345"), encode(12345, -3, Positive).toString()); + EXPECT_EQ(String("-12.345"), encode(12345, -3, Negative).toString()); + EXPECT_EQ(String("0.12345"), encode(12345, -5, Positive).toString()); + EXPECT_EQ(String("-0.12345"), encode(12345, -5, Negative).toString()); + EXPECT_EQ(String("50"), encode(50, 0, Positive).toString()); + EXPECT_EQ(String("-50"), encode(50, 0, Negative).toString()); + EXPECT_EQ(String("5e+1"), encode(5, 1, Positive).toString()); + EXPECT_EQ(String("-5e+1"), encode(5, 1, Negative).toString()); + EXPECT_EQ(String("5.678e+103"), encode(5678, 100, Positive).toString()); + EXPECT_EQ(String("-5.678e+103"), encode(5678, 100, Negative).toString()); + EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString()); + EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString()); +} + +TEST_F(DecimalTest, ToStringSpecialValues) +{ + EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString()); + EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString()); + EXPECT_EQ(String("NaN"), Decimal::nan().toString()); +} diff --git a/Source/WebKit/chromium/tests/FloatQuadTest.cpp b/Source/WebKit/chromium/tests/FloatQuadTest.cpp index 6c7091ca4..3e2f9bce6 100644 --- a/Source/WebKit/chromium/tests/FloatQuadTest.cpp +++ b/Source/WebKit/chromium/tests/FloatQuadTest.cpp @@ -25,20 +25,20 @@ #include "config.h" +#include "cc/CCMathUtil.h" #include "FloatQuad.h" - -#include "TransformationMatrix.h" - #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(FloatQuadTest, IsRectilinearTest) { const int numRectilinear = 8; - TransformationMatrix rectilinearTrans[numRectilinear]; + WebTransformationMatrix rectilinearTrans[numRectilinear]; rectilinearTrans[1].rotate(90); rectilinearTrans[2].rotate(180); rectilinearTrans[3].rotate(270); @@ -50,12 +50,14 @@ TEST(FloatQuadTest, IsRectilinearTest) rectilinearTrans[7].rotate(180); for (int i = 0; i < numRectilinear; ++i) { - FloatQuad quad = rectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_TRUE(quad.isRectilinear()); } const int numNonRectilinear = 10; - TransformationMatrix nonRectilinearTrans[numNonRectilinear]; + WebTransformationMatrix nonRectilinearTrans[numNonRectilinear]; nonRectilinearTrans[0].rotate(359.999); nonRectilinearTrans[1].rotate(0.0000001); nonRectilinearTrans[2].rotate(89.999999); @@ -68,7 +70,9 @@ TEST(FloatQuadTest, IsRectilinearTest) nonRectilinearTrans[9].skewY(0.00001); for (int i = 0; i < numNonRectilinear; ++i) { - FloatQuad quad = nonRectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_FALSE(quad.isRectilinear()); } } diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 491d48db5..8213dd812 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -36,9 +36,11 @@ #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -496,8 +498,8 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setTargetRenderSurface(0)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(TransformationMatrix())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(TransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7))); EXPECT_FALSE(testLayer->needsDisplay()); @@ -512,13 +514,13 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpaque(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4.0f, 9.0f))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setShouldScrollOnMainThread(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNonFastScrollableRegion(Region(IntRect(1, 1, 2, 2)))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10))); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer")); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDrawCheckerboardForMissingTiles(!testLayer->drawCheckerboardForMissingTiles())); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 8445feba7..4ed35986c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -275,3 +275,44 @@ TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) EXPECT_TRUE(layerRendererChromium.initialize()); } + +class LoseContextOnFirstGetContext : public FakeWebGraphicsContext3D { +public: + LoseContextOnFirstGetContext() + : m_contextLost(false) + { + } + + virtual bool makeContextCurrent() OVERRIDE + { + return !m_contextLost; + } + + virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual WGC3Denum getGraphicsResetStatusARB() OVERRIDE + { + return m_contextLost ? 1 : 0; + } + +private: + bool m_contextLost; +}; + +TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert) +{ + FakeLayerRendererChromiumClient mockClient; + FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + + layerRendererChromium.initialize(); +} diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp index edcfd4a63..be467a0d5 100644 --- a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -31,11 +31,12 @@ #include "GraphicsLayerClient.h" #include "IntRect.h" #include "Path.h" -#include "TransformationMatrix.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -63,11 +64,10 @@ TEST(LinkHighlightTest, verifyLinkHighlightLayer) EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); - TransformationMatrix::DecomposedType decomposition; - EXPECT_TRUE(contentLayer->transform().decompose(decomposition)); - - FloatPoint expectedTranslation(pathBoundingRect.x() + pathBoundingRect.width() / 2, pathBoundingRect.y() + pathBoundingRect.height() / 2); - EXPECT_EQ(FloatPoint(decomposition.translateX, decomposition.translateY), expectedTranslation); + float expectedXTranslation = pathBoundingRect.x() + pathBoundingRect.width() / 2; + float expectedYTranslation = pathBoundingRect.y() + pathBoundingRect.height() / 2; + EXPECT_FLOAT_EQ(expectedXTranslation, contentLayer->transform().m41()); + EXPECT_FLOAT_EQ(expectedYTranslation, contentLayer->transform().m42()); } TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 1db65ec6e..7acb31149 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -182,10 +182,6 @@ public: protected: virtual void SetUp() { - // When touch is enabled, padding is added to option elements - // In these tests, we'll assume touch is disabled. - m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled(); - RuntimeEnabledFeatures::setTouchEnabled(false); m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); m_webView->initializeMainFrame(&m_webFrameClient); m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); @@ -196,7 +192,6 @@ protected: m_popupMenu = 0; m_webView->close(); webkit_support::UnregisterAllMockedURLs(); - RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled); } // Returns true if there currently is a select popup in the WebView. @@ -284,7 +279,6 @@ protected: TestWebFrameClient m_webFrameClient; TestPopupMenuClient m_popupMenuClient; RefPtr<PopupMenu> m_popupMenu; - bool m_touchWasEnabled; std::string baseURL; }; @@ -360,8 +354,9 @@ TEST_F(SelectPopupMenuTest, ClickItem) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate a click down/up on the first item. simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -377,8 +372,9 @@ TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate the mouse moving over the first item. PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, 0); @@ -421,9 +417,9 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 0.5 means the Y position on the item at index 0. - IntPoint row1Point(2, menuHeight * 0.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 0.5 means the Y position on the item at index 0. + IntPoint row1Point(2, menuItemHeight * 0.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -437,8 +433,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) m_popupMenuClient.setDisabledIndex(1); showPopup(); - // menuHeight * 1.5 means the Y position on the item at index 1. - row1Point.setY(menuHeight * 1.5); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + row1Point.setY(menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -446,8 +442,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); showPopup(); - // menuHeight * 2.5 means the Y position on the item at index 2. - row1Point.setY(menuHeight * 2.5); + // menuItemHeight * 2.5 means the Y position on the item at index 2. + row1Point.setY(menuItemHeight * 2.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -488,9 +484,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -510,9 +506,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c9125a852..80b099f19 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -33,10 +33,12 @@ #include "WebCompositor.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; using namespace WTF; +using WebKit::WebTransformationMatrix; #define EXPECT_EQ_RECT(a, b) \ EXPECT_EQ(a.x(), b.x()); \ @@ -109,7 +111,7 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); layer->invalidateRect(IntRect(0, 0, 100, 200)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); @@ -327,7 +329,7 @@ TEST(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); layer->invalidateRect(IntRect(0, 0, 100, 100)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); @@ -1018,7 +1020,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1063,7 +1065,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); @@ -1114,7 +1116,7 @@ TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); @@ -1149,10 +1151,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) // This makes sure the painting works when the occluded region (in screen space) // is transformed differently than the layer. layer->setBounds(IntSize(600, 600)); - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1179,7 +1181,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // pixels, which means none should be occluded. layer->setContentsScale(0.5); layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1212,10 +1214,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // This makes sure content scaling and transforms work together. - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1244,7 +1246,7 @@ TEST(TiledLayerChromiumTest, visibleContentOpaqueRegion) IntRect visibleBounds = IntRect(0, 0, 100, 150); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); @@ -1338,7 +1340,7 @@ TEST(TiledLayerChromiumTest, pixelsPaintedMetrics) IntRect visibleBounds = IntRect(0, 0, 100, 300); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index a6ab77fc1..4aa905c78 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -643,4 +643,85 @@ TEST_F(WebFrameTest, FindInPage) webView->close(); } +TEST_F(WebFrameTest, GetContentAsPlainText) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + // We set the size because it impacts line wrapping, which changes the + // resulting text value. + webView->resize(WebSize(640, 480)); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Make sure it comes out OK. + const std::string expected("Foo bar\nbaz"); + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ(expected, std::string(text.utf8())); + + // Try reading the same one with clipping of the text. + const int length = 5; + text = frame->contentAsText(length); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + + // Now do a new test with a subframe. + const char outerFrameSource[] = "Hello<iframe></iframe> world"; + frame->loadHTMLString(outerFrameSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Load something into the subframe. + WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); + ASSERT_TRUE(subframe); + subframe->loadHTMLString("sub<p>text", testURL); + webkit_support::RunAllPendingMessages(); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + + // Get the frame text where the subframe separator falls on the boundary of + // what we'll take. There used to be a crash in this case. + text = frame->contentAsText(12); + EXPECT_EQ("Hello world", std::string(text.utf8())); + + webView->close(); +} + +TEST_F(WebFrameTest, GetFullHtmlOfPage) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<p>Hello</p><p>World</p>"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + const std::string html = frame->contentAsMarkup().utf8(); + + // Load again with the output html. + frame->loadHTMLString(html, testURL); + webkit_support::RunAllPendingMessages(); + + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + // Test selection check + EXPECT_FALSE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("SelectAll")); + EXPECT_TRUE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_FALSE(frame->hasSelection()); + WebString selectionHtml = frame->selectionAsMarkup(); + EXPECT_TRUE(selectionHtml.isEmpty()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp index 64c63eae9..3792eaf79 100644 --- a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp +++ b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp @@ -31,11 +31,16 @@ #include "config.h" #include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> #include <gtest/gtest.h> +#include "KeyboardEvent.h" #include "WebInputEvent.h" +#include "WebInputEventConversion.h" #include "WebInputEventFactory.h" +using WebKit::WebInputEvent; +using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebInputEventFactory; @@ -172,4 +177,27 @@ TEST(WebInputEventFactoryTest, MouseUpClickCount) EXPECT_EQ(0, mouseUpEvent.clickCount); } +TEST(WebInputEventFactoryTest, NumPadConversion) +{ + // Construct a GDK input event for the numpad "5" key. + char five[] = "5"; + GdkEventKey gdkEvent; + memset(&gdkEvent, 0, sizeof(GdkEventKey)); + gdkEvent.type = GDK_KEY_PRESS; + gdkEvent.keyval = GDK_KP_5; + gdkEvent.string = five; + + // Numpad flag should be set on the WebKeyboardEvent. + WebKeyboardEvent webEvent = WebInputEventFactory::keyboardEvent(&gdkEvent); + EXPECT_TRUE(webEvent.modifiers & WebInputEvent::IsKeyPad); + + // Round-trip through the WebCore KeyboardEvent class. + WebKit::PlatformKeyboardEventBuilder platformBuilder(webEvent); + RefPtr<WebCore::KeyboardEvent> keypress = WebCore::KeyboardEvent::create(platformBuilder, 0); + EXPECT_TRUE(keypress->keyLocation() == WebCore::KeyboardEvent::DOM_KEY_LOCATION_NUMPAD); + + WebKit::WebKeyboardEventBuilder builder(*keypress); + EXPECT_TRUE(builder.modifiers & WebInputEvent::IsKeyPad); +} + } // anonymous namespace diff --git a/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp new file mode 100644 index 000000000..deaf7ad74 --- /dev/null +++ b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <public/WebTransformOperations.h> + +#include <public/WebTransformationMatrix.h> + +#include "CCLayerTreeTestCommon.h" + +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> + +using namespace WebKit; + +TEST(WebTransformOperationTest, transformTypesAreUnique) +{ + Vector<OwnPtr<WebTransformOperations> > transforms; + + WebTransformOperations* toAdd = new WebTransformOperations(); + toAdd->appendTranslate(0, 0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendRotate(0, 0, 1, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendScale(1, 1, 1); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendSkew(0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendPerspective(800); + transforms.append(adoptPtr(toAdd)); + + for (size_t i = 0; i < transforms.size(); ++i) { + for (size_t j = 0; j < transforms.size(); ++j) { + bool matchesType = transforms[i]->matchesTypes(*transforms[j]); + EXPECT_TRUE((i == j && matchesType) || !matchesType); + } + } +} + +TEST(WebTransformOperationTest, matchTypesSameLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + WebTransformOperations translates3 = translates2; + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_TRUE(translates.matchesTypes(translates2)); + EXPECT_TRUE(translates.matchesTypes(translates3)); +} + +TEST(WebTransformOperationTest, matchTypesDifferentLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_FALSE(translates.matchesTypes(translates2)); +} + +TEST(WebTransformOperationTest, applyTranslate) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendTranslate(x, y, z); + WebTransformationMatrix expected; + expected.translate3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyRotate) +{ + double x = 1; + double y = 2; + double z = 3; + double degrees = 80; + WebTransformOperations operations; + operations.appendRotate(x, y, z, degrees); + WebTransformationMatrix expected; + expected.rotate3d(x, y, z, degrees); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyScale) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendScale(x, y, z); + WebTransformationMatrix expected; + expected.scale3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applySkew) +{ + double x = 1; + double y = 2; + WebTransformOperations operations; + operations.appendSkew(x, y); + WebTransformationMatrix expected; + expected.skewX(x); + expected.skewY(y); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyPerspective) +{ + double depth = 800; + WebTransformOperations operations; + operations.appendPerspective(depth); + WebTransformationMatrix expected; + expected.applyPerspective(depth); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyMatrix) +{ + double dx = 1; + double dy = 2; + double dz = 3; + WebTransformationMatrix expectedMatrix; + expectedMatrix.translate3d(dx, dy, dz); + WebTransformOperations matrixTransform; + matrixTransform.appendMatrix(expectedMatrix); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform.apply()); +} + +TEST(WebTransformOperationTest, applyOrder) +{ + double sx = 2; + double sy = 4; + double sz = 8; + + double dx = 1; + double dy = 2; + double dz = 3; + + WebTransformOperations operations; + operations.appendScale(sx, sy, sz); + operations.appendTranslate(dx, dy, dz); + + WebTransformationMatrix expectedScaleMatrix; + expectedScaleMatrix.scale3d(sx, sy, sz); + + WebTransformationMatrix expectedTranslateMatrix; + expectedTranslateMatrix.translate3d(dx, dy, dz); + + WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix; + expectedCombinedMatrix.multiply(expectedTranslateMatrix); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations.apply()); +} + +TEST(WebTransformOperationTest, blendOrder) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendScale(sx2, sy2, sz2); + operationsTo.appendTranslate(dx2, dy2, dz2); + + WebTransformationMatrix scaleFrom; + scaleFrom.scale3d(sx1, sy1, sz1); + WebTransformationMatrix translateFrom; + translateFrom.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix scaleTo; + scaleTo.scale3d(sx2, sy2, sz2); + WebTransformationMatrix translateTo; + translateTo.translate3d(dx2, dy2, dz2); + + double progress = 0.25; + + WebTransformationMatrix blendedScale = scaleTo; + blendedScale.blend(scaleFrom, progress); + + WebTransformationMatrix blendedTranslate = translateTo; + blendedTranslate.blend(translateFrom, progress); + + WebTransformationMatrix expected = blendedScale; + expected.multiply(blendedTranslate); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +static void checkProgress(double progress, + const WebTransformationMatrix& fromMatrix, + const WebTransformationMatrix& toMatrix, + const WebTransformOperations& fromTransform, + const WebTransformOperations& toTransform) +{ + WebTransformationMatrix expectedMatrix = toMatrix; + expectedMatrix.blend(fromMatrix, progress); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransform, progress)); +} + +TEST(WebTransformOperationTest, blendProgress) +{ + double sx = 2; + double sy = 4; + double sz = 8; + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixFrom; + matrixFrom.scale3d(sx, sy, sz); + + sx = 4; + sy = 8; + sz = 16; + WebTransformOperations operationsTo; + operationsTo.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixTo; + matrixTo.scale3d(sx, sy, sz); + + checkProgress(-1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.25, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.5, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(2, matrixFrom, matrixTo, operationsFrom, operationsTo); +} + +TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendTranslate(dx2, dy2, dz2); + operationsTo.appendScale(sx2, sy2, sz2); + + WebTransformationMatrix from; + from.scale3d(sx1, sy1, sz1); + from.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix to; + to.translate3d(dx2, dy2, dz2); + to.scale3d(sx2, sy2, sz2); + + double progress = 0.25; + + WebTransformationMatrix expected = to; + expected.blend(from, progress); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} diff --git a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp index 2888e0d7c..937cee202 100644 --- a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp @@ -153,6 +153,15 @@ TEST(WebTransformationMatrixTest, verifyConstructorFor2dElements) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyConstructorForAllElements) +{ + WebTransformationMatrix A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + EXPECT_ROW1_EQ(1, 5, 9, 13, A); + EXPECT_ROW2_EQ(2, 6, 10, 14, A); + EXPECT_ROW3_EQ(3, 7, 11, 15, A); + EXPECT_ROW4_EQ(4, 8, 12, 16, A); +} + TEST(WebTransformationMatrixTest, verifyCopyConstructor) { WebTransformationMatrix A; @@ -624,6 +633,38 @@ TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3d) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForArbitraryAxis) +{ + // Check rotation about an arbitrary non-axis-aligned vector. + WebTransformationMatrix A; + A.rotate3d(1, 1, 1, 90); + EXPECT_ROW1_NEAR(0.3333333333333334258519187, + -0.2440169358562924717404030, + 0.9106836025229592124219380, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(0.9106836025229592124219380, + 0.3333333333333334258519187, + -0.2440169358562924717404030, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_NEAR(-0.2440169358562924717404030, + 0.9106836025229592124219380, + 0.3333333333333334258519187, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForDegenerateAxis) +{ + // Check rotation about a degenerate zero vector. + // It is expected to default to rotation about the z-axis. + WebTransformationMatrix A; + A.rotate3d(0, 0, 0, 90); + EXPECT_ROW1_NEAR(0, -1, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(1, 0, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_EQ(0, 0, 1, 0, A); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + TEST(WebTransformationMatrixTest, verifySkewX) { WebTransformationMatrix A; diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 597886912..ec4f3151d 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,118 @@ +2012-05-31 Alexander Shalamov <alexander.shalamov@intel.com> + + [EFL] <input type="number"> is not a spinbutton + https://bugs.webkit.org/show_bug.cgi?id=86846 + + Reviewed by Kenneth Rohde Christiansen. + + Implemented spinner widget. + + * DefaultTheme/default.edc: + * DefaultTheme/widget/spinner/sp_bg.png: Added. + * DefaultTheme/widget/spinner/sp_down_default.png: Added. + * DefaultTheme/widget/spinner/sp_down_hover.png: Added. + * DefaultTheme/widget/spinner/sp_down_pressed.png: Added. + * DefaultTheme/widget/spinner/sp_up_default.png: Added. + * DefaultTheme/widget/spinner/sp_up_hover.png: Added. + * DefaultTheme/widget/spinner/sp_up_pressed.png: Added. + * DefaultTheme/widget/spinner/spinner.edc: Added. + +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientEfl.h: + (WebCore::EditorClientEfl::requestCheckingOfString): + +2012-05-31 Jussi Kukkonen <jussi.kukkonen@intel.com> + + [EFL][DRT] LayoutTestController does not implement clearApplicationCacheForOrigin + https://bugs.webkit.org/show_bug.cgi?id=86195 + + Reviewed by Gustavo Noronha Silva. + + add new function to clear security origin application cache, + and a function to create a security origin from url string. + Reindent the header to match new longer return signature. + + * ewk/ewk_security_origin.cpp: + (ewk_security_origin_application_cache_clear): + (ewk_security_origin_new_from_string): + * ewk/ewk_security_origin.h: + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] EFL's DRT should print the number of MessagePorts for new each new intent + https://bugs.webkit.org/show_bug.cgi?id=86841 + + Reviewed by Adam Barth. + + Add EWKPrivate method to retrieve the internal WebCore object for a Ewk_Intent. + Add helper function to DumpRenderTreeSupportEfl that returns the MessagePorts + for a Ewk_Intent object so that the DRT can print information about them. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::intentMessagePorts): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + (WebCore): + * ewk/ewk_intent.cpp: + (EWKPrivate): + (EWKPrivate::coreIntent): + * ewk/ewk_intent_private.h: + (EWKPrivate): + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Ewk_Intent_Request's postResult/postFailure should take serialized script values in argument + https://bugs.webkit.org/show_bug.cgi?id=87829 + + Reviewed by Adam Barth. + + Ewk_Intent_Request's postResult/postFailure methods now take + SerializedScriptValues in argument instead of strings. The client can + now post results of any type, not just strings, which is according to + spec. Those methods are now moved to private header and a helper + function was added to DumpRenderTreeSupportEfl so that the DRT can + still send intent results. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::sendWebIntentResponse): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + * ewk/ewk_intent_private.h: + (WebCore): + * ewk/ewk_intent_request.cpp: + (ewk_intent_request_result_post): + (ewk_intent_request_failure_post): + * ewk/ewk_intent_request.h: + +2012-05-29 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Compilation warning in DumpRenderTreeView.cpp + https://bugs.webkit.org/show_bug.cgi?id=87636 + + Reviewed by Filip Pizlo. + + Fix return type of exceeded_application_cache_quota callback, it + should be int64_t, not uint64_t. + + * ewk/ewk_view.h: + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from DRT after its + move to windows.internals.settings. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + 2012-05-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> [EFL] API for PageGroup visited links hash populating diff --git a/Source/WebKit/efl/DefaultTheme/default.edc b/Source/WebKit/efl/DefaultTheme/default.edc index b44fe5cad..5715e289d 100644 --- a/Source/WebKit/efl/DefaultTheme/default.edc +++ b/Source/WebKit/efl/DefaultTheme/default.edc @@ -56,6 +56,7 @@ collections { #include "widget/search/cancel/search_cancel.edc" #include "widget/search/decoration/search_decoration.edc" #include "widget/slider/slider.edc" +#include "widget/spinner/spinner.edc" #include "widget/mediacontrol/playpausebutton/playpause_button.edc" #include "widget/mediacontrol/mutebutton/mute_button.edc" #include "widget/mediacontrol/seekforwardbutton/seekforward_button.edc" diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png Binary files differnew file mode 100644 index 000000000..5d552a822 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png Binary files differnew file mode 100644 index 000000000..f68387348 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png Binary files differnew file mode 100644 index 000000000..a1c4f3fdc --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png Binary files differnew file mode 100644 index 000000000..083531450 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png Binary files differnew file mode 100644 index 000000000..584a65593 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png Binary files differnew file mode 100644 index 000000000..000ffd1e2 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png Binary files differnew file mode 100644 index 000000000..85a741706 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc b/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc new file mode 100644 index 000000000..a48b8f2f2 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St + * - Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +group { + name: "webkit/widget/spinner"; + + images { + image: "widget/spinner/sp_bg.png" COMP; + image: "widget/spinner/sp_up_default.png" COMP; + image: "widget/spinner/sp_down_default.png" COMP; + image: "widget/spinner/sp_up_pressed.png" COMP; + image: "widget/spinner/sp_down_pressed.png" COMP; + image: "widget/spinner/sp_up_hover.png" COMP; + image: "widget/spinner/sp_down_hover.png" COMP; + } + + script { + public isSpinup; + public isEnabled; + public isPressed; + public isHovered; + + public show() { + if (get_int(isEnabled) == 1) { + set_state(PART:"up_bt", "default", 0.0); + set_state(PART:"down_bt", "default", 0.0); + if (get_int(isHovered) == 1) { + if (get_int(isSpinup)) { + set_state(PART:"up_bt", "hovered", 0.0); + if (get_int(isPressed)) + set_state(PART:"up_bt", "pressed", 0.0); + } + else { + set_state(PART:"down_bt", "hovered", 0.0); + if (get_int(isPressed)) + set_state(PART:"down_bt", "pressed", 0.0); + } + } + } + else { + set_state(PART:"up_bt", "disabled", 0.0); + set_state(PART:"down_bt", "disabled", 0.0); + } + } + } + + parts { + part { + name: "bg"; + type: IMAGE; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 6; + } + rel2 { + relative: 1.0 1.0; + offset: -2 -6; + } + image { + normal: "widget/spinner/sp_bg.png"; + border: 1 0 0 0; + } + } + } + + part { + name: "up_bt"; + description { + state: "default" 0.0; + min: 9 7; + max: 9 7; + fixed: 1 1; + rel1 { + relative: 0.0 0.0; + offset: 0 16; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + } + image.normal: "widget/spinner/sp_up_default.png"; + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_up_pressed.png"; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 150; + } + description { + state: "hovered" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_up_hover.png"; + } + } + + part { + name: "down_bt"; + description { + state: "default" 0.0; + min: 9 7; + max: 9 7; + fixed: 1 1; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -18; + } + image.normal: "widget/spinner/sp_down_default.png"; + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_down_pressed.png"; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 150; + } + description { + state: "hovered" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_down_hover.png"; + } + } + + part { + name: "text_confinement"; + type: RECT; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -18 0; + } + } + } + } + + programs { + program { + name: "spinup"; + signal: "spinup"; + script { + set_int(isSpinup, 1); + show(); + } + } + + program { + name: "pressed"; + signal: "pressed"; + script { + set_int(isPressed, 1); + show(); + } + } + + program { + name: "enabled"; + signal: "enabled"; + script { + set_int(isEnabled, 1); + show(); + } + } + program { + name: "hovered"; + signal: "hovered"; + script { + set_int(isHovered, 1); + show(); + } + } + program { + name: "reset"; + signal: "reset"; + script { + set_int(isSpinup, 0); + set_int(isEnabled, 0); + set_int(isPressed, 0); + set_int(isHovered, 0); + show(); + } + } + } +} diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index f372ade3f..7e2127ab2 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -24,6 +24,7 @@ #include "FrameLoaderClientEfl.h" #include "ewk_frame_private.h" #include "ewk_history_private.h" +#include "ewk_intent_private.h" #include "ewk_private.h" #include "ewk_view_private.h" @@ -41,8 +42,10 @@ #include <HTMLInputElement.h> #include <InspectorController.h> #include <IntRect.h> +#include <Intent.h> #include <JSCSSStyleDeclaration.h> #include <JSElement.h> +#include <JavaScriptCore/OpaqueJSString.h> #include <MemoryCache.h> #include <PageGroup.h> #include <PrintContext.h> @@ -428,24 +431,6 @@ void DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(const Evas_Object* ewkVie corePage->settings()->setCSSGridLayoutEnabled(enabled); } -void DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) - WebCore::Page* corePage = EWKPrivate::corePage(ewkView); - if (!corePage) - return; - - WebCore::InspectorController* controller = corePage->inspectorController(); - if (!controller) - return; - - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); -#endif -} - bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name) { WebCore::Page* page = EWKPrivate::corePage(ewkView); @@ -684,6 +669,27 @@ void DumpRenderTreeSupportEfl::setSerializeHTTPLoads(bool enabled) WebCore::resourceLoadScheduler()->setSerialLoadingEnabled(enabled); } +void DumpRenderTreeSupportEfl::sendWebIntentResponse(Ewk_Intent_Request* request, JSStringRef response) +{ +#if ENABLE(WEB_INTENTS) + JSC::UString responseString = response->ustring(); + if (responseString.isNull()) + ewk_intent_request_failure_post(request, WebCore::SerializedScriptValue::create(String::fromUTF8("ERROR"))); + else + ewk_intent_request_result_post(request, WebCore::SerializedScriptValue::create(String(responseString.impl()))); +#endif +} + +WebCore::MessagePortChannelArray* DumpRenderTreeSupportEfl::intentMessagePorts(const Ewk_Intent* intent) +{ +#if ENABLE(WEB_INTENTS) + const WebCore::Intent* coreIntent = EWKPrivate::coreIntent(intent); + return coreIntent ? coreIntent->messagePorts() : 0; +#else + return 0; +#endif +} + void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length) { WebCore::Page* page = EWKPrivate::corePage(ewkView); diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index 2379f2013..c8007a213 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -31,11 +31,15 @@ typedef struct _Evas_Object Evas_Object; typedef struct _Ewk_History_Item Ewk_History_Item; +typedef struct _Ewk_Intent Ewk_Intent; +typedef struct _Ewk_Intent_Request Ewk_Intent_Request; typedef Vector<Ewk_History_Item*> HistoryItemChildrenVector; namespace WebCore { class Frame; +class MessagePortChannel; +typedef Vector<OwnPtr<MessagePortChannel>, 1> MessagePortChannelArray; } class EAPI DumpRenderTreeSupportEfl { @@ -77,7 +81,6 @@ public: static bool findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions); static bool isCommandEnabled(const Evas_Object* ewkView, const char* name); static void setCSSGridLayoutEnabled(const Evas_Object* ewkView, bool enabled); - static void setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled); static void setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled); static void setSelectTrailingWhitespaceEnabled(Evas_Object* ewkView, bool enabled); @@ -105,6 +108,10 @@ public: static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); static void setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool); static void setSerializeHTTPLoads(bool); + + // Web Intents + static void sendWebIntentResponse(Ewk_Intent_Request*, JSStringRef response); + static WebCore::MessagePortChannelArray* intentMessagePorts(const Ewk_Intent*); // TextInputController static void setComposition(Evas_Object*, const char*, int, int); diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h index 583fc6ec6..d1feeb477 100644 --- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h @@ -150,7 +150,7 @@ public: virtual void getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual TextCheckerClient* textChecker() { return this; } private: diff --git a/Source/WebKit/efl/ewk/ewk_intent.cpp b/Source/WebKit/efl/ewk/ewk_intent.cpp index 9302263d2..e1da07f80 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent.cpp @@ -159,7 +159,7 @@ Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent) * Creates a new Ewk_Intent object. * * @param core WebCore::Intent instance to use internally. - * @return a new allocated the Ewk_Intent object on sucess or @c 0 on failure + * @return a new allocated the Ewk_Intent object on success or @c 0 on failure */ Ewk_Intent* ewk_intent_new(WebCore::Intent* core) { @@ -188,4 +188,14 @@ void ewk_intent_free(Ewk_Intent* intent) eina_stringshare_del(intent->service); delete intent; } + +namespace EWKPrivate { + +WebCore::Intent* coreIntent(const Ewk_Intent* intent) +{ + EWK_INTENT_CORE_GET_OR_RETURN(intent, core, 0); + return core; +} + +} // namespace EWKPrivate #endif diff --git a/Source/WebKit/efl/ewk/ewk_intent_private.h b/Source/WebKit/efl/ewk/ewk_intent_private.h index 394622946..aaec903a8 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_private.h +++ b/Source/WebKit/efl/ewk/ewk_intent_private.h @@ -29,11 +29,20 @@ namespace WebCore { class Intent; class IntentRequest; +class SerializedScriptValue; } Ewk_Intent* ewk_intent_new(WebCore::Intent* core); void ewk_intent_free(Ewk_Intent* intent); Ewk_Intent_Request* ewk_intent_request_new(PassRefPtr<WebCore::IntentRequest> core); + +void ewk_intent_request_result_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> result); +void ewk_intent_request_failure_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> failure); + +namespace EWKPrivate { +WebCore::Intent* coreIntent(const Ewk_Intent* intent); +} // namespace EWKPrivate + #endif #endif // ewk_intent_private_h diff --git a/Source/WebKit/efl/ewk/ewk_intent_request.cpp b/Source/WebKit/efl/ewk/ewk_intent_request.cpp index e70f274a2..4c30782fb 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_request.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent_request.cpp @@ -80,27 +80,43 @@ Ewk_Intent* ewk_intent_request_intent_get(const Ewk_Intent_Request* request) #endif } -void ewk_intent_request_result_post(Ewk_Intent_Request* request, const char* result) -{ #if ENABLE(WEB_INTENTS) +/** + * @internal + * + * Report request success. + * + * The serialized payload data will be passed to the success callback registered by the + * client. + * + * @param request request item. + * @param result serialized payload data. + */ +void ewk_intent_request_result_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> result) +{ EWK_INTENT_REQUEST_CORE_GET_OR_RETURN(request, core); - RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::create(String::fromUTF8(result)); - core->postResult(value.release().leakRef()); -#endif + core->postResult(result.get()); } -void ewk_intent_request_failure_post(Ewk_Intent_Request* request, const char* failure) +/** + * @internal + * + * Report request failure. + * + * The serialized payload data will be passed to the error callback registered by the + * client. + * + * @param request request item. + * @param failure serialized payload data. + */ +void ewk_intent_request_failure_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> failure) { -#if ENABLE(WEB_INTENTS) EWK_INTENT_REQUEST_CORE_GET_OR_RETURN(request, core); - RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::create(String::fromUTF8(failure)); - core->postFailure(value.release().leakRef()); -#endif + core->postFailure(failure.get()); } -#if ENABLE(WEB_INTENTS) /** * @internal * diff --git a/Source/WebKit/efl/ewk/ewk_intent_request.h b/Source/WebKit/efl/ewk/ewk_intent_request.h index 7554644c0..22c71d6b0 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_request.h +++ b/Source/WebKit/efl/ewk/ewk_intent_request.h @@ -56,26 +56,6 @@ EAPI void ewk_intent_request_unref(Ewk_Intent_Request *request); */ EAPI Ewk_Intent *ewk_intent_request_intent_get(const Ewk_Intent_Request *request); -/** - * Report request success. - * - * The payload data will be passed to the success callback registered by the client. - * - * @param request request item. - * @param result payload data. - */ -EAPI void ewk_intent_request_result_post(Ewk_Intent_Request *request, const char *result); - -/** - * Report request failure. - * - * The payload data will be passed to the error callback registered by the client. - * - * @param request request item. - * @param failure payload data. - */ -EAPI void ewk_intent_request_failure_post(Ewk_Intent_Request *request, const char *failure); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.cpp b/Source/WebKit/efl/ewk/ewk_security_origin.cpp index e5b6a3393..66064a029 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.cpp +++ b/Source/WebKit/efl/ewk/ewk_security_origin.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "ewk_security_origin.h" +#include "ApplicationCache.h" #include "ApplicationCacheStorage.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" @@ -89,6 +90,11 @@ void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin* WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin->securityOrigin.get(), quota); } +void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin* origin) +{ + WebCore::ApplicationCache::deleteCacheForOrigin(origin->securityOrigin.get()); +} + Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* origin) { Eina_List* databases = 0; @@ -117,6 +123,11 @@ void ewk_security_origin_free(Ewk_Security_Origin* origin) delete origin; } +Ewk_Security_Origin* ewk_security_origin_new_from_string(const char* url) +{ + return ewk_security_origin_new(WebCore::SecurityOrigin::createFromString(String::fromUTF8(url)).get()); +} + /** * @internal * Creates a EWK wrapper for WebCore Security Origin object. diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.h b/Source/WebKit/efl/ewk/ewk_security_origin.h index 04148b486..98abf769a 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.h +++ b/Source/WebKit/efl/ewk/ewk_security_origin.h @@ -51,7 +51,7 @@ typedef struct _Ewk_Security_Origin Ewk_Security_Origin; * * @return the protocol scheme */ -EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); /** * Returns the host of the security origin. @@ -63,7 +63,7 @@ EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); * * @return the host domain */ -EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); /** * Returns the port of the security origin. @@ -72,7 +72,7 @@ EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); * * @return the port */ -EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); +EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); /** * Retrieves the usage of a database for a security origin. @@ -84,7 +84,7 @@ EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); * * @return the usage in bytes */ -EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin *o); +EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin *o); /** * Retrieves the quota of a database for a security origin. @@ -96,7 +96,7 @@ EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_ * * @return the quota in bytes */ -EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o); +EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o); /** * Sets the database usage quota for a security origin. @@ -107,7 +107,7 @@ EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_ * @param o security origin object * @param quota the usage quota in bytes */ -EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin *o, uint64_t quota); +EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin *o, uint64_t quota); /** * Sets the application cache usage quota for a security origin. @@ -115,7 +115,14 @@ EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_ * @param o security origin object * @param quota the usage quota in bytes */ -EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin *o, int64_t quota); +EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin *o, int64_t quota); + +/** + * Clears the application cache for a security origin. + * + * @param o security origin object. + */ +EAPI void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin *o); /** * Return the list of web databases in the security origin. @@ -133,14 +140,24 @@ EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Secu * @see ewk_web_database_free() * @see ewk_web_database_list_free() */ -EAPI Eina_List *ewk_security_origin_web_database_get_all(const Ewk_Security_Origin *o); +EAPI Eina_List *ewk_security_origin_web_database_get_all(const Ewk_Security_Origin *o); /** * Release all resources allocated by a security origin object. * * @param o security origin object */ -EAPI void ewk_security_origin_free(Ewk_Security_Origin *o); +EAPI void ewk_security_origin_free(Ewk_Security_Origin *o); + +/** + * Creates a security origin for a url. + * + * @param url the url for the security origin. + * + * @return the security origin object + */ +EAPI Ewk_Security_Origin *ewk_security_origin_new_from_string(const char *url); + #ifdef __cplusplus } diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index 4331bd8c7..cc6503812 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -177,7 +177,7 @@ struct _Ewk_View_Smart_Class { Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, char **value); Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd); - uint64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); + int64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size); Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 71935613b..9ed422cae 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,96 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/TextCheckerClientGtk.h: + (WebKit::TextCheckerClientGtk::requestCheckingOfString): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119113. + http://trac.webkit.org/changeset/119113 + https://bugs.webkit.org/show_bug.cgi?id=88016 + + This caused multiple regressions (Requested by mrobinson on + #webkit). + + * WebCoreSupport/TextCheckerClientGtk.cpp: + (WebKit::TextCheckerClientGtk::checkSpellingOfString): + * webkit/webkitspellcheckerenchant.cpp: + (checkSpellingOfString): + +2012-05-31 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] Memory leak in webkit_web_view_init + https://bugs.webkit.org/show_bug.cgi?id=87943 + + Reviewed by Martin Robinson. + + Fixed a memory leak in webkit_web_view_init by making the + UserMediaClientGtk to be owned by the WebView. + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + * webkit/webkitwebviewprivate.h: + +2012-05-31 Martin Robinson <mrobinson@igalia.com> + + Spell checker doesn't recognize contractions (apostrophes) + https://bugs.webkit.org/show_bug.cgi?id=86118 + + Reviewed by Gustavo Noronha Silva. + + The Enchant spell checker was breaking words on apostrophes, because + apparently they were always being detected as Pango word-end + characters. To know whether or not the apostrophe is a + word end character requires looking at a string with a larger + granularity than one character. + + Simplify the way the we break strings, by search for non-graphable + character manually to find word starts and ends. This has the side + effect of removing the dependency on Pango and eliminating one copy. + + This change also cleans up some misbehavior on the part of the + WebCoreSupport layer which was not converting from Unicode character + offsets to UTF-16. These offsets can be different if any of the + characters in the UTF-16 string are surrogate pairs (non BMP + characters). + + * WebCoreSupport/TextCheckerClientGtk.cpp: + (WebKit::TextCheckerClientGtk::checkSpellingOfString): Properly + convert from Unicode offsets to UTF-16 offsets. + * webkit/webkitspellcheckerenchant.cpp: + (findByteOffsetToFirstNonGraphableCharacter): Added this helper. + (getExtentsOfNextWord): Ditto. + (wordIsSpelledCorrectlyInAtLeastOneDictionary): Ditto. + (checkSpellingOfString): Don't split words on apostrophes. + +2012-05-30 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Memory leak in webkitWebViewBaseStartDrag + https://bugs.webkit.org/show_bug.cgi?id=87756 + + Reviewed by Carlos Garcia Campos. + + Fixed a memory leak in drag and drop by using adoptRef instead + of just getting a new reference of targetList. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * webkit/webkitwebinspector.cpp: + (webkit_web_inspector_set_property): + 2012-05-25 Lu Guanqun <guanqun.lu@intel.com> [GTK] fix compilation for webkitwebview.cpp diff --git a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index bc8747d6b..92800d9fa 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -79,7 +79,7 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject(); - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); + GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); diff --git a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h index 26d13d5bb..b4861df36 100644 --- a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h @@ -49,7 +49,7 @@ class TextCheckerClientGtk : public WebCore::TextCheckerClient { virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } void updateSpellCheckingLanguage(const char*); private: diff --git a/Source/WebKit/gtk/webkit/webkitwebinspector.cpp b/Source/WebKit/gtk/webkit/webkitwebinspector.cpp index 692079f68..164e46367 100644 --- a/Source/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -353,11 +353,7 @@ static void webkit_web_inspector_set_property(GObject* object, guint prop_id, co case PROP_JAVASCRIPT_PROFILING_ENABLED: { #if ENABLE(JAVASCRIPT_DEBUGGER) bool enabled = g_value_get_boolean(value); - WebCore::InspectorController* controller = priv->page->inspectorController(); - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); + priv->page->inspectorController()->setProfilerEnabled(enabled); #else g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n"); #endif diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 1a54ea877..4b5244211 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -119,10 +119,6 @@ #include "DeviceOrientationClientGtk.h" #endif -#if ENABLE(MEDIA_STREAM) -#include "UserMediaClientGtk.h" -#endif - /** * SECTION:webkitwebview * @short_description: The central class of the WebKitGTK+ API @@ -3555,7 +3551,8 @@ static void webkit_web_view_init(WebKitWebView* webView) #endif #if ENABLE(MEDIA_STREAM) - WebCore::provideUserMediaTo(priv->corePage, new UserMediaClientGtk); + priv->userMediaClient = adoptPtr(new UserMediaClientGtk); + WebCore::provideUserMediaTo(priv->corePage, priv->userMediaClient.get()); #endif if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) { diff --git a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h index 0bc5a56fa..4c65d0f55 100644 --- a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h +++ b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h @@ -34,6 +34,10 @@ #include <webkit/webkitwebview.h> #include <wtf/gobject/GOwnPtr.h> +#if ENABLE(MEDIA_STREAM) +#include "UserMediaClientGtk.h" +#endif + namespace WebKit { WebCore::Page* core(WebKitWebView*); WebKitWebView* kit(WebCore::Page*); @@ -104,6 +108,10 @@ struct _WebKitWebViewPrivate { #if ENABLE(ICONDATABASE) gulong iconLoadedHandler; #endif + +#if ENABLE(MEDIA_STREAM) + OwnPtr<WebKit::UserMediaClientGtk> userMediaClient; +#endif }; void webkit_web_view_notify_ready(WebKitWebView*); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 81d5761ec..4782c02f9 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,57 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (-[WebEditorSpellCheckResponder initWithClient:sequence:results:]): + (-[WebEditorSpellCheckResponder perform]): + (WebEditorClient::didCheckSucceeded): + (WebEditorClient::requestCheckingOfString): + +2012-05-31 Andy Estes <aestes@apple.com> + + Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC) + https://bugs.webkit.org/show_bug.cgi?id=87933 + + Reviewed by Dan Bernstein. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-29 Nikolas Zimmermann <nzimmermann@rim.com> + + SVGViewSpec DOM bindings aka SVGSVGElement.currentView is unimplemented + https://bugs.webkit.org/show_bug.cgi?id=15495 + + Reviewed by Rob Buis. + + * MigrateHeaders.make: Copy DOMSVGViewSpec*.h headers. + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * WebInspector/WebInspector.mm: + (-[WebInspector setJavaScriptProfilingEnabled:]): + 2012-05-24 Tim Horton <timothy_horton@apple.com> Add feature defines for web-facing parts of CSS Regions and Exclusions diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index d4032fdba..b7255f055 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; +ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); @@ -126,4 +127,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/MigrateHeaders.make b/Source/WebKit/mac/MigrateHeaders.make index fd6a1f523..163d3fa07 100644 --- a/Source/WebKit/mac/MigrateHeaders.make +++ b/Source/WebKit/mac/MigrateHeaders.make @@ -463,6 +463,8 @@ all : \ $(INTERNAL_HEADERS_DIR)/DOMSVGUseElementInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGViewElement.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGViewElementInternal.h \ + $(PRIVATE_HEADERS_DIR)/DOMSVGViewSpec.h \ + $(INTERNAL_HEADERS_DIR)/DOMSVGViewSpecInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGZoomAndPan.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGZoomEvent.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGZoomEventInternal.h \ diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h index 00b912566..1b3f3a5ab 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -76,10 +76,11 @@ public: virtual NSURL* canonicalizeURL(NSURL*) OVERRIDE; virtual NSURL* canonicalizeURLString(NSString*) OVERRIDE; -#ifndef BUILDING_ON_LEOPARD virtual void uppercaseWord() OVERRIDE; virtual void lowercaseWord() OVERRIDE; virtual void capitalizeWord() OVERRIDE; + +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool show) OVERRIDE; virtual bool substitutionsPanelIsShowing() OVERRIDE; virtual void toggleSmartInsertDelete() OVERRIDE; @@ -136,7 +137,10 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE; virtual void willSetInputMethodState() OVERRIDE; virtual void setInputMethodState(bool enabled) OVERRIDE; - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE; + virtual void requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE; + + void didCheckSucceed(int sequence, NSArray* results); + private: void registerUndoOrRedoStep(PassRefPtr<WebCore::UndoStep>, bool isRedo); WebEditorClient(); @@ -144,4 +148,5 @@ private: WebView *m_webView; RetainPtr<WebEditorUndoTarget> m_undoTarget; bool m_haveUndoRedoOperations; + RefPtr<WebCore::TextCheckingRequest> m_textCheckingRequest; }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index bb4b4398a..5cc6ca4c3 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -376,8 +376,6 @@ void WebEditorClient::setInsertionPasteboard(const String& pasteboardName) [m_webView _setInsertionPasteboard:pasteboard]; } - -#ifndef BUILDING_ON_LEOPARD void WebEditorClient::uppercaseWord() { [m_webView uppercaseWord:nil]; @@ -393,6 +391,7 @@ void WebEditorClient::capitalizeWord() [m_webView capitalizeWord:nil]; } +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::showSubstitutionsPanel(bool show) { NSPanel *spellingPanel = [[NSSpellChecker sharedSpellChecker] substitutionsPanel]; @@ -461,7 +460,7 @@ void WebEditorClient::toggleAutomaticSpellingCorrection() { [m_webView toggleAutomaticSpellingCorrection:nil]; } -#endif +#endif // USE(AUTOMATIC_TEXT_REPLACEMENT) bool WebEditorClient::shouldInsertNode(Node *node, Range* replacingRange, EditorInsertAction givenAction) { @@ -927,47 +926,54 @@ void WebEditorClient::setInputMethodState(bool) #ifndef BUILDING_ON_LEOPARD @interface WebEditorSpellCheckResponder : NSObject { - WebCore::SpellChecker* _sender; + WebEditorClient* _client; int _sequence; - TextCheckingTypeMask _types; RetainPtr<NSArray> _results; } -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results; +- (id)initWithClient:(WebEditorClient*)client sequence:(int)sequence results:(NSArray*)results; - (void)perform; @end @implementation WebEditorSpellCheckResponder -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results +- (id)initWithClient:(WebEditorClient*)client sequence:(int)sequence results:(NSArray*)results { self = [super init]; if (!self) return nil; - _sender = sender; + _client = client; _sequence = sequence; - _types = types; _results = results; return self; } - (void)perform { - _sender->didCheckSucceeded(_sequence, core(_results.get(), _types)); + _client->didCheckSucceed(_sequence, _results.get()); } @end #endif -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, const WebCore::TextCheckingRequest& request) +void WebEditorClient::didCheckSucceed(int sequence, NSArray* results) +{ + ASSERT_UNUSED(sequence, sequence == m_textCheckingRequest->sequence()); + m_textCheckingRequest->didSucceed(core(results, m_textCheckingRequest->mask())); + m_textCheckingRequest.clear(); +} + +void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request) { #ifndef BUILDING_ON_LEOPARD - NSRange range = NSMakeRange(0, request.text().length()); + ASSERT(!m_textCheckingRequest); + m_textCheckingRequest = request; + + int sequence = m_textCheckingRequest->sequence(); + NSRange range = NSMakeRange(0, m_textCheckingRequest->text().length()); NSRunLoop* currentLoop = [NSRunLoop currentRunLoop]; - int sequence = request.sequence(); - TextCheckingTypeMask types = request.mask(); - [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:request.text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 + [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) { [currentLoop performSelector:@selector(perform) - target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence types:types results:results] autorelease] + target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease] argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; }]; #endif diff --git a/Source/WebKit/mac/WebInspector/WebInspector.mm b/Source/WebKit/mac/WebInspector/WebInspector.mm index 67a73542d..08f4bfad2 100644 --- a/Source/WebKit/mac/WebInspector/WebInspector.mm +++ b/Source/WebKit/mac/WebInspector/WebInspector.mm @@ -149,10 +149,7 @@ using namespace WebCore; if (!page) return; - if (enabled) - page->inspectorController()->enableProfiler(); - else - page->inspectorController()->disableProfiler(); + page->inspectorController()->setProfilerEnabled(enabled); } - (BOOL)isTimelineProfilingEnabled diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index 3f6fe1471..d194f9fc3 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -313,7 +313,7 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) if (d->page && (event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchUpdate -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) || event->type() == QEvent::TouchCancel #endif )) { diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h index 15fe087d6..c7ca44aad 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/Api/qgraphicswebview.h @@ -23,7 +23,7 @@ #include "qwebkitglobal.h" #include "qwebpage.h" #include <QtCore/qurl.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qgraphicswidget.h> #else #include <QtGui/qgraphicswidget.h> diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index f09a8a80d..aba58db0c 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -116,7 +116,7 @@ #include <qregion.h> #include <qnetworkrequest.h> -#if ENABLE(ORIENTATION_EVENTS) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if ENABLE(ORIENTATION_EVENTS) && !HAVE(QT5) QTM_USE_NAMESPACE #endif diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h index 4ab7b9700..82fd92033 100644 --- a/Source/WebKit/qt/Api/qwebframe_p.h +++ b/Source/WebKit/qt/Api/qwebframe_p.h @@ -30,9 +30,9 @@ #include "PlatformString.h" #if ENABLE(ORIENTATION_EVENTS) #include "qorientationsensor.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !(defined(HAVE_QT5) && HAVE_QT5) using QTM_NAMESPACE::QOrientationSensor; -#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0). +#endif #endif // ENABLE(ORIENTATION_EVENTS). #include "qwebelement.h" #include "wtf/RefPtr.h" diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index d9b00773b..8fb319dd4 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -3151,7 +3151,7 @@ bool QWebPage::event(QEvent *ev) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) case QEvent::TouchCancel: #endif // Return whether the default action was cancelled in the JS event handler diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h index 0bf35e247..fce68a8c4 100644 --- a/Source/WebKit/qt/Api/qwebpage.h +++ b/Source/WebKit/qt/Api/qwebpage.h @@ -26,7 +26,7 @@ #include <QtCore/qobject.h> #include <QtCore/qurl.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qwidget.h> #else #include <QtGui/qwidget.h> diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 4e01836f7..5425a9270 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -46,7 +46,7 @@ #include "FileSystem.h" #include <QApplication> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QStandardPaths> #else #include <QDesktopServices> @@ -1151,7 +1151,7 @@ void QWebSettings::enablePersistentStorage(const QString& path) if (path.isEmpty()) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) storagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); @@ -1174,7 +1174,7 @@ void QWebSettings::enablePersistentStorage(const QString& path) #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE) // All applications can share the common QtWebkit cache file(s). // Path is not configurable and uses QDesktopServices::CacheLocation by default. -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); #else QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/Api/qwebview.cpp index 937d3bdca..76bf39277 100644 --- a/Source/WebKit/qt/Api/qwebview.cpp +++ b/Source/WebKit/qt/Api/qwebview.cpp @@ -704,7 +704,7 @@ bool QWebView::event(QEvent *e) } else if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchUpdate -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) || e->type() == QEvent::TouchCancel #endif ) { diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/Api/qwebview.h index 90d0a8e3b..c31aa355b 100644 --- a/Source/WebKit/qt/Api/qwebview.h +++ b/Source/WebKit/qt/Api/qwebview.h @@ -23,7 +23,7 @@ #include "qwebkitglobal.h" #include "qwebpage.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qwidget.h> #else #include <QtGui/qwidget.h> diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index bf8496bbb..3980c1975 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,70 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/TextCheckerClientQt.h: + (WebCore::TextCheckerClientQt::requestCheckingOfString): + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * Api/qgraphicswebview.cpp: + * Api/qgraphicswebview.h: + * Api/qwebframe.cpp: + * Api/qwebframe_p.h: + * Api/qwebpage.cpp: + * Api/qwebpage.h: + * Api/qwebsettings.cpp: + * Api/qwebview.cpp: + * Api/qwebview.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + * WebCoreSupport/GeolocationClientQt.cpp: + * WebCoreSupport/GeolocationClientQt.h: + * WebCoreSupport/PageClientQt.cpp: + * WebCoreSupport/WebEventConversion.cpp: + * declarative/plugin.cpp: + * tests/qwebframe/tst_qwebframe.cpp: + * tests/util.h: + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Sync up favicon-implementation with WebView url changes in r118158 + + https://bugs.webkit.org/show_bug.cgi?id=87133 + + We now base64-encode the page url in the image-provider url, so that any + normalization done by QUrl will not mess up the page-url. The logic of + creating and parsing the provider-url has been moved into the image + provider, to keep it in one place. + + We were also releasing icons (even ones we hadn't retained), which we can't + do since we don't know when the icon url is no longer in use. + + Reviewed-by Simon Hausmann. + + * declarative/plugin.cpp: + * declarative/public.pri: + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from DRT after its + move to windows.internals.settings. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + 2012-05-27 Simon Hausmann <simon.hausmann@nokia.com> [Qt] Trivial unreviewed build fix with newer Qt diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index ff7d00627..e70bf004a 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -301,20 +301,6 @@ void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isA inputElement->setAutofilled(isAutofilled); } -void DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) - Frame* coreFrame = QWebFramePrivate::core(frame); - InspectorController* controller = coreFrame->page()->inspectorController(); - if (!controller) - return; - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); -#endif -} - void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const QString& value) { WebCore::Element* webElement = element.m_element; @@ -1274,11 +1260,6 @@ void QWEBKIT_EXPORT qt_drt_run(bool b) DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b); } -void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) -{ - DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(frame, enabled); -} - void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 2c96fb3a2..41800fabd 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -125,7 +125,6 @@ public: static void garbageCollectorCollect(); static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); static void setAutofilled(const QWebElement&, bool enabled); - static void setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); static void setValueForUser(const QWebElement&, const QString& value); static int javaScriptObjectsCount(); static void clearScriptWorlds(); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index e816b9f21..097d7d889 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1603,7 +1603,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Vector<String> params = paramNames; Vector<String> values = paramValues; if (mimeType == "application/x-shockwave-flash") { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) const bool shouldInjectWmode = true; #else // Inject wmode=opaque when there is no client or the client is not a QWebView. diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp index 8551cf906..ec4d1bb9e 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp @@ -37,9 +37,9 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) #include <QGeoPositionInfoSource> -#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#elif HAVE(QT5) #include <QtLocation/QGeoPositionInfoSource> #endif diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h index 9d07a9155..94b0f6531 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h @@ -31,13 +31,13 @@ #include <QObject> #include <wtf/RefPtr.h> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) #include <QGeoPositionInfo> namespace QtMobility { class QGeoPositionInfoSource; }; using namespace QtMobility; -#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#elif HAVE(QT5) #include <QtLocation/QGeoPositionInfo> class QGeoPositionInfoSource; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp index ed61d1f96..93be5a5e2 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -30,7 +30,7 @@ #if ENABLE(WEBGL) #include <QGLWidget> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QWindow> #endif @@ -50,7 +50,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG if (glWidget->isValid()) { // Geometry can be set to zero because m_glWidget is used only for its QGLContext. glWidget->setGeometry(0, 0, 0, 0); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) *surface = glWidget->windowHandle(); *context = glWidget->context()->contextHandle(); #else @@ -69,7 +69,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG #include "texmap/TextureMapperLayer.h" #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QWindow* QWebPageClient::ownerWindow() const { QWidget* widget = ownerWidget(); diff --git a/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h b/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h index 22d728eb0..bf9ded465 100644 --- a/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h @@ -48,7 +48,7 @@ public: virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual bool isContinousSpellCheckingEnabled(); virtual void toggleContinousSpellChecking(); diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp index d45f8ce31..0b732a4ce 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp +++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp @@ -243,7 +243,7 @@ WebKitPlatformTouchEvent::WebKitPlatformTouchEvent(QTouchEvent* event) case QEvent::TouchEnd: m_type = PlatformEvent::TouchEnd; break; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) case QEvent::TouchCancel: m_type = PlatformEvent::TouchCancel; break; diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index f8c532a06..988b36e0e 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -17,13 +17,15 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" + #include "qglobal.h" #if defined(HAVE_QQUICK1) #include "qdeclarativewebview_p.h" #endif -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#if (HAVE(QT5)) #include <QtQml/qqml.h> #include <QtQml/qqmlextensionplugin.h> #else diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 04b17b724..576ce03ca 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -34,6 +34,8 @@ contains(DEFINES, HAVE_QQUICK1=1) { HEADERS += qdeclarativewebview_p.h } +WEBKIT += wtf + DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} CONFIG += rpath diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 2c28aef1f..3d8a2b3ce 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -2033,7 +2033,7 @@ void tst_QWebFrame::enumerate_data() << "dp1" << "dp2" << "dp3" // inherited signals and slots << "destroyed(QObject*)" << "destroyed()" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 << "objectNameChanged(QString)" #endif << "deleteLater()" diff --git a/Source/WebKit/qt/tests/util.h b/Source/WebKit/qt/tests/util.h index 22192bad2..2fb59e067 100644 --- a/Source/WebKit/qt/tests/util.h +++ b/Source/WebKit/qt/tests/util.h @@ -49,7 +49,7 @@ static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) return timeoutSpy.isEmpty(); } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !(defined(HAVE_QT5) && HAVE_QT5) // Will try to wait for the condition while allowing event processing #define QTRY_VERIFY(__expr) \ do { \ diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 8e6d35209..17b8a8747 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,23 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/WebEditorClient.h: + (WebEditorClient::requestCheckingOfString): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * WebInspector.cpp: + (WebInspector::setJavaScriptProfilingEnabled): + 2012-05-25 Lynn Neir <lynn.neir@skype.net> Added methods needed to implement backend for DRT's TextInputController on windows, https://bugs.webkit.org/show_bug.cgi?id=32021 diff --git a/Source/WebKit/win/WebCoreSupport/WebEditorClient.h b/Source/WebKit/win/WebCoreSupport/WebEditorClient.h index 1a1e7c393..16deaa3ad 100644 --- a/Source/WebKit/win/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebEditorClient.h @@ -112,7 +112,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual WebCore::TextCheckerClient* textChecker() { return this; } diff --git a/Source/WebKit/win/WebInspector.cpp b/Source/WebKit/win/WebInspector.cpp index 39c75277d..8bfa7e53a 100644 --- a/Source/WebKit/win/WebInspector.cpp +++ b/Source/WebKit/win/WebInspector.cpp @@ -232,10 +232,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::setJavaScriptProfilingEnabled(BOOL enabl if (!page) return S_OK; - if (enabled) - page->inspectorController()->enableProfiler(); - else - page->inspectorController()->disableProfiler(); + page->inspectorController()->setProfilerEnabled(enabled); return S_OK; } diff --git a/Source/WebKit/wince/ChangeLog b/Source/WebKit/wince/ChangeLog index 624eeb70a..2fc0e425c 100644 --- a/Source/WebKit/wince/ChangeLog +++ b/Source/WebKit/wince/ChangeLog @@ -1,3 +1,26 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientWinCE.h: + (WebKit::EditorClientWinCE::requestCheckingOfString): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix after r115926. + + * WebView.cpp: + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix after r117470. + + * WebCoreSupport/EditorClientWinCE.h: + (EditorClientWinCE): + 2012-05-18 MORITA Hajime <morrita@google.com> Another unreviewed attempt to fix build breakage on r117572. diff --git a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h index 165a9d798..394802a19 100644 --- a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h +++ b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h @@ -90,7 +90,7 @@ public: virtual void textWillBeDeletedInTextField(WebCore::Element*); virtual void textDidChangeInTextArea(WebCore::Element*); - virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const; + virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const; virtual void ignoreWordInSpellDocument(const WTF::String&); virtual void learnWord(const WTF::String&); virtual void checkSpellingOfString(const UChar*, int, int*, int*); @@ -103,7 +103,7 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual WebCore::TextCheckerClient* textChecker() { return this; } private: diff --git a/Source/WebKit/wince/WebView.cpp b/Source/WebKit/wince/WebView.cpp index 032a32f22..fcc04d7db 100644 --- a/Source/WebKit/wince/WebView.cpp +++ b/Source/WebKit/wince/WebView.cpp @@ -36,6 +36,7 @@ #include "FrameLoaderClientWinCE.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLFormElement.h" #include "InitializeThreading.h" #include "InspectorClientWinCE.h" #include "IntSize.h" diff --git a/Source/WebKit/wx/ChangeLog b/Source/WebKit/wx/ChangeLog index c74ddf64e..077cdd463 100644 --- a/Source/WebKit/wx/ChangeLog +++ b/Source/WebKit/wx/ChangeLog @@ -1,3 +1,13 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebKitSupport/EditorClientWx.h: + (WebCore::EditorClientWx::requestCheckingOfString): + 2012-05-18 MORITA Hajime <morrita@google.com> Another unreviewed attempt to fix build breakage on r117572. diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h index 4ac6d73cf..12cd5f959 100644 --- a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -116,7 +116,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual TextCheckerClient* textChecker() { return this; } private: diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 9fe432aa7..3c1571067 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -41,6 +41,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBKIT2_DIR}/WebProcess/WebCoreSupport" "${WEBKIT2_DIR}/WebProcess/WebPage" "${WEBCORE_DIR}" + "${WEBCORE_DIR}/Modules/intents" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings/js" "${WEBCORE_DIR}/bindings" @@ -51,6 +52,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/editing" "${WEBCORE_DIR}/history" "${WEBCORE_DIR}/html" + "${WEBCORE_DIR}/html/track" "${WEBCORE_DIR}/inspector" "${WEBCORE_DIR}/loader" "${WEBCORE_DIR}/loader/icon" @@ -492,6 +494,16 @@ SET(WebKit2_MESSAGES_IN_FILES WebProcess/WebPage/WebPage.messages.in ) +SET(WebProcess_NAME bin/WebProcess) + +SET(WebProcess_LIBRARIES + ${JavaScriptCore_LIBRARY_NAME} + ${WebCore_LIBRARY_NAME} + ${WebKit2_LIBRARY_NAME} +) + +WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() + # Create JavaScript C++ code given an IDL input FOREACH (_file ${WebKit2_MESSAGES_IN_FILES}) GET_FILENAME_COMPONENT (_name ${_file} NAME_WE) @@ -510,19 +522,6 @@ SET(WebKit2_LIBRARIES ${WebCore_LIBRARY_NAME} ) -SET(WebProcess_NAME ../bin/WebProcess) -SET(WebProcess_SOURCES "") - -SET(WebProcess_LIBRARIES - ${JavaScriptCore_LIBRARY_NAME} - ${WebCore_LIBRARY_NAME} - ${WebKit2_LIBRARY_NAME} -) - -SET(ForwardingHeaders_NAME ) -SET(ForwardingNetworkHeaders_NAME ) -WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() - ADD_DEFINITIONS(-DBUILDING_WEBKIT) INCLUDE_DIRECTORIES(${WebKit2_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebKit2_LIBRARY_NAME} ${WebKit2_LIBRARY_TYPE} ${WebKit2_SOURCES}) @@ -537,6 +536,7 @@ SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES LINK_INTERFACE_LIBRARIE ADD_EXECUTABLE(${WebProcess_NAME} ${WebProcess_SOURCES}) TARGET_LINK_LIBRARIES(${WebProcess_NAME} ${WebProcess_LIBRARIES}) SET_TARGET_PROPERTIES(${WebProcess_NAME} PROPERTIES FOLDER "WebKit") +SET_TARGET_PROPERTIES(${WebProcess_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) IF (WebKit2_LINK_FLAGS) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 9c8efa89e..2dd830c1c 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,822 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::requestCheckingOfString): + * WebProcess/WebCoreSupport/WebEditorClient.h: + +2012-05-31 Andy Estes <aestes@apple.com> + + [WebKit2] Remove nested #if conditions from messages.in files + https://bugs.webkit.org/show_bug.cgi?id=88039 + + Reviewed by Filip Pizlo. + + The code generator that processes messages.in files can't handle nested + #if conditions. Sadly I added said conditions in r117700 but failed to + verify the generated result. Un-nest the conditions I added. + + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebPage/WebPage.messages.in: + +2012-05-31 Andy Estes <aestes@apple.com> + + Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC) + https://bugs.webkit.org/show_bug.cgi?id=87933 + + Reviewed by Dan Bernstein. + + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_download_get_request to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=87957 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitDownload.cpp: + (webkit_download_get_request): Return the WebKitURIRequest + representing the request that originated the download. + * UIProcess/API/gtk/WebKitDownload.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/TestDownloads.cpp: + (testDownloadLocalFile): + (testDownloadRemoteFile): + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [SOUP] WebProcess crashes when a download is started from an existing ResourceHandle + https://bugs.webkit.org/show_bug.cgi?id=87953 + + Reviewed by Martin Robinson. + + The output stream to write the downloaded data is created in the + didReceiveResponse callback of the download client. When a + download is created for an existing ResourceHandle (this happens + for example when policy decision is download), the response has + already been received. In this case we should make sure that the + download client is notified about the response, so that when data + actually arrives the output stream has already been created. + + * WebProcess/Downloads/soup/DownloadSoup.cpp: + (WebKit::Download::startWithHandle): + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix webkit_web_view_can_execute_editing_command() API doc + https://bugs.webkit.org/show_bug.cgi?id=87930 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp: + +2012-05-31 Zalan Bujtas <zbujtas@gmail.com> + + [Qt][WK2] Add missing ViewportUpdateDeferrer guarding to setPageItemRectVisible() calls. + https://bugs.webkit.org/show_bug.cgi?id=87936 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::viewportAttributesChanged): + (WebKit::QtViewportInteractionEngine::pageContentsSizeChanged): + +2012-05-31 Keunsoon Lee <keunsoon.lee@samsung.com> + + [EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl + https://bugs.webkit.org/show_bug.cgi?id=70231 + + Reviewed by Chang Shu. + + These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks. + The callback conveys WKURLResponseRef and WKURLRequestRef as parameter. + + By the way, EFL browser needs content type from response to decide correct policy. + Another information, cookie, is necessary with similar reason. + But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL(). + + So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef, + and not to desturb WebKit2 main stream. + + * Shared/API/c/efl/WKURLRequestEfl.cpp: Added. + (WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef. + * Shared/API/c/efl/WKURLRequestEfl.h: Added. + * Shared/API/c/efl/WKURLResponseEfl.cpp: Added. + (WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef. + * Shared/API/c/efl/WKURLResponseEfl.h: Added. + * Shared/efl/WebCoreArgumentCodersEfl.cpp: Added. + (CoreIPC): + (CoreIPC::::encode): + (CoreIPC::::decode): + * Shared/efl/WebURLRequestEfl.cpp: Added. + (WebKit): + (WebKit::WebURLRequestEfl::WebURLRequestEfl): + (WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest. + * Shared/efl/WebURLRequestEfl.h: Added. + (WebKit): + (WebURLRequestEfl): + (WebKit::WebURLRequestEfl::create): + * Shared/efl/WebURLResponseEfl.cpp: Added. + (WebKit): + (WebKit::WebURLResponseEfl::WebURLResponseEfl): + (WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse. + * Shared/efl/WebURLResponseEfl.h: Added. + (WebKit): + (WebURLResponseEfl): + (WebKit::WebURLResponseEfl::create): + +2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL][WK2] Rename ewk_private.h to ewk_view_private.h + https://bugs.webkit.org/show_bug.cgi?id=87923 + + Reviewed by Kenneth Rohde Christiansen. + + EFL WK1 decided to divide up ewk_private.h into each file's XXX_private.h file in order to maintain + internal functions more easily. EFL WK2 needs to adjust this as well. + + * UIProcess/API/efl/PageClientImpl.cpp: + * UIProcess/API/efl/ewk_view_private.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_private.h. + (WebCore): + * UIProcess/cairo/BackingStoreCairo.cpp: + +2012-05-31 Andy Estes <aestes@apple.com> + + Move the specification of framework and library linking out of WebKit2.xcodeproj and into WebKit2.xcconfig + https://bugs.webkit.org/show_bug.cgi?id=87932 + + Reviewed by Dan Bernstein. + + Doing this makes it easier to vary linking based on SDK or other factors. + + * Configurations/WebKit2.xcconfig: Create FRAMEWORK_AND_LIBRARY_LDFLAGS, + which specifies the same list of frameworks and libraries that were + previously in WebKit2's 'Link Binary With Libraries' build phase, and + append it to $(OTHER_LDFLAGS). + * WebKit2.xcodeproj/project.pbxproj: Remove all frameworks and + libraries from the 'Link Binary With Libraries' build phase. + +2012-05-30 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Memory leak in webkitWebViewBaseStartDrag + https://bugs.webkit.org/show_bug.cgi?id=87756 + + Reviewed by Carlos Garcia Campos. + + Fixed memory leaks in drag and drop by using adoptRef instead + of just getting new references. + + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (webkitWebViewBaseStartDrag): + +2012-05-30 Luiz Agostini <luiz.agostini@nokia.com> + + [Qt] handled touchmove events should not cancel tap gesture recognition + https://bugs.webkit.org/show_bug.cgi?id=87808 + + Reviewed by Kenneth Rohde Christiansen. + + Tap gesture recognition should not be canceled if a touchmove event is handled + by the web process. + + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::doneWithTouchEvent): + +2012-05-30 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK][WK2] Errors in documentation about webkit_web_view_run_javascript() + https://bugs.webkit.org/show_bug.cgi?id=87866 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: Fix errors. + +2012-05-30 Andy Estes <aestes@apple.com> + + WebProcessMainMac.mm doesn't need to import WKView.h. + + Rubber-stamped by Anders Carlsson. + + * WebProcess/mac/WebProcessMainMac.mm: + +2012-05-30 Marcelo Lira <marcelo.lira@openbossa.org> + + WebKit2: Implement layoutTestController.setPluginsEnabled() in WebKitTestRunner. + https://bugs.webkit.org/show_bug.cgi?id=58593 + + Adds the ability to change the pluginsEnabled flag in WebCore::Settings + to WebKitTestRunner's LayoutTestController. The flag is modified via the + public C API of the WebProcess. + + Reviewed by Darin Adler. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetPluginsEnabled): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setPluginsEnabled): Calls the setPluginsEnabled + method for the WebCore::Settings of each WebCore::Page in the current + page group. + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + +2012-05-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + HashTable.h has using directives for std::pair and std::make_pair + https://bugs.webkit.org/show_bug.cgi?id=29919 + + Reviewed by Darin Adler. + + Change code to use std::pair and std::make_pair. + + * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm: + (WebKit::DynamicLinkerEnvironmentExtractor::processEnvironmentVariable): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed: Fix wrongly typed Qt slot. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Move ViewportAttribute related methods to the interaction engine. + https://bugs.webkit.org/show_bug.cgi?id=87855 + + Reviewed by Simon Hausmann. + + Move the logic of didChange{ViewportProperties|ContentsSize} to the + interaction engine and update our testing object. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate): + (QQuickWebViewFlickablePrivate::didChangeViewportProperties): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/qwebkittest.cpp: + (QWebKitTest::contentsScale): + (QWebKitTest::devicePixelRatio): + (QWebKitTest::initialScale): + (QWebKitTest::minimumScale): + (QWebKitTest::maximumScale): + (QWebKitTest::isScalable): + (QWebKitTest::layoutSize): + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::viewportAttributesChanged): + (WebKit): + (WebKit::QtViewportInteractionEngine::pageContentsSizeChanged): + * UIProcess/qt/QtViewportInteractionEngine.h: + (QtViewportInteractionEngine): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Do renames in ViewportInteractionEngine as agreed upon + https://bugs.webkit.org/show_bug.cgi?id=87845 + + Reviewed by Simon Hausmann. + + Mostly moving methods around and renaming them to be more + consistent and avoid terminology clashes. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewFlickablePrivate::didChangeViewportProperties): + (QQuickWebViewFlickablePrivate::pageDidRequestScroll): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::boundPosition): + (WebKit): + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + (WebKit::QtViewportInteractionEngine::setPageItemRectVisible): + (WebKit::QtViewportInteractionEngine::animatePageItemRectVisible): + (WebKit::QtViewportInteractionEngine::flickMoveStarted): + (WebKit::QtViewportInteractionEngine::flickMoveEnded): + (WebKit::QtViewportInteractionEngine::pageItemPositionChanged): + (WebKit::QtViewportInteractionEngine::pageContentPositionRequest): + (WebKit::QtViewportInteractionEngine::scaleAnimationValueChanged): + (WebKit::QtViewportInteractionEngine::computePosRangeForPageItemAtScale): + (WebKit::QtViewportInteractionEngine::focusEditableArea): + (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded): + (WebKit::QtViewportInteractionEngine::nearestValidBounds): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::pinchGestureEnded): + (WebKit::QtViewportInteractionEngine::pageItemSizeChanged): + * UIProcess/qt/QtViewportInteractionEngine.h: + (WebKit::QtViewportInteractionEngine::setDevicePixelRatio): + (QtViewportInteractionEngine): + +2012-05-30 Mariusz Grzegorczyk <mariusz.g@samsung.com>, Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Fix WebKit2-EFL build + https://bugs.webkit.org/show_bug.cgi?id=83693 + + Reviewed by Carlos Garcia Campos. + + * CMakeLists.txt: Move IDL generator codes to generate port specific *.messages.in. + * PlatformEfl.cmake: Add soup related files after r115411 and includes to fix build break. + * UIProcess/API/efl/PageClientImpl.cpp: Fix build break with ENABLE_TOUCH_EVENTS. + (WebKit): + (WebKit::PageClientImpl::doneWithTouchEvent): + * UIProcess/API/efl/PageClientImpl.h: + (PageClientImpl): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: Fix build break with ENABLE_INPUT_TYPE_COLOR and ENABLE_REGISTER_PROTOCOL_HANDLER. + (WebKit): + (WebKit::WebChromeClient::createColorChooser): + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Fix build break with ENABLE_WEB_INTENTS + (WebKit): + (WebKit::WebFrameLoaderClient::dispatchIntent): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + (WebCore): + (WebFrameLoaderClient): + * WebProcess/WebProcess.cpp: Guard PLATFORM_STRATEGIES codes. + (WebKit::WebProcess::didGetPlugins): + * WebProcess/soup/WebSoupRequestManager.cpp: Try to share with EFL port. + (WebKit::WebSoupRequestManager::didHandleURIRequest): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Variable renaming as preparation of further refactoring. + + Rubberstamped by Simon Hausmann. + + Change m_viewport to m_viewportItem and m_content to m_pageItem. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + (WebKit::QtViewportInteractionEngine::setItemRectVisible): + (WebKit::QtViewportInteractionEngine::animateItemRectVisible): + (WebKit::QtViewportInteractionEngine::flickableMoveStarted): + (WebKit::QtViewportInteractionEngine::flickableMoveEnded): + (WebKit::QtViewportInteractionEngine::flickableMovingPositionUpdate): + (WebKit::QtViewportInteractionEngine::scaleAnimationStateChanged): + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + (WebKit::QtViewportInteractionEngine::computePosRangeForItemAtScale): + (WebKit::QtViewportInteractionEngine::focusEditableArea): + (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded): + (WebKit::QtViewportInteractionEngine::nearestValidBounds): + (WebKit::QtViewportInteractionEngine::reset): + (WebKit::QtViewportInteractionEngine::setCSSScale): + (WebKit::QtViewportInteractionEngine::currentCSSScale): + (WebKit::QtViewportInteractionEngine::scrollAnimationActive): + (WebKit::QtViewportInteractionEngine::panGestureActive): + (WebKit::QtViewportInteractionEngine::panGestureStarted): + (WebKit::QtViewportInteractionEngine::panGestureRequestUpdate): + (WebKit::QtViewportInteractionEngine::panGestureEnded): + (WebKit::QtViewportInteractionEngine::panGestureCancelled): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::pinchGestureStarted): + (WebKit::QtViewportInteractionEngine::pinchGestureRequestUpdate): + (WebKit::QtViewportInteractionEngine::scaleContent): + * UIProcess/qt/QtViewportInteractionEngine.h: + (QtViewportInteractionEngine): + +2012-05-30 Zalan Bujtas <zbujtas@gmail.com> + + [Qt][WK2] Do not use anonymous variables for ViewportUpdateDeferrer. + https://bugs.webkit.org/show_bug.cgi?id=87831 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::itemSizeChanged): + +2012-05-30 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix WebKit2GTK+ API tests in the bots. + + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewCanShowMIMEType): Remove the check for multimedia and + plugins MIME types since they depend on the configuration and they + are not available in the bots. + +2012-05-29 Jer Noble <jer.noble@apple.com> + + Noticeable delay taking an HTML5 trailer fullscreen. + https://bugs.webkit.org/show_bug.cgi?id=87794 + + Reviewed by Darin Adler. + + Work around a not-entirely understood delay when using the results of a CGWindowListCreateImage() + call as the contents of a placeholder view. The backing of the resulting CGImageRef resides on + the WindowServer, and drawing that image requires synchronous calls to the WindowServer process. + By copying the image data, up front, into our own process, we can avoid those synchronous calls + later and avoid the delay-causing drawing behavior. + + * UIProcess/mac/WKFullScreenWindowController.mm: + (CGImageDeepCopy): Added a helper function which copies the image data into a new CGImage. + (-[WKFullScreenWindowController enterFullScreen:]): Use the above. + +2012-05-29 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Reproducible crash in performDragControllerAction + https://bugs.webkit.org/show_bug.cgi?id=87744 + + Reviewed by Martin Robinson. + + Fix a crash by using deref() instead of delete to dereference and + release the platformData of DragData. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::performDragControllerAction): + +2012-05-29 Simon Pena <spena@igalia.com> + + [GTK] Missing field initializers for WKPageLoaderClient and WKPageUIClient + https://bugs.webkit.org/show_bug.cgi?id=87745 + + Reviewed by Carlos Garcia Campos. + + Add missing initializers for WKPageLoaderClient and + WKPageUIClient, for callbacks WKPagePluginDidFailCallback and + WKPageUnavailablePluginButtonClickedCallback, introduced in + revision r116716. + + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (attachLoaderClientToView): Initialize WKPagePluginDidFailCallback + * UIProcess/API/gtk/WebKitUIClient.cpp: + (attachUIClientToView): Initialize callback + WKPageUnavailablePluginButtonClickedCallback + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Policy decision headers are not included in the main webkit2.h header + https://bugs.webkit.org/show_bug.cgi?id=87753 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/webkit2.h: Include + WebKitNavigationPolicyDecision.h and WebKitResponsePolicyDecision.h. + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_web_view_can_show_mime_type() to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=85998 + + Reviewed by Martin Robinson. + + And use it in the default handler of WebKitWebView::decide-policy + signal to decide whether to use or ignore a response policy + decision depending on whether the mime type of the response can be + displayed in the WebView or not. + + * UIProcess/API/gtk/WebKitURIResponse.cpp: + (webkitURIResponseGetProperty): Add getter for mime-type property. + (webkit_uri_response_class_init): Add mime-type property. + (webkit_uri_response_get_mime_type): Return the mime type of the + response. + * UIProcess/API/gtk/WebKitURIResponse.h: + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewDecidePolicy): In case of response policy decisions, + use the URI response to decide what to do: download if the + response is an attachment, use if the mime type is supported by + the web view or ignore otherwise. + (webkit_web_view_can_show_mime_type): Returns whether the given + mime type can be displayed in the WebView or not. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/TestResources.cpp: + (testWebResourceResponse): + (testWebResourceMimeType): + (serverCallback): + (beforeAll): + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewCanShowMIMEType): + (beforeAll): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Move tests from DesktopBehavior which can be made to work + https://bugs.webkit.org/show_bug.cgi?id=87736 + + Rubberstamped by Simon Hausmann. + + Move and modify the following tests to WebView/ and make them + use touch events. + + * UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml. + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Sync up favicon-implementation with WebView url changes in r118158 + + https://bugs.webkit.org/show_bug.cgi?id=87133 + + We now base64-encode the page url in the image-provider url, so that any + normalization done by QUrl will not mess up the page-url. The logic of + creating and parsing the provider-url has been moved into the image + provider, to keep it in one place. + + We were also releasing icons (even ones we hadn't retained), which we can't + do since we don't know when the icon url is no longer in use. + + Reviewed-by Simon Hausmann. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): + (QQuickWebViewPrivate::loadProgressDidChange): + (QQuickWebViewPrivate::_q_onUrlChanged): + (QQuickWebViewPrivate::_q_onIconChangedForPageURL): + (QQuickWebViewPrivate::updateIcon): + (QQuickWebView::icon): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/qwebiconimageprovider.cpp: + (QWebIconImageProvider::iconURLForPageURLInContext): + (QWebIconImageProvider::requestImage): + * UIProcess/API/qt/qwebiconimageprovider_p.h: + (WebKit): + * UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml: + * UIProcess/qt/QtWebIconDatabaseClient.cpp: + (WebKit::QtWebIconDatabaseClient::didChangeIconForPageURL): + (WebKit::QtWebIconDatabaseClient::iconForPageURL): + (WebKit): + (WebKit::QtWebIconDatabaseClient::iconImageForPageURL): + * UIProcess/qt/QtWebIconDatabaseClient.h: + (QtWebIconDatabaseClient): + +2012-05-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt][WK2] Fix failing qmltests::FitToView::test_basic() + https://bugs.webkit.org/show_bug.cgi?id=87236 + + Reviewed by Simon Hausmann. + + The fix is a combination of things. First of all some events + were emitted at the wrong times or when nothing had changed. + + We also initialized the view saying it was suspended which is + not correct. + + Another bug was that the touch tap, didn't result in marking + the view as having user interaction. This was recently fixed + in r118493. + + * UIProcess/API/qt/qquickwebpage.cpp: + (QQuickWebPage::setContentsScale): + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate): + + Make sure pageIsSuspended is initialized to false. + + (QQuickWebViewFlickablePrivate::_q_onInformVisibleContentChange): + + Early bail out if there is no change. + + Inform contentScaleCommitted if the scale changed since last time. + + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + + Make sure to commit the right signals, ie. *Changed and not *Committed. + + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qwebkittest.cpp: + (touchPoint): + (QWebKitTest::sendTouchEvent): + (QWebKitTest::touchTap): + (QWebKitTest::touchDoubleTap): + + Add proper touch emulation for the testing system. Call directly + to our WebKit API (avoid Qt event loop) to ensure all events gets + delivered. + + * UIProcess/API/qt/qwebkittest_p.h: + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::setItemRectVisible): + + Assert that a ViewportUpdateDeferrer is always used when calling + this method. + + (WebKit::QtViewportInteractionEngine::animateItemRectVisible): + + Remove work around now we have the proper fix in place. + + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + + Do not send the informVisibleContentChange manually, use the + ViewportUpdateDeferrer instead. + + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + + Add missing ViewportUpdateDeferrer. + + (WebKit::QtViewportInteractionEngine::pinchGestureStarted): + + No reason to emit informVisibleContentChange before pinch + start, as it is always done on end (due to the ViewportUpdateDeferrer). + + (WebKit::QtViewportInteractionEngine::itemSizeChanged): + + Add missing ViewportUpdateDeferrer. + +2012-05-29 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] [WK2] Allow user to inject JS scripts when the page loads + https://bugs.webkit.org/show_bug.cgi?id=85827 + + Reviewed by Simon Hausmann. + + Create a new experimental property to list URLs of JS scripts that should be + loaded when a page is loaded. These scripts will run in the normal JS environment + of the page. + + The supported URL schemes are file:/// and qrc:///. The scripts are read from the + UI process and transfered to the Web process. + + Together with the experimental messaging API this provides a way for the + application to manipulate the DOM (by injecting a script that does the + manipulation and communicating with it via postMessage). This covers some of the + use cases of QWebElement in our WK1 API. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + (readUserScript): + (QQuickWebViewPrivate::updateUserScripts): + (QQuickWebViewExperimental::userScripts): + (QQuickWebViewExperimental::setUserScripts): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/append-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/common/big-user-script.js: Added. + * UIProcess/API/qt/tests/qmltests/common/change-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/resources.qrc: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::setUserScripts): + (WebKit): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::setUserScripts): + (WebKit): + +2012-05-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118752. + http://trac.webkit.org/changeset/118752 + https://bugs.webkit.org/show_bug.cgi?id=87731 + + incomplete patch (Requested by cmarcelo on #webkit). + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + +2012-05-21 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] [WK2] Allow user to inject JS scripts when the page loads + https://bugs.webkit.org/show_bug.cgi?id=85827 + + Reviewed by Simon Hausmann. + + Create a new experimental property to list URLs of JS scripts that should be + loaded when a page is loaded. These scripts will run in the normal JS environment + of the page. + + The supported URL schemes are file:/// and qrc:///. The scripts are read from the + UI process and transfered to the Web process. + + Together with the experimental messaging API this provides a way for the + application to manipulate the DOM (by injecting a script that does the + manipulation and communicating with it via postMessage). This covers some of the + use cases of QWebElement in our WK1 API. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + (readUserScript): + (QQuickWebViewPrivate::updateUserScripts): + (QQuickWebViewExperimental::userScripts): + (QQuickWebViewExperimental::setUserScripts): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/append-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/common/big-user-script.js: Added. + * UIProcess/API/qt/tests/qmltests/common/change-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/resources.qrc: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::setUserScripts): + (WebKit): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::setUserScripts): + (WebKit): + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add return value information to WebKitWebView::load-failed signal documentation + https://bugs.webkit.org/show_bug.cgi?id=87704 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkit_web_view_class_init): + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add WebKitWebInspector.h to the list of WebKit2 GTK public headers + https://bugs.webkit.org/show_bug.cgi?id=87703 + + Reviewed by Martin Robinson. + + * GNUmakefile.list.am: Add WebKitWebInspector.h to webkit2gtk_h_api. + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from WTR after its + move to windows.internals.settings. + + * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleInspector.h: + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::setJavaScriptProfilingEnabled): + * win/WebKit2.def: + +2012-05-28 No'am Rosenthal <noam.rosenthal@nokia.com> + + Remove unused argument coders for animation + https://bugs.webkit.org/show_bug.cgi?id=87435 + + Reviewed by Sam Weinig. + + Left the used argument coders only, behind a proper USE(UI_SIDE_COMPOSITING) flag. + + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC): + * Shared/WebCoreArgumentCoders.h: + +2012-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move allowRoundingHacks to Internals interface + https://bugs.webkit.org/show_bug.cgi?id=87328 + + Reviewed by Hajime Morita. + + * win/WebKit2.def: Add setAllowsRoundingHacks() to symbol filter. + 2012-05-26 Geoffrey Garen <ggaren@apple.com> WebKit should be lazy-finalization-safe (esp. the DOM) v2 diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index fc1a6952f..76440b0a6 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; +ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); @@ -126,4 +127,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig index 14b5d2516..752b3c5b7 100644 --- a/Source/WebKit2/Configurations/WebKit2.xcconfig +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -29,8 +29,10 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR); DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR); +FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore; + OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)) $(OTHER_LDFLAGS); -OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)) $(FRAMEWORK_AND_LIBRARY_LDFLAGS); OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index 35d22fad0..b1eea2473 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -109,6 +109,7 @@ webkit2gtk_h_api += \ $(WebKit2)/UIProcess/API/gtk/WebKitURIRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitWebInspector.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebResource.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \ diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 6b768d373..bc6e96638 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -24,6 +24,9 @@ LIST(APPEND WebKit2_SOURCES Shared/efl/WebEventFactory.cpp Shared/efl/WebCoreArgumentCodersEfl.cpp + UIProcess/API/C/soup/WKContextSoup.cpp + UIProcess/API/C/soup/WKSoupRequestManager.cpp + UIProcess/API/efl/PageClientImpl.cpp UIProcess/API/efl/ewk_view.cpp @@ -36,11 +39,13 @@ LIST(APPEND WebKit2_SOURCES UIProcess/efl/WebPageProxyEfl.cpp UIProcess/efl/WebPreferencesEfl.cpp + UIProcess/soup/WebSoupRequestManagerClient.cpp + UIProcess/soup/WebSoupRequestManagerProxy.cpp + UIProcess/Launcher/efl/ProcessLauncherEfl.cpp UIProcess/Launcher/efl/ThreadLauncherEfl.cpp - UIProcess/Plugins/efl/PluginInfoStoreEfl.cpp - UIProcess/Plugins/efl/PluginProcessProxyEfl.cpp + UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp WebProcess/Cookies/soup/WebCookieManagerSoup.cpp @@ -59,18 +64,32 @@ LIST(APPEND WebKit2_SOURCES WebProcess/WebPage/efl/WebInspectorEfl.cpp WebProcess/WebPage/efl/WebPageEfl.cpp + + WebProcess/soup/WebSoupRequestManager.cpp + WebProcess/soup/WebKitSoupRequestGeneric.cpp + WebProcess/soup/WebKitSoupRequestInputStream.cpp +) + +LIST(APPEND WebKit2_MESSAGES_IN_FILES + UIProcess/soup/WebSoupRequestManagerProxy.messages.in + WebProcess/soup/WebSoupRequestManager.messages.in ) LIST(APPEND WebKit2_INCLUDE_DIRECTORIES - "${JAVASCRIPTCORE_DIR}/wtf/gobject" + "${JAVASCRIPTCORE_DIR}/llint" "${WEBCORE_DIR}/platform/efl" "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/network/soup" + "${WEBCORE_DIR}/svg/graphics" "${WEBKIT2_DIR}/Shared/efl" - "${WEBKIT2_DIR}/UIProcess/API/efl/" + "${WEBKIT2_DIR}/UIProcess/API/C/soup" + "${WEBKIT2_DIR}/UIProcess/API/efl" + "${WEBKIT2_DIR}/UIProcess/soup" "${WEBKIT2_DIR}/WebProcess/Downloads/efl" "${WEBKIT2_DIR}/WebProcess/efl" + "${WEBKIT2_DIR}/WebProcess/soup" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" + "${WTF_DIR}/wtf/gobject" ${CAIRO_INCLUDE_DIRS} ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} @@ -81,6 +100,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES ${SQLITE_INCLUDE_DIRS} ${Glib_INCLUDE_DIRS} ${LIBSOUP24_INCLUDE_DIRS} + ${WTF_DIR} ) LIST(APPEND WebKit2_LIBRARIES diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp new file mode 100755 index 000000000..9a3e9fcc5 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WKURLRequestEfl.h" + +#include "WKAPICast.h" +#include "WebURLRequestEfl.h" + +using namespace WebKit; + +WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef requestRef) +{ + RefPtr<WebURLRequestEfl> requestEfl = WebURLRequestEfl::create(toImpl(requestRef)); + return toCopiedAPI(requestEfl->cookies()); +} diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h new file mode 100755 index 000000000..62688dd54 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WKURLRequestEfl_h +#define WKURLRequestEfl_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLRequestEfl_h */ diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp new file mode 100755 index 000000000..abe01d77b --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WKURLResponseEfl.h" + +#include "WKAPICast.h" +#include "WebURLResponseEfl.h" + +using namespace WebKit; + +WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef responseRef) +{ + RefPtr<WebURLResponseEfl> responseEfl = WebURLResponseEfl::create(toImpl(responseRef)); + return toCopiedAPI(responseEfl->contentType()); +} diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h new file mode 100755 index 000000000..bae655c64 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WKURLResponseEfl_h +#define WKURLResponseEfl_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLResponseEfl_h */ diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 804568c2d..3cb57b013 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -45,25 +45,15 @@ #include <WebCore/WindowFeatures.h> #include <wtf/text/StringHash.h> -#if PLATFORM(QT) +#if USE(UI_SIDE_COMPOSITING) #include <WebCore/Animation.h> #include <WebCore/FloatPoint3D.h> -#include <WebCore/IdentityTransformOperation.h> -#include <WebCore/Matrix3DTransformOperation.h> -#include <WebCore/MatrixTransformOperation.h> -#include <WebCore/PerspectiveTransformOperation.h> -#include <WebCore/RotateTransformOperation.h> -#include <WebCore/ScaleTransformOperation.h> -#include <WebCore/SkewTransformOperation.h> -#include <WebCore/TimingFunction.h> -#include <WebCore/TransformOperation.h> -#include <WebCore/TransformOperations.h> -#include <WebCore/TranslateTransformOperation.h> -#endif +#include <WebCore/TransformationMatrix.h> -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) #include <WebCore/FilterOperations.h> #endif +#endif using namespace WebCore; using namespace WebKit; @@ -642,8 +632,7 @@ bool ArgumentCoder<KURL>::decode(ArgumentDecoder* decoder, KURL& result) return true; } -#if PLATFORM(QT) - +#if USE(UI_SIDE_COMPOSITING) void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder* encoder, const FloatPoint3D& floatPoint3D) { SimpleArgumentCoder<FloatPoint3D>::encode(encoder, floatPoint3D); @@ -654,7 +643,6 @@ bool ArgumentCoder<FloatPoint3D>::decode(ArgumentDecoder* decoder, FloatPoint3D& return SimpleArgumentCoder<FloatPoint3D>::decode(decoder, floatPoint3D); } - void ArgumentCoder<Length>::encode(ArgumentEncoder* encoder, const Length& length) { SimpleArgumentCoder<Length>::encode(encoder, length); @@ -675,577 +663,7 @@ bool ArgumentCoder<TransformationMatrix>::decode(ArgumentDecoder* decoder, Trans return SimpleArgumentCoder<TransformationMatrix>::decode(decoder, transformationMatrix); } - -void ArgumentCoder<RefPtr<MatrixTransformOperation> >::encode(ArgumentEncoder* encoder, const MatrixTransformOperation* operation) -{ - ArgumentCoder<WebCore::TransformationMatrix>::encode(encoder, operation->matrix()); -} - -bool ArgumentCoder<RefPtr<MatrixTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<MatrixTransformOperation>& operation) -{ - TransformationMatrix matrix; - if (!ArgumentCoder<WebCore::TransformationMatrix>::decode(decoder, matrix)) - return false; - - operation = MatrixTransformOperation::create(matrix); - return true; -} - -void ArgumentCoder<RefPtr<Matrix3DTransformOperation> >::encode(ArgumentEncoder* encoder, const Matrix3DTransformOperation* operation) -{ - ArgumentCoder<TransformationMatrix>::encode(encoder, operation->matrix()); -} - -bool ArgumentCoder<RefPtr<Matrix3DTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<Matrix3DTransformOperation>& operation) -{ - - TransformationMatrix matrix; - if (!ArgumentCoder<WebCore::TransformationMatrix>::decode(decoder, matrix)) - return false; - - operation = Matrix3DTransformOperation::create(matrix); - return true; -} - -void ArgumentCoder<RefPtr<PerspectiveTransformOperation> >::encode(ArgumentEncoder* encoder, const PerspectiveTransformOperation* operation) -{ - ArgumentCoder<Length>::encode(encoder, operation->perspective()); -} - -bool ArgumentCoder<RefPtr<PerspectiveTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<PerspectiveTransformOperation>& operation) -{ - Length perspective; - if (!ArgumentCoder<Length>::decode(decoder, perspective)) - return false; - - operation = PerspectiveTransformOperation::create(perspective); - return true; -} - -void ArgumentCoder<RefPtr<RotateTransformOperation> >::encode(ArgumentEncoder* encoder, const RotateTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->x()); - encoder->encode(operation->y()); - encoder->encode(operation->z()); - encoder->encode(operation->angle()); -} - -bool ArgumentCoder<RefPtr<RotateTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<RotateTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double x; - double y; - double z; - double angle; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(x)) - return false; - if (!decoder->decode(y)) - return false; - if (!decoder->decode(z)) - return false; - if (!decoder->decode(angle)) - return false; - - operation = RotateTransformOperation::create(x, y, z, angle, operationType); - return true; -} - - -void ArgumentCoder<RefPtr<ScaleTransformOperation> >::encode(ArgumentEncoder* encoder, const ScaleTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->x()); - encoder->encode(operation->y()); - encoder->encode(operation->z()); -} - -bool ArgumentCoder<RefPtr<ScaleTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<ScaleTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double x; - double y; - double z; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(x)) - return false; - if (!decoder->decode(y)) - return false; - if (!decoder->decode(z)) - return false; - - operation = ScaleTransformOperation::create(x, y, z, operationType); - return true; -} - -void ArgumentCoder<RefPtr<SkewTransformOperation> >::encode(ArgumentEncoder* encoder, const SkewTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->angleX()); - encoder->encode(operation->angleY()); -} - -bool ArgumentCoder<RefPtr<SkewTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<SkewTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double angleX; - double angleY; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(angleX)) - return false; - if (!decoder->decode(angleY)) - return false; - - operation = SkewTransformOperation::create(angleX, angleY, operationType); - return true; -} - -void ArgumentCoder<RefPtr<TranslateTransformOperation> >::encode(ArgumentEncoder* encoder, const TranslateTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - ArgumentCoder<Length>::encode(encoder, operation->x()); - ArgumentCoder<Length>::encode(encoder, operation->y()); - ArgumentCoder<Length>::encode(encoder, operation->z()); -} - -bool ArgumentCoder<RefPtr<TranslateTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<TranslateTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - Length x; - Length y; - Length z; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, x)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, y)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, z)) - return false; - - operation = TranslateTransformOperation::create(x, y, z, operationType); - return true; -} - -void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const RefPtr<TimingFunction>& function) -{ - encode(encoder, function.get()); -} - -void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const WebCore::TimingFunction* function) -{ - if (!function) { - encoder->encodeEnum(WebCore::TimingFunction::LinearFunction); - return; - } - - encoder->encodeEnum(function->type()); - switch (function->type()) { - case TimingFunction::LinearFunction: - break; - case TimingFunction::CubicBezierFunction: { - const WebCore::CubicBezierTimingFunction* cubicFunction = static_cast<const WebCore::CubicBezierTimingFunction*>(function); - encoder->encodeDouble(cubicFunction->x1()); - encoder->encodeDouble(cubicFunction->y1()); - encoder->encodeDouble(cubicFunction->x2()); - encoder->encodeDouble(cubicFunction->y2()); - break; - } - case TimingFunction::StepsFunction: { - const WebCore::StepsTimingFunction* stepsFunction = static_cast<const WebCore::StepsTimingFunction*>(function); - encoder->encodeInt32(stepsFunction->numberOfSteps()); - encoder->encodeBool(stepsFunction->stepAtStart()); - break; - } - } -} - -bool ArgumentCoder<RefPtr<TimingFunction> >::decode(ArgumentDecoder* decoder, RefPtr<TimingFunction>& function) -{ - TimingFunction::TimingFunctionType type; - if (!decoder->decodeEnum(type)) - return false; - - switch (type) { - case TimingFunction::LinearFunction: - function = LinearTimingFunction::create(); - return true; - - case TimingFunction::CubicBezierFunction: { - double x1, y1, x2, y2; - if (!decoder->decodeDouble(x1)) - return false; - if (!decoder->decodeDouble(y1)) - return false; - if (!decoder->decodeDouble(x2)) - return false; - if (!decoder->decodeDouble(y2)) - return false; - function = CubicBezierTimingFunction::create(x1, y1, x2, y2); - return true; - } - - case TimingFunction::StepsFunction: { - int numSteps; - bool stepAtStart; - if (!decoder->decodeInt32(numSteps)) - return false; - if (!decoder->decodeBool(stepAtStart)) - return false; - - function = StepsTimingFunction::create(numSteps, stepAtStart); - return true; - } - - } - - return false; -} - -template<typename T> -void encodeOperation(ArgumentEncoder* encoder, const RefPtr<TransformOperation>& operation) -{ - ArgumentCoder<RefPtr<T> >::encode(encoder, static_cast<const T*>(operation.get())); -} - -void ArgumentCoder<RefPtr<TransformOperation> >::encode(ArgumentEncoder* encoder, const RefPtr<TransformOperation>& operation) -{ - // We don't want to encode null-references. - ASSERT(operation); - - encoder->encodeEnum(operation->getOperationType()); - switch (operation->getOperationType()) { - case TransformOperation::SCALE: - case TransformOperation::SCALE_X: - case TransformOperation::SCALE_Y: - case TransformOperation::SCALE_Z: - case TransformOperation::SCALE_3D: - encodeOperation<ScaleTransformOperation>(encoder, operation); - return; - - case TransformOperation::TRANSLATE: - case TransformOperation::TRANSLATE_X: - case TransformOperation::TRANSLATE_Y: - case TransformOperation::TRANSLATE_Z: - case TransformOperation::TRANSLATE_3D: - encodeOperation<TranslateTransformOperation>(encoder, operation); - return; - - case TransformOperation::ROTATE: - case TransformOperation::ROTATE_X: - case TransformOperation::ROTATE_Y: - case TransformOperation::ROTATE_3D: - encodeOperation<RotateTransformOperation>(encoder, operation); - return; - - case TransformOperation::SKEW: - case TransformOperation::SKEW_X: - case TransformOperation::SKEW_Y: - encodeOperation<SkewTransformOperation>(encoder, operation); - return; - - case TransformOperation::MATRIX: - encodeOperation<MatrixTransformOperation>(encoder, operation); - return; - - case TransformOperation::MATRIX_3D: - encodeOperation<Matrix3DTransformOperation>(encoder, operation); - return; - - case TransformOperation::PERSPECTIVE: - encodeOperation<PerspectiveTransformOperation>(encoder, operation); - return; - - case TransformOperation::IDENTITY: - case TransformOperation::NONE: - return; - } -} - -template<typename T> -bool decodeOperation(ArgumentDecoder* decoder, RefPtr<TransformOperation>& operation) -{ - RefPtr<T> newOperation; - if (!decoder->decode(newOperation)) - return false; - - operation = newOperation; - return true; -} - -bool ArgumentCoder<RefPtr<TransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<TransformOperation>& operation) -{ - TransformOperation::OperationType type; - if (!decoder->decodeEnum(type)) - return false; - - switch (type) { - case TransformOperation::SCALE: - case TransformOperation::SCALE_X: - case TransformOperation::SCALE_Y: - case TransformOperation::SCALE_Z: - case TransformOperation::SCALE_3D: - return decodeOperation<ScaleTransformOperation>(decoder, operation); - - case TransformOperation::TRANSLATE: - case TransformOperation::TRANSLATE_X: - case TransformOperation::TRANSLATE_Y: - case TransformOperation::TRANSLATE_Z: - case TransformOperation::TRANSLATE_3D: - return decodeOperation<TranslateTransformOperation>(decoder, operation); - - case TransformOperation::ROTATE: - case TransformOperation::ROTATE_X: - case TransformOperation::ROTATE_Y: - case TransformOperation::ROTATE_3D: - return decodeOperation<RotateTransformOperation>(decoder, operation); - - case TransformOperation::SKEW: - case TransformOperation::SKEW_X: - case TransformOperation::SKEW_Y: - return decodeOperation<SkewTransformOperation>(decoder, operation); - - case TransformOperation::MATRIX: - return decodeOperation<MatrixTransformOperation>(decoder, operation); - - case TransformOperation::MATRIX_3D: - return decodeOperation<Matrix3DTransformOperation>(decoder, operation); - - case TransformOperation::PERSPECTIVE: - return decodeOperation<PerspectiveTransformOperation>(decoder, operation); - - case TransformOperation::IDENTITY: - case TransformOperation::NONE: - operation = IdentityTransformOperation::create(); - return true; - } - - return false; -} - -void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder* encoder, const TransformOperations& operations) -{ - Vector<RefPtr<TransformOperation> > operationsVector = operations.operations(); - int size = operationsVector.size(); - encoder->encodeInt32(size); - for (int i = 0; i < size; ++i) - ArgumentCoder<RefPtr<TransformOperation> >::encode(encoder, operationsVector[i]); -} - -bool ArgumentCoder<TransformOperations>::decode(ArgumentDecoder* decoder, TransformOperations& operations) -{ - int size; - if (!decoder->decodeInt32(size)) - return false; - - Vector<RefPtr<TransformOperation> >& operationVector = operations.operations(); - operationVector.clear(); - operationVector.resize(size); - for (int i = 0; i < size; ++i) { - RefPtr<TransformOperation> operation; - if (!ArgumentCoder<RefPtr<TransformOperation> >::decode(decoder, operation)) - return false; - operationVector[i] = operation; - } - - return true; -} - -template<typename T> -static void encodeBoolAndValue(ArgumentEncoder* encoder, bool isSet, const T& value) -{ - encoder->encodeBool(isSet); - if (isSet) - encoder->encode(value); -} - -template<typename T> -static void encodeBoolAndEnumValue(ArgumentEncoder* encoder, bool isSet, T value) -{ - encoder->encodeBool(isSet); - if (isSet) - encoder->encodeEnum(value); -} - -void ArgumentCoder<RefPtr<Animation> >::encode(ArgumentEncoder* encoder, const RefPtr<Animation>& animation) -{ - encodeBoolAndValue(encoder, animation->isDelaySet(), animation->delay()); - encodeBoolAndEnumValue(encoder, animation->isDirectionSet(), animation->direction()); - encodeBoolAndValue(encoder, animation->isDurationSet(), animation->duration()); - encodeBoolAndValue(encoder, animation->isFillModeSet(), animation->fillMode()); - encodeBoolAndValue(encoder, animation->isIterationCountSet(), animation->iterationCount()); - encodeBoolAndValue(encoder, animation->isNameSet(), animation->name()); - encodeBoolAndEnumValue(encoder, animation->isPlayStateSet(), animation->playState()); - encodeBoolAndValue(encoder, animation->isPropertySet(), static_cast<int>(animation->property())); - encodeBoolAndValue<RefPtr<TimingFunction> >(encoder, animation->isTimingFunctionSet(), animation->timingFunction()); - encoder->encodeBool(animation->isNoneAnimation()); -} - - -template<typename T> -static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, T& value) -{ - if (!decoder->decodeBool(isSet)) - return false; - if (!isSet) - return true; - - return decoder->decode(value); -} - -template<typename T> -static bool decodeBoolAndEnumValue(ArgumentDecoder* decoder, bool& isSet, T& value) -{ - if (!decoder->decodeBool(isSet)) - return false; - if (!isSet) - return true; - - return decoder->decodeEnum(value); -} - -bool ArgumentCoder<RefPtr<Animation> >::decode(ArgumentDecoder* decoder, RefPtr<Animation>& animation) -{ - bool isDelaySet, isDirectionSet, isDurationSet, isFillModeSet, isIterationCountSet, isNameSet, isPlayStateSet, isPropertySet, isTimingFunctionSet; - int property, iterationCount, fillMode; - double duration; - RefPtr<TimingFunction> timingFunction; - String name; - - double delay; - if (!decodeBoolAndValue(decoder, isDelaySet, delay)) - return false; - - Animation::AnimationDirection direction = Animation::AnimationDirectionNormal; - if (!decodeBoolAndEnumValue(decoder, isDirectionSet, direction)) - return false; - if (!decodeBoolAndValue(decoder, isDurationSet, duration)) - return false; - if (!decodeBoolAndValue(decoder, isFillModeSet, fillMode)) - return false; - if (!decodeBoolAndValue(decoder, isIterationCountSet, iterationCount)) - return false; - if (!decodeBoolAndValue(decoder, isNameSet, name)) - return false; - - EAnimPlayState playState = AnimPlayStatePlaying; - if (!decodeBoolAndEnumValue(decoder, isPlayStateSet, playState)) - return false; - if (!decodeBoolAndValue(decoder, isPropertySet, property)) - return false; - if (!decodeBoolAndValue<RefPtr<TimingFunction> >(decoder, isTimingFunctionSet, timingFunction)) - return false; - - animation = Animation::create(); - animation->clearAll(); - - if (isDelaySet) - animation->setDelay(delay); - if (isDirectionSet) - animation->setDirection(direction); - if (isDurationSet) - animation->setDuration(duration); - if (isFillModeSet) - animation->setFillMode(fillMode); - if (isIterationCountSet) - animation->setIterationCount(iterationCount); - if (isNameSet) - animation->setName(name); - if (isPlayStateSet) - animation->setPlayState(playState); - if (isPropertySet) - animation->setProperty(static_cast<CSSPropertyID>(property)); - if (isTimingFunctionSet) - animation->setTimingFunction(timingFunction); - - return true; -} - -#if USE(ACCELERATED_COMPOSITING) - -void ArgumentCoder<KeyframeValueList>::encode(ArgumentEncoder* encoder, const WebCore::KeyframeValueList& keyframes) -{ - encoder->encodeUInt32(keyframes.size()); - encoder->encodeInt32(keyframes.property()); - for (size_t i = 0; i < keyframes.size(); ++i) { - const WebCore::AnimationValue* value = keyframes.at(i); - encoder->encodeFloat(value->keyTime()); - ArgumentCoder<RefPtr<WebCore::TimingFunction> >::encode(encoder, value->timingFunction()); - switch (keyframes.property()) { - case WebCore::AnimatedPropertyOpacity: { - const WebCore::FloatAnimationValue* floatValue = static_cast<const WebCore::FloatAnimationValue*>(value); - encoder->encodeFloat(floatValue->value()); - break; - } - case WebCore::AnimatedPropertyWebkitTransform: { - const WebCore::TransformAnimationValue* transformValue = static_cast<const WebCore::TransformAnimationValue*>(value); - ArgumentCoder<WebCore::TransformOperations>::encode(encoder, *transformValue->value()); - break; - } - default: - break; - } - } -} - -bool ArgumentCoder<KeyframeValueList>::decode(ArgumentDecoder* decoder, WebCore::KeyframeValueList& keyframes) -{ - uint32_t size; - int32_t property; - if (!decoder->decodeUInt32(size)) - return false; - if (!decoder->decodeInt32(property)) - return false; - - keyframes = WebCore::KeyframeValueList(WebCore::AnimatedPropertyID(property)); - - for (size_t i = 0; i < size; ++i) { - float keyTime; - - RefPtr<WebCore::TimingFunction> timingFunction; - if (!decoder->decodeFloat(keyTime)) - return false; - if (!ArgumentCoder<RefPtr<WebCore::TimingFunction> >::decode(decoder, timingFunction)) - return false; - - switch (property) { - case WebCore::AnimatedPropertyOpacity: { - float value; - if (!decoder->decodeFloat(value)) - return false; - keyframes.insert(new WebCore::FloatAnimationValue(keyTime, value, timingFunction)); - break; - } - case WebCore::AnimatedPropertyWebkitTransform: { - WebCore::TransformOperations value; - if (!ArgumentCoder<WebCore::TransformOperations>::decode(decoder, value)) - return false; - keyframes.insert(new WebCore::TransformAnimationValue(keyTime, &value, timingFunction)); - break; - } - default: - break; - } - } - - return true; -} - -#endif - -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, const WebCore::FilterOperations& filters) { encoder->encodeUInt32(filters.size()); diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index d02f5fc17..2697408ed 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -234,7 +234,7 @@ template<> struct ArgumentCoder<WebCore::KURL> { static bool decode(ArgumentDecoder*, WebCore::KURL&); }; -#if PLATFORM(QT) +#if USE(UI_SIDE_COMPOSITING) template<> struct ArgumentCoder<WebCore::FloatPoint3D> { static void encode(ArgumentEncoder*, const WebCore::FloatPoint3D&); static bool decode(ArgumentDecoder*, WebCore::FloatPoint3D&); @@ -250,77 +250,15 @@ template<> struct ArgumentCoder<WebCore::TransformationMatrix> { static bool decode(ArgumentDecoder*, WebCore::TransformationMatrix&); }; -template<> struct ArgumentCoder<RefPtr<WebCore::MatrixTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::MatrixTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::MatrixTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::Matrix3DTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::Matrix3DTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::Matrix3DTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::PerspectiveTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::PerspectiveTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::PerspectiveTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::RotateTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::RotateTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::RotateTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::ScaleTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::ScaleTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::ScaleTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::SkewTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::SkewTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::SkewTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TranslateTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::TranslateTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TranslateTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TimingFunction> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::TimingFunction>&); - static void encode(ArgumentEncoder*, const WebCore::TimingFunction*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TimingFunction>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TransformOperation> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::TransformOperation>&); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TransformOperation>&); -}; - -template<> struct ArgumentCoder<WebCore::TransformOperations> { - static void encode(ArgumentEncoder*, const WebCore::TransformOperations&); - static bool decode(ArgumentDecoder*, WebCore::TransformOperations&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::Animation> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::Animation>&); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::Animation>&); -}; -#endif - -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) template<> struct ArgumentCoder<WebCore::FilterOperations> { static void encode(ArgumentEncoder*, const WebCore::FilterOperations&); static bool decode(ArgumentDecoder*, WebCore::FilterOperations&); }; #endif - -#if USE(ACCELERATED_COMPOSITING) -template<> struct ArgumentCoder<WebCore::KeyframeValueList> { - static void encode(ArgumentEncoder*, const WebCore::KeyframeValueList& keyframes); - static bool decode(ArgumentDecoder*, WebCore::KeyframeValueList& keyframes); -}; #endif + } // namespace CoreIPC #endif // WebCoreArgumentCoders_h diff --git a/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp b/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp new file mode 100755 index 000000000..a964883bb --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebCoreArgumentCoders.h" + +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +using namespace WebCore; + +namespace CoreIPC { + +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +{ + encoder->encode(resourceRequest.url().string()); + encoder->encode(resourceRequest.httpHeaderField("Cookie")); +} + +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +{ + ResourceRequest request; + + String url; + if (!decoder->decode(url)) + return false; + request.setURL(KURL(KURL(), url)); + + String cookie; + if (!decoder->decode(cookie)) + return false; + request.setHTTPHeaderField("Cookie", cookie); + + resourceRequest = request; + return true; +} + + +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +{ + encoder->encode(resourceResponse.mimeType()); +} + +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +{ + ResourceResponse response; + + String mimeType; + if (!decoder->decode(mimeType)) + return false; + response.setMimeType(mimeType); + + resourceResponse = response; + return true; +} + + +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) +{ + encoder->encode(resourceError.domain()); + encoder->encode(resourceError.errorCode()); + encoder->encode(resourceError.failingURL()); + encoder->encode(resourceError.localizedDescription()); +} + +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) +{ + String domain; + if (!decoder->decode(domain)) + return false; + + int errorCode; + if (!decoder->decode(errorCode)) + return false; + + String failingURL; + if (!decoder->decode(failingURL)) + return false; + + String localizedDescription; + if (!decoder->decode(localizedDescription)) + return false; + + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); + return true; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp b/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp new file mode 100755 index 000000000..2a498c441 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebURLRequestEfl.h" + +using namespace WebCore; + +namespace WebKit { + +WebURLRequestEfl::WebURLRequestEfl(const WebURLRequest* request) + : m_request(request) +{ +} + +const String WebURLRequestEfl::cookies() const +{ + if (!m_request) + return String(); + + return m_request->resourceRequest().httpHeaderField("Cookie"); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebURLRequestEfl.h b/Source/WebKit2/Shared/efl/WebURLRequestEfl.h new file mode 100755 index 000000000..8057db28f --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLRequestEfl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebURLRequestEfl_h +#define WebURLRequestEfl_h + +#include "WebURLRequest.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebURLRequestEfl : public RefCounted<WebURLRequestEfl> { +public: + static PassRefPtr<WebURLRequestEfl> create(const WebURLRequest* request) + { + return adoptRef(new WebURLRequestEfl(request)); + } + + const String cookies() const; + +private: + explicit WebURLRequestEfl(const WebURLRequest*); + + const WebURLRequest* m_request; +}; + +} // namespace WebKit + +#endif // WebURLRequestEfl_h diff --git a/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp b/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp new file mode 100755 index 000000000..55128a420 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebURLResponseEfl.h" + +namespace WebKit { + +WebURLResponseEfl::WebURLResponseEfl(const WebURLResponse* response) + : m_response(response) +{ +} + +const String& WebURLResponseEfl::contentType() const +{ + if (!m_response) + return String(); + + return m_response->resourceResponse().mimeType(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebURLResponseEfl.h b/Source/WebKit2/Shared/efl/WebURLResponseEfl.h new file mode 100755 index 000000000..1193a8023 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLResponseEfl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebURLResponseEfl_h +#define WebURLResponseEfl_h + +#include "WebURLResponse.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebURLResponseEfl : public RefCounted<WebURLResponseEfl> { +public: + static PassRefPtr<WebURLResponseEfl> create(const WebURLResponse* response) + { + return adoptRef(new WebURLResponseEfl(response)); + } + + const String& contentType() const; + +private: + explicit WebURLResponseEfl(const WebURLResponse*); + + const WebURLResponse* m_response; +}; + +} // namespace WebKit + +#endif // WebURLResponseEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index c7e5f029c..567548f5d 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -32,7 +32,7 @@ #include "WebContext.h" #include "WebContextMenuProxy.h" #include "WebPageProxy.h" -#include "ewk_private.h" +#include "ewk_view_private.h" using namespace WebCore; @@ -186,6 +186,13 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) notImplemented(); } +#if ENABLE(TOUCH_EVENTS) +void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) +{ + notImplemented(); +} +#endif + PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy*) { notImplemented(); diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 0858fc33d..a4dcd93e3 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -77,6 +77,9 @@ private: virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool); +#if ENABLE(TOUCH_EVENTS) + virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); +#endif virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index d331d996f..e776725cc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -18,8 +18,8 @@ * */ -#ifndef ewk_private_h -#define ewk_private_h +#ifndef ewk_view_private_h +#define ewk_view_private_h #include <Evas.h> @@ -31,4 +31,4 @@ class IntSize; void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect); void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size); -#endif // ewk_private_h +#endif // ewk_view_private_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index 018f08d3d..61d316f6c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -20,8 +20,10 @@ #include "config.h" #include "WebKitDownload.h" +#include "DownloadProxy.h" #include "WebKitDownloadPrivate.h" #include "WebKitMarshal.h" +#include "WebKitURIRequestPrivate.h" #include "WebKitURIResponsePrivate.h" #include <WebCore/ErrorsGtk.h> #include <WebCore/ResourceResponse.h> @@ -53,6 +55,7 @@ enum { struct _WebKitDownloadPrivate { WKRetainPtr<WKDownloadRef> wkDownload; + GRefPtr<WebKitURIRequest> request; GRefPtr<WebKitURIResponse> response; CString destinationURI; guint64 currentSize; @@ -360,6 +363,25 @@ void webkitDownloadDestinationCreated(WebKitDownload* download, const CString& d } /** + * webkit_download_get_request: + * @download: a #WebKitDownload + * + * Retrieves the #WebKitURIRequest object that backs the download + * process. + * + * Returns: (transfer none): the #WebKitURIRequest of @download + */ +WebKitURIRequest* webkit_download_get_request(WebKitDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0); + + WebKitDownloadPrivate* priv = download->priv; + if (!priv->request) + priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(priv->wkDownload.get())->request())); + return download->priv->request.get(); +} + +/** * webkit_download_get_destination: * @download: a #WebKitDownload * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h index b6c51fea5..b4a2d3bab 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h @@ -26,6 +26,7 @@ #include <glib-object.h> #include <webkit2/WebKitDefines.h> +#include <webkit2/WebKitURIRequest.h> #include <webkit2/WebKitURIResponse.h> G_BEGIN_DECLS @@ -57,6 +58,9 @@ struct _WebKitDownloadClass { WEBKIT_API GType webkit_download_get_type (void); +WEBKIT_API WebKitURIRequest * +webkit_download_get_request (WebKitDownload *download); + WEBKIT_API const gchar * webkit_download_get_destination (WebKitDownload *download); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index 9476255c8..158c7fc42 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -147,7 +147,8 @@ void attachLoaderClientToView(WebKitWebView* webView) 0, // didDetectXSSForFrame 0, // didFirstVisuallyNonEmptyLayoutForFrame 0, // willGoToBackForwardListItem - 0 // interactionOccurredWhileProcessUnresponsive + 0, // interactionOccurredWhileProcessUnresponsive + 0, // pluginDidFail }; WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); WKPageSetPageLoaderClient(wkPage, &wkLoaderClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp index 9f78c9cbf..2548d7b72 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp @@ -191,6 +191,7 @@ void attachUIClientToView(WebKitWebView* webView) createNewPage, mouseDidMoveOverElement, 0, // decidePolicyForNotificationPermissionRequest + 0, // unavailablePluginButtonClicked }; WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); WKPageSetPageUIClient(wkPage, &wkUIClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp index 174bf12f8..93f83c2de 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp @@ -30,7 +30,8 @@ enum { PROP_URI, PROP_STATUS_CODE, - PROP_CONTENT_LENGTH + PROP_CONTENT_LENGTH, + PROP_MIME_TYPE }; using namespace WebCore; @@ -40,6 +41,7 @@ G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT) struct _WebKitURIResponsePrivate { WebCore::ResourceResponse resourceResponse; CString uri; + CString mimeType; }; static void webkitURIResponseFinalize(GObject* object) @@ -62,6 +64,9 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue* case PROP_CONTENT_LENGTH: g_value_set_uint64(value, webkit_uri_response_get_content_length(response)); break; + case PROP_MIME_TYPE: + g_value_set_string(value, webkit_uri_response_get_mime_type(response)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); } @@ -112,6 +117,19 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass 0, G_MAXUINT64, 0, WEBKIT_PARAM_READABLE)); + /** + * WebKitURIResponse:mime-type: + * + * The MIME type of the response. + */ + g_object_class_install_property(objectClass, + PROP_MIME_TYPE, + g_param_spec_string("mime-type", + _("MIME Type"), + _("The MIME type of the response"), + 0, + WEBKIT_PARAM_READABLE)); + g_type_class_add_private(responseClass, sizeof(WebKitURIResponsePrivate)); } @@ -170,6 +188,20 @@ guint64 webkit_uri_response_get_content_length(WebKitURIResponse* response) return response->priv->resourceResponse.expectedContentLength(); } +/** + * webkit_uri_response_get_mime_type: + * @response: a #WebKitURIResponse + * + * Returns: the MIME type of the #WebKitURIResponse + */ +const gchar* webkit_uri_response_get_mime_type(WebKitURIResponse* response) +{ + g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0); + + response->priv->mimeType = response->priv->resourceResponse.mimeType().utf8(); + return response->priv->mimeType.data(); +} + WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse) { WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL)); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h index cfbe4d819..0cc6c8959 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h @@ -64,6 +64,9 @@ webkit_uri_response_get_status_code (WebKitURIResponse *response); WEBKIT_API guint64 webkit_uri_response_get_content_length (WebKitURIResponse *response); +WEBKIT_API const gchar * +webkit_uri_response_get_mime_type (WebKitURIResponse *response); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 77ef6c1de..938f95fd1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -33,9 +33,11 @@ #include "WebKitPrintOperationPrivate.h" #include "WebKitPrivate.h" #include "WebKitResourceLoadClient.h" +#include "WebKitResponsePolicyDecision.h" #include "WebKitScriptDialogPrivate.h" #include "WebKitSettingsPrivate.h" #include "WebKitUIClient.h" +#include "WebKitURIResponsePrivate.h" #include "WebKitWebContextPrivate.h" #include "WebKitWebInspectorPrivate.h" #include "WebKitWebResourcePrivate.h" @@ -190,9 +192,25 @@ static gboolean webkitWebViewScriptDialog(WebKitWebView* webView, WebKitScriptDi return TRUE; } -static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* decision, WebKitPolicyDecisionType) +static gboolean webkitWebViewDecidePolicy(WebKitWebView* webView, WebKitPolicyDecision* decision, WebKitPolicyDecisionType decisionType) { - webkit_policy_decision_use(decision); + if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { + webkit_policy_decision_use(decision); + return TRUE; + } + + WebKitURIResponse* response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); + const ResourceResponse resourceResponse = webkitURIResponseGetResourceResponse(response); + if (resourceResponse.isAttachment()) { + webkit_policy_decision_download(decision); + return TRUE; + } + + if (webkit_web_view_can_show_mime_type(webView, webkit_uri_response_get_mime_type(response))) + webkit_policy_decision_use(decision); + else + webkit_policy_decision_ignore(decision); + return TRUE; } @@ -509,6 +527,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * * By default, if the signal is not handled, a stock error page will be displayed. * You need to handle the signal if you want to provide your own error page. + * + * Returns: %TRUE to stop other handlers from being invoked for the event. + * %FALSE to propagate the event further. */ signals[LOAD_FAILED] = g_signal_new("load-failed", @@ -1754,7 +1775,7 @@ void webkit_web_view_can_execute_editing_command(WebKitWebView* webView, const c * * Finish an asynchronous operation started with webkit_web_view_can_execute_editing_command(). * - * Returns: %TRUE if a selection can be cut or %FALSE otherwise + * Returns: %TRUE if the editing command can be executed or %FALSE otherwise */ gboolean webkit_web_view_can_execute_editing_command_finish(WebKitWebView* webView, GAsyncResult* result, GError** error) { @@ -1918,13 +1939,13 @@ void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script, * context = webkit_javascript_result_get_global_context (js_result); * value = webkit_javascript_result_get_value (js_result); * if (JSValueIsString (context, value)) { - * JSStringRef *js_str_value; - * gchar *str_value; - * gsize str_length; + * JSStringRef js_str_value; + * gchar *str_value; + * gsize str_length; * - * js_str_value = JSValueToStringCopy (context, value, NULL)); + * js_str_value = JSValueToStringCopy (context, value, NULL); * str_length = JSStringGetMaximumUTF8CStringSize (js_str_value); - * str_value = (gchar *)g_malloc (str_length)); + * str_value = (gchar *)g_malloc (str_length); * JSStringGetUTF8CString (js_str_value, str_value, str_length); * JSStringRelease (js_str_value); * g_print ("Script result: %s\n", str_value); @@ -1942,7 +1963,7 @@ void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script, * gchar *script; * * script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id); - * webkit_web_view_run_javascript (web_view, script, web_view_javascript_finished, NULL); + * webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL); * g_free (script); * } * </programlisting></informalexample> @@ -2023,3 +2044,21 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) return webView->priv->inspector.get(); } + +/** + * webkit_web_view_can_show_mime_type: + * @web_view: a #WebKitWebView + * @mime_type: a MIME type + * + * Whether or not a MIME type can be displayed in @web_view. + * + * Returns: %TRUE if the MIME type @mime_type can be displayed or %FALSE otherwise + */ +gboolean webkit_web_view_can_show_mime_type(WebKitWebView* webView, const char* mimeType) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + g_return_val_if_fail(mimeType, FALSE); + + WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); + return page->canShowMIMEType(String::fromUTF8(mimeType)); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 7f9fb9e36..716fbbd08 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -306,6 +306,10 @@ webkit_web_view_get_subresources (WebKitWebView *w WEBKIT_API WebKitWebInspector * webkit_web_view_get_inspector (WebKitWebView *web_view); +WEBKIT_API gboolean +webkit_web_view_can_show_mime_type (WebKitWebView *web_view, + const gchar *mime_type); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index 4faa75fb0..f8308aa14 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -675,8 +675,8 @@ void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData& { WebKitWebViewBasePrivate* priv = webViewBase->priv; - RefPtr<DataObjectGtk> dataObject(dragData.platformData()); - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); + RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData()); + GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(webViewBase), targetList.get(), diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 4251cc4a6..6dde0866d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -95,6 +95,7 @@ webkit_web_view_get_inspector webkit_web_view_get_javascript_global_context webkit_web_view_run_javascript webkit_web_view_run_javascript_finish +webkit_web_view_can_show_mime_type <SUBSECTION WebKitJavascriptResult> WebKitJavascriptResult @@ -302,6 +303,7 @@ WebKitURIResponse webkit_uri_response_get_uri webkit_uri_response_get_status_code webkit_uri_response_get_content_length +webkit_uri_response_get_mime_type <SUBSECTION Standard> WebKitURIResponseClass @@ -346,6 +348,7 @@ webkit_window_properties_get_type <SECTION> <FILE>WebKitDownload</FILE> WebKitDownload +webkit_download_get_request webkit_download_get_destination webkit_download_set_destination webkit_download_get_response diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp index a119e4477..acec9ece1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp @@ -88,6 +88,7 @@ public: static void downloadStartedCallback(WebKitWebContext* context, WebKitDownload* download, DownloadTest* test) { + g_assert(webkit_download_get_request(download)); test->started(download); g_signal_connect(download, "notify::response", G_CALLBACK(receivedResponseCallback), test); g_signal_connect(download, "created-destination", G_CALLBACK(createdDestinationCallback), test); @@ -191,6 +192,10 @@ static void testDownloadLocalFile(DownloadTest* test, gconstpointer) g_assert_cmpint(events[3], ==, DownloadTest::ReceivedData); g_assert_cmpint(events[4], ==, DownloadTest::Finished); + WebKitURIRequest* request = webkit_download_get_request(download.get()); + g_assert(request); + g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, sourceURI.get()); + g_assert_cmpint(test->m_downloadSize, ==, g_file_info_get_size(sourceInfo.get())); g_assert(webkit_download_get_destination(download.get())); g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1); @@ -328,6 +333,11 @@ static void testDownloadRemoteFile(DownloadTest* test, gconstpointer) g_assert_cmpint(events[4], ==, DownloadTest::Finished); events.clear(); + WebKitURIRequest* request = webkit_download_get_request(download.get()); + g_assert(request); + CString requestURI = kServer->getURIForPath("/test.pdf"); + g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, requestURI.data()); + g_assert(webkit_download_get_destination(download.get())); g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1); test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index 39841756d..7de95e0f0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -300,13 +300,11 @@ public: g_main_loop_run(m_mainLoop); } - int waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse() + WebKitURIResponse* waitUntilResourceLoadFinsihedAndReturnURIResponse() { waitUntilResourceLoadFinsihed(); g_assert(m_resource); - WebKitURIResponse* response = webkit_web_resource_get_response(m_resource.get()); - g_assert(response); - return webkit_uri_response_get_status_code(response); + return webkit_web_resource_get_response(m_resource.get()); } GRefPtr<WebKitWebResource> m_resource; @@ -355,33 +353,48 @@ static void testWebResourceResponse(SingleResourceLoadTest* test, gconstpointer) { // No cached resource: First load. test->loadURI(kServer->getURIForPath("/javascript.html").data()); - gint statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + WebKitURIResponse* response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // No cached resource: Second load. test->loadURI(kServer->getURIForPath("/javascript.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // No cached resource: Reload. webkit_web_view_reload(test->m_webView); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: First load. test->loadURI(kServer->getURIForPath("/image.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: Second load. test->loadURI(kServer->getURIForPath("/image.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: Reload. webkit_web_view_reload(test->m_webView); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_NOT_MODIFIED); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_NOT_MODIFIED); +} + +static void testWebResourceMimeType(SingleResourceLoadTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/javascript.html").data()); + WebKitURIResponse* response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/javascript"); + + test->loadURI(kServer->getURIForPath("/image.html").data()); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "image/vnd.microsoft.icon"); + + test->loadURI(kServer->getURIForPath("/redirected-css.html").data()); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/css"); } class ResourceURITrackingTest: public SingleResourceLoadTest { @@ -555,6 +568,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* addCacheHTTPHeadersToResponse(message); } else if (g_str_equal(path, "/javascript.js")) { soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kJavascript, strlen(kJavascript)); + soup_message_headers_append(message->response_headers, "Content-Type", "text/javascript"); } else if (g_str_equal(path, "/blank.ico")) { GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL)); char* contents; @@ -569,6 +583,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* " padding: 0px;" "}"; soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, simpleCSS, strlen(simpleCSS)); + soup_message_headers_append(message->response_headers, "Content-Type", "text/css"); } else if (g_str_equal(path, "/redirected.css")) { soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY); soup_message_headers_append(message->response_headers, "Location", "/simple-style.css"); @@ -585,6 +600,7 @@ void beforeAll() ResourcesTest::add("WebKitWebView", "resources", testWebViewResources); SingleResourceLoadTest::add("WebKitWebResource", "loading", testWebResourceLoading); SingleResourceLoadTest::add("WebKitWebResource", "response", testWebResourceResponse); + SingleResourceLoadTest::add("WebKitWebResource", "mime-type", testWebResourceMimeType); ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI); ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index e4c60bebc..6ede533d4 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -706,6 +706,20 @@ static void testWebViewFullScreen(FullScreenClientTest* test, gconstpointer) g_assert_cmpint(test->m_event, ==, FullScreenClientTest::Leave); } +static void testWebViewCanShowMIMEType(WebViewTest* test, gconstpointer) +{ + // Supported MIME types. + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "text/html")); + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "text/plain")); + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "image/jpeg")); + + // Unsupported MIME types. + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "text/vcard")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/pdf")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/zip")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/octet-stream")); +} + void beforeAll() { WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext); @@ -720,6 +734,7 @@ void beforeAll() WebViewTest::add("WebKitWebView", "run-javascript", testWebViewRunJavaScript); FileChooserTest::add("WebKitWebView", "file-chooser-request", testWebViewFileChooserRequest); FullScreenClientTest::add("WebKitWebView", "fullscreen", testWebViewFullScreen); + WebViewTest::add("WebKitWebView", "can-show-mime-type", testWebViewCanShowMIMEType); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index b58210a80..cc5c349e2 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -36,9 +36,11 @@ #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> #include <webkit2/WebKitMimeInfo.h> +#include <webkit2/WebKitNavigationPolicyDecision.h> #include <webkit2/WebKitPermissionRequest.h> #include <webkit2/WebKitPlugin.h> #include <webkit2/WebKitPrintOperation.h> +#include <webkit2/WebKitResponsePolicyDecision.h> #include <webkit2/WebKitScriptDialog.h> #include <webkit2/WebKitSettings.h> #include <webkit2/WebKitURIRequest.h> diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index 178e2dade..e0d6012d2 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -124,7 +124,7 @@ void QQuickWebPage::setContentsScale(qreal scale) ASSERT(scale > 0); d->contentsScale = scale; d->updateSize(); - emit d->viewportItem->experimental()->test()->contentsScaleCommitted(); + emit d->viewportItem->experimental()->test()->contentsScaleChanged(); } qreal QQuickWebPage::contentsScale() const diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 9d77171cc..5b43e337d 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -44,6 +44,7 @@ #include "qquickwebpage_p_p.h" #include "qquickwebview_p_p.h" #include "qwebdownloaditem_p_p.h" +#include "qwebiconimageprovider_p.h" #include "qwebkittest_p.h" #include "qwebloadrequest_p.h" #include "qwebnavigationhistory_p.h" @@ -54,13 +55,16 @@ #include <JavaScriptCore/JSBase.h> #include <JavaScriptCore/JSRetainPtr.h> #include <QDateTime> +#include <QtCore/QFile> #include <QtQml/QJSValue> +#include <QtQuick/QQuickView> #include <WKOpenPanelResultListener.h> #include <WKSerializedScriptValue.h> #include <WebCore/IntPoint.h> #include <WebCore/IntRect.h> #include <wtf/Assertions.h> #include <wtf/MainThread.h> +#include <wtf/Vector.h> #include <wtf/text/WTFString.h> using namespace WebCore; @@ -303,7 +307,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(toAPI(webPageProxy.get()))); QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); - QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QUrl, QUrl)), q_ptr, SLOT(_q_onIconChangedForPageURL(QUrl, QUrl))); + QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QString)), q_ptr, SLOT(_q_onIconChangedForPageURL(QString))); // Any page setting should preferrable be set before creating the page. webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); @@ -373,9 +377,6 @@ void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress) { Q_Q(QQuickWebView); - if (!loadProgress) - setIcon(QUrl()); - m_loadProgress = loadProgress; emit q->loadProgressChanged(); @@ -418,16 +419,6 @@ void QQuickWebViewPrivate::setNeedsDisplay() q->page()->update(); } -void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL) -{ - Q_Q(QQuickWebView); - - if (q->url() != pageURL) - return; - - setIcon(iconURL); -} - void QQuickWebViewPrivate::processDidCrash() { Q_Q(QQuickWebView); @@ -452,6 +443,7 @@ void QQuickWebViewPrivate::didRelaunchProcess() webPageProxy->drawingArea()->setSize(viewSize(), IntSize()); updateViewportSize(); + updateUserScripts(); } PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy() @@ -480,8 +472,38 @@ void QQuickWebViewPrivate::_q_onVisibleChanged() void QQuickWebViewPrivate::_q_onUrlChanged() { + updateIcon(); +} + +void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QString& pageUrl) +{ + if (pageUrl != QString(m_currentUrl)) + return; + + updateIcon(); +} + +/* Called either when the url changes, or when the icon for the current page changes */ +void QQuickWebViewPrivate::updateIcon() +{ Q_Q(QQuickWebView); - context->iconDatabase()->requestIconForPageURL(q->url()); + + QQuickView* view = qobject_cast<QQuickView*>(q->canvas()); + if (!view) + return; + + QWebIconImageProvider* provider = static_cast<QWebIconImageProvider*>( + view->engine()->imageProvider(QWebIconImageProvider::identifier())); + if (!provider) + return; + + WTF::String iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get()); + + if (iconUrl == m_iconUrl) + return; + + m_iconUrl = iconUrl; + emit q->iconChanged(); } void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem) @@ -641,31 +663,6 @@ void QQuickWebViewPrivate::addAttachedPropertyTo(QObject* object) attached->setView(q); } -void QQuickWebViewPrivate::setIcon(const QUrl& iconURL) -{ - Q_Q(QQuickWebView); - if (m_iconURL == iconURL) - return; - - if (!webPageProxy->mainFrame()) - return; - - String oldPageURL = QUrl::fromPercentEncoding(m_iconURL.encodedFragment()); - String newPageURL = webPageProxy->mainFrame()->url(); - - if (oldPageURL != newPageURL) { - QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); - if (!oldPageURL.isEmpty()) - iconDatabase->releaseIconForPageURL(oldPageURL); - - if (!newPageURL.isEmpty()) - iconDatabase->retainIconForPageURL(newPageURL); - } - - m_iconURL = iconURL; - emit q->iconChanged(); -} - bool QQuickWebViewPrivate::navigatorQtObjectEnabled() const { return m_navigatorQtObjectEnabled; @@ -679,6 +676,52 @@ void QQuickWebViewPrivate::setNavigatorQtObjectEnabled(bool enabled) context->setNavigatorQtObjectEnabled(webPageProxy.get(), enabled); } +static QString readUserScript(const QUrl& url) +{ + QString path; + if (url.isLocalFile()) + path = url.toLocalFile(); + else if (url.scheme() == QLatin1String("qrc")) + path = QStringLiteral(":") + url.path(); + else { + qWarning("QQuickWebView: Couldn't open '%s' as user script because only file:/// and qrc:/// URLs are supported.", qPrintable(url.toString())); + return QString(); + } + + QFile file(path); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qWarning("QQuickWebView: Couldn't open '%s' as user script due to error '%s'.", qPrintable(url.toString()), qPrintable(file.errorString())); + return QString(); + } + + QString contents = QString::fromUtf8(file.readAll()); + if (contents.isEmpty()) + qWarning("QQuickWebView: Ignoring '%s' as user script because file is empty.", qPrintable(url.toString())); + + return contents; +} + +void QQuickWebViewPrivate::updateUserScripts() +{ + Vector<String> scripts; + scripts.reserveCapacity(userScripts.size()); + + for (unsigned i = 0; i < userScripts.size(); ++i) { + const QUrl& url = userScripts.at(i); + if (!url.isValid()) { + qWarning("QQuickWebView: Couldn't open '%s' as user script because URL is invalid.", qPrintable(url.toString())); + continue; + } + + QString contents = readUserScript(url); + if (contents.isEmpty()) + continue; + scripts.append(String(contents)); + } + + webPageProxy->setUserScripts(scripts); +} + QPointF QQuickWebViewPrivate::contentPos() const { Q_Q(const QQuickWebView); @@ -727,12 +770,6 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) { - // Default values for the Legacy view. - attributes.devicePixelRatio = 1; - attributes.initialScale = 1; - attributes.minimumScale = 1; - attributes.maximumScale = 1; - attributes.userScalable = 0; } void QQuickWebViewLegacyPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) @@ -782,7 +819,8 @@ void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor) QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) - , pageIsSuspended(true) + , pageIsSuspended(false) + , lastCommittedScale(-1) { // Disable mouse events on the flickable web view so we do not // select text during pan gestures on platforms which send both @@ -823,30 +861,7 @@ void QQuickWebViewFlickablePrivate::onComponentComplete() void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& newAttributes) { - Q_Q(QQuickWebView); - - // FIXME: Revise these when implementing fit-to-width. - WebCore::ViewportAttributes attr = newAttributes; - WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr); - - // FIXME: Resetting here can reset more than needed. For instance it will end deferrers. - // This needs to be revised at some point. - interactionEngine->reset(); - - interactionEngine->setContentToDevicePixelRatio(attr.devicePixelRatio); - - interactionEngine->setAllowsUserScaling(!!attr.userScalable); - interactionEngine->setCSSScaleBounds(attr.minimumScale, attr.maximumScale); - - if (!interactionEngine->hadUserInteraction() && !pageIsSuspended) - interactionEngine->setCSSScale(attr.initialScale); - - this->attributes = attr; - emit q->experimental()->test()->viewportChanged(); - - // If the web app successively changes the viewport on purpose - // it wants to be in control and we should disable animations. - interactionEngine->setItemRectVisible(interactionEngine->nearestValidBounds()); + interactionEngine->viewportAttributesChanged(newAttributes); } void QQuickWebViewFlickablePrivate::updateViewportSize() @@ -876,14 +891,19 @@ void QQuickWebViewFlickablePrivate::_q_onInformVisibleContentChange(const QPoint if (!drawingArea) return; - const QRect visibleRect(visibleContentsRect()); + QRectF accurateVisibleRect(q->boundingRect()); + accurateVisibleRect.translate(contentPos()); + + if (accurateVisibleRect == drawingArea->contentsRect()) + return; + float scale = pageView->contentsScale(); - emit q->experimental()->test()->contentsScaleChanged(); + if (scale != lastCommittedScale) + emit q->experimental()->test()->contentsScaleCommitted(); + lastCommittedScale = scale; - QRectF accurateVisibleRect(q->boundingRect()); - accurateVisibleRect.translate(contentPos()); - drawingArea->setVisibleContentsRect(visibleRect, scale, trajectoryVector, FloatPoint(accurateVisibleRect.x(), accurateVisibleRect.y())); + drawingArea->setVisibleContentsRect(QRect(visibleContentsRect()), scale, trajectoryVector, FloatPoint(accurateVisibleRect.x(), accurateVisibleRect.y())); // Ensure that updatePaintNode is always called before painting. pageView->update(); @@ -908,38 +928,17 @@ void QQuickWebViewFlickablePrivate::_q_resume() void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) { - interactionEngine->pagePositionRequest(pos); + interactionEngine->pageContentPositionRequest(pos); } void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) { Q_Q(QQuickWebView); - QSize viewportSize = q->boundingRect().size().toSize(); pageView->setContentsSize(newSize); // emits contentsSizeChanged() - - float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(attributes, viewportSize, newSize); - - bool scaleCommitNotified = false; - - if (!qFuzzyCompare(minimumScale, attributes.minimumScale)) { - interactionEngine->setCSSScaleBounds(minimumScale, attributes.maximumScale); - emit q->experimental()->test()->viewportChanged(); - - if (!interactionEngine->hadUserInteraction() && !pageIsSuspended) { - // Emits contentsScaleCommitted(); - scaleCommitNotified = true; - interactionEngine->setCSSScale(minimumScale); - } - } - - // Emit for testing purposes, so that it can be verified that - // we didn't do scale adjustment. - if (!scaleCommitNotified) - emit q->experimental()->test()->contentsScaleCommitted(); + interactionEngine->pageContentsSizeChanged(newSize, q->boundingRect().size().toSize()); } - /*! \qmlsignal WebView::onNavigationRequested(WebNavigationRequest request) @@ -1296,6 +1295,22 @@ void QQuickWebViewExperimental::evaluateJavaScript(const QString& script, const d_ptr->webPageProxy.get()->runJavaScriptInMainFrame(script, ScriptValueCallback::create(closure, javaScriptCallback)); } +QList<QUrl> QQuickWebViewExperimental::userScripts() const +{ + Q_D(const QQuickWebView); + return d->userScripts; +} + +void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts) +{ + Q_D(QQuickWebView); + if (d->userScripts == userScripts) + return; + d->userScripts = userScripts; + d->updateUserScripts(); + emit userScriptsChanged(); +} + QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index) { const QObjectList children = property->object->children(); @@ -1494,7 +1509,7 @@ void QQuickWebView::emitUrlChangeIfNeeded() QUrl QQuickWebView::icon() const { Q_D(const QQuickWebView); - return d->m_iconURL; + return QUrl(d->m_iconUrl); } /*! diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index f33c6e654..cf469fb1e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -212,11 +212,12 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged()); Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged()); Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*)); - Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QUrl&, const QUrl&)); + Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QString&)); // Hides QObject::d_ptr allowing us to use the convenience macros. QScopedPointer<QQuickWebViewPrivate> d_ptr; QQuickWebViewExperimental* m_experimental; + friend class QWebKitTest; friend class WebKit::QtViewportInteractionEngine; friend class WebKit::QtWebPageLoadClient; friend class WebKit::QtWebPagePolicyClient; @@ -268,6 +269,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject { Q_PROPERTY(QQmlListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates) Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged) Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged) + Q_PROPERTY(QList<QUrl> userScripts READ userScripts WRITE setUserScripts NOTIFY userScriptsChanged) Q_ENUMS(NavigationRequestActionExperimental) public: @@ -300,6 +302,8 @@ public: void setUserAgent(const QString& userAgent); double devicePixelRatio() const; void setDevicePixelRatio(double); + QList<QUrl> userScripts() const; + void setUserScripts(const QList<QUrl>& userScripts); QWebKitTest* test(); @@ -353,6 +357,7 @@ Q_SIGNALS: void devicePixelRatioChanged(); void enterFullScreenRequested(); void exitFullScreenRequested(); + void userScriptsChanged(); private: QQuickWebView* q_ptr; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 572a7f226..69afc2d54 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -103,7 +103,7 @@ public: void _q_onVisibleChanged(); void _q_onUrlChanged(); void _q_onReceivedResponseFromDownload(QWebDownloadItem*); - void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString); + void _q_onIconChangedForPageURL(const QString&); void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtWebPageUIClient::FileChooserType); quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage); @@ -118,12 +118,12 @@ public: void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; } void setTransparentBackground(bool); void addAttachedPropertyTo(QObject*); - void setIcon(const QUrl&); bool navigatorQtObjectEnabled() const; bool renderToOffscreenBuffer() const { return m_renderToOffscreenBuffer; } bool transparentBackground() const; void setNavigatorQtObjectEnabled(bool); + void updateUserScripts(); QPointF contentPos() const; void setContentPos(const QPointF&); @@ -132,6 +132,8 @@ public: void setDialogActive(bool active) { m_dialogActive = active; } + void updateIcon(); + // PageClient. WebCore::IntSize viewSize() const; void didReceiveMessageFromNavigatorQtObject(const String& message); @@ -190,14 +192,14 @@ protected: QQmlComponent* filePicker; QQmlComponent* databaseQuotaDialog; - WebCore::ViewportAttributes attributes; + QList<QUrl> userScripts; bool m_useDefaultContentItemSize; bool m_navigatorQtObjectEnabled; bool m_renderToOffscreenBuffer; bool m_dialogActive; bool m_allowAnyHTTPSCertificateForLocalHost; - QUrl m_iconURL; + WTF::String m_iconUrl; int m_loadProgress; WTF::String m_currentUrl; }; @@ -239,6 +241,7 @@ public: private: QScopedPointer<WebKit::QtViewportInteractionEngine> interactionEngine; bool pageIsSuspended; + float lastCommittedScale; }; #endif // qquickwebview_p_p_h diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp index 71342a1e3..63dce28d0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp @@ -24,6 +24,7 @@ #include "QtWebIconDatabaseClient.h" #include <QtCore/QUrl> #include <QtGui/QImage> +#include <wtf/text/StringHash.h> #include <wtf/text/WTFString.h> using namespace WebKit; @@ -37,24 +38,52 @@ QWebIconImageProvider::~QWebIconImageProvider() { } -QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) +WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String &pageURL, QtWebContext* context) { - QString decodedIconUrl = id; - decodedIconUrl.remove(0, decodedIconUrl.indexOf('#') + 1); - String pageURL = QString::fromUtf8(QUrl(decodedIconUrl).toEncoded()); + QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); + WTF::String iconURL = iconDatabase->iconForPageURL(pageURL); + + if (iconURL.isEmpty()) + return String(); + + QUrl url; + url.setScheme(QStringLiteral("image")); + url.setHost(QWebIconImageProvider::identifier()); + + QString path; + path.append(QLatin1Char('/')); + path.append(QString::number(context->contextID())); + path.append(QLatin1Char('/')); + path.append(QString::number(WTF::StringHash::hash(iconURL))); + url.setPath(path); + + // FIXME: Use QUrl::DecodedMode when landed in Qt + url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64())); + + // FIXME: We can't know when the icon url is no longer in use, + // so we never release these icons. At some point we might want + // to introduce expiry of icons to elevate this issue. + iconDatabase->retainIconForPageURL(pageURL); + return url.toString(QUrl::FullyEncoded); +} + +QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) +{ // The string identifier has the leading image://webicon/ already stripped, so we just // need to truncate from the first slash to get the context id. - QString contextIDAsString = id; - contextIDAsString.truncate(contextIDAsString.indexOf(QLatin1Char('/'))); + QString contextIDString = id.left(id.indexOf(QLatin1Char('/'))); bool ok = false; - uint64_t contextId = contextIDAsString.toUInt(&ok); + uint64_t contextId = contextIDString.toUInt(&ok); if (!ok) return QImage(); + QtWebContext* context = QtWebContext::contextByID(contextId); if (!context) return QImage(); + QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1())); + QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); QImage icon = requestedSize.isValid() ? iconDatabase->iconImageForPageURL(pageURL, requestedSize) : iconDatabase->iconImageForPageURL(pageURL); ASSERT(!icon.isNull()); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h index a54008a2c..7efe21a14 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h @@ -21,13 +21,23 @@ #define qwebiconimageprovider_p_h #include "qwebkitglobal.h" +#include <QString> #include <QtQuick/QQuickImageProvider> +#include <wtf/text/WTFString.h> + +namespace WebKit { + class QtWebContext; +} class QWEBKIT_EXPORT QWebIconImageProvider : public QQuickImageProvider { public: QWebIconImageProvider(); ~QWebIconImageProvider(); - QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); + + static QString identifier() { return QStringLiteral("webicon"); } + + WTF::String iconURLForPageURLInContext(const WTF::String& pageURL, WebKit::QtWebContext* context); + virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); }; #endif diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp index 529df01eb..e0a441c0e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp @@ -22,9 +22,10 @@ #include "qwebkittest_p.h" #include "QtViewportInteractionEngine.h" -#include "QtWebPageEventHandler.h" -#include "qquickwebview_p.h" #include "qquickwebview_p_p.h" +#include "qwindowsysteminterface_qpa.h" +#include <QMutableListIterator> +#include <QTouchEvent> using namespace WebKit; @@ -43,41 +44,71 @@ static QTouchEvent::TouchPoint touchPoint(qreal x, qreal y) QPointF localPos(x, y); QTouchEvent::TouchPoint point; + point.setId(1); point.setLastPos(localPos); QRectF touchRect(0, 0, 40, 40); touchRect.moveCenter(localPos); point.setRect(touchRect); + point.setPressure(1); return point; } +bool QWebKitTest::sendTouchEvent(QQuickWebView* window, QEvent::Type type, const QList<QTouchEvent::TouchPoint>& points, ulong timestamp) +{ + ASSERT(window); + + static QTouchDevice* device = 0; + if (!device) { + device = new QTouchDevice; + device->setType(QTouchDevice::TouchScreen); + QWindowSystemInterface::registerTouchDevice(device); + } + + Qt::TouchPointStates touchPointStates = 0; + foreach (const QTouchEvent::TouchPoint& touchPoint, points) + touchPointStates |= touchPoint.state(); + + QTouchEvent event(type, device, Qt::NoModifier, touchPointStates, points); + event.setTimestamp(timestamp); + event.setAccepted(false); + + window->touchEvent(&event); + + return event.isAccepted(); +} + bool QWebKitTest::touchTap(QObject* item, qreal x, qreal y, int delay) { - if (!qobject_cast<QQuickWebView*>(item)) { - // FIXME: We only support the actual web view for now. - qWarning("Touch event \"DoubleTap\" not accepted by receiving item"); + QQuickWebView* window = qobject_cast<QQuickWebView*>(item); + + if (!window) { + qWarning("Touch event \"TouchBegin\" not accepted by receiving item"); return false; } // FIXME: implement delay using QTest::qWait() or similar. Q_UNUSED(delay); - m_webViewPrivate->pageView->eventHandler()->handleSingleTapEvent(touchPoint(x, y)); + + QList<QTouchEvent::TouchPoint> points; + points.append(touchPoint(x, y)); + + points[0].setState(Qt::TouchPointPressed); + sendTouchEvent(window, QEvent::TouchBegin, points, QDateTime::currentMSecsSinceEpoch()); + + points[0].setState(Qt::TouchPointReleased); + sendTouchEvent(window, QEvent::TouchEnd, points, QDateTime::currentMSecsSinceEpoch()); return true; } bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay) { - if (!qobject_cast<QQuickWebView*>(item)) { - // FIXME: We only support the actual web view for now. - qWarning("Touch event \"DoubleTap\" not accepted by receiving item"); + if (!touchTap(item, x, y, delay)) return false; - } - - // FIXME: implement delay using QTest::qWait() or similar. - Q_UNUSED(delay); - m_webViewPrivate->pageView->eventHandler()->handleDoubleTapEvent(touchPoint(x, y)); + if (!touchTap(item, x, y, delay)) + return false; return true; } @@ -89,44 +120,49 @@ QSize QWebKitTest::contentsSize() const QVariant QWebKitTest::contentsScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->currentCSSScale(); - - return m_webViewPrivate->attributes.initialScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->currentCSSScale(); + return QVariant(); } QVariant QWebKitTest::devicePixelRatio() const { - return m_webViewPrivate->attributes.devicePixelRatio; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_devicePixelRatio; + return QVariant(); } QVariant QWebKitTest::initialScale() const { - return m_webViewPrivate->attributes.initialScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_rawAttributes.initialScale; + return QVariant(); } QVariant QWebKitTest::minimumScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->m_minimumScale; - - return m_webViewPrivate->attributes.minimumScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_minimumScale; + return QVariant(); } QVariant QWebKitTest::maximumScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->m_maximumScale; - - return m_webViewPrivate->attributes.maximumScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_maximumScale; + return QVariant(); } QVariant QWebKitTest::isScalable() const { - return !!m_webViewPrivate->attributes.userScalable; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return !!viewport->m_rawAttributes.userScalable; + return QVariant(); } QVariant QWebKitTest::layoutSize() const { - return QSizeF(m_webViewPrivate->attributes.layoutSize); + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return QSizeF(viewport->m_rawAttributes.layoutSize); + return QVariant(); } diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h index 613486409..982398d3a 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h @@ -22,6 +22,7 @@ #define qwebkittest_p_h #include "qwebkitglobal.h" +#include "qquickwebview_p.h" #include <QtCore/QObject> #include <QtCore/QPointer> @@ -60,6 +61,8 @@ public: QWebKitTest(QQuickWebViewPrivate* webviewPrivate, QObject* parent = 0); virtual ~QWebKitTest(); + bool sendTouchEvent(QQuickWebView* window, QEvent::Type type, const QList<QTouchEvent::TouchPoint>& points, ulong timestamp); + QSize contentsSize() const; QVariant contentsScale() const; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp index 6c0cb4b62..0e3b33cf7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp @@ -17,6 +17,8 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" + #include <QMetaEnum> #include <QMetaMethod> #include <QMetaObject> @@ -142,7 +144,7 @@ static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringL { if (method.access() != QMetaMethod::Private) { const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void"; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName)); #else *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 5cc6f35f5..fd940d43d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -16,3 +16,5 @@ DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" OTHER_FILES += \ WebView/* \ common/* + +RESOURCES = resources.qrc diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml index 8210040e8..f6ed4b261 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml @@ -20,6 +20,7 @@ TestWebView { TestCase { id: test name: "WebViewLoadFavIcon" + when: windowShown function init() { if (webView.icon != '') { @@ -36,7 +37,6 @@ TestWebView { var url = Qt.resolvedUrl("../common/favicon.html") webView.url = url verify(webView.waitForLoadSucceeded()) - expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133") compare(spy.count, 1) compare(favicon.width, 48) compare(favicon.height, 48) @@ -47,7 +47,6 @@ TestWebView { var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!") webView.url = url verify(webView.waitForLoadSucceeded()) - expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133") compare(spy.count, 1) compare(favicon.width, 16) compare(favicon.height, 16) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml index d3d7786a3..78ea6f94f 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Moved to Desktop tests because we want to have mouseClick() to open the <select> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -59,7 +57,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml index 1b3ab6314..9f16bb8b6 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml @@ -45,7 +45,7 @@ Item { } TestCase { - name: "DesktopWebViewMessaging" + name: "WebViewMessaging" property url testUrl: Qt.resolvedUrl("../common/messaging.html") function init() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml index f43f65672..73ea70845 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Added to Desktop tests because we want to have mouseClick() to open the <input> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -46,7 +44,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml index 7ca9efa38..be1409b7f 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Added to Desktop tests because we want to have mouseClick() to open the <input> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -51,7 +49,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml new file mode 100644 index 000000000..3d15aca05 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml @@ -0,0 +1,113 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import "../common" + +Item { + TestWebView { + id: webView + width: 400 + height: 300 + } + + TestWebView { + id: webViewWithConditionalUserScripts + width: 400 + height: 300 + + onNavigationRequested: { + var urlString = request.url.toString(); + if (urlString.indexOf("test1.html") !== -1) + experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; + else if (urlString.indexOf("test2.html") !== -1) + experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; + else + experimental.userScripts = []; + } + } + + TestCase { + name: "WebViewUserScripts" + + function init() { + webView.url = ""; + webView.experimental.userScripts = []; + } + + function test_oneScript() { + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1"); + + webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; + compare(webView.title, "Test page 1"); + + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + + webView.url = Qt.resolvedUrl("../common/test2.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + + webView.experimental.userScripts = []; + compare(webView.title, "New title"); + + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page with huge link area"); + } + + function test_twoScripts() { + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1"); + + webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js"), Qt.resolvedUrl("../common/append-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title with appendix"); + + // Make sure we can remove scripts from the preload list. + webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1 with appendix"); + + // Make sure the scripts are loaded in order. + webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js"), Qt.resolvedUrl("../common/change-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + } + + function test_setUserScriptsConditionally() { + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test1.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "New title"); + + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test2.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "Test page with huge link area with appendix"); + + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test3.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "Test page 3"); + } + + function test_bigScript() { + webView.experimental.userScripts = [Qt.resolvedUrl("../common/big-user-script.js")]; + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Big user script changed title"); + } + + function test_fromResourceFile() { + webView.experimental.userScripts = ["qrc:///common/change-document-title.js"]; + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js new file mode 100644 index 000000000..fb4a2a6f2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js @@ -0,0 +1 @@ +document.title += " with appendix"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js new file mode 100644 index 000000000..e6e3d2b44 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js @@ -0,0 +1,110 @@ +// Used to make sure serialization of user scripts between UI process and Web process can handle files bigger +// than the maximum message size defined in ConnectionXXX classes. + +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// + +document.title = "Big user script changed title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js new file mode 100644 index 000000000..bdae45c21 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js @@ -0,0 +1 @@ +document.title = "New title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc new file mode 100644 index 000000000..1696aaac1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>common/change-document-title.js</file> + </qresource> +</RCC> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 358a2328c..2704efe4a 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -11,6 +11,7 @@ SOURCES += ../util.cpp \ INCLUDEPATH += $$PWD QT += testlib qml quick quick-private webkit +WEBKIT += wtf # For platform macros DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \ QWP_PATH=\\\"$${ROOT_BUILD_DIR}/bin\\\" diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm index 70dccc58a..bfc270c69 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm @@ -88,7 +88,7 @@ void DynamicLinkerEnvironmentExtractor::processEnvironmentVariable(const char* e return; CString value(equalsLocation + 1); - m_extractedVariables.append(make_pair(name.latin1(), value)); + m_extractedVariables.append(std::make_pair(name.latin1(), value)); } size_t DynamicLinkerEnvironmentExtractor::processLoadCommand(const void* data, size_t length, bool shouldByteSwap) diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index d2f18070e..742aea62c 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -451,7 +451,7 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { if (!m_process || !m_process->canSendMessage()) { - m_pendingMessagesToPostToInjectedBundle.append(make_pair(messageName, messageBody)); + m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); return; } diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 72d469590..95e6c1339 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -336,6 +336,7 @@ public: void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password); void certificateVerificationRequest(const String& hostname, bool& ignoreErrors); void proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password); + void setUserScripts(const Vector<String>&); #endif // PLATFORM(QT). #if PLATFORM(QT) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 8541cfb7c..de60a7166 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -232,17 +232,17 @@ messages -> WebPageProxy { # Drag and drop messages #if ENABLE(DRAG_SUPPORT) DidPerformDragControllerAction(WebCore::DragSession dragSession) -#if PLATFORM(MAC) +#endif +#if PLATFORM(MAC) && ENABLE(DRAG_SUPPORT) SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag) SetPromisedData(WTF::String pasteboardName, WebKit::SharedMemory::Handle imageHandle, uint64_t imageSize, WTF::String filename, WTF::String extension, WTF::String title, WTF::String url, WTF::String visibleURL, WebKit::SharedMemory::Handle archiveHandle, uint64_t archiveSize) #endif -#if PLATFORM(WIN) +#if PLATFORM(WIN) && ENABLE(DRAG_SUPPORT) StartDragDrop(WebCore::IntPoint imagePoint, WebCore::IntPoint dragPoint, uint64_t okEffect, HashMap<UINT,Vector<String> > dataMap, uint64_t fileSize, String pathname, WebKit::SharedMemory::Handle fileContentHandle, WebCore::IntSize dragImageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag) #endif -#if PLATFORM(QT) || PLATFORM(GTK) +#if (PLATFORM(QT) || PLATFORM(GTK)) && ENABLE(DRAG_SUPPORT) StartDrag(WebCore::DragData dragData, WebKit::ShareableBitmap::Handle dragImage) #endif -#endif #if PLATFORM(MAC) # Dictionary support. diff --git a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp index fec82b773..ae0fd3669 100644 --- a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp +++ b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp @@ -34,7 +34,7 @@ #include <cairo/cairo.h> #if PLATFORM(EFL) -#include "ewk_private.h" +#include "ewk_view_private.h" #endif using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm index 649176215..68e2cd314 100644 --- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm +++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm @@ -183,6 +183,28 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1; #pragma mark - #pragma mark Exposed Interface +static RetainPtr<CGDataProviderRef> createImageProviderWithCopiedData(CGDataProviderRef sourceProvider) +{ + RetainPtr<CFDataRef> data = adoptCF(CGDataProviderCopyData(sourceProvider)); + return adoptCF(CGDataProviderCreateWithCFData(data.get())); +} + +static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) +{ + size_t width = CGImageGetWidth(sourceImage); + size_t height = CGImageGetHeight(sourceImage); + size_t bitsPerComponent = CGImageGetBitsPerComponent(sourceImage); + size_t bitsPerPixel = CGImageGetBitsPerPixel(sourceImage); + size_t bytesPerRow = CGImageGetBytesPerRow(sourceImage); + CGColorSpaceRef colorSpace = CGImageGetColorSpace(sourceImage); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(sourceImage); + RetainPtr<CGDataProviderRef> provider = createImageProviderWithCopiedData(CGImageGetDataProvider(sourceImage)); + bool shouldInterpolate = CGImageGetShouldInterpolate(sourceImage); + CGColorRenderingIntent intent = CGImageGetRenderingIntent(sourceImage); + + return adoptCF(CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, bitmapInfo, provider.get(), 0, shouldInterpolate, intent)); +} + - (void)enterFullScreen:(NSScreen *)screen { if (_isFullScreen) @@ -204,6 +226,11 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1; CGWindowID windowID = [[_webView window] windowNumber]; RetainPtr<CGImageRef> webViewContents(AdoptCF, CGWindowListCreateImage(NSRectToCGRect(webViewFrame), kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageShouldBeOpaque)); + // Using the returned CGImage directly would result in calls to the WindowServer every time + // the image was painted. Instead, copy the image data into our own process to eliminate that + // future overhead. + webViewContents = createImageWithCopiedData(webViewContents.get()); + // Screen updates to be re-enabled in beganEnterFullScreenWithInitialFrame:finalFrame: NSDisableScreenUpdates(); [[self window] setAutodisplay:NO]; diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp index d3d5efef2..45c6499da 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp @@ -24,6 +24,7 @@ #include "qquickwebpage_p.h" #include "qquickwebview_p.h" +#include "qwebkittest_p.h" #include <QPointF> #include <QTransform> #include <QWheelEvent> @@ -113,6 +114,12 @@ inline qreal QtViewportInteractionEngine::itemCoordFromCSS(qreal value) const return value * m_devicePixelRatio; } +static inline QPointF boundPosition(const QPointF minPosition, const QPointF& position, const QPointF& maxPosition) +{ + return QPointF(qBound(minPosition.x(), position.x(), maxPosition.x()), + qBound(minPosition.y(), position.y(), maxPosition.y())); +} + inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect) const { QRectF itemRect; @@ -125,9 +132,9 @@ inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect return itemRect; } -QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewport, QQuickWebPage* content) - : m_viewport(viewport) - , m_content(content) +QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewportItem, QQuickWebPage* pageItem) + : m_viewportItem(viewportItem) + , m_pageItem(pageItem) , m_suspendCount(0) , m_hasSuspendedContent(false) , m_hadUserInteraction(false) @@ -137,10 +144,10 @@ QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewport { reset(); - connect(m_content, SIGNAL(widthChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection); - connect(m_content, SIGNAL(heightChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection); - connect(m_viewport, SIGNAL(movementStarted()), SLOT(flickableMoveStarted()), Qt::DirectConnection); - connect(m_viewport, SIGNAL(movementEnded()), SLOT(flickableMoveEnded()), Qt::DirectConnection); + connect(m_pageItem, SIGNAL(widthChanged()), SLOT(pageItemSizeChanged()), Qt::DirectConnection); + connect(m_pageItem, SIGNAL(heightChanged()), SLOT(pageItemSizeChanged()), Qt::DirectConnection); + connect(m_viewportItem, SIGNAL(movementStarted()), SLOT(flickMoveStarted()), Qt::DirectConnection); + connect(m_viewportItem, SIGNAL(movementEnded()), SLOT(flickMoveEnded()), Qt::DirectConnection); connect(m_scaleAnimation, SIGNAL(valueChanged(QVariant)), SLOT(scaleAnimationValueChanged(QVariant)), Qt::DirectConnection); @@ -168,20 +175,74 @@ qreal QtViewportInteractionEngine::outerBoundedCSSScale(qreal cssScale) const return innerBoundedCSSScale(cssScale); } -void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect) +void QtViewportInteractionEngine::viewportAttributesChanged(const WebCore::ViewportAttributes& newAttributes) { + m_rawAttributes = newAttributes; + WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); + + // FIXME: Resetting here can reset more than needed. For instance it will end deferrers. + // This needs to be revised at some point. + reset(); + + + // FIXME: Should get directly from the webPageProxy. + setDevicePixelRatio(m_rawAttributes.devicePixelRatio); + + setAllowsUserScaling(!!m_rawAttributes.userScalable); + setCSSScaleBounds(m_rawAttributes.minimumScale, m_rawAttributes.maximumScale); + + if (!m_hadUserInteraction && !m_hasSuspendedContent) { + // Emits contentsScaleChanged(); + setCSSScale(m_rawAttributes.initialScale); + } + + emit m_viewportItem->experimental()->test()->viewportChanged(); + + // If the web app successively changes the viewport on purpose + // it wants to be in control and we should disable animations. + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); +} + +void QtViewportInteractionEngine::pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize) +{ + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, viewportSize, newSize); + + if (!qFuzzyCompare(minimumScale, m_rawAttributes.minimumScale)) { + setCSSScaleBounds(minimumScale, m_rawAttributes.maximumScale); + emit m_viewportItem->experimental()->test()->viewportChanged(); + + if (!m_hadUserInteraction && !m_hasSuspendedContent) { + // Emits contentsScaleChanged(); + setCSSScale(minimumScale); + } + } + + // Emit for testing purposes, so that it can be verified that + // we didn't do scale adjustment. + emit m_viewportItem->experimental()->test()->contentsScaleCommitted(); + + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); +} + +void QtViewportInteractionEngine::setPageItemRectVisible(const QRectF& itemRect) +{ + ASSERT_WITH_MESSAGE(m_suspendCount, + "setPageItemRectVisible has to be guarded using a ViewportUpdateDeferrer."); + if (itemRect.isEmpty()) return; - qreal itemScale = m_viewport->width() / itemRect.width(); + qreal itemScale = m_viewportItem->width() / itemRect.width(); - m_content->setContentsScale(itemScale); + m_pageItem->setContentsScale(itemScale); // To animate the position together with the scale we multiply the position with the current scale // and add it to the page position (displacement on the flickable contentItem because of additional items). - QPointF newPosition(m_content->pos() + (itemRect.topLeft() * itemScale)); + QPointF newPosition(m_pageItem->pos() + (itemRect.topLeft() * itemScale)); - m_viewport->setContentPos(newPosition); + m_viewportItem->setContentPos(newPosition); } // Ease out overshoot of 1.25 combined with ease in correction of 0.25. Both quadratic to have physical motion. @@ -190,7 +251,7 @@ static qreal physicalOvershoot(qreal t) return (-t * (t - 2)) * 1.25 - (t * t) * 0.25; } -void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect) +void QtViewportInteractionEngine::animatePageItemRectVisible(const QRectF& itemRect) { ASSERT(m_scaleAnimation->state() == QAbstractAnimation::Stopped); @@ -198,64 +259,74 @@ void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect) if (scrollAnimationActive()) return; - QRectF currentItemRectVisible = m_viewport->mapRectToWebContent(m_viewport->boundingRect()); - if (itemRect == currentItemRectVisible) + QRectF currentPageItemRectVisible = m_viewportItem->mapRectToWebContent(m_viewportItem->boundingRect()); + if (itemRect == currentPageItemRectVisible) return; - // FIXME: Investigate why that animation doesn't run when we are unfocused. - if (!m_viewport->isVisible() || !m_viewport->hasFocus()) { - // Apply the end result immediately when we are non-visible. - setItemRectVisible(itemRect); - return; - } - QEasingCurve easingCurve; easingCurve.setCustomType(physicalOvershoot); m_scaleAnimation->setDuration(kScaleAnimationDurationMillis); m_scaleAnimation->setEasingCurve(easingCurve); - m_scaleAnimation->setStartValue(currentItemRectVisible); + m_scaleAnimation->setStartValue(currentPageItemRectVisible); m_scaleAnimation->setEndValue(itemRect); m_scaleAnimation->start(); } -void QtViewportInteractionEngine::flickableMoveStarted() +void QtViewportInteractionEngine::flickMoveStarted() { - Q_ASSERT(m_viewport->isMoving()); + Q_ASSERT(m_viewportItem->isMoving()); m_scrollUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); - m_lastScrollPosition = m_viewport->contentPos(); - connect(m_viewport, SIGNAL(contentXChanged()), SLOT(flickableMovingPositionUpdate())); - connect(m_viewport, SIGNAL(contentYChanged()), SLOT(flickableMovingPositionUpdate())); + m_lastScrollPosition = m_viewportItem->contentPos(); + connect(m_viewportItem, SIGNAL(contentXChanged()), SLOT(pageItemPositionChanged())); + connect(m_viewportItem, SIGNAL(contentYChanged()), SLOT(pageItemPositionChanged())); } -void QtViewportInteractionEngine::flickableMoveEnded() +void QtViewportInteractionEngine::flickMoveEnded() { - Q_ASSERT(!m_viewport->isMoving()); + Q_ASSERT(!m_viewportItem->isMoving()); // This method is called on the end of the pan or pan kinetic animation. m_scrollUpdateDeferrer.clear(); m_lastScrollPosition = QPointF(); - disconnect(m_viewport, SIGNAL(contentXChanged()), this, SLOT(flickableMovingPositionUpdate())); - disconnect(m_viewport, SIGNAL(contentYChanged()), this, SLOT(flickableMovingPositionUpdate())); + disconnect(m_viewportItem, SIGNAL(contentXChanged()), this, SLOT(pageItemPositionChanged())); + disconnect(m_viewportItem, SIGNAL(contentYChanged()), this, SLOT(pageItemPositionChanged())); } -void QtViewportInteractionEngine::flickableMovingPositionUpdate() +void QtViewportInteractionEngine::pageItemPositionChanged() { - QPointF newPosition = m_viewport->contentPos(); + QPointF newPosition = m_viewportItem->contentPos(); emit informVisibleContentChange(m_lastScrollPosition - newPosition); m_lastScrollPosition = newPosition; } +void QtViewportInteractionEngine::pageContentPositionRequest(const QPoint& cssPosition) +{ + // Ignore the request if suspended. Can only happen due to delay in event delivery. + if (m_suspendCount) + return; + + qreal endItemScale = m_pageItem->contentsScale(); // Stay at same scale. + + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); + QPointF endPosition = boundPosition(endPosRange.topLeft(), cssPosition * endItemScale, endPosRange.bottomRight()); + + QRectF endVisibleContentRect(endPosition / endItemScale, m_viewportItem->boundingRect().size() / endItemScale); + + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(endVisibleContentRect); +} + void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/) { switch (newState) { case QAbstractAnimation::Running: - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); ASSERT(!m_animationUpdateDeferrer); m_animationUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); break; @@ -267,29 +338,9 @@ void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation: } } -static inline QPointF boundPosition(const QPointF minPosition, const QPointF& position, const QPointF& maxPosition) -{ - return QPointF(qBound(minPosition.x(), position.x(), maxPosition.x()), - qBound(minPosition.y(), position.y(), maxPosition.y())); -} - -void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition) +void QtViewportInteractionEngine::scaleAnimationValueChanged(QVariant value) { - // Ignore the request if suspended. Can only happen due to delay in event delivery. - if (m_suspendCount) - return; - - qreal endItemScale = m_content->contentsScale(); // Stay at same scale. - - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); - QPointF endPosition = boundPosition(endPosRange.topLeft(), pagePosition * endItemScale, endPosRange.bottomRight()); - - QRectF endVisibleContentRect(endPosition / endItemScale, m_viewport->boundingRect().size() / endItemScale); - - setItemRectVisible(endVisibleContentRect); - - // Make sure that tiles all around the viewport will be requested. - emit informVisibleContentChange(QPointF()); + setPageItemRectVisible(value.toRectF()); } void QtViewportInteractionEngine::touchBegin() @@ -306,10 +357,10 @@ void QtViewportInteractionEngine::touchEnd() m_touchUpdateDeferrer.clear(); } -QRectF QtViewportInteractionEngine::computePosRangeForItemAtScale(qreal itemScale) const +QRectF QtViewportInteractionEngine::computePosRangeForPageItemAtScale(qreal itemScale) const { - const QSizeF contentItemSize = m_content->contentsSize() * itemScale; - const QSizeF viewportItemSize = m_viewport->boundingRect().size(); + const QSizeF contentItemSize = m_pageItem->contentsSize() * itemScale; + const QSizeF viewportItemSize = m_viewportItem->boundingRect().size(); const qreal horizontalRange = contentItemSize.width() - viewportItemSize.width(); const qreal verticalRange = contentItemSize.height() - viewportItemSize.height(); @@ -325,7 +376,7 @@ void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, con QRectF endArea = itemRectFromCSS(targetArea); qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(2.0)); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); qreal x; const qreal borderOffset = 10; @@ -345,13 +396,13 @@ void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, con const QPointF viewportHotspot = QPointF(x, /* FIXME: visibleCenter */ viewportRect.center().y()); QPointF endPosition = hotspot * endItemScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); - animateItemRectVisible(endVisibleContentRect); + animatePageItemRectVisible(endVisibleContentRect); } void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea) @@ -368,12 +419,12 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi const int margin = 10; // We want at least a little bit of margin. QRectF endArea = itemRectFromCSS(targetArea.adjusted(-margin, -margin, margin, margin)); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); qreal targetCSSScale = viewportRect.size().width() / endArea.size().width(); qreal endCSSScale = innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5))); qreal endItemScale = itemScaleFromCSS(endCSSScale); - qreal currentScale = m_content->contentsScale(); + qreal currentScale = m_pageItem->contentsScale(); // We want to end up with the target area filling the whole width of the viewport (if possible), // and centralized vertically where the user requested zoom. Thus our hotspot is the center of @@ -383,7 +434,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi QPointF endPosition = hotspot * endCSSScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); @@ -396,7 +447,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi // Use fuzzy compare with a fixed error to be able to deal with largish differences due to pixel rounding. if (fuzzyCompare(endItemScale, currentScale, 0.01)) { // If moving the viewport would expose more of the targetRect and move at least 40 pixels, update position but do not scale out. - QRectF currentContentRect(m_viewport->contentPos() / currentScale, viewportRect.size() / currentScale); + QRectF currentContentRect(m_viewportItem->contentPos() / currentScale, viewportRect.size() / currentScale); QRectF targetIntersection = endVisibleContentRect.intersected(targetArea); if (!currentContentRect.contains(targetIntersection) && (qAbs(endVisibleContentRect.top() - currentContentRect.top()) >= 40 || qAbs(endVisibleContentRect.left() - currentContentRect.left()) >= 40)) zoomAction = NoZoom; @@ -410,7 +461,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi switch (zoomAction) { case ZoomIn: - m_scaleStack.append(ScaleStackItem(currentScale, m_viewport->contentPos().x())); + m_scaleStack.append(ScaleStackItem(currentScale, m_viewportItem->contentPos().x())); m_zoomOutScale = endItemScale; break; case ZoomBack: { @@ -420,7 +471,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi // Recalculate endPosition and bound it according to new scale. endPosition.setY(hotspot.y() * endCSSScale - viewportHotspot.y()); endPosition.setX(lastScale.xPosition); - endPosRange = computePosRangeForItemAtScale(endItemScale); + endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); endVisibleContentRect = QRectF(endPosition / endItemScale, viewportRect.size() / endItemScale); break; @@ -435,19 +486,19 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi break; } - animateItemRectVisible(endVisibleContentRect); + animatePageItemRectVisible(endVisibleContentRect); } QRectF QtViewportInteractionEngine::nearestValidBounds() const { qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(currentCSSScale())); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); QPointF viewportHotspot = viewportRect.center(); - QPointF endPosition = m_viewport->mapToWebContent(viewportHotspot) * endItemScale - viewportHotspot; + QPointF endPosition = m_viewportItem->mapToWebContent(viewportHotspot) * endItemScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); @@ -468,7 +519,7 @@ void QtViewportInteractionEngine::reset() m_pinchStartScale = -1; m_zoomOutScale = 0.0; - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); m_scaleAnimation->stop(); m_scaleUpdateDeferrer.clear(); m_scrollUpdateDeferrer.clear(); @@ -486,22 +537,22 @@ void QtViewportInteractionEngine::setCSSScale(qreal scale) ViewportUpdateDeferrer guard(this); qreal newScale = innerBoundedCSSScale(scale); - m_content->setContentsScale(itemScaleFromCSS(newScale)); + m_pageItem->setContentsScale(itemScaleFromCSS(newScale)); } qreal QtViewportInteractionEngine::currentCSSScale() const { - return cssScaleFromItem(m_content->contentsScale()); + return cssScaleFromItem(m_pageItem->contentsScale()); } bool QtViewportInteractionEngine::scrollAnimationActive() const { - return m_viewport->isFlicking(); + return m_viewportItem->isFlicking(); } bool QtViewportInteractionEngine::panGestureActive() const { - return m_viewport->isDragging(); + return m_viewportItem->isDragging(); } void QtViewportInteractionEngine::panGestureStarted(const QPointF& position, qint64 eventTimestampMillis) @@ -509,19 +560,19 @@ void QtViewportInteractionEngine::panGestureStarted(const QPointF& position, qin // This can only happen as a result of a user interaction. ASSERT(m_hadUserInteraction); - m_viewport->handleFlickableMousePress(position, eventTimestampMillis); + m_viewportItem->handleFlickableMousePress(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } void QtViewportInteractionEngine::panGestureRequestUpdate(const QPointF& position, qint64 eventTimestampMillis) { - m_viewport->handleFlickableMouseMove(position, eventTimestampMillis); + m_viewportItem->handleFlickableMouseMove(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } void QtViewportInteractionEngine::panGestureEnded(const QPointF& position, qint64 eventTimestampMillis) { - m_viewport->handleFlickableMouseRelease(position, eventTimestampMillis); + m_viewportItem->handleFlickableMouseRelease(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } @@ -534,7 +585,7 @@ void QtViewportInteractionEngine::panGestureCancelled() // back inside valid bounds. // When the pinch gesture ends, the content is positioned and scaled // back to valid boundaries. - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); } bool QtViewportInteractionEngine::scaleAnimationActive() const @@ -552,8 +603,9 @@ void QtViewportInteractionEngine::cancelScrollAnimation() // pan gesture, the animation is stopped and the content is // immediately positioned back to valid boundaries. - m_viewport->cancelFlick(); - setItemRectVisible(nearestValidBounds()); + m_viewportItem->cancelFlick(); + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); } void QtViewportInteractionEngine::interruptScaleAnimation() @@ -581,10 +633,7 @@ void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenter m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; - m_pinchStartScale = m_content->contentsScale(); - - // Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end. - emit informVisibleContentChange(QPointF()); + m_pinchStartScale = m_pageItem->contentsScale(); } void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInViewportCoordinates, qreal totalScaleFactor) @@ -601,12 +650,12 @@ void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinch // Allow zooming out beyond mimimum scale on pages that do not explicitly disallow it. const qreal targetCSSScale = outerBoundedCSSScale(cssScale); - scaleContent(m_viewport->mapToWebContent(pinchCenterInViewportCoordinates), targetCSSScale); + scaleContent(m_viewportItem->mapToWebContent(pinchCenterInViewportCoordinates), targetCSSScale); const QPointF positionDiff = pinchCenterInViewportCoordinates - m_lastPinchCenterInViewportCoordinates; m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; - m_viewport->setContentPos(m_viewport->contentPos() - positionDiff); + m_viewportItem->setContentPos(m_viewportItem->contentPos() - positionDiff); } void QtViewportInteractionEngine::pinchGestureEnded() @@ -618,7 +667,7 @@ void QtViewportInteractionEngine::pinchGestureEnded() m_pinchStartScale = -1; - animateItemRectVisible(nearestValidBounds()); + animatePageItemRectVisible(nearestValidBounds()); m_scaleUpdateDeferrer.clear(); // Clear after starting potential animation, which takes over deferring. } @@ -634,21 +683,22 @@ void QtViewportInteractionEngine::pinchGestureCancelled() * * FIXME: This is currently called twice if you concurrently change width and height. */ -void QtViewportInteractionEngine::itemSizeChanged() +void QtViewportInteractionEngine::pageItemSizeChanged() { if (m_suspendCount) return; - setItemRectVisible(nearestValidBounds()); + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); } void QtViewportInteractionEngine::scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale) { - QPointF oldPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); - m_content->setContentsScale(itemScaleFromCSS(cssScale)); - QPointF newPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); + QPointF oldPinchCenterOnViewport = m_viewportItem->mapFromWebContent(centerInCSSCoordinates); + m_pageItem->setContentsScale(itemScaleFromCSS(cssScale)); + QPointF newPinchCenterOnViewport = m_viewportItem->mapFromWebContent(centerInCSSCoordinates); - m_viewport->setContentPos(m_viewport->contentPos() + (newPinchCenterOnViewport - oldPinchCenterOnViewport)); + m_viewportItem->setContentPos(m_viewportItem->contentPos() + (newPinchCenterOnViewport - oldPinchCenterOnViewport)); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h index ba540d548..b7595e569 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h @@ -26,6 +26,7 @@ #include <QtCore/QRectF> #include <QtCore/QVariant> #include <QtCore/QVariantAnimation> +#include <WebCore/ViewportArguments.h> #include <wtf/OwnPtr.h> QT_BEGIN_NAMESPACE @@ -58,14 +59,15 @@ public: qreal currentCSSScale() const; void setAllowsUserScaling(bool allow) { m_allowsUserScaling = allow; } - void setContentToDevicePixelRatio(qreal ratio) {m_devicePixelRatio = ratio; } + void setDevicePixelRatio(qreal ratio) { m_devicePixelRatio = ratio; } - void setItemRectVisible(const QRectF&); - void animateItemRectVisible(const QRectF&); + void setPageItemRectVisible(const QRectF&); + void animatePageItemRectVisible(const QRectF&); QRectF nearestValidBounds() const; - void pagePositionRequest(const QPoint& pos); + void pageContentPositionRequest(const QPoint& pos); + void touchBegin(); void touchEnd(); @@ -73,11 +75,9 @@ public: void cancelScrollAnimation(); bool panGestureActive() const; - void panGestureStarted(const QPointF& position, qint64 eventTimestampMillis); void panGestureRequestUpdate(const QPointF& position, qint64 eventTimestampMillis); void panGestureEnded(const QPointF& position, qint64 eventTimestampMillis); - void panGestureCancelled(); bool scaleAnimationActive() const; @@ -92,32 +92,32 @@ public: void zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea); void focusEditableArea(const QRectF& caretArea, const QRectF& targetArea); + void viewportAttributesChanged(const WebCore::ViewportAttributes&); + void pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize); + Q_SIGNALS: void contentSuspendRequested(); void contentResumeRequested(); void informVisibleContentChange(const QPointF& trajectory = QPointF()); - void visibleContentRectAndScaleChanged(); - private Q_SLOTS: // Respond to changes of content that are not driven by us, like the page resizing itself. - void itemSizeChanged(); - - void flickableMovingPositionUpdate(); + void pageItemSizeChanged(); + void pageItemPositionChanged(); void scaleAnimationStateChanged(QAbstractAnimation::State, QAbstractAnimation::State); - void scaleAnimationValueChanged(QVariant value) { setItemRectVisible(value.toRectF()); } + void scaleAnimationValueChanged(QVariant value); - void flickableMoveStarted(); // Called when panning starts. - void flickableMoveEnded(); // Called when panning (+ kinetic animation) ends. + void flickMoveStarted(); // Called when panning starts. + void flickMoveEnded(); // Called when panning (+ kinetic animation) ends. private: friend class ViewportUpdateDeferrer; friend class ::QWebKitTest; - QQuickWebView* const m_viewport; - QQuickWebPage* const m_content; + QQuickWebView* const m_viewportItem; + QQuickWebPage* const m_pageItem; qreal cssScaleFromItem(qreal) const; qreal itemScaleFromCSS(qreal) const; @@ -127,6 +127,11 @@ private: qreal innerBoundedCSSScale(qreal) const; qreal outerBoundedCSSScale(qreal) const; + QRectF computePosRangeForPageItemAtScale(qreal itemScale) const; + void scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale); + + WebCore::ViewportAttributes m_rawAttributes; + bool m_allowsUserScaling; qreal m_minimumScale; qreal m_maximumScale; @@ -134,12 +139,9 @@ private: QSize m_layoutSize; - QRectF computePosRangeForItemAtScale(qreal itemScale) const; - - void scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale); - int m_suspendCount; bool m_hasSuspendedContent; + OwnPtr<ViewportUpdateDeferrer> m_scaleUpdateDeferrer; OwnPtr<ViewportUpdateDeferrer> m_scrollUpdateDeferrer; OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer; diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index c769c8b03..5132c7939 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -62,13 +62,29 @@ QtWebIconDatabaseClient::~QtWebIconDatabaseClient() WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0); } -void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo) +void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo) { - QUrl qUrl = WKURLCopyQUrl(pageURL); - toQtWebIconDatabaseClient(clientInfo)->requestIconForPageURL(qUrl); + emit toQtWebIconDatabaseClient(clientInfo)->iconChangedForPageURL(toImpl(pageURL)->string()); } -QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const QSize& iconSize) +WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL) +{ + String iconURL; + m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); + + if (iconURL.isEmpty()) + return String(); + + // Verify that the image data is actually available before reporting back + // a url, since clients assume that the url can be used directly. + WebCore::Image* iconImage = m_iconDatabase->imageForPageURL(pageURL); + if (!iconImage || iconImage->isNull()) + return String(); + + return iconURL; +} + +QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize) { MutexLocker locker(m_imageLock); @@ -84,33 +100,6 @@ QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const return nativeImage->toImage(); } -unsigned QtWebIconDatabaseClient::iconURLHashForPageURL(const String& pageURL) -{ - String iconURL; - m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); - return StringHash::hash(iconURL); -} - -void QtWebIconDatabaseClient::requestIconForPageURL(const QUrl& pageURL) -{ - String pageURLString = WebCore::KURL(pageURL).string(); - if (iconImageForPageURL(pageURLString).isNull()) - return; - - unsigned iconID = iconURLHashForPageURL(pageURLString); - QUrl url; - url.setScheme(QStringLiteral("image")); - url.setHost(QStringLiteral("webicon")); - QString path; - path.append(QLatin1Char('/')); - path.append(QString::number(m_contextId)); - path.append(QLatin1Char('/')); - path.append(QString::number(iconID)); - url.setPath(path); - url.setEncodedFragment(pageURL.toEncoded()); - emit iconChangedForPageURL(pageURL, url); -} - void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL) { m_iconDatabase->retainIconForPageURL(pageURL); diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h index 933ad9abe..65e86e18c 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h @@ -49,18 +49,16 @@ public: QtWebIconDatabaseClient(QtWebContext*); ~QtWebIconDatabaseClient(); + WTF::String iconForPageURL(const WTF::String& pageURL); QImage iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize = QSize(32, 32)); + void retainIconForPageURL(const WTF::String&); void releaseIconForPageURL(const WTF::String&); -public Q_SLOTS: - void requestIconForPageURL(const QUrl&); - public: - Q_SIGNAL void iconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL); + Q_SIGNAL void iconChangedForPageURL(const QString& pageURL); private: - unsigned iconURLHashForPageURL(const WTF::String&); static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo); uint64_t m_contextId; RefPtr<WebKit::WebIconDatabase> m_iconDatabase; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index c1ebaac14..bbdc3a63b 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -436,7 +436,10 @@ void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, return; if (wasEventHandled || event.type() == WebEvent::TouchCancel) { - resetGestureRecognizers(); + m_panGestureRecognizer.cancel(); + m_pinchGestureRecognizer.cancel(); + if (event.type() != WebEvent::TouchMove) + m_tapGestureRecognizer.cancel(); return; } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index ae3c4aab6..5cafad59c 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -102,6 +102,11 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) } } +void WebPageProxy::setUserScripts(const Vector<String>& scripts) +{ + process()->send(Messages::WebPage::SetUserScripts(scripts), m_pageID); +} + #if PLUGIN_ARCHITECTURE(X11) void WebPageProxy::createPluginContainer(uint64_t& windowID) { diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index a8d66839f..81196140e 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -68,7 +68,6 @@ 1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A17977E137EE82C00F97D45 /* PluginCreationParameters.h */; }; 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; }; 1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */; }; - 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; }; 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; }; 1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */; }; 1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */; }; @@ -178,8 +177,6 @@ 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */; }; 1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */; }; 1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9FBA8C13FF04E600DEED67 /* PluginComplexTextInputState.h */; }; - 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; - 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; }; 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */; }; 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; }; @@ -196,7 +193,6 @@ 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; }; 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */; }; 1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */; }; - 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; }; 1AAF061412B01131008E49E2 /* PDFViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF061212B01131008E49E2 /* PDFViewController.h */; }; 1AAF061512B01131008E49E2 /* PDFViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF061312B01131008E49E2 /* PDFViewController.mm */; }; 1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */; }; @@ -452,7 +448,6 @@ 7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 7801C096142290C400FAF9AF /* WebHitTestResult.h */; }; 8CFECE941490F140002AAA32 /* EditorState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CFECE931490F140002AAA32 /* EditorState.cpp */; }; 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905620E812BC248B000799B6 /* WebMemorySampler.cpp */; }; 909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 905620E912BC248B000799B6 /* WebMemorySampler.h */; }; 909854EE12BC4E18000AD080 /* WebMemorySampler.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */; }; @@ -651,7 +646,6 @@ BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */; }; BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */; }; - BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; }; BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64696D11DBE603006455B0 /* ImmutableArray.cpp */; }; BC64697011DBE603006455B0 /* ImmutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64696E11DBE603006455B0 /* ImmutableArray.h */; }; BC646C1A11DD399F006455B0 /* WKBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */; }; @@ -697,7 +691,6 @@ BC8699B6116AADAA002A925B /* WKView.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8699B3116AADAA002A925B /* WKView.mm */; }; BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8699B4116AADAA002A925B /* WKViewInternal.h */; }; BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */; }; - BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC87DFA91018101400564216 /* libicucore.dylib */; }; BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8A501411765F5600757573 /* WKRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC9099801256A98200083756 /* WKStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90997F1256A98200083756 /* WKStringPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */; }; @@ -778,7 +771,6 @@ BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */; }; BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC812C91F59008F9C35 /* WKImageCG.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */; }; - BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCD0042C110C1E27003B8A67 /* CoreServices.framework */; }; BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD01397110FA420003B8A67 /* WKFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCD0139C110FA420003B8A67 /* WKFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD01398110FA420003B8A67 /* WKFrame.cpp */; }; BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -837,7 +829,6 @@ BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF501B3123EF602005955AE /* ThreadLauncherMac.mm */; }; BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF505E51243047B005955AE /* PlatformCertificateInfo.h */; }; BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */; }; - BCF5068512431861005955AE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; }; BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF50726124329AA005955AE /* WebCertificateInfo.h */; }; BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */; }; BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F851176CD6F00471A52 /* WebHistoryClient.h */; }; @@ -884,7 +875,6 @@ CD73BA53131B645B00EEDED2 /* WebFullScreenManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD73BA37131A29FE00EEDED2 /* WebFullScreenManager.cpp */; }; CDCA85C8132ABA4E00E961DF /* WKFullScreenWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */; }; CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */; }; - CDCA85D5132AC2B300E961DF /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDCA85D4132AC2B300E961DF /* IOKit.framework */; }; CDCA85EE132AD70100E961DF /* WebFullScreenManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85DE132AD05300E961DF /* WebFullScreenManagerProxyMac.mm */; }; CEDA12E2152CD1AE00D9E08D /* WebAlternativeTextClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEDA12DF152CCAE800D9E08D /* WebAlternativeTextClient.cpp */; }; CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */; }; @@ -2029,16 +2019,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */, - 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */, - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */, - CDCA85D5132AC2B300E961DF /* IOKit.framework in Frameworks */, - BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */, - BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */, - 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */, - BCF5068512431861005955AE /* Security.framework in Frameworks */, - 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp index 2d96feeb7..5c96eba48 100644 --- a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp @@ -30,6 +30,7 @@ #include "DataReference.h" #include <WebCore/ErrorsGtk.h> #include <WebCore/NotImplemented.h> +#include <WebCore/ResourceHandleInternal.h> #include <gio/gio.h> #include <glib/gi18n-lib.h> #include <wtf/gobject/GOwnPtr.h> @@ -147,6 +148,10 @@ void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* resource resourceHandle->setClient(m_downloadClient.get()); m_resourceHandle = resourceHandle; didStart(); + // If the handle already got a response, make sure the download client is notified. + ResourceHandleInternal* handleInternal = m_resourceHandle->getInternal(); + if (!handleInternal->m_response.isNull()) + m_downloadClient->didReceiveResponse(m_resourceHandle.get(), handleInternal->m_response); } void Download::cancel() diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 2653417bb..bbb6adbaf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -146,6 +146,11 @@ void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundleRef, WKBundlePageGroupR toImpl(bundleRef)->setFrameFlatteningEnabled(toImpl(pageGroupRef), enabled); } +void WKBundleSetPluginsEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) +{ + toImpl(bundleRef)->setPluginsEnabled(toImpl(pageGroupRef), enabled); +} + void WKBundleSetGeolocationPermission(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) { toImpl(bundleRef)->setGeoLocationPermission(toImpl(pageGroupRef), enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp index a699eabaa..ae69a5394 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp @@ -55,11 +55,6 @@ void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, l return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string()); } -void WKBundleInspectorSetJavaScriptProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) -{ - toImpl(inspectorRef)->setJavaScriptProfilingEnabled(enabled); -} - void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) { if (enabled) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h index 593d90aa5..e32fdf25e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h @@ -44,7 +44,6 @@ WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector); WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector); WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script); -WK_EXPORT void WKBundleInspectorSetJavaScriptProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); #ifdef __cplusplus diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index 5c47618c7..ccda367f6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -69,6 +69,7 @@ WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, W WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); +WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 5db3de7f2..c6e9a60b5 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -196,6 +196,13 @@ void InjectedBundle::setFrameFlatteningEnabled(WebPageGroupProxy* pageGroup, boo (*iter)->settings()->setFrameFlatteningEnabled(enabled); } +void InjectedBundle::setPluginsEnabled(WebPageGroupProxy* pageGroup, bool enabled) +{ + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); + for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) + (*iter)->settings()->setPluginsEnabled(enabled); +} + void InjectedBundle::setGeoLocationPermission(WebPageGroupProxy* pageGroup, bool enabled) { #if ENABLE(GEOLOCATION) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index 66111ffbb..5ba1a2f27 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -108,6 +108,7 @@ public: void setAllowUniversalAccessFromFileURLs(WebPageGroupProxy*, bool); void setAllowFileAccessFromFileURLs(WebPageGroupProxy*, bool); void setFrameFlatteningEnabled(WebPageGroupProxy*, bool); + void setPluginsEnabled(WebPageGroupProxy*, bool); void setGeoLocationPermission(WebPageGroupProxy*, bool); void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool); void setPrivateBrowsingEnabled(WebPageGroupProxy*, bool); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 4b78c5a29..c06f11b36 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -45,6 +45,7 @@ #include "WebProcess.h" #include "WebSearchPopupMenu.h" #include <WebCore/AXObjectCache.h> +#include <WebCore/ColorChooser.h> #include <WebCore/DatabaseTracker.h> #include <WebCore/FileChooser.h> #include <WebCore/FileIconLoader.h> @@ -595,6 +596,14 @@ bool WebChromeClient::paintCustomOverhangArea(GraphicsContext* context, const In return true; } +#if ENABLE(INPUT_TYPE_COLOR) +PassOwnPtr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserClient*, const Color&) +{ + notImplemented(); + return nullptr; +} +#endif + void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser) { if (m_page->activeOpenPanelResultListener()) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 59e7688cc..18e04db80 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -153,6 +153,10 @@ private: virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; +#if ENABLE(INPUT_TYPE_COLOR) + virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE; +#endif + virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>) OVERRIDE; virtual void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader*) OVERRIDE; @@ -212,6 +216,10 @@ private: virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE; virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { } +#if ENABLE(REGISTER_PROTOCOL_HANDLER) + virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) OVERRIDE { } +#endif + String m_cachedToolTip; mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; mutable bool m_cachedMainFrameHasHorizontalScrollbar; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index b17240d5e..03d599d91 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -457,7 +457,7 @@ void WebEditorClient::setInputMethodState(bool) notImplemented(); } -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) +void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { notImplemented(); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index 6693ca257..4b930daf5 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -100,10 +100,12 @@ private: virtual NSURL* canonicalizeURLString(NSString*) OVERRIDE; #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) virtual void uppercaseWord() OVERRIDE; virtual void lowercaseWord() OVERRIDE; virtual void capitalizeWord() OVERRIDE; +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool show) OVERRIDE; virtual bool substitutionsPanelIsShowing() OVERRIDE; virtual void toggleSmartInsertDelete() OVERRIDE; @@ -143,7 +145,7 @@ private: virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) OVERRIDE; virtual void willSetInputMethodState() OVERRIDE; virtual void setInputMethodState(bool enabled) OVERRIDE; - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE; + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE; #if PLATFORM(GTK) virtual bool shouldShowUnicodeMenu() OVERRIDE; #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index b01f3febf..3f3c06fc7 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -73,6 +73,10 @@ #include <WebCore/Widget.h> #include <WebCore/WindowFeatures.h> +#if ENABLE(WEB_INTENTS) +#include <WebCore/IntentRequest.h> +#endif + using namespace WebCore; namespace WebKit { @@ -1515,6 +1519,13 @@ bool WebFrameLoaderClient::shouldCacheResponse(DocumentLoader*, unsigned long id } #endif // PLATFORM(WIN) && USE(CFNETWORK) +#if ENABLE(WEB_INTENTS) +void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest>) +{ + notImplemented(); +} +#endif + bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) const { notImplemented(); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index af5d6df0a..a2726cc37 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -28,6 +28,12 @@ #include <WebCore/FrameLoaderClient.h> +namespace WebCore { +#if ENABLE(WEB_INTENTS) +class IntentRequest; +#endif +} + namespace WebKit { class PluginView; @@ -215,7 +221,11 @@ private: // FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>. virtual bool shouldCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&, const unsigned char* data, unsigned long long length) OVERRIDE; #endif - + +#if ENABLE(WEB_INTENTS) + virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; +#endif + virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const OVERRIDE; virtual void didChangeScrollOffset() OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm index 651d0dd8f..10f520de4 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -160,6 +160,7 @@ void WebEditorClient::capitalizeWord() changeWordCase(m_page, @selector(capitalizedString)); } +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::showSubstitutionsPanel(bool) { notImplemented(); @@ -231,6 +232,7 @@ void WebEditorClient::toggleAutomaticSpellingCorrection() { notImplemented(); } +#endif // USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp index 87573f9ea..68d3b0c41 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp @@ -195,10 +195,8 @@ void WebInspector::setJavaScriptProfilingEnabled(bool enabled) m_page->corePage()->inspectorController()->show(); if (!m_frontendClient) return; - if (enabled) - m_page->corePage()->inspectorController()->enableProfiler(); - else - m_page->corePage()->inspectorController()->disableProfiler(); + + m_page->corePage()->inspectorController()->setProfilerEnabled(enabled); #endif } diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index a07b675f9..6f1827cc1 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -2146,10 +2146,11 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra send(Messages::WebPageProxy::DidPerformDragControllerAction(WebCore::DragSession())); #if PLATFORM(QT) QMimeData* data = const_cast<QMimeData*>(dragData.platformData()); + delete data; #elif PLATFORM(GTK) DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData()); + data->deref(); #endif - delete data; return; } @@ -2177,10 +2178,11 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra // DragData does not delete its platformData so we need to do that here. #if PLATFORM(QT) QMimeData* data = const_cast<QMimeData*>(dragData.platformData()); + delete data; #elif PLATFORM(GTK) DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData()); + data->deref(); #endif - delete data; } #else diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 4b2b76c8c..3b7e6e64f 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -523,6 +523,7 @@ public: void registerApplicationScheme(const String& scheme); void applicationSchemeReply(const QtNetworkReplyData&); void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*); + void setUserScripts(const Vector<String>&); #endif void wheelEvent(const WebWheelEvent&); #if ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 4bab8ac42..f14fcb6c9 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -40,6 +40,7 @@ messages -> WebPage { #if ENABLE(TOUCH_EVENTS) TouchEvent(WebKit::WebTouchEvent event) TouchEventSyncForTesting(WebKit::WebTouchEvent event) -> (bool handled) +#endif #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT) HighlightPotentialActivation(WebCore::IntPoint point, WebCore::IntSize area) #endif @@ -68,6 +69,7 @@ messages -> WebPage { #if PLATFORM(QT) ApplicationSchemeReply(WebKit::QtNetworkReplyData reply) RegisterApplicationScheme(WTF::String scheme) + SetUserScripts(WTF::Vector<WTF::String> script) #endif StopLoadingFrame(uint64_t frameID) @@ -140,17 +142,17 @@ messages -> WebPage { HideFindUI() CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount) -#if ENABLE(DRAG_SUPPORT) # Drag and drop. -#if PLATFORM(WIN) +#if PLATFORM(WIN) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags) #endif -#if PLATFORM(QT) || PLATFORM(GTK) +#if (PLATFORM(QT) || PLATFORM(GTK)) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::DragData dragData) #endif -#if !PLATFORM(WIN) && !PLATFORM(QT) && !PLATFORM(GTK) +#if !PLATFORM(WIN) && !PLATFORM(QT) && !PLATFORM(GTK) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::SandboxExtension::HandleArray sandboxExtensionsForUpload) #endif +#if ENABLE(DRAG_SUPPORT) DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 40071982b..2e90a7360 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -32,10 +32,12 @@ #include "WebEvent.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" +#include <WebCore/DOMWrapperWorld.h> #include <WebCore/FocusController.h> #include <WebCore/Frame.h> #include <WebCore/KeyboardEvent.h> #include <WebCore/Page.h> +#include <WebCore/PageGroup.h> #include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/Range.h> #include <WebCore/Settings.h> @@ -411,4 +413,13 @@ void WebPage::applicationSchemeReply(const QtNetworkReplyData& replyData) networkReply->finalize(); } +void WebPage::setUserScripts(const Vector<String>& scripts) +{ + // This works because we keep an unique page group for each Page. + PageGroup* pageGroup = PageGroup::pageGroup(this->pageGroup()->identifier()); + pageGroup->removeUserScriptsFromWorld(mainThreadNormalWorld()); + for (unsigned i = 0; i < scripts.size(); ++i) + pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 15cb28e80..2b0382dba 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -1044,8 +1044,10 @@ void WebProcess::setTextCheckerState(const TextCheckerState& textCheckerState) void WebProcess::didGetPlugins(CoreIPC::Connection*, uint64_t requestID, const Vector<WebCore::PluginInfo>& plugins) { +#if USE(PLATFORM_STRATEGIES) // Pass this to WebPlatformStrategies.cpp. handleDidGetPlugins(requestID, plugins); +#endif } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm index 63e7ba5d1..48ac2f338 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -32,7 +32,6 @@ #import "WebProcess.h" #import "WebSystemInterface.h" #import <WebCore/RunLoop.h> -#import <WebKit2/WKView.h> #import <WebKitSystemInterface.h> #import <mach/mach_error.h> #import <objc/objc-auto.h> diff --git a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp index 1e10baaf1..22b09fd30 100644 --- a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp +++ b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp @@ -22,11 +22,11 @@ #include "DataReference.h" #include "MessageID.h" +#include "WebErrors.h" #include "WebKitSoupRequestGeneric.h" #include "WebKitSoupRequestInputStream.h" #include "WebProcess.h" #include "WebSoupRequestManagerProxyMessages.h" -#include <WebCore/ErrorsGtk.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> #include <libsoup/soup-requester.h> @@ -99,7 +99,7 @@ void WebSoupRequestManager::didHandleURIRequest(const CoreIPC::DataReference& re } else { GOwnPtr<char> uriString(soup_uri_to_string(soup_request_get_uri(SOUP_REQUEST(request.get())), FALSE)); WebCore::ResourceRequest resourceRequest(String::fromUTF8(uriString.get())); - WebCore::ResourceError resourceError(WebCore::cannotShowURLError(resourceRequest)); + WebCore::ResourceError resourceError(cannotShowURLError(resourceRequest)); g_simple_async_result_set_error(result.get(), g_quark_from_string(resourceError.domain().utf8().data()), resourceError.errorCode(), "%s", resourceError.localizedDescription().utf8().data()); } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index dc7b4cb6d..bb02686dd 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -255,3 +255,6 @@ EXPORTS ?isPageBoxVisible@Document@WebCore@@QAE_NH@Z ?suspendAnimations@AnimationController@WebCore@@QAEXXZ ?resumeAnimations@AnimationController@WebCore@@QAEXXZ + ?setAllowsRoundingHacks@TextRun@WebCore@@SAX_N@Z + ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ + ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 96c0f7f41..6457b64c5 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -109,6 +109,8 @@ _ZNK7WebCore14DocumentMarker11descriptionEv; _ZN7WebCore8Document16isPageBoxVisibleEi; _ZN7WebCore19AnimationController17suspendAnimationsEv; _ZN7WebCore19AnimationController16resumeAnimationsEv; +_ZN7WebCore19InspectorController18setProfilerEnabledEb; +_ZN7WebCore19InspectorController15profilerEnabledEv; _ZNK7WebCore19InspectorController12getHighlightEPNS_9HighlightE; _ZN7WebCore24InspectorInstrumentation26instrumentingAgentsForPageEPNS_4PageE; _ZN7WebCore24InspectorInstrumentation17s_frontendCounterE; @@ -145,6 +147,7 @@ _ZN7WebCore8Document34webkitDidEnterFullScreenForElementEPNS_7ElementE; _ZN7WebCore8Document34webkitWillExitFullScreenForElementEPNS_7ElementE; _ZN7WebCore8Document35webkitWillEnterFullScreenForElementEPNS_7ElementE; _ZN7WebCore17JSDOMGlobalObject6s_infoE; +_ZN7WebCore7TextRun22setAllowsRoundingHacksEb; local: _Z*; cti*; diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 985b5562e..1a7514473 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -39,6 +39,7 @@ SET(ENABLE_GLIB_SUPPORT ON) SET(WTF_USE_SOUP 1) ADD_DEFINITIONS(-DWTF_USE_SOUP=1) +ADD_DEFINITIONS(-DBUILDING_SOUP__=1) ADD_DEFINITIONS(-DENABLE_CONTEXT_MENUS=0) @@ -66,6 +67,8 @@ SET(VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/eflsymbols.filter" WEBKIT_OPTION_BEGIN() WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FAST_MOBILE_SCROLLING ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS ON) diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index 5e40271f2..2b9a7787e 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -20,6 +20,8 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_CHANNEL_MESSAGING "Toggle MessageChannel and MessagePort support" ON) WEBKIT_OPTION_DEFINE(ENABLE_CSS3_FLEXBOX "Toggle CSS3 Flexbox support" ON) WEBKIT_OPTION_DEFINE(ENABLE_CSS_FILTERS "Toggle CSS Filters support" OFF) + WEBKIT_OPTION_DEFINE(ENABLE_CSS_IMAGE_RESOLUTION "Toggle CSS image-resolution support" OFF) + WEBKIT_OPTION_DEFINE(ENABLE_CSS_IMAGE_SET "Toggle CSS image-set support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_SHADERS "Toggle CSS Shaders (within CSS Filters) support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_VARIABLES "Toggle CSS Variables support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_DATALIST "Toggle HTML5 datalist support" OFF) diff --git a/Source/cmake/WebKitHelpers.cmake b/Source/cmake/WebKitHelpers.cmake index 1f372cc6c..d78d69608 100644 --- a/Source/cmake/WebKitHelpers.cmake +++ b/Source/cmake/WebKitHelpers.cmake @@ -1,7 +1,7 @@ # Sets extra compile flags for a target, depending on the compiler being used. # Currently, only GCC is supported. MACRO(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target) - IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + IF (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") GET_TARGET_PROPERTY(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS) IF (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND") SET(OLD_COMPILE_FLAGS "") diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index d274e9792..59b682d0a 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -14,6 +14,8 @@ #cmakedefine01 ENABLE_CHANNEL_MESSAGING #cmakedefine01 ENABLE_CLIENT_BASED_GEOLOCATION #cmakedefine01 ENABLE_CSS3_FLEXBOX +#cmakedefine01 ENABLE_CSS_IMAGE_RESOLUTION +#cmakedefine01 ENABLE_CSS_IMAGE_SET #cmakedefine01 ENABLE_DATALIST #cmakedefine01 ENABLE_DATA_TRANSFER_ITEMS #cmakedefine01 ENABLE_DETAILS diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/config.json b/Tools/BuildSlaveSupport/build.webkit.org-config/config.json index 6e8d1c7ff..dc62cd8fc 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/config.json +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/config.json @@ -3,12 +3,7 @@ { "name": "apple-xserve-4", "platform": "mac-snowleopard" }, - { "name": "apple-xserve-5", "platform": "mac-snowleopard" }, - { "name": "apple-xserve-6", "platform": "mac-snowleopard" }, - { "name": "apple-xserve-7", "platform": "mac-snowleopard" }, - { "name": "apple-xserve-8", "platform": "mac-snowleopard" }, { "name": "apple-xserve-9", "platform": "mac-snowleopard" }, - { "name": "apple-macpro-7", "platform": "mac-snowleopard" }, { "name": "apple-macpro-3", "platform": "mac-lion" }, { "name": "apple-macpro-4", "platform": "mac-lion" }, @@ -75,34 +70,16 @@ "builders": [ { "name": "SnowLeopard Intel Release (Build)", "type": "Build", "builddir": "snowleopard-intel-release", "platform": "mac-snowleopard", "configuration": "release", "architectures": ["x86_64"], - "triggers": ["snowleopard-intel-release-tests", "snowleopard-intel-release-tests-wk2"], "slavenames": ["apple-xserve-4", "test-slave"] }, { "name": "SnowLeopard Intel Debug (Build)", "type": "Build", "builddir": "snowleopard-intel-debug", "platform": "mac-snowleopard", "configuration": "debug", "architectures": ["x86_64"], - "triggers": ["snowleopard-intel-debug-tests", "snowleopard-intel-debug-tests-wk2"], "slavenames": ["apple-xserve-9"] }, - { "name": "SnowLeopard Intel Release (Tests)", "type": "Test", "builddir": "snowleopard-intel-release-tests", - "platform": "mac-snowleopard", "configuration": "release", "architectures": ["x86_64"], - "slavenames": ["apple-xserve-5", "apple-xserve-6", "test-slave"] - }, - { "name": "SnowLeopard Intel Debug (Tests)", "type": "Test", "builddir": "snowleopard-intel-debug-tests", - "platform": "mac-snowleopard", "configuration": "debug", "architectures": ["x86_64"], - "slavenames": ["apple-xserve-8"] - }, { "name": "Lion Leaks", "type": "BuildAndTestLeaks", "builddir": "lion-intel-leaks", "platform": "mac-lion", "configuration": "debug", "architectures": ["x86_64"], "slavenames": ["apple-macpro-3"] }, - { "name": "SnowLeopard Intel Release (WebKit2 Tests)", "type": "TestWebKit2", "builddir": "snowleopard-intel-release-tests-wk2", - "platform": "mac-snowleopard", "configuration": "release", "architectures": ["x86_64"], - "slavenames": ["apple-xserve-7", "test-slave"] - }, - { "name": "SnowLeopard Intel Debug (WebKit2 Tests)", "type": "TestWebKit2", "builddir": "snowleopard-intel-debug-tests-wk2", - "platform": "mac-snowleopard", "configuration": "debug", "architectures": ["x86_64"], - "slavenames": ["apple-macpro-7"] - }, { "name": "Lion Debug (Build)", "type": "Build", "builddir": "lion-intel-debug", "platform": "mac-lion", "configuration": "debug", "architectures": ["x86_64"], "triggers": ["lion-intel-debug-tests", "lion-intel-debug-tests-wk2"], @@ -340,18 +317,6 @@ { "type": "Triggerable", "name": "lion-intel-debug-tests-wk2", "builderNames": ["Lion Debug (WebKit2 Tests)"] }, - { "type": "Triggerable", "name": "snowleopard-intel-release-tests", - "builderNames": ["SnowLeopard Intel Release (Tests)"] - }, - { "type": "Triggerable", "name": "snowleopard-intel-release-tests-wk2", - "builderNames": ["SnowLeopard Intel Release (WebKit2 Tests)"] - }, - { "type": "Triggerable", "name": "snowleopard-intel-debug-tests", - "builderNames": ["SnowLeopard Intel Debug (Tests)"] - }, - { "type": "Triggerable", "name": "snowleopard-intel-debug-tests-wk2", - "builderNames": ["SnowLeopard Intel Debug (WebKit2 Tests)"] - }, { "type": "Triggerable", "name": "win-release-tests", "builderNames": ["Windows 7 Release (Tests)"] }, diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt index dccf023d1..689467061 100644 --- a/Tools/CMakeLists.txt +++ b/Tools/CMakeLists.txt @@ -1,6 +1,8 @@ IF ("${PORT}" STREQUAL "Efl") - ADD_SUBDIRECTORY(DumpRenderTree/efl) - ADD_SUBDIRECTORY(EWebLauncher) + IF (ENABLE_WEBKIT) + ADD_SUBDIRECTORY(DumpRenderTree/efl) + ADD_SUBDIRECTORY(EWebLauncher) + ENDIF () ELSEIF ("${PORT}" STREQUAL "WinCE") ADD_SUBDIRECTORY(WinCELauncher) ENDIF() diff --git a/Tools/ChangeLog b/Tools/ChangeLog index e86900fe5..63af81316 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,937 @@ +2012-06-01 Ryosuke Niwa <rniwa@webkit.org> + + Add public page loading performance tests using web-page-replay + https://bugs.webkit.org/show_bug.cgi?id=84008 + + Reviewed by Dirk Pranke. + + Add the primitive implementation of replay performance tests. We use web-page-replay (http://code.google.com/p/web-page-replay/) + to cache data locally. Each replay test is represented by a text file with .replay extension containing a single URL. + To hash out bugs and isolate them from the rest of performance tests, replay tests are hidden behind --replay flag. + + Run "run-perf-tests --replay PerformanceTests/Replay" after changing the system network preference to forward HTTP and HTTPS requests + to localhost:8080 and localhost:8443 respectively (i.e. configure the system as if there are HTTP proxies at ports 8080 and 8443) + excluding: *.webkit.org, *.googlecode.com, *.sourceforge.net, pypi.python.org, and www.adambarth.com for thirdparty Python dependencies. + run-perf-tests starts web-page-replay, which provides HTTP proxies at ports 8080 and 8443 to replay pages. + + * Scripts/webkitpy/layout_tests/port/driver.py: + (Driver.is_external_http_test): Added. + * Scripts/webkitpy/layout_tests/port/webkit.py: + (WebKitDriver._command_from_driver_input): Allow test names that starts with http:// or https://. + * Scripts/webkitpy/performance_tests/perftest.py: + (PerfTest.__init__): Takes port. + (PerfTest.prepare): Added. Overridden by ReplayPerfTest. + (PerfTest): + (PerfTest.run): Calls run_single. + (PerfTest.run_single): Extracted from PageLoadingPerfTest.run. + (ChromiumStylePerfTest.__init__): + (PageLoadingPerfTest.__init__): + (PageLoadingPerfTest.run): + (ReplayServer): Added. Responsible for starting and stopping replay.py in the web-page-replay. + (ReplayServer.__init__): + (ReplayServer.wait_until_ready): Wait until port 8080 is ready. I have tried looking at the piped output from web-page-replay + but it caused a dead lock on some web pages. + (ReplayServer.stop): + (ReplayServer.__del__): + (ReplayPerfTest): + (ReplayPerfTest.__init__): + (ReplayPerfTest._start_replay_server): + (ReplayPerfTest.prepare): Creates test.wpr and test-expected.png to cache the page when a replay test is ran for the first time. + The subsequent runs of the same test will just use test.wpr. + (ReplayPerfTest.run_single): + (PerfTestFactory): + (PerfTestFactory.create_perf_test): + * Scripts/webkitpy/performance_tests/perftest_unittest.py: + (MainTest.test_parse_output): + (MainTest.test_parse_output_with_failing_line): + (TestPageLoadingPerfTest.test_run): + (TestPageLoadingPerfTest.test_run_with_bad_output): + (TestReplayPerfTest): + (TestReplayPerfTest.ReplayTestPort): + (TestReplayPerfTest.ReplayTestPort.__init__): + (TestReplayPerfTest.ReplayTestPort.__init__.ReplayTestDriver): + (TestReplayPerfTest.ReplayTestPort.__init__.ReplayTestDriver.run_test): + (TestReplayPerfTest.ReplayTestPort._driver_class): + (TestReplayPerfTest.MockReplayServer): + (TestReplayPerfTest.MockReplayServer.__init__): + (TestReplayPerfTest.MockReplayServer.stop): + (TestReplayPerfTest._add_file): + (TestReplayPerfTest._setup_test): + (TestReplayPerfTest.test_run_single): + (TestReplayPerfTest.test_run_single.run_test): + (TestReplayPerfTest.test_run_single_fails_without_webpagereplay): + (TestReplayPerfTest.test_prepare_fails_when_wait_until_ready_fails): + (TestReplayPerfTest.test_run_single_fails_when_output_has_error): + (TestReplayPerfTest.test_run_single_fails_when_output_has_error.run_test): + (TestReplayPerfTest.test_prepare): + (TestReplayPerfTest.test_prepare.run_test): + (TestReplayPerfTest.test_prepare_calls_run_single): + (TestReplayPerfTest.test_prepare_calls_run_single.run_single): + (TestPerfTestFactory.test_regular_test): + (TestPerfTestFactory.test_inspector_test): + (TestPerfTestFactory.test_page_loading_test): + * Scripts/webkitpy/performance_tests/perftestsrunner.py: + (PerfTestsRunner): + (PerfTestsRunner._parse_args): Added --replay flag to enable replay tests. + (PerfTestsRunner._collect_tests): Collect .replay files when replay tests are enabled. + (PerfTestsRunner._collect_tests._is_test_file): + (PerfTestsRunner.run): Exit early if one of calls to prepare() fails. + * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py: + (create_runner): + (run_test): + (_tests_for_runner): + (test_run_test_set): + (test_run_test_set_kills_drt_per_run): + (test_run_test_pause_before_testing): + (test_run_test_set_for_parser_tests): + (test_run_test_set_with_json_output): + (test_run_test_set_with_json_source): + (test_run_test_set_with_multiple_repositories): + (test_run_with_upload_json): + (test_upload_json): + (test_upload_json.MockFileUploader.upload_single_text_file): + (_add_file): + (test_collect_tests): + (test_collect_tests_with_multile_files): + (test_collect_tests_with_multile_files.add_file): + (test_collect_tests_with_skipped_list): + (test_collect_tests_with_page_load_svg): + (test_collect_tests_should_ignore_replay_tests_by_default): + (test_collect_tests_with_replay_tests): + (test_parse_args): + * Scripts/webkitpy/thirdparty/__init__.py: Added the dependency for web-page-replay version 1.1.1. + (AutoinstallImportHook.find_module): + (AutoinstallImportHook._install_webpagereplay): + +2012-05-31 Yaron Friedman <yfriedman@chromium.org> + + Support building the Android port of chromium with Ninja + https://bugs.webkit.org/show_bug.cgi?id=87545 + + Reviewed by Adam Barth. + + Ensures that shared libraries are looked up in a generator-agnostic + way and that output is placed in the correct directory. + + Depends on http://codereview.chromium.org/10386188/ + + * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp: + +2012-05-31 Ryosuke Niwa <rniwa@webkit.org> + + [Chromium] Chromium DRT should be able to load external resources + https://bugs.webkit.org/show_bug.cgi?id=87893 + + Reviewed by Dirk Pranke. + + Allow external resources to be loaded when the main frame's URL is also an external resource. + This change is analogous to r118231 for Mac port. + + * DumpRenderTree/chromium/WebViewHost.cpp: + (blockRequest): + (isLocalhost): + (hostIsUsedBySomeTestsToGenerateError): + (WebViewHost::willSendRequest): + +2012-05-31 Anders Carlsson <andersca@apple.com> + + Build fixes. + + Disable the C++11 extensions warning. + + * DumpRenderTree/mac/Configurations/Base.xcconfig: + * TestWebKitAPI/Configurations/Base.xcconfig: + * WebKitTestRunner/Configurations/Base.xcconfig: + +2012-05-31 Alexey Proskuryakov <ap@apple.com> + + [WK2] window.internals settings are not reset between tests + https://bugs.webkit.org/show_bug.cgi?id=87783 + + Reviewed by Mihai Parparita. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::done): Call resetAfterTest(). + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::prepare): Renamed from "reset" for clarity. + (WTR::InjectedBundlePage::resetAfterTest): Added a function that resets internals. + This needs to be done after a tets, because the code assumes that there is an object + with this name in global scope. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: + +2012-05-31 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][DRT] EFL's DRT navigation_policy_decision implementation + https://bugs.webkit.org/show_bug.cgi?id=85006 + + Reviewed by Tor Arne Vestbø. + + Added navigation_policy_decision implementation for DumpRenderTreeView. + Added LayoutTestController::setCustomPolicyDelegate implementation. + Modified LayoutTestController::waitForPolicyDelegate. + + * DumpRenderTree/efl/DumpRenderTree.cpp: + * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: + (DumpRenderTreeChrome::resetDefaultsToConsistentValues): + * DumpRenderTree/efl/DumpRenderTreeEfl.h: + * DumpRenderTree/efl/DumpRenderTreeView.cpp: + (navigationTypeToString): aux function + (onNavigationPolicyDecision): navigation_policy_decision implementation + (drtViewAdd): + * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: + (LayoutTestController::setCustomPolicyDelegate): + (LayoutTestController::waitForPolicyDelegate): + +2012-05-31 Jussi Kukkonen <jussi.kukkonen@intel.com> + + [EFL][DRT] LayoutTestController does not implement clearApplicationCacheForOrigin + https://bugs.webkit.org/show_bug.cgi?id=86195 + + Reviewed by Gustavo Noronha Silva. + + Implement clearApplicationCacheForOrigin in EFL + LayoutTestController. + + * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: + (LayoutTestController::clearApplicationCacheForOrigin): + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + * DumpRenderTree/qt/EventSenderQt.cpp: + * DumpRenderTree/qt/QtInitializeTestFonts.cpp: + * DumpRenderTree/qt/main.cpp: + * QtTestBrowser/cookiejar.cpp: + * QtTestBrowser/launcherwindow.cpp: + * WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp: + * qmake/mkspecs/features/default_post.prf: + +2012-05-31 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Don't enforce the version of libpng for the config test when passing the option to the linker + + Rubber-stamped by Kenneth Rohde Christiansen. + + * qmake/config.tests/libpng/libpng.pro: + +2012-05-30 Peter Beverloo <peter@chromium.org> + + [Chromium] Automatically install 64-bit linker for Android + https://bugs.webkit.org/show_bug.cgi?id=79780 + + Reviewed by Adam Barth. + + Change the update-webkit-chromium script to check whether the 64-bit + linker needs to be installed as part of the update process. The actual + code for doing these checks and "installing" it has been added to the + webkitdirs.pm script. + + The linker itself is part of the third_party/aosp repository, which + will be pulled in through the DEPS change. + + * Scripts/update-webkit-chromium: + * Scripts/webkitdirs.pm: + (chromiumInstall64BitAndroidLinkerIfNeeded): + (chromiumReplaceAndroidLinkerIfNeeded): + +2012-05-30 Stephanie Lewis <slewis@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87803 + Layout tests often fail trying to stat nonexistent logs + + Reviewed by Dirk Pranke. + + CrashReporter removes logs using a heuristic to conserve space. Wrap a + try/catch block around accessing the logs as a precaution. + + * Scripts/webkitpy/common/system/crashlogs.py: + (CrashLogs._find_newest_log_darwin): + +2012-05-30 Gavin Peters <gavinp@chromium.org> + + Add a LayoutTest for prerender remove after stop. + https://bugs.webkit.org/show_bug.cgi?id=87860 + + These very boring mocks in DumpRenderTree mean that the basic Prerendering API + can be tested by LayoutTests now. + + Reviewed by Adam Barth. + + * DumpRenderTree/DumpRenderTree.gypi: + * DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp: Added. + (MockWebPrerenderingSupport::MockWebPrerenderingSupport): + (MockWebPrerenderingSupport::~MockWebPrerenderingSupport): + (MockWebPrerenderingSupport::add): + (MockWebPrerenderingSupport::cancel): + (MockWebPrerenderingSupport::abandon): + * DumpRenderTree/chromium/MockWebPrerenderingSupport.h: Added. + (MockWebPrerenderingSupport): + * DumpRenderTree/chromium/TestShell.cpp: + (TestShell::initialize): + * DumpRenderTree/chromium/TestShell.h: + (TestShell): + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::willAddPrerender): + (WebViewHost::setWebWidget): + * DumpRenderTree/chromium/WebViewHost.h: + (WebViewHost): + +2012-05-30 Stephanie Lewis <slewis@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87717 + Unresponsive WebProcesses can be mistaken for WebProcess crashes. + + Reviewed by Dirk Pranke. + + Change the error message from #CRASHED to #UNRESPONSIVE PROCESS + If there isn't a crash log found for the process add a message saying + the process was unresponsive. + + * Scripts/webkitpy/layout_tests/port/webkit.py: + (WebKitDriver.__init__): + (WebKitDriver._check_for_driver_crash): + (WebKitDriver.run_test): + * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: + (WebKitDriverTest.test_check_for_driver_crash.assert_crash): + (WebKitDriverTest): + (WebKitDriverTest.test_check_for_driver_crash): + * WebKitTestRunner/TestController.cpp: + (WTR): + (WTR::TestController::runTest): + +2012-05-30 Stephanie Lewis <slewis@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87714 + Mac crash logs can take a really long time to be written out. + + Reviewed by Dirk Pranke. + + Make a second pass looking for crash logs after the tests have completed running. + + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (use_trac_links_in_results_html): + (Manager.run): + * Scripts/webkitpy/layout_tests/port/base.py: + (Port.repository_paths): + (Port.look_for_new_crash_logs): + * Scripts/webkitpy/layout_tests/port/mac.py: + (MacPort.look_for_new_crash_logs): + * Scripts/webkitpy/layout_tests/port/mac_unittest.py: + (test_get_crash_log): + (test_look_for_new_crash_logs): + (test_look_for_new_crash_logs.fake_time_cb): + +2012-05-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Fix 2.9 issues with c_str() type by using the wx fprintf wrapper. + + * DumpRenderTree/wx/DumpRenderTreeWx.cpp: + (LayoutWebViewEventHandler::OnAlertEvent): + (LayoutWebViewEventHandler::OnConfirmEvent): + (LayoutWebViewEventHandler): + (LayoutWebViewEventHandler::OnPromptEvent): + (LayoutWebViewEventHandler::OnConsoleMessageEvent): + (LayoutWebViewEventHandler::OnReceivedTitleEvent): + +2012-05-30 Ojan Vafai <ojan@chromium.org> + + Only give lint errors for -expected.png png files that lack a checksum + https://bugs.webkit.org/show_bug.cgi?id=87875 + + Reviewed by Tony Chang. + + We have other pngs in the tree, e.g. for the inspector, that legitimately + lack a checksum. + + * Scripts/webkitpy/style/checkers/png.py: + (PNGChecker.check): + * Scripts/webkitpy/style/checkers/png_unittest.py: + (PNGCheckerTest.test_check): + +2012-05-30 Dirk Pranke <dpranke@chromium.org> + + nrwt: seems to leak temp dirs + https://bugs.webkit.org/show_bug.cgi?id=87795 + + Reviewed by Ojan Vafai. + + There appears to be a bug where the chromium bots are creating + temporary directories and not cleaning them up that started + after the switch to WebKitDriver. It's possible that __del__ + wasn't getting called in a timely manner (or at all), and it's + generally bad style to rely on __del__ being called, so this + code changes things so that we create a temp dir in + driver.start() and remove it in driver.stop(). We could be + paranoid and leave the __del__ code in, but there doesn't seem + to be much advantage to it. If there are bugs that result in + drivers being started but not stopped, we have other problems. + + * Scripts/webkitpy/common/system/filesystem_mock.py: + (MockFileSystem.__init__): + (MockFileSystem._mktemp): + (MockFileSystem.mkdtemp): + * Scripts/webkitpy/layout_tests/port/webkit.py: + (WebKitDriver.__init__): + (WebKitDriver._start): + (WebKitDriver.stop): + * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: + (WebKitDriverTest.test_check_for_driver_crash): + (WebKitDriverTest): + (WebKitDriverTest.test_creating_a_port_does_not_write_to_the_filesystem): + (WebKitDriverTest.test_stop_cleans_up_properly): + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] EFL's DRT should print the number of MessagePorts for new each new intent + https://bugs.webkit.org/show_bug.cgi?id=86841 + + Reviewed by Adam Barth. + + Print the number of MessagePorts for each new intent in EFL's DRT. + This output is expected by several Web Intents test cases. + + * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: + (DumpRenderTreeChrome::onFrameIntentNew): + +2012-05-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix after removal of setJavaScriptProfilingEnabled. + + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Ewk_Intent_Request's postResult/postFailure should take serialized script values in argument + https://bugs.webkit.org/show_bug.cgi?id=87829 + + Reviewed by Adam Barth. + + EFL's LayoutTestController now makes uses of the new helper method in + DumpRenderTreeSupportEfl in order to send the intent response. This is + now needed because the Ewk_Intent_Request postResult / postFailure + methods were made private. + + * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: + (LayoutTestController::sendWebIntentResponse): + +2012-05-30 Xueqing Huang <huangxueqing@baidu.com> + + eventSender.beginDragWithFiles should be implemented in Windows, which blocked drag and drop related tests. + https://bugs.webkit.org/show_bug.cgi?id=86296 + + Reviewed by Tony Chang. + + * DumpRenderTree/win/DRTDataObject.cpp: Added. + (cfHDropFormat): + (cfFileNameWFormat): + (cfUrlWFormat): + (WCEnumFormatEtc): + (WCEnumFormatEtc::WCEnumFormatEtc): + (WCEnumFormatEtc::QueryInterface): + (WCEnumFormatEtc::AddRef): + (WCEnumFormatEtc::Release): + (WCEnumFormatEtc::Next): + (WCEnumFormatEtc::Skip): + (WCEnumFormatEtc::Reset): + (WCEnumFormatEtc::Clone): + (DRTDataObject::createInstance): + (DRTDataObject::DRTDataObject): + (DRTDataObject::~DRTDataObject): + (DRTDataObject::QueryInterface): + (DRTDataObject::AddRef): + (DRTDataObject::Release): + (DRTDataObject::GetData): + (DRTDataObject::GetDataHere): + (DRTDataObject::QueryGetData): + (DRTDataObject::GetCanonicalFormatEtc): + (DRTDataObject::SetData): + (DRTDataObject::CopyMedium): + (DRTDataObject::EnumFormatEtc): + (DRTDataObject::DAdvise): + (DRTDataObject::DUnadvise): + (DRTDataObject::EnumDAdvise): + (DRTDataObject::clearData): + * DumpRenderTree/win/DRTDataObject.h: Added. + (DRTDataObject): + * DumpRenderTree/win/DRTDropSource.cpp: Added. + (DRTDropSource::DRTDropSource): + (DRTDropSource::~DRTDropSource): + (DRTDropSource::QueryInterface): + (DRTDropSource::AddRef): + (DRTDropSource::Release): + (DRTDropSource::createInstance): + (DRTDropSource::QueryContinueDrag): + (DRTDropSource::GiveFeedback): + * DumpRenderTree/win/DRTDropSource.h: Added. + (DRTDropSource): + * DumpRenderTree/win/DumpRenderTree.vcproj: + * DumpRenderTree/win/EventSender.cpp: + (beginDragWithFilesCallback): + +2012-05-30 Marcelo Lira <marcelo.lira@openbossa.org> + + WebKit2: Implement layoutTestController.setPluginsEnabled() in WebKitTestRunner. + https://bugs.webkit.org/show_bug.cgi?id=58593 + + Adds the ability to change the pluginsEnabled flag in WebCore::Settings + to WebKitTestRunner's LayoutTestController. The flag is modified via the + public C API of the WebProcess. + + Reviewed by Darin Adler. + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::setPluginsEnabled): Just calls the + WKBundleSetPluginsEnabled function in the public C API of WebProcess. + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + +2012-05-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][DRT] http/tests/navigation/new-window-redirect-history.html does not pass + https://bugs.webkit.org/show_bug.cgi?id=87848 + + Reviewed by Csaba Osztrogonác. + + The reason was that DumpRenderTreeChrome::extraViews() returned copy of the vector + and dumpBackForwardListForWebViews() used iterators belonging actually to different vectors + (browser->extraViews().begin() and browser->extraViews().end()) as if they had belonged to the same vector. + + * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: + (DumpRenderTreeChrome::extraViews): + * DumpRenderTree/efl/DumpRenderTreeChrome.h: + (DumpRenderTreeChrome): + +2012-05-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][DRT] EFL's DRT needs "postProgressFinishedNotification" message + https://bugs.webkit.org/show_bug.cgi?id=87833 + + Reviewed by Tor Arne Vestbø. + + Print "postProgressFinishedNotification" message if frame load finished + to unskip http/tests/loading/progress-finished-callback.html. + + * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: + (DumpRenderTreeChrome::onFrameLoadFinished): + +2012-05-30 Mariusz Grzegorczyk <mariusz.g@samsung.com>, Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Fix WebKit2-EFL build + https://bugs.webkit.org/show_bug.cgi?id=83693 + + Reviewed by Carlos Garcia Campos. + + * CMakeLists.txt: Guard Webkit1 related codes with ENABLE_WEBKIT. + +2012-05-29 János Badics <jbadics@inf.u-szeged.hu> + + [Qt] Modified ORWT and NRWT to check for test expectations in platform/qt-5.0-wk1 too + (They only used to check for Skipped in platform/qt-5.0-wk1) + https://bugs.webkit.org/show_bug.cgi?id=87376 + + Reviewed by Csaba Osztrogonác. + + * Scripts/old-run-webkit-tests: + (buildPlatformResultHierarchy): + * Scripts/webkitpy/layout_tests/port/qt.py: + (QtPort.baseline_search_path): + +2012-05-29 Ojan Vafai <ojan@chromium.org> + + Add a linter error for pngs that lack an embedded checksum + https://bugs.webkit.org/show_bug.cgi?id=87793 + + Reviewed by Dirk Pranke. + + * Scripts/read-checksum-from-png: + * Scripts/webkitpy/common/read_checksum_from_png.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png.py. + (read_checksum): + * Scripts/webkitpy/common/read_checksum_from_png_unittest.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png_unittest.py. + (ReadChecksumFromPngTest): + (ReadChecksumFromPngTest.test_read_checksum): + * Scripts/webkitpy/layout_tests/port/base.py: + * Scripts/webkitpy/style/checkers/png.py: + (PNGChecker.check): + * Scripts/webkitpy/style/checkers/png_unittest.py: + (PNGCheckerTest.test_check): + +2012-05-29 Stephanie Lewis <slewis@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87720 + WebProcess is often killed due to being unresponsive on the bots + + Reviewed by Alexey Proskuryakov. + + Blind attempt to improve flakiness on the bots by reducing the number + of crashes due to an unresponsive process. This helped on my personal machine + under stress conditions. I don't have enough cores to hit the problem + under normal conditions. + + * WebKitTestRunner/TestController.cpp: + (WTR): + +2012-05-29 Dirk Pranke <dpranke@chromium.org> + + webkitpy: rename 'rm' to 'delete' in rebaseline scm output + https://bugs.webkit.org/show_bug.cgi?id=87779 + + Reviewed by Eric Seidel. + + Update output to match the names in scm.py as per + https://bugs.webkit.org/show_bug.cgi?id=87451#c26 . + + * Scripts/webkitpy/tool/commands/rebaseline.py: + (RebaselineTest.execute): + * Scripts/webkitpy/tool/commands/rebaseline_unittest.py: + (test_rebaseline_test_and_print_scm_changes): + * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py: + (GardeningServerTest.test_rebaselineall): + +2012-05-29 Stephanie Lewis <slewis@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87711 + + Reviewed by Jessie Berlin. + + Remove Snowleopard testers so the hardware can be repurposed. The lion bots + are better maintained. + + * BuildSlaveSupport/build.webkit.org-config/config.json: + +2012-05-29 Dirk Pranke <dpranke@chromium.org> + + webkit-patch optimize-baselines should add/delete files in batches from the vcs + https://bugs.webkit.org/show_bug.cgi?id=87538 + + Reviewed by Ojan Vafai. + + Invoking git and svn on one file at a time is kinda slow. We + should batch the add and rm operations together. + + * Scripts/webkitpy/common/checkout/baselineoptimizer.py: + (BaselineOptimizer._move_baselines): + +2012-05-29 Dirk Pranke <dpranke@chromium.org> + + garden-o-matic should rebaseline baselines in parallel + https://bugs.webkit.org/show_bug.cgi?id=87451 + + Reviewed by Ojan Vafai. + + This modifies garden-o-matic so that we will fetch all + of the baselines in parallel from the bots, and then + optimize the baselines serially (since that should be fairly + quick and we get into trouble if we optimize in parallel due + to concurrent access to the source control system). + + This change adds a flag to webkit-patch rebaseline-test (--print-scm-changes) + so that the files that need to be modified in the SCM are returned to + garden-o-matic rather than actually added or removed. This is done so that + we can run multiple rebaseline-tests in parallel (we can't modify the SCM + concurrently). In order to safely return the files (as a JSON dict) I + needed to shift all of the logging in rebaseline-test to use the logging + module (and hence log to stderr). + + I also had to stub out a line in chromium.py that would get confused if + the skia overrides file didn't exist in a mock checkout. + + * Scripts/webkitpy/common/system/executive.py: + (Executive.popen): + (Executive): + (Executive.run_in_parallel): + (_run_command_thunk): + * Scripts/webkitpy/common/system/executive_mock.py: + (MockExecutive.run_in_parallel): + * Scripts/webkitpy/common/system/executive_unittest.py: + (ExecutiveTest.test_run_in_parallel): + * Scripts/webkitpy/layout_tests/port/chromium.py: + (ChromiumPort._expectations_file_contents): + * Scripts/webkitpy/tool/commands/rebaseline.py: + (AbstractRebaseliningCommand.__init__): + (RebaselineTest.__init__): + (RebaselineTest._copy_existing_baseline): + (RebaselineTest._save_baseline): + (RebaselineTest): + (RebaselineTest._add_to_scm): + (RebaselineTest._rebaseline_test): + (RebaselineTest.execute): + (RebaselineExpectations._rebaseline_port): + (RebaselineExpectations.execute): + (Rebaseline._builder_to_pull_from): + (Rebaseline.execute): + * Scripts/webkitpy/tool/commands/rebaseline_unittest.py: + (test_rebaseline_updates_expectations_file): + (test_rebaseline_test): + (test_rebaseline_test_and_print_scm_changes): + (test_rebaseline_and_copy_test): + (test_rebaseline_and_copy_test_no_existing_result): + (test_rebaseline_and_copy_test_with_lion_result): + (test_rebaseline_and_copy_no_overwrite_test): + (test_rebaseline_expectations): + * Scripts/webkitpy/tool/servers/gardeningserver.py: + (GardeningHTTPRequestHandler._rebaseline_commands): + (GardeningHTTPRequestHandler): + (GardeningHTTPRequestHandler._files_to_add): + (GardeningHTTPRequestHandler._optimize_baselines): + (GardeningHTTPRequestHandler.rebaselineall): + * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py: + (GardeningServerTest._post_to_path): + (GardeningServerTest.test_rebaselineall): + (GardeningServerTest.test_rebaselineall.run_command): + +2012-05-29 Benjamin Poulain <bpoulain@apple.com> + + Fix the type of dispatch_time() offset + + Rubber-stamped by Joseph Pecoraro. + + In r118631, I erroneously used the type NSTimeInterval for the delta of dispatch_time(). + + * DumpRenderTree/mac/FrameLoadDelegate.mm: + (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + 2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] OpenGL content is not rendered on simulator + https://bugs.webkit.org/show_bug.cgi?id=87721 + + Reviewed by George Staikos. + + Fixed by enabling GLES2 support in simulator builds. + + To experiment with building without OpenGL support, you can set the + DISABLE_GLES2 environment variable to a non-empty string and rebuild. + + PR #150695 + + * Scripts/webkitdirs.pm: + (blackberryCMakeArguments): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Scripts/webkitperl/FeatureList.pm: + * qmake/mkspecs/features/features.pri: + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Don't add cxx-flags to QMAKE_CFLAGS + + Prevents warnings such as: "command line option ‘-Wno-c++0x-compat’ is + valid for C++/ObjC++ but not for C [enabled by default]" + + Reviewed by Simon Hausmann. + + * qmake/mkspecs/features/unix/default_post.prf: + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Sync up favicon-implementation with WebView url changes in r118158 + + https://bugs.webkit.org/show_bug.cgi?id=87133 + + We now base64-encode the page url in the image-provider url, so that any + normalization done by QUrl will not mess up the page-url. The logic of + creating and parsing the provider-url has been moved into the image + provider, to keep it in one place. + + We were also releasing icons (even ones we hadn't retained), which we can't + do since we don't know when the icon url is no longer in use. + + Reviewed-by Simon Hausmann. + + * MiniBrowser/qt/icons/favicon.png: + * MiniBrowser/qt/qml/BrowserWindow.qml: + +2012-05-29 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL] Refactoring. Get rid of unnecessary singleCharacterString() function + https://bugs.webkit.org/show_bug.cgi?id=87654 + + Reviewed by Csaba Osztrogonác. + + Event sender provides strings for all the key events. + Also KeyEventInfo constructor parameters order was changed to simplify the case when + a key event has empty string. + + * DumpRenderTree/efl/EventSender.cpp: + (KeyEventInfo::KeyEventInfo): + (keyPadNameFromJSValue): + (keyNameFromJSValue): + +2012-05-23 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Cancel potential url-edit when going back/forward + + Reviewed by Kenneth Rohde Christiansen. + + * MiniBrowser/qt/qml/BrowserWindow.qml: + +2012-05-29 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Compilation warning in DumpRenderTreeView.cpp + https://bugs.webkit.org/show_bug.cgi?id=87636 + + Reviewed by Filip Pizlo. + + Fix compilation error in DumpRenderTreeView.cpp due to wrong format + specifier in printf. Also fix the return type for + onExceededApplicationCacheQuota callback. + + * DumpRenderTree/efl/DumpRenderTreeView.cpp: + (onExceededApplicationCacheQuota): + +2012-05-29 Hironori Bono <hbono@chromium.org> + + Adding Hironori Bono to committers.py. + https://bugs.webkit.org/show_bug.cgi?id=87697 + + * Scripts/webkitpy/common/config/committers.py: + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail + https://bugs.webkit.org/show_bug.cgi?id=80135 + + Reviewed by Rob Buis. + + Implemented interface function didReceiveAuthenticationChallenge in class + DumpRenderTree. + + Resubmit the patch reverted by r115104 after the digest infinite loop + issue for BlackBerry porting get identified and fixed. + + Internally reviewed by Joe Mason <jmason@rim.com> + + * DumpRenderTree/blackberry/DumpRenderTree.cpp: + (drtCredentialDescription): + (BlackBerry::WebKit::DumpRenderTree::didReceiveAuthenticationChallenge): + (WebKit): + * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h: + (WebCore): + (DumpRenderTree): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from DRT after its + move to windows.internals.settings. + + * DumpRenderTree/LayoutTestController.cpp: + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + (LayoutTestController): + * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp: + * DumpRenderTree/chromium/DRTDevToolsAgent.cpp: + * DumpRenderTree/chromium/DRTDevToolsAgent.h: + (DRTDevToolsAgent): + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::LayoutTestController): + * DumpRenderTree/chromium/LayoutTestController.h: + (LayoutTestController): + * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: + (DumpRenderTreeChrome::resetDefaultsToConsistentValues): + * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + * DumpRenderTree/mac/DumpRenderTree.mm: + (resetWebViewToConsistentStateBeforeTesting): + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController): + * DumpRenderTree/win/DumpRenderTree.cpp: + (resetWebViewToConsistentStateBeforeTesting): + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + (LayoutTestController): + +2012-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move allowRoundingHacks to Internals interface + https://bugs.webkit.org/show_bug.cgi?id=87328 + + Reviewed by Hajime Morita. + + Remove allowRoundingHacks functions, because it is able to work in the + cross-port way through the Internals interface. + + * DumpRenderTree/LayoutTestController.cpp: + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + (LayoutTestController): + * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp: + * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + +2012-05-28 Luke Macpherson <macpherson@chromium.org> + + Fix mac build with older XCode by defining NSEC_PER_MSEC. + https://bugs.webkit.org/show_bug.cgi?id=87616 + + Reviewed by Hajime Morita. + + The following patch introduced the use of NSEC_PER_MSEC which is not defined for older XCode versions. + http://trac.webkit.org/changeset/118631/trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm + Patch just adds a #ifndef / #define check. + + * DumpRenderTree/mac/FrameLoadDelegate.mm: + (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): + +2012-05-27 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] Enable blob support for the EFL port + https://bugs.webkit.org/show_bug.cgi?id=85363 + + Reviewed by Hajime Morita. + + Enable Blob support by default for the EFL port. + + * Scripts/webkitperl/FeatureList.pm: + +2012-05-27 Benjamin Poulain <bpoulain@apple.com> + + When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called + https://bugs.webkit.org/show_bug.cgi?id=87582 + + Reviewed by Darin Adler. + + Extend DumpRenderTree to support loading the main resource deferred with a delay. This makes it + possible to test pages in a similar way as they are loaded in Browsers. + + * DumpRenderTree/LayoutTestController.cpp: + (LayoutTestController::LayoutTestController): + (setUseDeferredFrameLoadingCallback): + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + (LayoutTestController::useDeferredFrameLoading): + (LayoutTestController::setUseDeferredFrameLoading): + (LayoutTestController): + * DumpRenderTree/mac/FrameLoadDelegate.mm: + (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): + 2012-05-27 David Barton <dbarton@mathscribe.com> [watchlist] Improve MathML rule diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index 92e6b104d..edae3aaeb 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -416,7 +416,7 @@ 'action_name': 'generate_and_build', 'inputs': [ '<(chromium_src_dir)/testing/android/generate_native_test.py', - '<(PRODUCT_DIR)/lib.target/libDumpRenderTree.so', + '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)DumpRenderTree<(SHARED_LIB_SUFFIX)', # FIXME: Build the jar for native tests with SDK. # For now we are using Android.mk to build the apk. ], @@ -426,14 +426,14 @@ 'action': [ '<(chromium_src_dir)/testing/android/generate_native_test.py', '--native_library', - '<(PRODUCT_DIR)/lib.target/libDumpRenderTree.so', + '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)DumpRenderTree<(SHARED_LIB_SUFFIX)', # FIXME: Build the jar for native tests with SDK. # '--jar', # 'foo/bar.jar', '--output', '<(PRODUCT_DIR)/DumpRenderTree_apk', '--ant-args', - '-DPRODUCT_DIR=<(PRODUCT_DIR)', + '-DPRODUCT_DIR=<(ant_build_out)', '--ant-compile' ], }], diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 55b58aed6..e8d88be74 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -24,6 +24,8 @@ 'chromium/MockGrammarCheck.h', 'chromium/MockSpellCheck.cpp', 'chromium/MockSpellCheck.h', + 'chromium/MockWebPrerenderingSupport.cpp', + 'chromium/MockWebPrerenderingSupport.h', 'chromium/MockWebSpeechInputController.cpp', 'chromium/MockWebSpeechInputController.h', 'chromium/NotificationPresenter.h', diff --git a/Tools/DumpRenderTree/LayoutTestController.cpp b/Tools/DumpRenderTree/LayoutTestController.cpp index f91c874d4..f1dee2419 100644 --- a/Tools/DumpRenderTree/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/LayoutTestController.cpp @@ -89,6 +89,7 @@ LayoutTestController::LayoutTestController(const std::string& testPathOrURL, con , m_handlesAuthenticationChallenges(false) , m_isPrinting(false) , m_deferMainResourceDataLoad(true) + , m_useDeferredFrameLoading(false) , m_shouldPaintBrokenImage(true) , m_shouldStayOnPageAfterHandlingBeforeUnload(false) , m_areDesktopNotificationPermissionRequestsIgnored(false) @@ -1231,6 +1232,17 @@ static JSValueRef setDefersLoadingCallback(JSContextRef context, JSObjectRef fun return JSValueMakeUndefined(context); } +static JSValueRef setUseDeferredFrameLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setUseDeferredFrameLoading(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} + static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has Mac and Windows implementation @@ -1388,17 +1400,6 @@ static JSValueRef setIconDatabaseEnabledCallback(JSContextRef context, JSObjectR return JSValueMakeUndefined(context); } -static JSValueRef setJavaScriptProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - controller->setJavaScriptProfilingEnabled(JSValueToBoolean(context, arguments[0])); - - return JSValueMakeUndefined(context); -} - static JSValueRef setMainFrameIsFirstResponderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac implementation @@ -2063,14 +2064,6 @@ static JSValueRef setSerializeHTTPLoadsCallback(JSContextRef context, JSObjectRe return JSValueMakeUndefined(context); } -static JSValueRef allowRoundingHacksCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - - controller->allowRoundingHacks(); - return JSValueMakeUndefined(context); -} - static JSValueRef setShouldStayOnPageAfterHandlingBeforeUnloadCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); @@ -2372,12 +2365,12 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setDeferMainResourceDataLoad", setDeferMainResourceDataLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setDefersLoading", setDefersLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setUseDeferredFrameLoading", setUseDeferredFrameLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAutomaticLinkDetectionEnabled", setAutomaticLinkDetectionEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMinimumTimerInterval", setMinimumTimerIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2431,7 +2424,6 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "originsWithLocalStorage", originsWithLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setTextDirection", setTextDirectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "allowRoundingHacks", allowRoundingHacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setShouldStayOnPageAfterHandlingBeforeUnload", setShouldStayOnPageAfterHandlingBeforeUnloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addChromeInputField", addChromeInputFieldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "removeChromeInputField", removeChromeInputFieldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/Tools/DumpRenderTree/LayoutTestController.h b/Tools/DumpRenderTree/LayoutTestController.h index 2b9f5fe24..6f02db3a1 100644 --- a/Tools/DumpRenderTree/LayoutTestController.h +++ b/Tools/DumpRenderTree/LayoutTestController.h @@ -100,7 +100,6 @@ public: void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme); void setDefersLoading(bool); void setIconDatabaseEnabled(bool iconDatabaseEnabled); - void setJavaScriptProfilingEnabled(bool profilingEnabled); void setJavaScriptCanAccessClipboard(bool flag); void setAutomaticLinkDetectionEnabled(bool flag); void setMainFrameIsFirstResponder(bool flag); @@ -282,6 +281,9 @@ public: bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; } void setDeferMainResourceDataLoad(bool flag) { m_deferMainResourceDataLoad = flag; } + bool useDeferredFrameLoading() const { return m_useDeferredFrameLoading; } + void setUseDeferredFrameLoading(bool flag) { m_useDeferredFrameLoading = flag; } + const std::string& testPathOrURL() const { return m_testPathOrURL; } const std::string& expectedPixelHash() const { return m_expectedPixelHash; } @@ -309,7 +311,6 @@ public: void evaluateInWebInspector(long callId, JSStringRef script); void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script); void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script); - void allowRoundingHacks(); bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } void setShouldStayOnPageAfterHandlingBeforeUnload(bool shouldStayOnPageAfterHandlingBeforeUnload) { m_shouldStayOnPageAfterHandlingBeforeUnload = shouldStayOnPageAfterHandlingBeforeUnload; } @@ -412,6 +413,7 @@ private: bool m_handlesAuthenticationChallenges; bool m_isPrinting; bool m_deferMainResourceDataLoad; + bool m_useDeferredFrameLoading; bool m_shouldPaintBrokenImage; bool m_shouldStayOnPageAfterHandlingBeforeUnload; bool m_areDesktopNotificationPermissionRequestsIgnored; diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index 620e6acd5..a19742c33 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -24,6 +24,7 @@ #include "BackForwardController.h" #include "BackForwardListImpl.h" #include "CString.h" +#include "Credential.h" #include "DatabaseTracker.h" #include "DocumentLoader.h" #include "DumpRenderTree/GCController.h" @@ -124,6 +125,12 @@ static String drtFrameDescription(WebCore::Frame* frame) return "frame (anonymous)"; } +static WTF::String drtCredentialDescription(WebCore::Credential&) +{ + // TODO: Implementation needed. + return "<unknown>"; +} + static bool shouldLogFrameLoadDelegates(const String& url) { return url.contains("loading/"); @@ -857,6 +864,20 @@ void DumpRenderTree::didReceiveResponseForFrame(WebCore::Frame* frame, const Web printf("%s has MIME type %s\n", response.url().lastPathComponent().utf8().data(), response.mimeType().utf8().data()); } +bool DumpRenderTree::didReceiveAuthenticationChallenge(WebCore::Credential& credential) +{ + if (!gLayoutTestController->handlesAuthenticationChallenges()) { + credential = WebCore::Credential(); + printf("%s - didReceiveAuthenticationChallenge - Simulating cancelled authentication\n", drtCredentialDescription(credential).utf8().data()); + return false; + } + const char* user = gLayoutTestController->authenticationUsername().c_str(); + const char* password = gLayoutTestController->authenticationPassword().c_str(); + credential = WebCore::Credential(user, password, WebCore::CredentialPersistenceForSession); + printf("%s - didReceiveAuthenticationChallenge - Responding with %s:%s\n", drtCredentialDescription(credential).utf8().data(), user, password); + return true; +} + } } diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index 2ff69161c..c6eba9d19 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -28,8 +28,9 @@ #include <wtf/Vector.h> namespace WebCore { -class Frame; +class Credential; class DOMWrapperWorld; +class Frame; class Range; } @@ -101,6 +102,7 @@ public: bool isSelectTrailingWhitespaceEnabled() const { return s_selectTrailingWhitespaceEnabled; } void setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; } + bool didReceiveAuthenticationChallenge(WebCore::Credential&); private: void runTest(const String& url); diff --git a/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp index aee4e6f20..c97ba39c1 100644 --- a/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp @@ -234,12 +234,6 @@ void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) notImplemented(); } -void LayoutTestController::setJavaScriptProfilingEnabled(bool profilingEnabled) -{ - UNUSED_PARAM(profilingEnabled); - notImplemented(); -} - void LayoutTestController::setMainFrameIsFirstResponder(bool flag) { UNUSED_PARAM(flag); @@ -705,11 +699,6 @@ void LayoutTestController::setTextDirection(JSStringRef) notImplemented(); } -void LayoutTestController::allowRoundingHacks() -{ - notImplemented(); -} - void LayoutTestController::goBack() { // FIXME: implement to enable loader/navigation-while-deferring-loads.html diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp index 21aed1b9d..b6659a47f 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp @@ -112,15 +112,6 @@ void DRTDevToolsAgent::detach() m_drtDevToolsClient = 0; } -bool DRTDevToolsAgent::setJavaScriptProfilingEnabled(bool enabled) -{ - WebDevToolsAgent* agent = webDevToolsAgent(); - if (!agent) - return false; - agent->setJavaScriptProfilingEnabled(enabled); - return true; -} - bool DRTDevToolsAgent::evaluateInWebInspector(long callID, const std::string& script) { WebDevToolsAgent* agent = webDevToolsAgent(); diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h index 6e491ad53..f3564bd78 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h @@ -69,7 +69,6 @@ public: void detach(); bool evaluateInWebInspector(long callID, const std::string& script); - bool setJavaScriptProfilingEnabled(bool); TaskList* taskList() { return &m_taskList; } private: diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index 38c2ad652..c739143e0 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -196,7 +196,6 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission); bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled); bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard); - bindMethod("setJavaScriptProfilingEnabled", &LayoutTestController::setJavaScriptProfilingEnabled); bindMethod("setMinimumTimerInterval", &LayoutTestController::setMinimumTimerInterval); bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation); bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); @@ -1831,14 +1830,6 @@ void LayoutTestController::logErrorToConsole(const std::string& text) WebString(), 0); } -void LayoutTestController::setJavaScriptProfilingEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isBool()) - return; - m_shell->drtDevToolsAgent()->setJavaScriptProfilingEnabled(arguments[0].toBoolean()); -} - void LayoutTestController::evaluateInWebInspector(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h index 0703ef010..37978657e 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h @@ -349,9 +349,6 @@ public: // Gets the number of geolocation permissions requests pending. void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*); - // Allows layout tests to start JavaScript profiling. - void setJavaScriptProfilingEnabled(const CppArgumentList&, CppVariant*); - // Allows layout tests to exec scripts at WebInspector side. void evaluateInWebInspector(const CppArgumentList&, CppVariant*); diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp new file mode 100644 index 000000000..d667d8865 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MockWebPrerenderingSupport.h" + +#include <wtf/Assertions.h> + +MockWebPrerenderingSupport::MockWebPrerenderingSupport() +{ + ASSERT(!current()); + initialize(this); +} + +MockWebPrerenderingSupport::~MockWebPrerenderingSupport() +{ + ASSERT(current() == this); + shutdown(); +} + +void MockWebPrerenderingSupport::add(const WebKit::WebPrerender&) +{ +} + +void MockWebPrerenderingSupport::cancel(const WebKit::WebPrerender&) +{ +} + +void MockWebPrerenderingSupport::abandon(const WebKit::WebPrerender&) +{ +} diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h new file mode 100644 index 000000000..b5d4af53d --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef MockWebPrerenderingSupport_h +#define MockWebPrerenderingSupport_h + +#include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupport.h" + +class MockWebPrerenderingSupport : public WebKit::WebPrerenderingSupport { +public: + MockWebPrerenderingSupport(); + virtual ~MockWebPrerenderingSupport(); + +private: + void add(const WebKit::WebPrerender&) OVERRIDE; + void cancel(const WebKit::WebPrerender&) OVERRIDE; + void abandon(const WebKit::WebPrerender&) OVERRIDE; +}; + +#endif // MockWebPrerenderingSupport_h diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 07a72e3f4..9b9ca4a5b 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -34,6 +34,7 @@ #include "DRTDevToolsAgent.h" #include "DRTDevToolsClient.h" #include "LayoutTestController.h" +#include "MockWebPrerenderingSupport.h" #include "platform/WebArrayBufferView.h" #include "WebCompositor.h" #include "WebDataSource.h" @@ -66,6 +67,7 @@ #include <wtf/MD5.h> #include <wtf/OwnArrayPtr.h> + using namespace WebKit; using namespace std; @@ -147,6 +149,7 @@ void TestShell::initialize() m_webPermissions = adoptPtr(new WebPermissions(this)); m_accessibilityController = adoptPtr(new AccessibilityController(this)); m_gamepadController = adoptPtr(new GamepadController(this)); + m_layoutTestController = adoptPtr(new LayoutTestController(this)); m_eventSender = adoptPtr(new EventSender(this)); m_textInputController = adoptPtr(new TextInputController(this)); @@ -154,6 +157,9 @@ void TestShell::initialize() m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); #endif m_printer = m_testShellMode ? TestEventPrinter::createTestShellPrinter() : TestEventPrinter::createDRTPrinter(); +#if ENABLE(LINK_PRERENDER) + m_prerenderingSupport = adoptPtr(new MockWebPrerenderingSupport()); +#endif WTF::initializeThreading(); diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index fc340248d..ae9d8d8a1 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -59,6 +59,7 @@ class WebURL; class DRTDevToolsAgent; class DRTDevToolsCallArgs; class DRTDevToolsClient; +class MockWebPrerenderingSupport; class WebPermissions; struct TestParams { @@ -224,6 +225,9 @@ private: #endif OwnPtr<WebViewHost> m_webViewHost; OwnPtr<WebKit::WebThread> m_webCompositorThread; +#if ENABLE(LINK_PRERENDER) + OwnPtr<MockWebPrerenderingSupport> m_prerenderingSupport; +#endif TestParams m_params; int m_timeout; // timeout value in millisecond diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index ef82f2b88..6c48bc1e1 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -450,6 +450,15 @@ bool WebViewHost::handleCurrentKeyboardEvent() return frame->executeCommand(WebString::fromUTF8(m_editCommandName), WebString::fromUTF8(m_editCommandValue)); } +// WebKit::WebPrerendererClient + +void WebViewHost::willAddPrerender(WebKit::WebPrerender*) +{ +} + + +// WebKit::WebSpellCheckClient + void WebViewHost::spellCheck(const WebString& text, int& misspelledOffset, int& misspelledLength, WebVector<WebString>* optionalSuggestions) { // Check the spelling of the given text. @@ -1206,6 +1215,21 @@ void WebViewHost::removeIdentifierForRequest(unsigned identifier) m_resourceIdentifierMap.remove(identifier); } +static void blockRequest(WebURLRequest& request) +{ + request.setURL(WebURL()); +} + +static bool isLocalhost(const string& host) +{ + return host == "127.0.0.1" || host == "localhost"; +} + +static bool hostIsUsedBySomeTestsToGenerateError(const string& host) +{ + return host == "255.255.255.255"; +} + void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRequest& request, const WebURLResponse& redirectResponse) { // Need to use GURL for host() and SchemeIs() @@ -1228,29 +1252,25 @@ void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRe if (!redirectResponse.isNull() && m_blocksRedirects) { fputs("Returning null for this redirect\n", stdout); - // To block the request, we set its URL to an empty one. - request.setURL(WebURL()); + blockRequest(request); return; } if (m_requestReturnNull) { - // To block the request, we set its URL to an empty one. - request.setURL(WebURL()); + blockRequest(request); return; } string host = url.host(); - // 255.255.255.255 is used in some tests that expect to get back an error. - if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https")) - && host != "127.0.0.1" - && host != "255.255.255.255" - && host != "localhost" - && !m_shell->allowExternalPages()) { - printf("Blocked access to external URL %s\n", requestURL.c_str()); - - // To block the request, we set its URL to an empty one. - request.setURL(WebURL()); - return; + if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))) { + GURL testURL = webView()->mainFrame()->document().url(); + const string& testHost = testURL.host(); + if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) && ((!testURL.SchemeIs("http") && !testURL.SchemeIs("https")) || isLocalhost(testHost)) + && !m_shell->allowExternalPages()) { + printf("Blocked access to external URL %s\n", requestURL.c_str()); + blockRequest(request); + return; + } } HashSet<String>::const_iterator end = m_clearHeaders.end(); @@ -1409,6 +1429,7 @@ void WebViewHost::setWebWidget(WebKit::WebWidget* widget) { m_webWidget = widget; webView()->setSpellCheckClient(this); + webView()->setPrerendererClient(this); webView()->setCompositorSurfaceReady(); } diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index c5f930127..21dbb4c8d 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -38,6 +38,7 @@ #include "WebCursorInfo.h" #include "WebFrameClient.h" #include "WebIntentRequest.h" +#include "WebPrerendererClient.h" #include "WebSpellCheckClient.h" #include "WebViewClient.h" #include <wtf/HashMap.h> @@ -74,7 +75,8 @@ class MediaStreamUtil; class TestMediaStreamClient; } -class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost { +class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost, + public WebKit::WebPrerendererClient, public WebKit::WebSpellCheckClient { public: WebViewHost(TestShell*); virtual ~WebViewHost(); @@ -124,6 +126,9 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl // NavigationHost virtual bool navigate(const TestNavigationEntry&, bool reload); + // WebKit::WebPrerendererClient + virtual void willAddPrerender(WebKit::WebPrerender*) OVERRIDE; + // WebKit::WebSpellCheckClient virtual void spellCheck(const WebKit::WebString&, int& offset, int& length, WebKit::WebVector<WebKit::WebString>* optionalSuggestions); virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index 668aa46a0..f8bf85e54 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -54,6 +54,8 @@ OwnPtr<DumpRenderTreeChrome> browser; Evas_Object* topLoadingFrame = 0; bool waitForPolicy = false; +bool policyDelegateEnabled = false; +bool policyDelegatePermissive = false; Ecore_Timer* waitToDumpWatchdog = 0; extern Ewk_History_Item* prevTestBFItem; diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index 2a39a693a..22f0ecff7 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -174,7 +174,7 @@ bool DumpRenderTreeChrome::initialize() return true; } -Vector<Evas_Object*> DumpRenderTreeChrome::extraViews() const +const Vector<Evas_Object*>& DumpRenderTreeChrome::extraViews() const { return m_extraViews; } @@ -265,7 +265,6 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(mainView(), false); DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(mainView(), false); DumpRenderTreeSupportEfl::setDefersLoading(mainView(), false); - DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(mainView(), false); DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(mainView(), false); DumpRenderTreeSupportEfl::setSerializeHTTPLoads(false); DumpRenderTreeSupportEfl::setDeadDecodedDataDeletionInterval(0); @@ -274,6 +273,9 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() ewk_intent_request_unref(m_currentIntentRequest); m_currentIntentRequest = 0; } + + policyDelegateEnabled = false; + policyDelegatePermissive = false; } static CString pathSuitableForTestResult(const char* uriString) @@ -582,6 +584,9 @@ void DumpRenderTreeChrome::onFrameLoadFinished(void*, Evas_Object* frame, void* if (error) return; + if (!done && gLayoutTestController->dumpProgressFinishedCallback()) + printf("postProgressFinishedNotification\n"); + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) { const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); printf("%s - didFinishLoadForFrame\n", frameName.utf8().data()); @@ -701,7 +706,9 @@ void DumpRenderTreeChrome::onFrameIntentNew(void*, Evas_Object*, void* eventInfo ewk_intent_action_get(intent), ewk_intent_type_get(intent)); - // TODO: Display number of ports once Ewk_Intent exposes this information. + const MessagePortChannelArray* messagePorts = DumpRenderTreeSupportEfl::intentMessagePorts(intent); + if (messagePorts) + printf("Have %d ports\n", static_cast<int>(messagePorts->size())); const char* service = ewk_intent_service_get(intent); if (service && strcmp(service, "")) diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h index 6ae30a34e..0d3b3f2f3 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h @@ -48,7 +48,7 @@ public: Evas_Object* createNewWindow(); void removeWindow(Evas_Object*); - Vector<Evas_Object*> extraViews() const; + const Vector<Evas_Object*>& extraViews() const; void clearExtraViews(); Evas_Object* mainFrame() const; diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h b/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h index 43812b19b..f474c89e2 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h @@ -36,6 +36,8 @@ class DumpRenderTreeChrome; extern OwnPtr<DumpRenderTreeChrome> browser; extern Evas_Object* topLoadingFrame; extern bool waitForPolicy; +extern bool policyDelegateEnabled; +extern bool policyDelegatePermissive; extern Ecore_Timer* waitToDumpWatchdog; #endif /* DumpRenderTreeEfl_h */ diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp index f9f8f65cb..f07d3815b 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp @@ -28,6 +28,7 @@ #include "DumpRenderTree.h" #include "DumpRenderTreeChrome.h" +#include "DumpRenderTreeEfl.h" #include "LayoutTestController.h" #include <EWebKit.h> #include <Ecore.h> @@ -120,7 +121,7 @@ static uint64_t onExceededDatabaseQuota(Ewk_View_Smart_Data* smartData, Evas_Obj return 5 * 1024 * 1024; } -static uint64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded) +static int64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded) { if (gLayoutTestController->dumpApplicationCacheDelegateCallbacks()) { // For example, numbers from 30000 - 39999 will output as 30000. @@ -128,7 +129,7 @@ static uint64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Securi // sufficient to just get a range of 10000 to determine if we were // above or below a threshold. int64_t truncatedSpaceNeeded = (totalSpaceNeeded / 10000) * 10000; - printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:~%llu\n", + printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:~%lld\n", ewk_security_origin_protocol_get(origin), ewk_security_origin_host_get(origin), ewk_security_origin_port_get(origin), @@ -152,6 +153,40 @@ static bool chooseAndInitializeAppropriateSmartClass(Ewk_View_Smart_Class* api) return shouldUseSingleBackingStore() ? ewk_view_single_smart_set(api) : ewk_view_tiled_smart_set(api); } +// Taken from the file "WebKit/Tools/DumpRenderTree/chromium/WebViewHost.cpp". +static inline const char* navigationTypeToString(const Ewk_Navigation_Type type) +{ + switch (type) { + case EWK_NAVIGATION_TYPE_LINK_CLICKED: + return "link clicked"; + case EWK_NAVIGATION_TYPE_FORM_SUBMITTED: + return "form submitted"; + case EWK_NAVIGATION_TYPE_BACK_FORWARD: + return "back/forward"; + case EWK_NAVIGATION_TYPE_RELOAD: + return "reload"; + case EWK_NAVIGATION_TYPE_FORM_RESUBMITTED: + return "form resubmitted"; + case EWK_NAVIGATION_TYPE_OTHER: + return "other"; + } + return "illegal value"; +} + +static Eina_Bool onNavigationPolicyDecision(Ewk_View_Smart_Data*, Ewk_Frame_Resource_Request* request, Ewk_Navigation_Type navigationType) +{ + if (!policyDelegateEnabled) + return true; + + printf("Policy delegate: attempt to load %s with navigation type '%s'\n", urlSuitableForTestResult(request->url).utf8().data(), + navigationTypeToString(navigationType)); + + if (gLayoutTestController) + gLayoutTestController->notifyDone(); + + return policyDelegatePermissive; +} + Evas_Object* drtViewAdd(Evas* evas) { static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("DRT_View"); @@ -170,6 +205,7 @@ Evas_Object* drtViewAdd(Evas* evas) api.window_close = onWindowClose; api.exceeded_application_cache_quota = onExceededApplicationCacheQuota; api.exceeded_database_quota = onExceededDatabaseQuota; + api.navigation_policy_decision = onNavigationPolicyDecision; return evas_object_smart_add(evas, evas_smart_class_new(&api.sc)); } diff --git a/Tools/DumpRenderTree/efl/EventSender.cpp b/Tools/DumpRenderTree/efl/EventSender.cpp index 83385c4fa..d606b37e3 100644 --- a/Tools/DumpRenderTree/efl/EventSender.cpp +++ b/Tools/DumpRenderTree/efl/EventSender.cpp @@ -112,7 +112,7 @@ enum EventQueueStrategy { }; struct KeyEventInfo { - KeyEventInfo(const CString& keyName, const CString& keyString, unsigned modifiers) + KeyEventInfo(const CString& keyName, unsigned modifiers, const CString& keyString = CString()) : keyName(keyName) , keyString(keyString) , modifiers(modifiers) @@ -389,108 +389,108 @@ static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObject static KeyEventInfo* keyPadNameFromJSValue(JSStringRef character, unsigned modifiers) { if (equals(character, "leftArrow")) - return new KeyEventInfo("KP_Left", "", modifiers); + return new KeyEventInfo("KP_Left", modifiers); if (equals(character, "rightArrow")) - return new KeyEventInfo("KP_Right", "", modifiers); + return new KeyEventInfo("KP_Right", modifiers); if (equals(character, "upArrow")) - return new KeyEventInfo("KP_Up", "", modifiers); + return new KeyEventInfo("KP_Up", modifiers); if (equals(character, "downArrow")) - return new KeyEventInfo("KP_Down", "", modifiers); + return new KeyEventInfo("KP_Down", modifiers); if (equals(character, "pageUp")) - return new KeyEventInfo("KP_Prior", "", modifiers); + return new KeyEventInfo("KP_Prior", modifiers); if (equals(character, "pageDown")) - return new KeyEventInfo("KP_Next", "", modifiers); + return new KeyEventInfo("KP_Next", modifiers); if (equals(character, "home")) - return new KeyEventInfo("KP_Home", "", modifiers); + return new KeyEventInfo("KP_Home", modifiers); if (equals(character, "end")) - return new KeyEventInfo("KP_End", "", modifiers); + return new KeyEventInfo("KP_End", modifiers); if (equals(character, "insert")) - return new KeyEventInfo("KP_Insert", "", modifiers); + return new KeyEventInfo("KP_Insert", modifiers); if (equals(character, "delete")) - return new KeyEventInfo("KP_Delete", "", modifiers); + return new KeyEventInfo("KP_Delete", modifiers); - return new KeyEventInfo(character->ustring().utf8(), character->ustring().utf8(), modifiers); + return new KeyEventInfo(character->ustring().utf8(), modifiers, character->ustring().utf8()); } static KeyEventInfo* keyNameFromJSValue(JSStringRef character, unsigned modifiers) { if (equals(character, "leftArrow")) - return new KeyEventInfo("Left", "", modifiers); + return new KeyEventInfo("Left", modifiers); if (equals(character, "rightArrow")) - return new KeyEventInfo("Right", "", modifiers); + return new KeyEventInfo("Right", modifiers); if (equals(character, "upArrow")) - return new KeyEventInfo("Up", "", modifiers); + return new KeyEventInfo("Up", modifiers); if (equals(character, "downArrow")) - return new KeyEventInfo("Down", "", modifiers); + return new KeyEventInfo("Down", modifiers); if (equals(character, "pageUp")) - return new KeyEventInfo("Prior", "", modifiers); + return new KeyEventInfo("Prior", modifiers); if (equals(character, "pageDown")) - return new KeyEventInfo("Next", "", modifiers); + return new KeyEventInfo("Next", modifiers); if (equals(character, "home")) - return new KeyEventInfo("Home", "", modifiers); + return new KeyEventInfo("Home", modifiers); if (equals(character, "end")) - return new KeyEventInfo("End", "", modifiers); + return new KeyEventInfo("End", modifiers); if (equals(character, "insert")) - return new KeyEventInfo("Insert", "", modifiers); + return new KeyEventInfo("Insert", modifiers); if (equals(character, "delete")) - return new KeyEventInfo("Delete", "", modifiers); + return new KeyEventInfo("Delete", modifiers); if (equals(character, "printScreen")) - return new KeyEventInfo("Print", "", modifiers); + return new KeyEventInfo("Print", modifiers); if (equals(character, "menu")) - return new KeyEventInfo("Menu", "", modifiers); + return new KeyEventInfo("Menu", modifiers); if (equals(character, "leftControl")) - return new KeyEventInfo("Control_L", "", modifiers); + return new KeyEventInfo("Control_L", modifiers); if (equals(character, "rightControl")) - return new KeyEventInfo("Control_R", "", modifiers); + return new KeyEventInfo("Control_R", modifiers); if (equals(character, "leftShift")) - return new KeyEventInfo("Shift_L", "", modifiers); + return new KeyEventInfo("Shift_L", modifiers); if (equals(character, "rightShift")) - return new KeyEventInfo("Shift_R", "", modifiers); + return new KeyEventInfo("Shift_R", modifiers); if (equals(character, "leftAlt")) - return new KeyEventInfo("Alt_L", "", modifiers); + return new KeyEventInfo("Alt_L", modifiers); if (equals(character, "rightAlt")) - return new KeyEventInfo("Alt_R", "", modifiers); + return new KeyEventInfo("Alt_R", modifiers); if (equals(character, "F1")) - return new KeyEventInfo("F1", "", modifiers); + return new KeyEventInfo("F1", modifiers); if (equals(character, "F2")) - return new KeyEventInfo("F2", "", modifiers); + return new KeyEventInfo("F2", modifiers); if (equals(character, "F3")) - return new KeyEventInfo("F3", "", modifiers); + return new KeyEventInfo("F3", modifiers); if (equals(character, "F4")) - return new KeyEventInfo("F4", "", modifiers); + return new KeyEventInfo("F4", modifiers); if (equals(character, "F5")) - return new KeyEventInfo("F5", "", modifiers); + return new KeyEventInfo("F5", modifiers); if (equals(character, "F6")) - return new KeyEventInfo("F6", "", modifiers); + return new KeyEventInfo("F6", modifiers); if (equals(character, "F7")) - return new KeyEventInfo("F7", "", modifiers); + return new KeyEventInfo("F7", modifiers); if (equals(character, "F8")) - return new KeyEventInfo("F8", "", modifiers); + return new KeyEventInfo("F8", modifiers); if (equals(character, "F9")) - return new KeyEventInfo("F9", "", modifiers); + return new KeyEventInfo("F9", modifiers); if (equals(character, "F10")) - return new KeyEventInfo("F10", "", modifiers); + return new KeyEventInfo("F10", modifiers); if (equals(character, "F11")) - return new KeyEventInfo("F11", "", modifiers); + return new KeyEventInfo("F11", modifiers); if (equals(character, "F12")) - return new KeyEventInfo("F12", "", modifiers); + return new KeyEventInfo("F12", modifiers); int charCode = JSStringGetCharactersPtr(character)[0]; if (charCode == '\n' || charCode == '\r') - return new KeyEventInfo("Return", "Return", modifiers); + return new KeyEventInfo("Return", modifiers, "\r"); if (charCode == '\t') - return new KeyEventInfo("Tab", "Tab", modifiers); + return new KeyEventInfo("Tab", modifiers, "\t"); if (charCode == '\x8') - return new KeyEventInfo("BackSpace", "BackSpace", modifiers); + return new KeyEventInfo("BackSpace", modifiers, "\x8"); if (charCode == ' ') - return new KeyEventInfo("space", " ", modifiers); + return new KeyEventInfo("space", modifiers, " "); if (charCode == '\x1B') - return new KeyEventInfo("Escape", "Escape", modifiers); + return new KeyEventInfo("Escape", modifiers, "\x1B"); if ((character->length() == 1) && (charCode >= 'A' && charCode <= 'Z')) modifiers |= EvasKeyModifierShift; - return new KeyEventInfo(character->ustring().utf8(), character->ustring().utf8(), modifiers); + return new KeyEventInfo(character->ustring().utf8(), modifiers, character->ustring().utf8()); } static KeyEventInfo* createKeyEventInfo(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) diff --git a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp index 92123e881..992785143 100644 --- a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp +++ b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp @@ -202,13 +202,15 @@ void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies) ewk_cookies_policy_set(alwaysAcceptCookies ? EWK_COOKIE_JAR_ACCEPT_ALWAYS : EWK_COOKIE_JAR_ACCEPT_NEVER); } -void LayoutTestController::setCustomPolicyDelegate(bool, bool) +void LayoutTestController::setCustomPolicyDelegate(bool enabled, bool permissive) { - notImplemented(); + policyDelegateEnabled = enabled; + policyDelegatePermissive = permissive; } void LayoutTestController::waitForPolicyDelegate() { + setCustomPolicyDelegate(true, false); waitForPolicy = true; setWaitToDump(true); } @@ -449,14 +451,6 @@ void LayoutTestController::setIconDatabaseEnabled(bool enabled) ewk_settings_icon_database_path_set(databasePath.utf8().data()); } -void LayoutTestController::setJavaScriptProfilingEnabled(bool enabled) -{ - if (enabled) - setDeveloperExtrasEnabled(enabled); - - DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(browser->mainView(), enabled); -} - void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) { DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(browser->mainView(), flag); @@ -586,10 +580,11 @@ void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quo ewk_security_origin_free(origin); } -void LayoutTestController::clearApplicationCacheForOrigin(OpaqueJSString*) +void LayoutTestController::clearApplicationCacheForOrigin(OpaqueJSString* url) { - // FIXME: Implement to support deleting all application caches for an origin. - notImplemented(); + Ewk_Security_Origin* origin = ewk_security_origin_new_from_string(url->ustring().utf8().data()); + ewk_security_origin_application_cache_clear(origin); + ewk_security_origin_free(origin); } long long LayoutTestController::localStorageDiskUsageForOrigin(JSStringRef) @@ -838,11 +833,6 @@ void LayoutTestController::setTextDirection(JSStringRef) notImplemented(); } -void LayoutTestController::allowRoundingHacks() -{ - notImplemented(); -} - void LayoutTestController::addChromeInputField() { notImplemented(); @@ -896,9 +886,5 @@ void LayoutTestController::sendWebIntentResponse(JSStringRef response) if (!request) return; - JSC::UString responseString = response->ustring(); - if (responseString.isNull()) - ewk_intent_request_failure_post(request, "ERROR"); - else - ewk_intent_request_result_post(request, responseString.utf8().data()); + DumpRenderTreeSupportEfl::sendWebIntentResponse(request, response); } diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 45c80e81f..8e4c16c5d 100644 --- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -540,17 +540,6 @@ void LayoutTestController::setIconDatabaseEnabled(bool enabled) webkit_icon_database_set_path(database, 0); } -void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - setDeveloperExtrasEnabled(flag); - - WebKitWebInspector* inspector = webkit_web_view_get_inspector(view); - g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", flag, NULL); -} - void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) { DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(flag); @@ -982,10 +971,6 @@ void LayoutTestController::setTextDirection(JSStringRef direction) // FIXME: Implement. } -void LayoutTestController::allowRoundingHacks() -{ -} - void LayoutTestController::addChromeInputField() { } diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 3ad47a260..8180cabdd 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -23,6 +23,7 @@ #include "CompilerVersion.xcconfig" +CLANG_WARN_CXX0X_EXTENSIONS = NO; HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include ForwardingHeaders mac/InternalHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index c1f44a473..00bdb2184 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -525,6 +525,7 @@ WebView *createWebViewAndOffscreenWindow() [WebView registerURLSchemeAsLocal:@"feedsearch"]; [webView setContinuousSpellCheckingEnabled:YES]; + [webView setDefersCallbacks:NO]; [webView setGrammarCheckingEnabled:YES]; [webView setInteractiveFormValidationEnabled:YES]; [webView setValidationMessageTimerMagnification:-1]; @@ -1264,7 +1265,6 @@ static void resetWebViewToConsistentStateBeforeTesting() } [[mainFrame webView] setSmartInsertDeleteEnabled:YES]; - [[[mainFrame webView] inspector] setJavaScriptProfilingEnabled:NO]; [WebView _setUsesTestModeFocusRingColor:YES]; [WebView _resetOriginAccessWhitelists]; diff --git a/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm b/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm index c88296262..69c246197 100644 --- a/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm +++ b/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm @@ -54,6 +54,10 @@ #import <WebKit/WebViewPrivate.h> #import <wtf/Assertions.h> +#ifndef NSEC_PER_MSEC +#define NSEC_PER_MSEC 1000000ull +#endif + @interface NSURL (DRTExtras) - (NSString *)_drt_descriptionSuitableForTestResult; @end @@ -173,6 +177,15 @@ printf ("%s\n", [string UTF8String]); [frame stopLoading]; } + + if (!done && gLayoutTestController->useDeferredFrameLoading()) { + [sender setDefersCallbacks:YES]; + int64_t deferredWaitTime = 5 * NSEC_PER_MSEC; + dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, deferredWaitTime); + dispatch_after(when, dispatch_get_main_queue(), ^{ + [sender setDefersCallbacks:NO]; + }); + } } - (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame diff --git a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 5b2e060c6..419a2cf92 100644 --- a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -561,12 +561,6 @@ void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) [sharedWebIconDatabase setEnabled:iconDatabaseEnabled]; } -void LayoutTestController::setJavaScriptProfilingEnabled(bool profilingEnabled) -{ - setDeveloperExtrasEnabled(profilingEnabled); - [[[mainFrame webView] inspector] setJavaScriptProfilingEnabled:profilingEnabled]; -} - void LayoutTestController::setMainFrameIsFirstResponder(bool flag) { NSView *documentView = [[mainFrame frameView] documentView]; @@ -967,11 +961,6 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObj [mainFrame _stringByEvaluatingJavaScriptFromString:scriptNS withGlobalObject:globalObject inScriptWorld:world]; } -void LayoutTestController::allowRoundingHacks() -{ - [WebView _setAllowsRoundingHacks:YES]; -} - @interface APITestDelegate : NSObject { bool* m_condition; diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index a9f27bf3b..df70e08a6 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -620,9 +620,7 @@ void DumpRenderTree::open(const QUrl& url) m_page->event(&ev); QWebSettings::clearMemoryCaches(); -#if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2)) QFontDatabase::removeAllApplicationFonts(); -#endif WebKit::initializeTestFonts(); DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/")); diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index 4a3b245ab..c0506efe2 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -511,7 +511,7 @@ void EventSender::cancelTouchPoint(int index) void EventSender::sendTouchEvent(QEvent::Type type) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) static QTouchDevice* device = 0; if (!device) { device = new QTouchDevice; diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index c1683f10e..9bbf439bc 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -477,12 +477,6 @@ void LayoutTestController::setAutofilled(const QWebElement& element, bool isAuto return DumpRenderTreeSupportQt::setAutofilled(element, isAutofilled); } -void LayoutTestController::setJavaScriptProfilingEnabled(bool enable) -{ - setDeveloperExtrasEnabled(enable); - DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); -} - void LayoutTestController::setValueForUser(const QWebElement& element, const QString& value) { DumpRenderTreeSupportQt::setValueForUser(element, value); diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h index 551167672..ef68b36e9 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -159,7 +159,6 @@ public slots: void setAllowFileAccessFromFileURLs(bool enable); void setAppCacheMaximumSize(unsigned long long quota); void setAutofilled(const QWebElement&, bool enable); - void setJavaScriptProfilingEnabled(bool enable); void setValueForUser(const QWebElement&, const QString& value); void setFixedContentsSize(int width, int height); void setPrivateBrowsingEnabled(bool enable); diff --git a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp b/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp index ca6b66c49..7ae5e22a3 100644 --- a/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp +++ b/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp @@ -67,7 +67,7 @@ void initializeTestFonts() // The resolving of default font families was altered in Qt5 with 2cc5442 (qtbase), // we use this hack to keep resolving to the same font Qt4 did for serif while // supporting both versions. -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) configFile = fontDir + "/fonts-qt5-wk1.conf"; if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(configFile.constData()), FcTrue)) qFatal("Couldn't load font configuration file"); diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp index 176336770..3125d61bc 100644 --- a/Tools/DumpRenderTree/qt/main.cpp +++ b/Tools/DumpRenderTree/qt/main.cpp @@ -152,7 +152,9 @@ int main(int argc, char* argv[]) QApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); -#if QT_VERSION <= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) + QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true); +#else #ifdef Q_WS_X11 QX11Info::setAppDpiY(0, 96); QX11Info::setAppDpiX(0, 96); @@ -170,8 +172,6 @@ int main(int argc, char* argv[]) * default font, but with the correct paint-device DPI. */ QApplication::setFont(QWidget().font()); -#else - QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true); #endif #if HAVE(SIGNAL_H) diff --git a/Tools/DumpRenderTree/win/DRTDataObject.cpp b/Tools/DumpRenderTree/win/DRTDataObject.cpp new file mode 100644 index 000000000..b3504539b --- /dev/null +++ b/Tools/DumpRenderTree/win/DRTDataObject.cpp @@ -0,0 +1,381 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2012 Baidu Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DRTDataObject.h" + +FORMATETC* cfHDropFormat() +{ + static FORMATETC urlFormat = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + return &urlFormat; +} + +FORMATETC* cfFileNameWFormat() +{ + static UINT cf = RegisterClipboardFormat(L"FileNameW"); + static FORMATETC urlFormat = {cf, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + return &urlFormat; +} + +FORMATETC* cfUrlWFormat() +{ + static UINT cf = RegisterClipboardFormat(L"UniformResourceLocatorW"); + static FORMATETC urlFormat = {cf, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + return &urlFormat; +} + +class WCEnumFormatEtc : public IEnumFORMATETC { +public: + explicit WCEnumFormatEtc(const Vector<FORMATETC>& formats); + explicit WCEnumFormatEtc(const Vector<FORMATETC*>& formats); + + // IUnknown members + STDMETHOD(QueryInterface)(REFIID, void**); + STDMETHOD_(ULONG, AddRef)(); + STDMETHOD_(ULONG, Release)(); + + // IEnumFORMATETC members + STDMETHOD(Next)(ULONG, LPFORMATETC, ULONG*); + STDMETHOD(Skip)(ULONG); + STDMETHOD(Reset)(); + STDMETHOD(Clone)(IEnumFORMATETC**); + +private: + long m_ref; + Vector<FORMATETC> m_formats; + size_t m_current; +}; + +WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC>& formats) + : m_ref(1) + , m_current(0) + , m_formats(formats) +{ +} + +WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC*>& formats) + : m_ref(1) + , m_current(0) +{ + for (size_t i = 0; i < formats.size(); ++i) + m_formats.append(*formats[i]); +} + +STDMETHODIMP WCEnumFormatEtc::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumFORMATETC)) { + *ppvObject = this; + AddRef(); + return S_OK; + } + + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) WCEnumFormatEtc::AddRef() +{ + return InterlockedIncrement(&m_ref); +} + +STDMETHODIMP_(ULONG) WCEnumFormatEtc::Release() +{ + long refCount = InterlockedDecrement(&m_ref); + if (!refCount) + delete this; + return refCount; +} + +STDMETHODIMP WCEnumFormatEtc::Next(ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched) +{ + if (pceltFetched) + *pceltFetched = 0; + + ULONG cReturn = celt; + + if (celt <= 0 || !lpFormatEtc || m_current >= m_formats.size()) + return S_FALSE; + + if (!pceltFetched && celt != 1) // pceltFetched can be 0 only for 1 item request + return S_FALSE; + + while (m_current < m_formats.size() && cReturn > 0) { + *lpFormatEtc++ = m_formats[m_current++]; + --cReturn; + } + if (pceltFetched) + *pceltFetched = celt - cReturn; + + return !cReturn ? S_OK : S_FALSE; +} + +STDMETHODIMP WCEnumFormatEtc::Skip(ULONG celt) +{ + if ((m_current + celt) >= m_formats.size()) + return S_FALSE; + m_current += celt; + return S_OK; +} + +STDMETHODIMP WCEnumFormatEtc::Reset() +{ + m_current = 0; + return S_OK; +} + +STDMETHODIMP WCEnumFormatEtc::Clone(IEnumFORMATETC** ppCloneEnumFormatEtc) +{ + if (!ppCloneEnumFormatEtc) + return E_POINTER; + + WCEnumFormatEtc* newEnum = new WCEnumFormatEtc(m_formats); + if (!newEnum) + return E_OUTOFMEMORY; + + newEnum->AddRef(); + newEnum->m_current = m_current; + *ppCloneEnumFormatEtc = newEnum; + return S_OK; +} + +////////////////////////////////////////////////////////////////////////// +HRESULT DRTDataObject::createInstance(DRTDataObject** result) +{ + if (!result) + return E_POINTER; + *result = new DRTDataObject(); + return S_OK; +} + +DRTDataObject::DRTDataObject() + : m_ref(1) +{ +} + +DRTDataObject::~DRTDataObject() +{ + for (size_t i = 0; i < m_medium.size(); ++i) { + ReleaseStgMedium(m_medium[i]); + delete m_medium[i]; + } + WTF::deleteAllValues(m_formats); +} + +STDMETHODIMP DRTDataObject::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDataObject)) + *ppvObject = this; + + if (*ppvObject) { + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) DRTDataObject::AddRef() +{ + return InterlockedIncrement(&m_ref); +} + +STDMETHODIMP_(ULONG) DRTDataObject::Release() +{ + long refCount = InterlockedDecrement(&m_ref); + if (!refCount) + delete this; + return refCount; +} + +STDMETHODIMP DRTDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) +{ + if (!pformatetcIn || !pmedium) + return E_POINTER; + pmedium->hGlobal = 0; + + for (size_t i = 0; i < m_formats.size(); ++i) { + if (pformatetcIn->lindex == m_formats[i]->lindex && pformatetcIn->dwAspect == m_formats[i]->dwAspect && pformatetcIn->cfFormat == m_formats[i]->cfFormat) { + CopyMedium(pmedium, m_medium[i], m_formats[i]); + return S_OK; + } + } + return DV_E_FORMATETC; +} + +STDMETHODIMP DRTDataObject::GetDataHere(FORMATETC*, STGMEDIUM*) +{ + return E_NOTIMPL; +} + +STDMETHODIMP DRTDataObject::QueryGetData(FORMATETC* pformatetc) +{ + if (!pformatetc) + return E_POINTER; + + if (!(DVASPECT_CONTENT & pformatetc->dwAspect)) + return (DV_E_DVASPECT); + + for (size_t i = 0; i < m_formats.size(); ++i) { + if (pformatetc->tymed & m_formats[i]->tymed) { + if (pformatetc->cfFormat == m_formats[i]->cfFormat) + return S_OK; + } + } + return DV_E_TYMED; +} + +STDMETHODIMP DRTDataObject::GetCanonicalFormatEtc(FORMATETC*, FORMATETC*) +{ + return DATA_S_SAMEFORMATETC; +} + +STDMETHODIMP DRTDataObject::SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease) +{ + if (!pformatetc || !pmedium) + return E_POINTER; + + FORMATETC* formatetc = new FORMATETC; + if (!formatetc) + return E_OUTOFMEMORY; + + STGMEDIUM* pStgMed = new STGMEDIUM; + + if (!pStgMed) { + delete formatetc; + return E_OUTOFMEMORY; + } + + ZeroMemory(formatetc, sizeof(FORMATETC)); + ZeroMemory(pStgMed, sizeof(STGMEDIUM)); + + *formatetc = *pformatetc; + m_formats.append(formatetc); + + if (fRelease) + *pStgMed = *pmedium; + else + CopyMedium(pStgMed, pmedium, pformatetc); + m_medium.append(pStgMed); + + return S_OK; +} + +void DRTDataObject::CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc) +{ + switch (pMedSrc->tymed) { +#if !OS(WINCE) + case TYMED_HGLOBAL: + pMedDest->hGlobal = static_cast<HGLOBAL>(OleDuplicateData(pMedSrc->hGlobal, pFmtSrc->cfFormat, 0)); + break; + case TYMED_GDI: + pMedDest->hBitmap = static_cast<HBITMAP>(OleDuplicateData(pMedSrc->hBitmap, pFmtSrc->cfFormat, 0)); + break; + case TYMED_MFPICT: + pMedDest->hMetaFilePict = static_cast<HMETAFILEPICT>(OleDuplicateData(pMedSrc->hMetaFilePict, pFmtSrc->cfFormat, 0)); + break; + case TYMED_ENHMF: + pMedDest->hEnhMetaFile = static_cast<HENHMETAFILE>(OleDuplicateData(pMedSrc->hEnhMetaFile, pFmtSrc->cfFormat, 0)); + break; + case TYMED_FILE: + pMedSrc->lpszFileName = static_cast<LPOLESTR>(OleDuplicateData(pMedSrc->lpszFileName, pFmtSrc->cfFormat, 0)); + break; +#endif + case TYMED_ISTREAM: + pMedDest->pstm = pMedSrc->pstm; + pMedSrc->pstm->AddRef(); + break; + case TYMED_ISTORAGE: + pMedDest->pstg = pMedSrc->pstg; + pMedSrc->pstg->AddRef(); + break; + default: + break; + } + pMedDest->tymed = pMedSrc->tymed; + pMedDest->pUnkForRelease = 0; + if (pMedSrc->pUnkForRelease) { + pMedDest->pUnkForRelease = pMedSrc->pUnkForRelease; + pMedSrc->pUnkForRelease->AddRef(); + } +} +STDMETHODIMP DRTDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc) +{ + if (!ppenumFormatEtc) + return E_POINTER; + + *ppenumFormatEtc = 0; + switch (dwDirection) { + case DATADIR_GET: + *ppenumFormatEtc = new WCEnumFormatEtc(m_formats); + if (!(*ppenumFormatEtc)) + return E_OUTOFMEMORY; + break; + + case DATADIR_SET: + default: + return E_NOTIMPL; + break; + } + + return S_OK; +} + +STDMETHODIMP DRTDataObject::DAdvise(FORMATETC*, DWORD, IAdviseSink*, DWORD*) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +STDMETHODIMP DRTDataObject::DUnadvise(DWORD) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE DRTDataObject::EnumDAdvise(IEnumSTATDATA**) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +void DRTDataObject::clearData(CLIPFORMAT format) +{ + size_t position = 0; + while (position < m_formats.size()) { + if (m_formats[position]->cfFormat == format) { + FORMATETC* current = m_formats[position]; + m_formats[position] = m_formats[m_formats.size() - 1]; + m_formats[m_formats.size() - 1] = 0; + m_formats.removeLast(); + delete current; + STGMEDIUM* medium = m_medium[position]; + m_medium[position] = m_medium[m_medium.size() - 1]; + m_medium[m_medium.size() - 1] = 0; + m_medium.removeLast(); + ReleaseStgMedium(medium); + delete medium; + continue; + } + position++; + } +} diff --git a/Tools/DumpRenderTree/win/DRTDataObject.h b/Tools/DumpRenderTree/win/DRTDataObject.h new file mode 100644 index 000000000..b772b253d --- /dev/null +++ b/Tools/DumpRenderTree/win/DRTDataObject.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2012 Baidu Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DRTDataObject_h +#define DRTDataObject_h + +#include <ShlObj.h> +#include <objidl.h> +#include <wtf/Vector.h> + +FORMATETC* cfHDropFormat(); + +FORMATETC* cfFileNameWFormat(); + +FORMATETC* cfUrlWFormat(); + +class DRTDataObject : public IDataObject { +public: + void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc); + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + + // IDataObject + virtual HRESULT STDMETHODCALLTYPE GetData(FORMATETC* pformatIn, STGMEDIUM* pmedium); + virtual HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC* pformat, STGMEDIUM* pmedium); + virtual HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC* pformat); + virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC* pformatectIn, FORMATETC* pformatOut); + virtual HRESULT STDMETHODCALLTYPE SetData(FORMATETC* pformat, STGMEDIUM*pmedium, BOOL release); + virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc); + virtual HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC*, DWORD, IAdviseSink*, DWORD*); + virtual HRESULT STDMETHODCALLTYPE DUnadvise(DWORD); + virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA**); + + void clearData(CLIPFORMAT); + + static HRESULT createInstance(DRTDataObject**); +private: + DRTDataObject(); + ~DRTDataObject(); + long m_ref; + Vector<FORMATETC*> m_formats; + Vector<STGMEDIUM*> m_medium; +}; + +#endif // DRTDataObject_h diff --git a/Tools/DumpRenderTree/win/DRTDropSource.cpp b/Tools/DumpRenderTree/win/DRTDropSource.cpp new file mode 100644 index 000000000..08b1be887 --- /dev/null +++ b/Tools/DumpRenderTree/win/DRTDropSource.cpp @@ -0,0 +1,86 @@ +/* +* Copyright (C) 2012 Baidu Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "config.h" +#include "DRTDropSource.h" + +DRTDropSource::DRTDropSource() + : m_ref(1) + , m_dropped(false) +{ +} + +DRTDropSource::~DRTDropSource() +{ +} + +STDMETHODIMP DRTDropSource::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDropSource)) { + *ppvObject = this; + AddRef(); + + return S_OK; + } + + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) DRTDropSource::AddRef() +{ + return InterlockedIncrement(&m_ref); +} + +STDMETHODIMP_(ULONG) DRTDropSource::Release() +{ + long refCount = InterlockedDecrement(&m_ref); + if (!refCount) + delete this; + return refCount; +} + +HRESULT DRTDropSource::createInstance(IDropSource** result) +{ + if (!result) + return E_INVALIDARG; + *result = new DRTDropSource; + return S_OK; +} + +STDMETHODIMP DRTDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) +{ + if (fEscapePressed || !(grfKeyState & (MK_LBUTTON | MK_RBUTTON))) { + m_dropped = !fEscapePressed; + return fEscapePressed ? DRAGDROP_S_CANCEL : DRAGDROP_S_DROP; + } + + return S_OK; +} + +STDMETHODIMP DRTDropSource::GiveFeedback(DWORD dwEffect) +{ + return DRAGDROP_S_USEDEFAULTCURSORS; +} diff --git a/Tools/DumpRenderTree/win/DRTDropSource.h b/Tools/DumpRenderTree/win/DRTDropSource.h new file mode 100644 index 000000000..f37f2b7e4 --- /dev/null +++ b/Tools/DumpRenderTree/win/DRTDropSource.h @@ -0,0 +1,48 @@ +/* +* Copyright (C) 2012 Baidu Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef DRTDropSource_h +#define DRTDropSource_h + +#include <ShlObj.h> +#include <windows.h> + +class DRTDropSource : public IDropSource { +public: + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState); + virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect); + + static HRESULT createInstance(IDropSource** result); +private: + DRTDropSource(); + ~DRTDropSource(); + long m_ref; + bool m_dropped; +}; + +#endif // DRTDropSource_h diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp index 4ed8e0dc6..92ab8632c 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp @@ -905,10 +905,6 @@ static void resetWebViewToConsistentStateBeforeTesting() if (SUCCEEDED(webViewPrivate->defaultMinimumTimerInterval(&minimumInterval))) webViewPrivate->setMinimumTimerInterval(minimumInterval); - COMPtr<IWebInspector> inspector; - if (SUCCEEDED(webViewPrivate->inspector(&inspector))) - inspector->setJavaScriptProfilingEnabled(FALSE); - HWND viewWindow; if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) SetFocus(viewWindow); diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj index 18137a242..4843c390e 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -402,6 +402,22 @@ > </File> <File + RelativePath=".\DRTDataObject.cpp" + > + </File> + <File + RelativePath=".\DRTDataObject.h" + > + </File> + <File + RelativePath=".\DRTDropSource.cpp" + > + </File> + <File + RelativePath=".\DRTDropSource.h" + > + </File> + <File RelativePath=".\EventSender.cpp" > </File> diff --git a/Tools/DumpRenderTree/win/EventSender.cpp b/Tools/DumpRenderTree/win/EventSender.cpp index 5c0993689..76dafd948 100644 --- a/Tools/DumpRenderTree/win/EventSender.cpp +++ b/Tools/DumpRenderTree/win/EventSender.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2012 Baidu Inc. All rights reserved * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,16 +30,19 @@ #include "config.h" #include "EventSender.h" +#include "DRTDataObject.h" +#include "DRTDropSource.h" #include "DraggingInfo.h" #include "DumpRenderTree.h" +#include <JavaScriptCore/JavaScriptCore.h> #include <WebCore/COMPtr.h> +#include <WebKit/WebKit.h> +#include <windows.h> #include <wtf/ASCIICType.h> #include <wtf/Assertions.h> #include <wtf/Platform.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <windows.h> +#include <wtf/text/WTFString.h> #define WM_DRT_SEND_QUEUED_EVENT (WM_APP+1) @@ -642,6 +646,86 @@ static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function return JSValueMakeUndefined(context); } +static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + JSObjectRef filesArray = JSValueToObject(context, arguments[0], 0); + + if (!filesArray) + return JSValueMakeUndefined(context); + + JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); + Vector<UChar> files; + int filesCount = JSValueToNumber(context, JSObjectGetProperty(context, filesArray, lengthProperty, 0), 0); + for (int i = 0; i < filesCount; ++i) { + JSValueRef value = JSObjectGetPropertyAtIndex(context, filesArray, i, 0); + JSStringRef file = JSValueToStringCopy(context, value, 0); + files.append(JSStringGetCharactersPtr(file), JSStringGetLength(file)); + files.append(0); + JSStringRelease(file); + } + + if (files.isEmpty()) + return JSValueMakeUndefined(context); + + // We should append "0" in the end of |files| so that |DragQueryFileW| retrieved the number of files correctly from Ole Clipboard. + files.append(0); + + STGMEDIUM hDropMedium = {0}; + hDropMedium.tymed = TYMED_HGLOBAL; + SIZE_T dropFilesSize = sizeof(DROPFILES) + (sizeof(WCHAR) * files.size()); + hDropMedium.hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dropFilesSize); + DROPFILES* dropFiles = reinterpret_cast<DROPFILES*>(GlobalLock(hDropMedium.hGlobal)); + memset(dropFiles, 0, sizeof(DROPFILES)); + dropFiles->pFiles = sizeof(DROPFILES); + dropFiles->fWide = TRUE; + + UChar* data = reinterpret_cast<UChar*>(reinterpret_cast<BYTE*>(dropFiles) + sizeof(DROPFILES)); + for (size_t i = 0; i < files.size(); ++i) + data[i] = files[i]; + GlobalUnlock(hDropMedium.hGlobal); + + STGMEDIUM hFileNameMedium = {0}; + hFileNameMedium.tymed = TYMED_HGLOBAL; + SIZE_T hFileNameSize = sizeof(WCHAR) * files.size(); + hFileNameMedium.hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, hFileNameSize); + WCHAR* hFileName = static_cast<WCHAR*>(GlobalLock(hFileNameMedium.hGlobal)); + for (size_t i = 0; i < files.size(); i++) + hFileName[i] = files[i]; + GlobalUnlock(hFileNameMedium.hGlobal); + + if (draggingInfo) { + delete draggingInfo; + draggingInfo = 0; + } + + COMPtr<DRTDataObject> dataObeject; + COMPtr<IDropSource> source; + if (FAILED(DRTDataObject::createInstance(&dataObeject))) + dataObeject = 0; + + if (FAILED(DRTDropSource::createInstance(&source))) + source = 0; + + if (dataObeject && source) { + draggingInfo = new DraggingInfo(dataObeject.get(), source.get()); + draggingInfo->setPerformedDropEffect(DROPEFFECT_COPY); + } + + if (draggingInfo) { + draggingInfo->dataObject()->SetData(cfHDropFormat(), &hDropMedium, FALSE); + draggingInfo->dataObject()->SetData(cfFileNameWFormat(), &hFileNameMedium, FALSE); + draggingInfo->dataObject()->SetData(cfUrlWFormat(), &hFileNameMedium, FALSE); + OleSetClipboard(draggingInfo->dataObject()); + down = true; + } + + JSStringRelease(lengthProperty); + return JSValueMakeUndefined(context); +} + static JSStaticFunction staticFunctions[] = { { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -654,6 +738,7 @@ static JSStaticFunction staticFunctions[] = { { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp index c6723bdf9..a168e1e93 100644 --- a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -846,24 +846,6 @@ void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) viewEditing->setSmartInsertDeleteEnabled(flag ? TRUE : FALSE); } -void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - setDeveloperExtrasEnabled(flag); - inspector->setJavaScriptProfilingEnabled(flag); -} - void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) { COMPtr<IWebView> webView; @@ -1475,10 +1457,6 @@ void LayoutTestController::setTextDirection(JSStringRef direction) framePrivate->setTextDirection(bstrT(direction).GetBSTR()); } -void LayoutTestController::allowRoundingHacks() -{ -} - void LayoutTestController::addChromeInputField() { } diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp index 1562886ef..31add11a2 100644 --- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp +++ b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp @@ -103,18 +103,18 @@ public: void OnAlertEvent(WebViewAlertEvent& event) { - fprintf(stdout, "ALERT: %S\n", event.GetMessage().c_str()); + wxFprintf(stdout, "ALERT: %S\n", event.GetMessage()); } void OnConfirmEvent(WebViewConfirmEvent& event) { - fprintf(stdout, "CONFIRM: %S\n", event.GetMessage().c_str()); + wxFprintf(stdout, "CONFIRM: %S\n", event.GetMessage()); event.SetReturnCode(1); } - + void OnPromptEvent(WebViewPromptEvent& event) { - fprintf(stdout, "PROMPT: %S, default text: %S\n", event.GetMessage().c_str(), event.GetResponse().c_str()); + wxFprintf(stdout, "PROMPT: %S, default text: %S\n", event.GetMessage(), event.GetResponse()); event.SetReturnCode(1); } @@ -123,15 +123,13 @@ public: fprintf(stdout, "CONSOLE MESSAGE: "); if (event.GetLineNumber()) fprintf(stdout, "line %d: ", event.GetLineNumber()); - fprintf(stdout, "%S\n", event.GetMessage().c_str()); + wxFprintf(stdout, "%S\n", event.GetMessage()); } void OnReceivedTitleEvent(WebViewReceivedTitleEvent& event) { - if (gLayoutTestController->dumpTitleChanges() && !done) { - const char* title = event.GetTitle().mb_str(wxConvUTF8); - printf("TITLE CHANGED: %S\n", title ? title : ""); - } + if (gLayoutTestController->dumpTitleChanges() && !done) + wxFprintf(stdout, "TITLE CHANGED: %S\n", event.GetTitle()); } void OnWindowObjectClearedEvent(WebViewWindowObjectClearedEvent& event) diff --git a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index b65e87ddf..37e3f055c 100644 --- a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -155,10 +155,6 @@ void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) // FIXME: implement } -void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) -{ -} - void LayoutTestController::setWaitToDump(bool waitUntilDone) { static const int timeoutSeconds = 10; @@ -608,10 +604,6 @@ void LayoutTestController::setTextDirection(JSStringRef direction) // FIXME: Implement. } -void LayoutTestController::allowRoundingHacks() -{ -} - void LayoutTestController::addChromeInputField() { } diff --git a/Tools/MiniBrowser/qt/icons/favicon.png b/Tools/MiniBrowser/qt/icons/favicon.png Binary files differindex 4462752a5..325d5bd1e 100644 --- a/Tools/MiniBrowser/qt/icons/favicon.png +++ b/Tools/MiniBrowser/qt/icons/favicon.png diff --git a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml index 5237c715c..0ebf02860 100644 --- a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml +++ b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml @@ -105,6 +105,7 @@ Rectangle { if (parent.enabled) { console.log("MiniBrowser: Going backward in session history.") webView.goBack() + webView.forceActiveFocus() } } } @@ -139,6 +140,7 @@ Rectangle { if (parent.enabled) { console.log("MiniBrowser: Going forward in session history.") webView.goForward() + webView.forceActiveFocus() } } } @@ -267,7 +269,7 @@ Rectangle { height: 16 anchors { left: parent.left - leftMargin: 4 + leftMargin: 6 verticalCenter: parent.verticalCenter } } diff --git a/Tools/QtTestBrowser/cookiejar.cpp b/Tools/QtTestBrowser/cookiejar.cpp index 22a8d17a2..b8ed7d003 100644 --- a/Tools/QtTestBrowser/cookiejar.cpp +++ b/Tools/QtTestBrowser/cookiejar.cpp @@ -25,9 +25,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" + #include "cookiejar.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QStandardPaths> #else #include <QDesktopServices> @@ -46,7 +48,7 @@ TestBrowserCookieJar::TestBrowserCookieJar(QObject* parent) connect(&m_timer, SIGNAL(timeout()), this, SLOT(saveToDisk())); #ifndef QT_NO_DESKTOPSERVICES -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QString path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); #else QString path = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 623a7efa1..e4ae456db 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -32,6 +32,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" + #include "launcherwindow.h" #include "cookiejar.h" #include "urlloader.h" @@ -64,7 +66,7 @@ #endif #if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QStandardPaths> #else #include <QDesktopServices> @@ -806,7 +808,7 @@ void LauncherWindow::setDiskCache(bool enable) QNetworkDiskCache* cache = 0; if (enable) { cache = new QNetworkDiskCache(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); #else QString cacheLocation = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); diff --git a/Tools/Scripts/old-run-webkit-tests b/Tools/Scripts/old-run-webkit-tests index 5b308ab03..09443c87c 100755 --- a/Tools/Scripts/old-run-webkit-tests +++ b/Tools/Scripts/old-run-webkit-tests @@ -2158,8 +2158,11 @@ sub buildPlatformResultHierarchy() @platforms = $platform; } } elsif ($platform =~ /^qt/) { - if ($platform eq "qt-5.0-wk2") { - push @platforms, $platform; + if ($platform eq "qt-5.0-wk2" || getQtVersion() eq "5.0" && $useWebKitTestRunner) { + push @platforms, "qt-5.0-wk2"; + } + elsif ($platform eq "qt-5.0-wk1" || getQtVersion() eq "5.0" && !$useWebKitTestRunner) { + push @platforms, "qt-5.0-wk1" } if (isARM() || $platform eq "qt-arm") { @@ -2488,9 +2491,6 @@ sub readSkippedFiles($) # additionally to their own to avoid maintaining separate lists. push(@skippedFileDirectories, catdir($platformBaseDirectory, "wk2")) if ($platform eq "win-wk2" || $platform eq "qt-5.0-wk2" || $platform eq "mac-wk2" || $platform eq "gtk-wk2"); - # Add Qt WK1-only skipped tests. - push(@skippedFileDirectories, catdir($platformBaseDirectory, "qt-5.0-wk1")) if (isQt() && !$useWebKitTestRunner); - if ($verbose) { foreach my $skippedPath (@skippedFileDirectories) { print "Using Skipped file: $skippedPath\n"; diff --git a/Tools/Scripts/read-checksum-from-png b/Tools/Scripts/read-checksum-from-png index ab08b253b..fb03f28b7 100755 --- a/Tools/Scripts/read-checksum-from-png +++ b/Tools/Scripts/read-checksum-from-png @@ -30,7 +30,7 @@ from __future__ import with_statement import sys -from webkitpy.layout_tests import read_checksum_from_png +from webkitpy.common import read_checksum_from_png if '__main__' == __name__: diff --git a/Tools/Scripts/update-webkit-chromium b/Tools/Scripts/update-webkit-chromium index 550830e1c..a5c242442 100755 --- a/Tools/Scripts/update-webkit-chromium +++ b/Tools/Scripts/update-webkit-chromium @@ -55,7 +55,7 @@ if (! -e ".gclient") { # If .gclient configuration file doesn't exist, create it. print "Configuring gclient...\n"; system($gclientPath, - "config", + "config", "--spec=solutions=[{'name':'./','url':None}]") == 0 or die $!; } @@ -72,7 +72,13 @@ if (isChromiumAndroid()) { die "Couldn't extract the Android NDK." if $result; } - $ENV{ANDROID_NDK_ROOT} = sourceDir() . "/Source/WebKit/chromium/android-ndk-r7b"; + my $androidNdkRoot = sourceDir() . "/Source/WebKit/chromium/android-ndk-r7b"; + + # Attempt to replace the NDK's linker with a 64-bit version if the host + # OS is Linux. This will significantly speed up link times. + chromiumInstall64BitAndroidLinkerIfNeeded($androidNdkRoot) if isLinux(); + + $ENV{ANDROID_NDK_ROOT} = $androidNdkRoot; $ENV{WEBKIT_ANDROID_BUILD} = 1; } diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index d293d81ef..b728bad0b 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -939,7 +939,6 @@ sub blackberryCMakeArguments() if ($cpu eq "a9") { $cpu = $arch . "v7le"; push @cmakeExtraOptions, '-DTARGETING_PLAYBOOK=1'; - push @cmakeExtraOptions, '-DENABLE_GLES2=1'; } my $stageDir = $ENV{"STAGE_DIR"}; @@ -966,7 +965,7 @@ sub blackberryCMakeArguments() push @cmakeExtraOptions, "-DCMAKE_SKIP_RPATH='ON'" if isDarwin(); push @cmakeExtraOptions, "-DENABLE_DRT=1" if $ENV{"ENABLE_DRT"}; - push @cmakeExtraOptions, "-DENABLE_GLES2=1" if $ENV{"ENABLE_GLES2"}; + push @cmakeExtraOptions, "-DENABLE_GLES2=1" unless $ENV{"DISABLE_GLES2"}; my @includeSystemDirectories; push @includeSystemDirectories, File::Spec->catdir($stageInc, "grskia", "skia"); @@ -2495,6 +2494,49 @@ sub buildChromium($@) return $result; } +sub chromiumInstall64BitAndroidLinkerIfNeeded +{ + my ($androidNdkRoot) = @_; + + # Resolve the toolchain version through glob(). + my $linkerDirPrefix = glob("$androidNdkRoot/toolchains/arm-linux-androideabi-*/prebuilt/linux-x86"); + + my $linkerDirname1 = "$linkerDirPrefix/bin"; + my $linkerBasename1 = "arm-linux-androideabi-ld"; + my $linkerDirname2 = "$linkerDirPrefix/arm-linux-androideabi/bin"; + my $linkerBasename2 = "ld"; + my $newLinker = "arm-linux-androideabi-ld.e4df3e0a5bb640ccfa2f30ee67fe9b3146b152d6"; + + # Do not continue if the new linker is not (yet) available. + if (! -e "third_party/aosp/$newLinker") { + return; + } + + chromiumReplaceAndroidLinkerIfNeeded($linkerDirname1, $linkerBasename1, $newLinker); + chromiumReplaceAndroidLinkerIfNeeded($linkerDirname2, $linkerBasename2, $newLinker); +} + +sub chromiumReplaceAndroidLinkerIfNeeded +{ + my ($linkerDirname, $linkerBasename, $newLinker) = @_; + + # If the destination directory does not exist, or the linker has already + # been installed, replacing it will not be necessary. + if (! -d "$linkerDirname" || -e "$linkerDirname/$newLinker") { + return; + } + + print "Installing 64-bit Android linker in $linkerDirname..\n"; + system("cp", "third_party/aosp/$newLinker", "$linkerDirname/$newLinker"); + system("mv", "$linkerDirname/$linkerBasename", "$linkerDirname/$linkerBasename.orig"); + system("ln", "-s", "$newLinker", "$linkerDirname/$linkerBasename"); + + if (! -e "$linkerDirname/$newLinker") { + print "Unable to copy the linker.\n"; + exit 1; + } +} + sub appleApplicationSupportPath { open INSTALL_DIR, "</proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Apple\ Inc./Apple\ Application\ Support/InstallDir"; diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm index 48b885af9..e96851f09 100644 --- a/Tools/Scripts/webkitperl/FeatureList.pm +++ b/Tools/Scripts/webkitperl/FeatureList.pm @@ -51,6 +51,7 @@ my ( $css3FlexboxSupport, $cssExclusionsSupport, $cssFiltersSupport, + $cssImageResolutionSupport, $cssRegionsSupport, $cssShadersSupport, $cssVariablesSupport, @@ -140,7 +141,7 @@ my @features = ( define => "ENABLE_BATTERY_STATUS", default => (isEfl() || isBlackBerry()), value => \$batteryStatusSupport }, { option => "blob", desc => "Toggle Blob support", - define => "ENABLE_BLOB", default => (isAppleMacWebKit() || isGtk() || isChromium() || isBlackBerry()), value => \$blobSupport }, + define => "ENABLE_BLOB", default => (isAppleMacWebKit() || isGtk() || isChromium() || isBlackBerry() || isEfl()), value => \$blobSupport }, { option => "channel-messaging", desc => "Toggle Channel Messaging support", define => "ENABLE_CHANNEL_MESSAGING", default => 1, value => \$channelMessagingSupport }, @@ -154,6 +155,9 @@ my @features = ( { option => "css3-flexbox", desc => "Toggle CSS3 Flexbox support", define => "ENABLE_CSS3_FLEXBOX", default => 1, value => \$css3FlexboxSupport }, + { option => "css-image-resolution", desc => "Toggle CSS image-resolution support", + define => "ENABLE_CSS_IMAGE_RESOLUTION", default => 0, value => \$cssImageResolutionSupport }, + { option => "css-regions", desc => "Toggle CSS Regions support", define => "ENABLE_CSS_REGIONS", default => 1, value => \$cssRegionsSupport }, diff --git a/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py b/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py index b305c19b8..8ae0bb9b9 100644 --- a/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py +++ b/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py @@ -154,17 +154,22 @@ class BaselineOptimizer(object): source = self._filesystem.join(self._scm.checkout_root, directory, baseline_name) data_for_result[result] = self._filesystem.read_binary_file(source) + file_names = [] for directory, result in results_by_directory.items(): if new_results_by_directory.get(directory) != result: - file_name = self._filesystem.join(self._scm.checkout_root, directory, baseline_name) - self._scm.delete(file_name) + file_names.append(self._filesystem.join(self._scm.checkout_root, directory, baseline_name)) + if file_names: + self._scm.delete_list(file_names) + file_names = [] for directory, result in new_results_by_directory.items(): if results_by_directory.get(directory) != result: destination = self._filesystem.join(self._scm.checkout_root, directory, baseline_name) self._filesystem.maybe_make_directory(self._filesystem.split(destination)[0]) self._filesystem.write_binary_file(destination, data_for_result[result]) - self._scm.add(destination) + file_names.append(destination) + if file_names: + self._scm.add_list(file_names) def directories_by_result(self, baseline_name): results_by_directory = self._read_results_by_directory(baseline_name) diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index 3f99eaddc..04ae256d2 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -251,6 +251,7 @@ committers_unable_to_review = [ Committer("Gyuyoung Kim", ["gyuyoung.kim@samsung.com", "gyuyoung.kim@webkit.org"], "gyuyoung"), Committer("Hans Wennborg", "hans@chromium.org", "hwennborg"), Committer("Hayato Ito", "hayato@chromium.org", "hayato"), + Committer("Hironori Bono", "hbono@chromium.org", "hbono"), Committer("Helder Correia", "helder@sencha.com", "helder"), Committer("Hin-Chung Lam", ["hclam@google.com", "hclam@chromium.org"]), Committer("Igor Trindade Oliveira", ["igor.oliveira@webkit.org", "igor.o@sisa.samsung.com"], "igoroliveira"), diff --git a/Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png.py b/Tools/Scripts/webkitpy/common/read_checksum_from_png.py index 70a0502b7..70a0502b7 100644 --- a/Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png.py +++ b/Tools/Scripts/webkitpy/common/read_checksum_from_png.py diff --git a/Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png_unittest.py b/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py index 7375741ac..defbbf806 100644 --- a/Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png_unittest.py +++ b/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py @@ -24,7 +24,7 @@ import StringIO import unittest -from webkitpy.layout_tests import read_checksum_from_png +from webkitpy.common import read_checksum_from_png class ReadChecksumFromPngTest(unittest.TestCase): diff --git a/Tools/Scripts/webkitpy/common/system/crashlogs.py b/Tools/Scripts/webkitpy/common/system/crashlogs.py index 0dd37d255..270ca81ed 100644 --- a/Tools/Scripts/webkitpy/common/system/crashlogs.py +++ b/Tools/Scripts/webkitpy/common/system/crashlogs.py @@ -56,15 +56,18 @@ class CrashLogs(object): first_line_regex = re.compile(r'^Process:\s+(?P<process_name>.*) \[(?P<pid>\d+)\]$') errors = '' for path in reversed(sorted(logs)): - if not newer_than or self._host.filesystem.mtime(path) > newer_than: - try: + try: + if not newer_than or self._host.filesystem.mtime(path) > newer_than: f = self._host.filesystem.read_text_file(path) match = first_line_regex.match(f[0:f.find('\n')]) if match and match.group('process_name') == process_name and (pid is None or int(match.group('pid')) == pid): return errors + f - except IOError, e: - if include_errors: - errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e)) + except IOError, e: + if include_errors: + errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e)) + except OSError, e: + if include_errors: + errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e)) if include_errors and errors: return errors diff --git a/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py b/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py index d93feec0e..1f5c40a09 100644 --- a/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py @@ -75,6 +75,7 @@ class CrashLogsTest(unittest.TestCase): else: self.assertEqual(a.splitlines(), b.splitlines()) + def test_find_log_darwin(self): if not SystemHost().platform.is_mac(): return @@ -105,8 +106,17 @@ class CrashLogsTest(unittest.TestCase): self.assertEqual(log, None) def bad_read(path): - raise IOError('No such file or directory') + raise IOError('IOError: No such file or directory') + + def bad_mtime(path): + raise OSError('OSError: No such file or directory') filesystem.read_text_file = bad_read log = crash_logs.find_newest_log("DumpRenderTree", 28531, include_errors=True) - self.assertTrue('No such file or directory' in log) + self.assertTrue('IOError: No such file or directory' in log) + + filesystem = MockFileSystem(files) + crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem)) + filesystem.mtime = bad_mtime + log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0, include_errors=True) + self.assertTrue('OSError: No such file or directory' in log) diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py index 43dcbca1b..8759c719a 100644 --- a/Tools/Scripts/webkitpy/common/system/executive.py +++ b/Tools/Scripts/webkitpy/common/system/executive.py @@ -451,3 +451,15 @@ class Executive(object): def popen(self, *args, **kwargs): return subprocess.Popen(*args, **kwargs) + + def run_in_parallel(self, command_lines_and_cwds, processes=None): + """Runs a list of (cmd_line list, cwd string) tuples in parallel and returns a list of (retcode, stdout, stderr) tuples.""" + return multiprocessing.Pool(processes=processes).map(_run_command_thunk, command_lines_and_cwds) + + +def _run_command_thunk(cmd_line_and_cwd): + # Note that this needs to be a bare module (and hence Picklable) method to work with multiprocessing.Pool. + (cmd_line, cwd) = cmd_line_and_cwd + proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = proc.communicate() + return (proc.returncode, stdout, stderr) diff --git a/Tools/Scripts/webkitpy/common/system/executive_mock.py b/Tools/Scripts/webkitpy/common/system/executive_mock.py index d57a5c480..b0db48ca3 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_mock.py +++ b/Tools/Scripts/webkitpy/common/system/executive_mock.py @@ -108,6 +108,11 @@ class MockExecutive(object): self._proc = MockProcess() return self._proc + def run_in_parallel(self, commands): + command_outputs = [] + for cmd_line, cwd in commands: + command_outputs.append([0, self.run_command(cmd_line, cwd=cwd), '']) + return command_outputs class MockExecutive2(object): @staticmethod diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py index c63ff3555..466e2ec02 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py @@ -31,6 +31,7 @@ import os import signal import subprocess import sys +import time import unittest # Since we execute this script directly as part of the unit tests, we need to ensure @@ -216,6 +217,18 @@ class ExecutiveTest(unittest.TestCase): pids = executive.running_pids() self.assertTrue(os.getpid() in pids) + def test_run_in_parallel(self): + NUM_PROCESSES = 4 + DELAY_SECS = 0.25 + cmd_line = [sys.executable, '-c', 'import time; time.sleep(%f); print "hello"' % DELAY_SECS] + cwd = os.getcwd() + commands = [tuple([cmd_line, cwd])] * NUM_PROCESSES + start = time.time() + command_outputs = Executive().run_in_parallel(commands, processes=NUM_PROCESSES) + done = time.time() + self.assertTrue(done - start < NUM_PROCESSES * DELAY_SECS) + self.assertEquals([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES) + def main(platform, stdin, stdout, cmd, args): if platform == 'win32' and hasattr(stdout, 'fileno'): diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py index d4a955080..a4eb695bf 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py @@ -47,6 +47,7 @@ class MockFileSystem(object): """ self.files = files or {} self.written_files = {} + self.last_tmpdir = None self._sep = '/' self.current_tmpno = 0 self.cwd = cwd @@ -233,7 +234,8 @@ class MockFileSystem(object): dir = self.sep + '__im_tmp' curno = self.current_tmpno self.current_tmpno += 1 - return self.join(dir, "%s_%u_%s" % (prefix, curno, suffix)) + self.last_tmpdir = self.join(dir, '%s_%u_%s' % (prefix, curno, suffix)) + return self.last_tmpdir def mkdtemp(self, **kwargs): class TemporaryDirectory(object): diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py index 047377c74..e762cfda0 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py @@ -46,6 +46,7 @@ import time from webkitpy.layout_tests.controllers import manager_worker_broker from webkitpy.layout_tests.controllers import worker +from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter from webkitpy.layout_tests.layout_package import json_layout_results_generator from webkitpy.layout_tests.layout_package import json_results_generator from webkitpy.layout_tests.models import test_expectations @@ -106,6 +107,7 @@ def use_trac_links_in_results_html(port_obj): # Use existence of builder_name as a proxy for knowing we're on a bot. return port_obj.get_option("builder_name") + # FIXME: This should be on the Manager class (since that's the only caller) # or split off from Manager onto another helper class, but should not be a free function. # Most likely this should be made into its own class, and this super-long function @@ -909,6 +911,10 @@ class Manager(object): end_time = time.time() + # Some crash logs can take a long time to be written out so look + # for new logs after the test run finishes. + self._look_for_new_crash_logs(result_summary, start_time) + self._look_for_new_crash_logs(retry_summary, start_time) self._clean_up_run() self._print_timing_statistics(end_time - start_time, thread_timings, test_timings, individual_test_timings, result_summary) @@ -970,6 +976,29 @@ class Manager(object): _log.debug("cleaning up port") self._port.clean_up_test_run() + def _look_for_new_crash_logs(self, result_summary, start_time): + """Since crash logs can take a long time to be written out if the system is + under stress do a second pass at the end of the test run. + + result_summary: the results of the test run + start_time: time the tests started at. We're looking for crash + logs after that time. + """ + crashed_processes = [] + for test, result in result_summary.unexpected_results.iteritems(): + if (result.type != test_expectations.CRASH): + continue + for failure in result.failures: + if not isinstance(failure, test_failures.FailureCrash): + continue + crashed_processes.append([test, failure.process_name, failure.pid]) + + crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time) + if crash_logs: + for test, crash_log in crash_logs.iteritems(): + writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test) + writer.write_crash_log(crash_log) + def update_summary(self, result_summary): """Update the summary and print results with any completed tests.""" while True: diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py index 63e18ac8a..3ddab8ec3 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py @@ -32,6 +32,7 @@ import StringIO import sys +import time import unittest from webkitpy.common.system.filesystem_mock import MockFileSystem @@ -326,6 +327,21 @@ class ManagerTest(unittest.TestCase): manager = get_manager_with_tests(['http\\tests\\mime']) self.assertTrue(manager.needs_servers()) + def test_look_for_new_crash_logs(self): + def get_manager_with_tests(test_names): + host = MockHost() + port = host.port_factory.get('test-mac-leopard') + manager = Manager(port, options=MockOptions(test_list=None, http=True), printer=Mock()) + manager.collect_tests(test_names) + return manager + host = MockHost() + port = host.port_factory.get('test-mac-leopard') + tests = ['failures/expected/crash.html'] + expectations = test_expectations.TestExpectations(port, tests) + rs = result_summary.ResultSummary(expectations, tests) + manager = get_manager_with_tests(tests) + manager._look_for_new_crash_logs(rs, time.time()) + class NaturalCompareTest(unittest.TestCase): def assert_cmp(self, x, y, result): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py index 64ad13686..c0e13dfcb 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py @@ -36,13 +36,13 @@ import errno import os import re +from webkitpy.common import find_files +from webkitpy.common import read_checksum_from_png from webkitpy.common.memoized import memoized from webkitpy.common.system import path -from webkitpy.common import find_files from webkitpy.common.system import logutils from webkitpy.common.system.executive import ScriptError from webkitpy.common.system.systemhost import SystemHost -from webkitpy.layout_tests import read_checksum_from_png from webkitpy.layout_tests.models.test_configuration import TestConfiguration from webkitpy.layout_tests.port import config as port_config from webkitpy.layout_tests.port import driver @@ -907,7 +907,6 @@ class Port(object): # where turnk isn't checked out as a whole. return [('webkit', self.layout_tests_dir())] - _WDIFF_DEL = '##WDIFF_DEL##' _WDIFF_ADD = '##WDIFF_ADD##' _WDIFF_END = '##WDIFF_END##' @@ -1085,6 +1084,9 @@ class Port(object): '\n'.join(('STDOUT: ' + l) for l in stdout_lines), '\n'.join(('STDERR: ' + l) for l in stderr_lines)) + def look_for_new_crash_logs(self, crashed_processes, start_time): + pass + def sample_process(self, name, pid): pass diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py index cb68f1460..9db4cb570 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -327,9 +327,12 @@ class ChromiumPort(Port): (filetype, filepath)) return (self._filesystem.read_text_file(filepath) or '') else: - _log.warning( - "%s test_expectations overrides file '%s' does not exist" % - (filetype, filepath)) + # FIXME: This allows this to work with mock checkouts; + # This probably shouldn't be used with a mock checkout, though. + if not 'mock-checkout' in filepath: + _log.warning( + "%s test_expectations overrides file '%s' does not exist" % + (filetype, filepath)) return '' def test_expectations_overrides(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/Tools/Scripts/webkitpy/layout_tests/port/mac.py index 855217682..fa57cc3f7 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/mac.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/mac.py @@ -41,6 +41,7 @@ from webkitpy.layout_tests.port.leakdetector import LeakDetector _log = logging.getLogger(__name__) + class MacPort(ApplePort): port_name = "mac" @@ -177,7 +178,7 @@ class MacPort(ApplePort): def release_http_lock(self): pass - def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None): + def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None, wait_for_log=True): # Note that we do slow-spin here and wait, since it appears the time # ReportCrash takes to actually write and flush the file varies when there are # lots of simultaneous crashes going on. @@ -192,14 +193,34 @@ class MacPort(ApplePort): deadline = now + 5 * int(self.get_option('child_processes', 1)) while not crash_log and now <= deadline: crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than) + if not wait_for_log: + break if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]: sleep_fn(0.1) now = time_fn() + if not crash_log: - crash_log = 'no crash log found for %s:%d' % (name, pid) - _log.warning(crash_log) + return None return crash_log + def look_for_new_crash_logs(self, crashed_processes, start_time): + """Since crash logs can take a long time to be written out if the system is + under stress do a second pass at the end of the test run. + + crashes: test_name -> pid, process_name tuple of crashed process + start_time: time the tests started at. We're looking for crash + logs after that time. + """ + crash_logs = {} + for (test_name, process_name, pid) in crashed_processes: + # Passing None for output. This is a second pass after the test finished so + # if the output had any loggine we would have already collected it. + crash_log = self._get_crash_log(process_name, pid, None, None, start_time, wait_for_log=False) + if not crash_log: + continue + crash_logs[test_name] = crash_log + return crash_logs + def sample_process(self, name, pid): try: hang_report = self._filesystem.join(self.results_directory(), "%s-%s.sample.txt" % (name, pid)) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt.py b/Tools/Scripts/webkitpy/layout_tests/port/qt.py index de93bf47f..520575952 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/qt.py @@ -111,10 +111,13 @@ class QtPort(WebKitPort): def baseline_search_path(self): search_paths = [] - if self.get_option('webkit_test_runner'): - search_paths.append(self._wk2_port_name()) - search_paths.append(self.name()) version = self.qt_version() + if '5.0' in version: + if self.get_option('webkit_test_runner'): + search_paths.append('qt-5.0-wk2') + else: + search_paths.append('qt-5.0-wk1') + search_paths.append(self.name()) if '4.8' in version: search_paths.append('qt-4.8') elif version: diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py index 0cc694780..7252b9833 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py @@ -72,6 +72,10 @@ class QtPortTest(port_testcase.PortTestCase): self._assert_search_path(['qt-5.0-wk2', 'qt-win', 'qt-5.0', 'qt'], 'win', use_webkit2=True, qt_version='5.0') self._assert_search_path(['qt-5.0-wk2', 'qt-linux', 'qt-5.0', 'qt'], 'linux', use_webkit2=True, qt_version='5.0') + self._assert_search_path(['qt-5.0-wk1', 'qt-mac', 'qt-5.0', 'qt'], 'mac', use_webkit2=False, qt_version='5.0') + self._assert_search_path(['qt-5.0-wk1', 'qt-win', 'qt-5.0', 'qt'], 'win', use_webkit2=False, qt_version='5.0') + self._assert_search_path(['qt-5.0-wk1', 'qt-linux', 'qt-5.0', 'qt'], 'linux', use_webkit2=False, qt_version='5.0') + def test_show_results_html_file(self): port = self.make_port() port._executive = MockExecutive(should_log=True) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py index d798039ac..879c79abf 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py @@ -441,7 +441,7 @@ class WebKitDriver(Driver): def __init__(self, port, worker_number, pixel_tests, no_timeout=False): Driver.__init__(self, port, worker_number, pixel_tests, no_timeout) - self._driver_tempdir = port._filesystem.mkdtemp(prefix='%s-' % self._port.driver_name()) + self._driver_tempdir = None # WebKitTestRunner can report back subprocess crashes by printing # "#CRASHED - PROCESSNAME". Since those can happen at any time # and ServerProcess won't be aware of them (since the actual tool @@ -449,6 +449,10 @@ class WebKitDriver(Driver): self._crashed_process_name = None self._crashed_pid = None + # WebKitTestRunner can report back subprocesses that became unresponsive + # This could mean they crashed. + self._subprocess_was_unresponsive = False + # stderr reading is scoped on a per-test (not per-block) basis, so we store the accumulated # stderr output, as well as if we've seen #EOF on this driver instance. # FIXME: We should probably remove _read_first_block and _read_optional_image_block and @@ -457,10 +461,9 @@ class WebKitDriver(Driver): self.err_seen_eof = False self._server_process = None - # FIXME: This may be unsafe, as python does not guarentee any ordering of __del__ calls - # I believe it's possible that self._port or self._port._filesystem may already be destroyed. def __del__(self): - self._port._filesystem.rmtree(str(self._driver_tempdir)) + assert(self._server_process is None) + assert(self._driver_tempdir is None) def cmd_line(self, pixel_tests, per_test_args): cmd = self._command_wrapper(self._port.get_option('wrapper')) @@ -485,6 +488,7 @@ class WebKitDriver(Driver): return cmd def _start(self, pixel_tests, per_test_args): + self._driver_tempdir = self._port._filesystem.mkdtemp(prefix='%s-' % self._port.driver_name()) server_name = self._port.driver_name() environment = self._port.setup_environ_for_server(server_name) environment['DYLD_LIBRARY_PATH'] = self._port._build_path() @@ -513,7 +517,8 @@ class WebKitDriver(Driver): # See http://trac.webkit.org/changeset/65537. self._crashed_process_name = self._server_process.name() self._crashed_pid = self._server_process.pid() - elif error_line.startswith("#CRASHED - WebProcess"): + elif (error_line.startswith("#CRASHED - WebProcess") + or error_line.startswith("#PROCESS UNRESPONSIVE - WebProcess")): # WebKitTestRunner uses this to report that the WebProcess subprocess crashed. pid = None m = re.search('pid (\d+)', error_line) @@ -523,11 +528,16 @@ class WebKitDriver(Driver): self._crashed_pid = pid # FIXME: delete this after we're sure this code is working :) _log.debug('WebProcess crash, pid = %s, error_line = %s' % (str(pid), error_line)) + if error_line.startswith("#PROCESS UNRESPONSIVE - WebProcess"): + self._subprocess_was_unresponsive = True return True return self.has_crashed() def _command_from_driver_input(self, driver_input): - if self.is_http_test(driver_input.test_name): + # FIXME: performance tests pass in full URLs instead of test names. + if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://'): + command = driver_input.test_name + elif self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) @@ -573,11 +583,18 @@ class WebKitDriver(Driver): # FIXME: We may need to also read stderr until the process dies? self.error_from_test += self._server_process.pop_all_buffered_stderr() - crash_log = '' + crash_log = None if self.has_crashed(): crash_log = self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, text, self.error_from_test, newer_than=start_time) + # If we don't find a crash log use a placeholder error message instead. + if not crash_log: + crash_log = 'no crash log found for %s:%d.' % (self._crashed_process_name, self._crashed_pid) + # If we were unresponsive append a message informing there may not have been a crash. + if self._subprocess_was_unresponsive: + crash_log += ' Process failed to become responsive before timing out.' + timeout = self._server_process.timed_out if timeout: # DRT doesn't have a built in timer to abort the test, so we might as well @@ -668,6 +685,10 @@ class WebKitDriver(Driver): self._server_process.stop() self._server_process = None + if self._driver_tempdir: + self._port._filesystem.rmtree(str(self._driver_tempdir)) + self._driver_tempdir = None + class ContentBlock(object): def __init__(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py index 09916ba4e..33e422866 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py @@ -277,6 +277,7 @@ class WebKitDriverTest(unittest.TestCase): self.assertEquals(content_block.content_type, 'my_type') self.assertEquals(content_block.encoding, 'none') self.assertEquals(content_block.content_hash, 'foobar') + driver._server_process = None def test_read_binary_block(self): port = TestWebKitPort() @@ -294,6 +295,7 @@ class WebKitDriverTest(unittest.TestCase): self.assertEquals(content_block.content_hash, 'actual') self.assertEquals(content_block.content, '12345678') self.assertEquals(content_block.decoded_content, '12345678') + driver._server_process = None def test_no_timeout(self): port = TestWebKitPort() @@ -317,10 +319,15 @@ class WebKitDriverTest(unittest.TestCase): def has_crashed(self): return self.crashed - def assert_crash(driver, error_line, crashed, name, pid): + def stop(self): + pass + + def assert_crash(driver, error_line, crashed, name, pid, unresponsive=False): self.assertEquals(driver._check_for_driver_crash(error_line), crashed) self.assertEquals(driver._crashed_process_name, name) self.assertEquals(driver._crashed_pid, pid) + self.assertEquals(driver._subprocess_was_unresponsive, unresponsive) + driver.stop() driver._server_process = FakeServerProcess(False) assert_crash(driver, '', False, None, None) @@ -328,19 +335,44 @@ class WebKitDriverTest(unittest.TestCase): driver._crashed_process_name = None driver._crashed_pid = None driver._server_process = FakeServerProcess(False) + driver._subprocess_was_unresponsive = False assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234) driver._crashed_process_name = None driver._crashed_pid = None driver._server_process = FakeServerProcess(False) + driver._subprocess_was_unresponsive = False assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess', None) driver._crashed_process_name = None driver._crashed_pid = None driver._server_process = FakeServerProcess(False) + driver._subprocess_was_unresponsive = False assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True, 'WebProcess', 8675) + + driver._crashed_process_name = None + driver._crashed_pid = None + driver._server_process = FakeServerProcess(False) + driver._subprocess_was_unresponsive = False + assert_crash(driver, '#PROCESS UNRESPONSIVE - WebProcess (pid 8675)\n', True, 'WebProcess', 8675, True) driver._crashed_process_name = None driver._crashed_pid = None driver._server_process = FakeServerProcess(True) + driver._subprocess_was_unresponsive = False assert_crash(driver, '', True, 'FakeServerProcess', 1234) + + def test_creating_a_port_does_not_write_to_the_filesystem(self): + port = TestWebKitPort() + driver = WebKitDriver(port, 0, pixel_tests=True) + self.assertEquals(port._filesystem.written_files, {}) + self.assertEquals(port._filesystem.last_tmpdir, None) + + def test_stop_cleans_up_properly(self): + port = TestWebKitPort() + driver = WebKitDriver(port, 0, pixel_tests=True) + driver.start(True, []) + last_tmpdir = port._filesystem.last_tmpdir + self.assertNotEquals(last_tmpdir, None) + driver.stop() + self.assertFalse(port._filesystem.isdir(last_tmpdir)) diff --git a/Tools/Scripts/webkitpy/performance_tests/perftest.py b/Tools/Scripts/webkitpy/performance_tests/perftest.py index a81c47880..20d3d5838 100644 --- a/Tools/Scripts/webkitpy/performance_tests/perftest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftest.py @@ -28,18 +28,30 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import errno import logging import math import re +import os +import signal +import socket +import subprocess +import time +# Import for auto-install +import webkitpy.thirdparty.autoinstalled.webpagereplay.replay + +from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter from webkitpy.layout_tests.port.driver import DriverInput +from webkitpy.layout_tests.port.driver import DriverOutput _log = logging.getLogger(__name__) class PerfTest(object): - def __init__(self, test_name, path_or_url): + def __init__(self, port, test_name, path_or_url): + self._port = port self._test_name = test_name self._path_or_url = path_or_url @@ -49,12 +61,18 @@ class PerfTest(object): def path_or_url(self): return self._path_or_url - def run(self, driver, timeout_ms): - output = driver.run_test(DriverInput(self.path_or_url(), timeout_ms, None, False)) + def prepare(self, time_out_ms): + return True + + def run(self, driver, time_out_ms): + output = self.run_single(driver, self.path_or_url(), time_out_ms) if self.run_failed(output): return None return self.parse_output(output) + def run_single(self, driver, path_or_url, time_out_ms, should_run_pixel_test=False): + return driver.run_test(DriverInput(path_or_url, time_out_ms, image_hash=None, should_run_pixel_test=should_run_pixel_test)) + def run_failed(self, output): if output.text == None or output.error: pass @@ -137,8 +155,8 @@ class PerfTest(object): class ChromiumStylePerfTest(PerfTest): _chromium_style_result_regex = re.compile(r'^RESULT\s+(?P<name>[^=]+)\s*=\s+(?P<value>\d+(\.\d+)?)\s*(?P<unit>\w+)$') - def __init__(self, test_name, path_or_url): - super(ChromiumStylePerfTest, self).__init__(test_name, path_or_url) + def __init__(self, port, test_name, path_or_url): + super(ChromiumStylePerfTest, self).__init__(port, test_name, path_or_url) def parse_output(self, output): test_failed = False @@ -157,15 +175,15 @@ class ChromiumStylePerfTest(PerfTest): class PageLoadingPerfTest(PerfTest): - def __init__(self, test_name, path_or_url): - super(PageLoadingPerfTest, self).__init__(test_name, path_or_url) + def __init__(self, port, test_name, path_or_url): + super(PageLoadingPerfTest, self).__init__(port, test_name, path_or_url) - def run(self, driver, timeout_ms): + def run(self, driver, time_out_ms): test_times = [] for i in range(0, 20): - output = driver.run_test(DriverInput(self.path_or_url(), timeout_ms, None, False)) - if self.run_failed(output): + output = self.run_single(driver, self.path_or_url(), time_out_ms) + if not output or self.run_failed(output): return None if i == 0: continue @@ -194,16 +212,130 @@ class PageLoadingPerfTest(PerfTest): return {self.test_name(): results} +class ReplayServer(object): + def __init__(self, archive, record): + self._process = None + + # FIXME: Should error if local proxy isn't set to forward requests to localhost:8080 and localhost:8413 + + replay_path = webkitpy.thirdparty.autoinstalled.webpagereplay.replay.__file__ + args = ['python', replay_path, '--no-dns_forwarding', '--port', '8080', '--ssl_port', '8413', '--use_closest_match', '--log_level', 'warning'] + if record: + args.append('--record') + args.append(archive) + + self._process = subprocess.Popen(args) + + def wait_until_ready(self): + for i in range(0, 10): + try: + connection = socket.create_connection(('localhost', '8080'), timeout=1) + connection.close() + return True + except socket.error: + time.sleep(1) + continue + return False + + def stop(self): + if self._process: + self._process.send_signal(signal.SIGINT) + self._process.wait() + self._process = None + + def __del__(self): + self.stop() + + +class ReplayPerfTest(PageLoadingPerfTest): + def __init__(self, port, test_name, path_or_url): + super(ReplayPerfTest, self).__init__(port, test_name, path_or_url) + + def _start_replay_server(self, archive, record): + try: + return ReplayServer(archive, record) + except OSError as error: + if error.errno == errno.ENOENT: + _log.error("Replay tests require web-page-replay.") + else: + raise error + + def prepare(self, time_out_ms): + filesystem = self._port.host.filesystem + path_without_ext = filesystem.splitext(self.path_or_url())[0] + + self._archive_path = filesystem.join(path_without_ext + '.wpr') + self._expected_image_path = filesystem.join(path_without_ext + '-expected.png') + self._url = filesystem.read_text_file(self.path_or_url()).split('\n')[0] + + if filesystem.isfile(self._archive_path) and filesystem.isfile(self._expected_image_path): + _log.info("Replay ready for %s" % self._archive_path) + return True + + _log.info("Preparing replay for %s" % self.test_name()) + + driver = self._port.create_driver(worker_number=1, no_timeout=True) + try: + output = self.run_single(driver, self._url, time_out_ms, record=True) + finally: + driver.stop() + + if not output or not filesystem.isfile(self._archive_path): + _log.error("Failed to prepare a replay for %s" % self.test_name()) + return False + + _log.info("Prepared replay for %s" % self.test_name()) + + return True + + def run_single(self, driver, url, time_out_ms, record=False): + server = self._start_replay_server(self._archive_path, record) + if not server: + _log.error("Web page replay didn't start.") + return None + + try: + if not server.wait_until_ready(): + _log.error("Web page replay didn't start.") + return None + + super(ReplayPerfTest, self).run_single(driver, "about:blank", time_out_ms) + _log.debug("Loading the page") + + output = super(ReplayPerfTest, self).run_single(driver, self._url, time_out_ms, should_run_pixel_test=True) + if self.run_failed(output): + return None + + if not output.image: + _log.error("Loading the page did not generate image results") + _log.error(output.text) + return None + + filesystem = self._port.host.filesystem + dirname = filesystem.dirname(url) + filename = filesystem.split(url)[1] + writer = TestResultWriter(filesystem, self._port, dirname, filename) + if record: + writer.write_image_files(actual_image=None, expected_image=output.image) + else: + writer.write_image_files(actual_image=output.image, expected_image=None) + + return output + finally: + server.stop() + + class PerfTestFactory(object): _pattern_map = [ - (re.compile('^inspector/'), ChromiumStylePerfTest), - (re.compile('^PageLoad/'), PageLoadingPerfTest), + (re.compile(r'^inspector/'), ChromiumStylePerfTest), + (re.compile(r'^PageLoad/'), PageLoadingPerfTest), + (re.compile(r'(.+)\.replay$'), ReplayPerfTest), ] @classmethod - def create_perf_test(cls, test_name, path): + def create_perf_test(cls, port, test_name, path): for (pattern, test_class) in cls._pattern_map: if pattern.match(test_name): - return test_class(test_name, path) - return PerfTest(test_name, path) + return test_class(port, test_name, path) + return PerfTest(port, test_name, path) diff --git a/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py b/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py index 21efd2c3c..078f08a46 100755 --- a/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py @@ -31,12 +31,16 @@ import StringIO import math import unittest +from webkitpy.common.host_mock import MockHost from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.layout_tests.port.driver import DriverOutput +from webkitpy.layout_tests.port.test import TestDriver +from webkitpy.layout_tests.port.test import TestPort from webkitpy.performance_tests.perftest import ChromiumStylePerfTest from webkitpy.performance_tests.perftest import PageLoadingPerfTest from webkitpy.performance_tests.perftest import PerfTest from webkitpy.performance_tests.perftest import PerfTestFactory +from webkitpy.performance_tests.perftest import ReplayPerfTest class MainTest(unittest.TestCase): @@ -53,7 +57,7 @@ class MainTest(unittest.TestCase): output_capture = OutputCapture() output_capture.capture_output() try: - test = PerfTest('some-test', '/path/some-dir/some-test') + test = PerfTest(None, 'some-test', '/path/some-dir/some-test') self.assertEqual(test.parse_output(output), {'some-test': {'avg': 1100.0, 'median': 1101.0, 'min': 1080.0, 'max': 1120.0, 'stdev': 11.0, 'unit': 'ms'}}) finally: @@ -77,7 +81,7 @@ class MainTest(unittest.TestCase): output_capture = OutputCapture() output_capture.capture_output() try: - test = PerfTest('some-test', '/path/some-dir/some-test') + test = PerfTest(None, 'some-test', '/path/some-dir/some-test') self.assertEqual(test.parse_output(output), None) finally: actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() @@ -101,7 +105,7 @@ class TestPageLoadingPerfTest(unittest.TestCase): return DriverOutput('some output', image=None, image_hash=None, audio=None, test_time=self._values[self._index - 1]) def test_run(self): - test = PageLoadingPerfTest('some-test', '/path/some-dir/some-test') + test = PageLoadingPerfTest(None, 'some-test', '/path/some-dir/some-test') driver = TestPageLoadingPerfTest.MockDriver([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) output_capture = OutputCapture() output_capture.capture_output() @@ -118,7 +122,7 @@ class TestPageLoadingPerfTest(unittest.TestCase): output_capture = OutputCapture() output_capture.capture_output() try: - test = PageLoadingPerfTest('some-test', '/path/some-dir/some-test') + test = PageLoadingPerfTest(None, 'some-test', '/path/some-dir/some-test') driver = TestPageLoadingPerfTest.MockDriver([1, 2, 3, 4, 5, 6, 7, 'some error', 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) self.assertEqual(test.run(driver, None), None) finally: @@ -128,17 +132,192 @@ class TestPageLoadingPerfTest(unittest.TestCase): self.assertEqual(actual_logs, 'error: some-test\nsome error\n') +class TestReplayPerfTest(unittest.TestCase): + + class ReplayTestPort(TestPort): + def __init__(self, custom_run_test=None): + + class ReplayTestDriver(TestDriver): + def run_test(self, text_input): + return custom_run_test(text_input) if custom_run_test else None + + self._custom_driver_class = ReplayTestDriver + super(self.__class__, self).__init__(host=MockHost()) + + def _driver_class(self): + return self._custom_driver_class + + class MockReplayServer(object): + def __init__(self, wait_until_ready=True): + self.wait_until_ready = lambda: wait_until_ready + + def stop(self): + pass + + def _add_file(self, port, dirname, filename, content=True): + port.host.filesystem.maybe_make_directory(dirname) + port.host.filesystem.files[port.host.filesystem.join(dirname, filename)] = content + + def _setup_test(self, run_test=None): + test_port = self.ReplayTestPort(run_test) + self._add_file(test_port, '/path/some-dir', 'some-test.replay', 'http://some-test/') + test = ReplayPerfTest(test_port, 'some-test.replay', '/path/some-dir/some-test.replay') + test._start_replay_server = lambda archive, record: self.__class__.MockReplayServer() + return test, test_port + + def test_run_single(self): + output_capture = OutputCapture() + output_capture.capture_output() + + loaded_pages = [] + + def run_test(test_input): + if test_input.test_name != "about:blank": + self.assertEqual(test_input.test_name, 'http://some-test/') + loaded_pages.append(test_input) + self._add_file(port, '/path/some-dir', 'some-test.wpr', 'wpr content') + return DriverOutput('actual text', 'actual image', 'actual checksum', + audio=None, crash=False, timeout=False, error=False) + + test, port = self._setup_test(run_test) + test._archive_path = '/path/some-dir/some-test.wpr' + test._url = 'http://some-test/' + + try: + driver = port.create_driver(worker_number=1, no_timeout=True) + self.assertTrue(test.run_single(driver, '/path/some-dir/some-test.replay', time_out_ms=100)) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + + self.assertEqual(len(loaded_pages), 2) + self.assertEqual(loaded_pages[0].test_name, 'about:blank') + self.assertEqual(loaded_pages[1].test_name, 'http://some-test/') + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, '') + + def test_run_single_fails_without_webpagereplay(self): + output_capture = OutputCapture() + output_capture.capture_output() + + test, port = self._setup_test() + test._start_replay_server = lambda archive, record: None + test._archive_path = '/path/some-dir.wpr' + test._url = 'http://some-test/' + + try: + driver = port.create_driver(worker_number=1, no_timeout=True) + self.assertEqual(test.run_single(driver, '/path/some-dir/some-test.replay', time_out_ms=100), None) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, "Web page replay didn't start.\n") + + def test_prepare_fails_when_wait_until_ready_fails(self): + output_capture = OutputCapture() + output_capture.capture_output() + + test, port = self._setup_test() + test._start_replay_server = lambda archive, record: self.__class__.MockReplayServer(wait_until_ready=False) + test._archive_path = '/path/some-dir.wpr' + test._url = 'http://some-test/' + + try: + driver = port.create_driver(worker_number=1, no_timeout=True) + self.assertEqual(test.run_single(driver, '/path/some-dir/some-test.replay', time_out_ms=100), None) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, "Web page replay didn't start.\n") + + def test_run_single_fails_when_output_has_error(self): + output_capture = OutputCapture() + output_capture.capture_output() + + loaded_pages = [] + + def run_test(test_input): + loaded_pages.append(test_input) + self._add_file(port, '/path/some-dir', 'some-test.wpr', 'wpr content') + return DriverOutput('actual text', 'actual image', 'actual checksum', + audio=None, crash=False, timeout=False, error='some error') + + test, port = self._setup_test(run_test) + test._archive_path = '/path/some-dir.wpr' + test._url = 'http://some-test/' + + try: + driver = port.create_driver(worker_number=1, no_timeout=True) + self.assertEqual(test.run_single(driver, '/path/some-dir/some-test.replay', time_out_ms=100), None) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + + self.assertEqual(len(loaded_pages), 2) + self.assertEqual(loaded_pages[0].test_name, 'about:blank') + self.assertEqual(loaded_pages[1].test_name, 'http://some-test/') + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, 'error: some-test.replay\nsome error\n') + + def test_prepare(self): + output_capture = OutputCapture() + output_capture.capture_output() + + def run_test(test_input): + self._add_file(port, '/path/some-dir', 'some-test.wpr', 'wpr content') + return DriverOutput('actual text', 'actual image', 'actual checksum', + audio=None, crash=False, timeout=False, error=False) + + test, port = self._setup_test(run_test) + + try: + self.assertEqual(test.prepare(time_out_ms=100), True) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, 'Preparing replay for some-test.replay\nPrepared replay for some-test.replay\n') + + def test_prepare_calls_run_single(self): + output_capture = OutputCapture() + output_capture.capture_output() + called = [False] + + def run_single(driver, url, time_out_ms, record): + self.assertTrue(record) + self.assertEqual(url, 'http://some-test/') + called[0] = True + return False + + test, port = self._setup_test() + test.run_single = run_single + + try: + self.assertEqual(test.prepare(time_out_ms=100), False) + finally: + actual_stdout, actual_stderr, actual_logs = output_capture.restore_output() + self.assertTrue(called[0]) + self.assertEqual(test._archive_path, '/path/some-dir/some-test.wpr') + self.assertEqual(test._url, 'http://some-test/') + self.assertEqual(actual_stdout, '') + self.assertEqual(actual_stderr, '') + self.assertEqual(actual_logs, "Preparing replay for some-test.replay\nFailed to prepare a replay for some-test.replay\n") + class TestPerfTestFactory(unittest.TestCase): def test_regular_test(self): - test = PerfTestFactory.create_perf_test('some-dir/some-test', '/path/some-dir/some-test') + test = PerfTestFactory.create_perf_test(None, 'some-dir/some-test', '/path/some-dir/some-test') self.assertEqual(test.__class__, PerfTest) def test_inspector_test(self): - test = PerfTestFactory.create_perf_test('inspector/some-test', '/path/inspector/some-test') + test = PerfTestFactory.create_perf_test(None, 'inspector/some-test', '/path/inspector/some-test') self.assertEqual(test.__class__, ChromiumStylePerfTest) def test_page_loading_test(self): - test = PerfTestFactory.create_perf_test('PageLoad/some-test', '/path/PageLoad/some-test') + test = PerfTestFactory.create_perf_test(None, 'PageLoad/some-test', '/path/PageLoad/some-test') self.assertEqual(test.__class__, PageLoadingPerfTest) diff --git a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py index b4c29490a..9a3757128 100644 --- a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py @@ -41,6 +41,7 @@ from webkitpy.common.host import Host from webkitpy.common.net.file_uploader import FileUploader from webkitpy.layout_tests.views import printing from webkitpy.performance_tests.perftest import PerfTestFactory +from webkitpy.performance_tests.perftest import ReplayPerfTest _log = logging.getLogger(__name__) @@ -51,6 +52,7 @@ class PerfTestsRunner(object): _EXIT_CODE_BAD_BUILD = -1 _EXIT_CODE_BAD_JSON = -2 _EXIT_CODE_FAILED_UPLOADING = -3 + _EXIT_CODE_BAD_PREPARATION = -4 def __init__(self, args=None, port=None): self._options, self._args = PerfTestsRunner._parse_args(args) @@ -90,21 +92,27 @@ class PerfTestsRunner(object): optparse.make_option("--pause-before-testing", dest="pause_before_testing", action="store_true", default=False, help="Pause before running the tests to let user attach a performance monitor."), optparse.make_option("--output-json-path", - help="Filename of the JSON file that summaries the results"), + help="Filename of the JSON file that summaries the results."), optparse.make_option("--source-json-path", - help="Path to a JSON file to be merged into the JSON file when --output-json-path is present"), + help="Path to a JSON file to be merged into the JSON file when --output-json-path is present."), optparse.make_option("--test-results-server", - help="Upload the generated JSON file to the specified server when --output-json-path is present"), + help="Upload the generated JSON file to the specified server when --output-json-path is present."), optparse.make_option("--webkit-test-runner", "-2", action="store_true", help="Use WebKitTestRunner rather than DumpRenderTree."), + optparse.make_option("--replay", dest="replay", action="store_true", default=False, + help="Run replay tests."), ] return optparse.OptionParser(option_list=(perf_option_list)).parse_args(args) def _collect_tests(self): """Return the list of tests found.""" + test_extensions = ['.html', '.svg'] + if self._options.replay: + test_extensions.append('.replay') + def _is_test_file(filesystem, dirname, filename): - return filesystem.splitext(filename)[1] in ['.html', '.svg'] + return filesystem.splitext(filename)[1] in test_extensions filesystem = self._host.filesystem @@ -122,7 +130,8 @@ class PerfTestsRunner(object): relative_path = self._port.relative_perf_test_filename(path).replace('\\', '/') if self._port.skips_perf_test(relative_path): continue - tests.append(PerfTestFactory.create_perf_test(relative_path, path)) + test = PerfTestFactory.create_perf_test(self._port, relative_path, path) + tests.append(test) return tests @@ -131,10 +140,13 @@ class PerfTestsRunner(object): _log.error("Build not up to date for %s" % self._port._path_to_driver()) return self._EXIT_CODE_BAD_BUILD - # We wrap any parts of the run that are slow or likely to raise exceptions - # in a try/finally to ensure that we clean up the logging configuration. - unexpected = -1 tests = self._collect_tests() + _log.info("Running %d tests" % len(tests)) + + for test in tests: + if not test.prepare(self._options.time_out_ms): + return self._EXIT_CODE_BAD_PREPARATION + unexpected = self._run_tests_set(sorted(list(tests), key=lambda test: test.test_name()), self._port) options = self._options diff --git a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py index be925c953..8e1eb57ff 100755 --- a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py @@ -120,12 +120,12 @@ max 1120 runner._host.filesystem.maybe_make_directory(runner._base_path, 'inspector') runner._host.filesystem.maybe_make_directory(runner._base_path, 'Bindings') runner._host.filesystem.maybe_make_directory(runner._base_path, 'Parser') - return runner + return runner, test_port def run_test(self, test_name): - runner = self.create_runner() + runner, port = self.create_runner() driver = MainTest.TestDriver() - return runner._run_single_test(ChromiumStylePerfTest(test_name, runner._host.filesystem.join('some-dir', test_name)), driver) + return runner._run_single_test(ChromiumStylePerfTest(port, test_name, runner._host.filesystem.join('some-dir', test_name)), driver) def test_run_passing_test(self): self.assertTrue(self.run_test('pass.html')) @@ -152,19 +152,19 @@ max 1120 path = filesystem.join(runner._base_path, test) dirname = filesystem.dirname(path) if test.startswith('inspector/'): - tests.append(ChromiumStylePerfTest(test, path)) + tests.append(ChromiumStylePerfTest(runner._port, test, path)) else: - tests.append(PerfTest(test, path)) + tests.append(PerfTest(runner._port, test, path)) return tests def test_run_test_set(self): - runner = self.create_runner() + runner, port = self.create_runner() tests = self._tests_for_runner(runner, ['inspector/pass.html', 'inspector/silent.html', 'inspector/failed.html', 'inspector/tonguey.html', 'inspector/timeout.html', 'inspector/crash.html']) output = OutputCapture() output.capture_output() try: - unexpected_result_count = runner._run_tests_set(tests, runner._port) + unexpected_result_count = runner._run_tests_set(tests, port) finally: stdout, stderr, log = output.restore_output() self.assertEqual(unexpected_result_count, len(tests) - 1) @@ -178,11 +178,11 @@ max 1120 def stop(self): TestDriverWithStopCount.stop_count += 1 - runner = self.create_runner(driver_class=TestDriverWithStopCount) + runner, port = self.create_runner(driver_class=TestDriverWithStopCount) tests = self._tests_for_runner(runner, ['inspector/pass.html', 'inspector/silent.html', 'inspector/failed.html', 'inspector/tonguey.html', 'inspector/timeout.html', 'inspector/crash.html']) - unexpected_result_count = runner._run_tests_set(tests, runner._port) + unexpected_result_count = runner._run_tests_set(tests, port) self.assertEqual(TestDriverWithStopCount.stop_count, 6) @@ -193,13 +193,13 @@ max 1120 def start(self): TestDriverWithStartCount.start_count += 1 - runner = self.create_runner(args=["--pause-before-testing"], driver_class=TestDriverWithStartCount) + runner, port = self.create_runner(args=["--pause-before-testing"], driver_class=TestDriverWithStartCount) tests = self._tests_for_runner(runner, ['inspector/pass.html']) output = OutputCapture() output.capture_output() try: - unexpected_result_count = runner._run_tests_set(tests, runner._port) + unexpected_result_count = runner._run_tests_set(tests, port) self.assertEqual(TestDriverWithStartCount.start_count, 1) finally: stdout, stderr, log = output.restore_output() @@ -207,12 +207,12 @@ max 1120 self.assertEqual(log, "Running inspector/pass.html (1 of 1)\nRESULT group_name: test_name= 42 ms\n\n") def test_run_test_set_for_parser_tests(self): - runner = self.create_runner() + runner, port = self.create_runner() tests = self._tests_for_runner(runner, ['Bindings/event-target-wrapper.html', 'Parser/some-parser.html']) output = OutputCapture() output.capture_output() try: - unexpected_result_count = runner._run_tests_set(tests, runner._port) + unexpected_result_count = runner._run_tests_set(tests, port) finally: stdout, stderr, log = output.restore_output() self.assertEqual(unexpected_result_count, 0) @@ -226,9 +226,9 @@ max 1120 '', ''])) def test_run_test_set_with_json_output(self): - runner = self.create_runner(args=['--output-json-path=/mock-checkout/output.json']) - runner._host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True - runner._host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True + runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json']) + port.host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True + port.host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True runner._timestamp = 123456789 output_capture = OutputCapture() output_capture.capture_output() @@ -238,7 +238,8 @@ max 1120 stdout, stderr, logs = output_capture.restore_output() self.assertEqual(logs, - '\n'.join(['Running Bindings/event-target-wrapper.html (1 of 2)', + '\n'.join(['Running 2 tests', + 'Running Bindings/event-target-wrapper.html (1 of 2)', 'RESULT Bindings: event-target-wrapper= 1489.05 ms', 'median= 1487.0 ms, stdev= 14.46 ms, min= 1471.0 ms, max= 1510.0 ms', '', @@ -246,17 +247,17 @@ max 1120 'RESULT group_name: test_name= 42 ms', '', ''])) - self.assertEqual(json.loads(runner._host.filesystem.files['/mock-checkout/output.json']), { + self.assertEqual(json.loads(port.host.filesystem.files['/mock-checkout/output.json']), { "timestamp": 123456789, "results": {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, "inspector/pass.html:group_name:test_name": 42}, "webkit-revision": 5678}) def test_run_test_set_with_json_source(self): - runner = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', '--source-json-path=/mock-checkout/source.json']) - runner._host.filesystem.files['/mock-checkout/source.json'] = '{"key": "value"}' - runner._host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True - runner._host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True + runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', '--source-json-path=/mock-checkout/source.json']) + port.host.filesystem.files['/mock-checkout/source.json'] = '{"key": "value"}' + port.host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True + port.host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True runner._timestamp = 123456789 output_capture = OutputCapture() output_capture.capture_output() @@ -265,7 +266,8 @@ max 1120 finally: stdout, stderr, logs = output_capture.restore_output() - self.assertEqual(logs, '\n'.join(['Running Bindings/event-target-wrapper.html (1 of 2)', + self.assertEqual(logs, '\n'.join(['Running 2 tests', + 'Running Bindings/event-target-wrapper.html (1 of 2)', 'RESULT Bindings: event-target-wrapper= 1489.05 ms', 'median= 1487.0 ms, stdev= 14.46 ms, min= 1471.0 ms, max= 1510.0 ms', '', @@ -273,7 +275,7 @@ max 1120 'RESULT group_name: test_name= 42 ms', '', ''])) - self.assertEqual(json.loads(runner._host.filesystem.files['/mock-checkout/output.json']), { + self.assertEqual(json.loads(port.host.filesystem.files['/mock-checkout/output.json']), { "timestamp": 123456789, "results": {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, "inspector/pass.html:group_name:test_name": 42}, @@ -281,16 +283,16 @@ max 1120 "key": "value"}) def test_run_test_set_with_multiple_repositories(self): - runner = self.create_runner(args=['--output-json-path=/mock-checkout/output.json']) - runner._host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True + runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json']) + port.host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True runner._timestamp = 123456789 - runner._port.repository_paths = lambda: [('webkit', '/mock-checkout'), ('some', '/mock-checkout/some')] + port.repository_paths = lambda: [('webkit', '/mock-checkout'), ('some', '/mock-checkout/some')] self.assertEqual(runner.run(), 0) - self.assertEqual(json.loads(runner._host.filesystem.files['/mock-checkout/output.json']), { + self.assertEqual(json.loads(port.host.filesystem.files['/mock-checkout/output.json']), { "timestamp": 123456789, "results": {"inspector/pass.html:group_name:test_name": 42.0}, "webkit-revision": 5678, "some-revision": 5678}) def test_run_with_upload_json(self): - runner = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', + runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', '--test-results-server', 'some.host', '--platform', 'platform1', '--builder-name', 'builder1', '--build-number', '123']) upload_json_is_called = [False] upload_json_returns_true = True @@ -302,26 +304,26 @@ max 1120 return upload_json_returns_true runner._upload_json = mock_upload_json - runner._host.filesystem.files['/mock-checkout/source.json'] = '{"key": "value"}' - runner._host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True - runner._host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True + port.host.filesystem.files['/mock-checkout/source.json'] = '{"key": "value"}' + port.host.filesystem.files[runner._base_path + '/inspector/pass.html'] = True + port.host.filesystem.files[runner._base_path + '/Bindings/event-target-wrapper.html'] = True runner._timestamp = 123456789 self.assertEqual(runner.run(), 0) self.assertEqual(upload_json_is_called[0], True) - generated_json = json.loads(runner._host.filesystem.files['/mock-checkout/output.json']) + generated_json = json.loads(port.host.filesystem.files['/mock-checkout/output.json']) self.assertEqual(generated_json['platform'], 'platform1') self.assertEqual(generated_json['builder-name'], 'builder1') self.assertEqual(generated_json['build-number'], 123) upload_json_returns_true = False - runner = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', + runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', '--test-results-server', 'some.host', '--platform', 'platform1', '--builder-name', 'builder1', '--build-number', '123']) runner._upload_json = mock_upload_json self.assertEqual(runner.run(), -3) def test_upload_json(self): - runner = self.create_runner() - runner._host.filesystem.files['/mock-checkout/some.json'] = 'some content' + runner, port = self.create_runner() + port.host.filesystem.files['/mock-checkout/some.json'] = 'some content' called = [] upload_single_text_file_throws = False @@ -334,7 +336,7 @@ max 1120 called.append('FileUploader') def upload_single_text_file(mock, filesystem, content_type, filename): - self.assertEqual(filesystem, runner._host.filesystem) + self.assertEqual(filesystem, port.host.filesystem) self.assertEqual(content_type, 'application/json') self.assertEqual(filename, 'some.json') called.append('upload_single_text_file') @@ -358,59 +360,64 @@ max 1120 runner._upload_json('some.host', 'some.json', MockFileUploader) self.assertEqual(called, ['FileUploader', 'upload_single_text_file']) + def _add_file(self, runner, dirname, filename, content=True): + dirname = runner._host.filesystem.join(runner._base_path, dirname) if dirname else runner._base_path + runner._host.filesystem.maybe_make_directory(dirname) + runner._host.filesystem.files[runner._host.filesystem.join(dirname, filename)] = content + def test_collect_tests(self): - runner = self.create_runner() - filename = runner._host.filesystem.join(runner._base_path, 'inspector', 'a_file.html') - runner._host.filesystem.files[filename] = 'a content' + runner, port = self.create_runner() + self._add_file(runner, 'inspector', 'a_file.html', 'a content') tests = runner._collect_tests() self.assertEqual(len(tests), 1) def _collect_tests_and_sort_test_name(self, runner): return sorted([test.test_name() for test in runner._collect_tests()]) - def test_collect_tests(self): - runner = self.create_runner(args=['PerformanceTests/test1.html', 'test2.html']) + def test_collect_tests_with_multile_files(self): + runner, port = self.create_runner(args=['PerformanceTests/test1.html', 'test2.html']) def add_file(filename): - runner._host.filesystem.files[runner._host.filesystem.join(runner._base_path, filename)] = 'some content' + port.host.filesystem.files[runner._host.filesystem.join(runner._base_path, filename)] = 'some content' add_file('test1.html') add_file('test2.html') add_file('test3.html') - runner._host.filesystem.chdir(runner._port.perf_tests_dir()[:runner._port.perf_tests_dir().rfind(runner._host.filesystem.sep)]) + port.host.filesystem.chdir(runner._port.perf_tests_dir()[:runner._port.perf_tests_dir().rfind(runner._host.filesystem.sep)]) self.assertEqual(self._collect_tests_and_sort_test_name(runner), ['test1.html', 'test2.html']) def test_collect_tests_with_skipped_list(self): - runner = self.create_runner() - - def add_file(dirname, filename, content=True): - dirname = runner._host.filesystem.join(runner._base_path, dirname) if dirname else runner._base_path - runner._host.filesystem.maybe_make_directory(dirname) - runner._host.filesystem.files[runner._host.filesystem.join(dirname, filename)] = content - - add_file('inspector', 'test1.html') - add_file('inspector', 'unsupported_test1.html') - add_file('inspector', 'test2.html') - add_file('inspector/resources', 'resource_file.html') - add_file('unsupported', 'unsupported_test2.html') - runner._port.skipped_perf_tests = lambda: ['inspector/unsupported_test1.html', 'unsupported'] + runner, port = self.create_runner() + + self._add_file(runner, 'inspector', 'test1.html') + self._add_file(runner, 'inspector', 'unsupported_test1.html') + self._add_file(runner, 'inspector', 'test2.html') + self._add_file(runner, 'inspector/resources', 'resource_file.html') + self._add_file(runner, 'unsupported', 'unsupported_test2.html') + port.skipped_perf_tests = lambda: ['inspector/unsupported_test1.html', 'unsupported'] self.assertEqual(self._collect_tests_and_sort_test_name(runner), ['inspector/test1.html', 'inspector/test2.html']) def test_collect_tests_with_page_load_svg(self): - runner = self.create_runner() + runner, port = self.create_runner() + self._add_file(runner, 'PageLoad', 'some-svg-test.svg') + tests = runner._collect_tests() + self.assertEqual(len(tests), 1) + self.assertEqual(tests[0].__class__.__name__, 'PageLoadingPerfTest') - def add_file(dirname, filename, content=True): - dirname = runner._host.filesystem.join(runner._base_path, dirname) if dirname else runner._base_path - runner._host.filesystem.maybe_make_directory(dirname) - runner._host.filesystem.files[runner._host.filesystem.join(dirname, filename)] = content + def test_collect_tests_should_ignore_replay_tests_by_default(self): + runner, port = self.create_runner() + self._add_file(runner, 'Replay', 'www.webkit.org.replay') + self.assertEqual(runner._collect_tests(), []) - add_file('PageLoad', 'some-svg-test.svg') + def test_collect_tests_with_replay_tests(self): + runner, port = self.create_runner(args=['--replay']) + self._add_file(runner, 'Replay', 'www.webkit.org.replay') tests = runner._collect_tests() self.assertEqual(len(tests), 1) - self.assertEqual(tests[0].__class__.__name__, 'PageLoadingPerfTest') + self.assertEqual(tests[0].__class__.__name__, 'ReplayPerfTest') def test_parse_args(self): - runner = self.create_runner() + runner, port = self.create_runner() options, args = PerfTestsRunner._parse_args([ '--build-directory=folder42', '--platform=platform42', diff --git a/Tools/Scripts/webkitpy/style/checkers/png.py b/Tools/Scripts/webkitpy/style/checkers/png.py index e0b79e27e..30b7a1439 100644 --- a/Tools/Scripts/webkitpy/style/checkers/png.py +++ b/Tools/Scripts/webkitpy/style/checkers/png.py @@ -27,10 +27,10 @@ import os import re +from webkitpy.common import read_checksum_from_png from webkitpy.common.system.systemhost import SystemHost from webkitpy.common.checkout.scm.detection import SCMDetector - class PNGChecker(object): """Check svn:mime-type for checking style""" @@ -48,6 +48,11 @@ class PNGChecker(object): config_file_path = "" detection = self._detector.display_name() + if self._fs.exists(self._file_path) and self._file_path.endswith("-expected.png"): + with self._fs.open_binary_file_for_reading(self._file_path) as filehandle: + if not read_checksum_from_png.read_checksum(filehandle): + self._handle_style_error(0, 'image/png', 5, "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.") + if detection == "git": config_file_path = self._config_file_path() there_is_enable_line = False diff --git a/Tools/Scripts/webkitpy/style/checkers/png_unittest.py b/Tools/Scripts/webkitpy/style/checkers/png_unittest.py index ae46641a2..764c28591 100644 --- a/Tools/Scripts/webkitpy/style/checkers/png_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/png_unittest.py @@ -113,6 +113,22 @@ class PNGCheckerTest(unittest.TestCase): checker.check() self.assertEquals(len(errors), 1) + file_path = "foo.png" + fs.write_binary_file(file_path, "Dummy binary data") + scm = MockSCMDetector('git') + errors = [] + checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) + checker.check() + self.assertEquals(len(errors), 1) + + file_path = "foo-expected.png" + fs.write_binary_file(file_path, "Dummy binary data") + scm = MockSCMDetector('git') + errors = [] + checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) + checker.check() + self.assertEquals(len(errors), 2) + self.assertEquals(errors[0], (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.')) if __name__ == '__main__': unittest.main() diff --git a/Tools/Scripts/webkitpy/thirdparty/__init__.py b/Tools/Scripts/webkitpy/thirdparty/__init__.py index 0df0cf7b6..26245bacc 100644 --- a/Tools/Scripts/webkitpy/thirdparty/__init__.py +++ b/Tools/Scripts/webkitpy/thirdparty/__init__.py @@ -82,6 +82,8 @@ class AutoinstallImportHook(object): self._install_irc() elif '.buildbot' in fullname: self._install_buildbot() + elif '.webpagereplay' in fullname: + self._install_webpagereplay() def _install_mechanize(self): self._install("http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz", @@ -126,6 +128,15 @@ class AutoinstallImportHook(object): installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="ircbot.py") + def _install_webpagereplay(self): + if not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay")): + self._install("http://web-page-replay.googlecode.com/files/webpagereplay-1.1.1.tar.gz", "webpagereplay-1.1.1") + self._fs.move(self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay-1.1.1"), self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay")) + + init_path = self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay", "__init__.py") + if not self._fs.exists(init_path): + self._fs.write_text_file(init_path, "") + def _install(self, url, url_subpath): installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR) installer.install(url=url, url_subpath=url_subpath) diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py index 30409783f..5a184f19e 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py @@ -26,6 +26,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import json +import logging import optparse import os.path import re @@ -51,16 +53,19 @@ from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand _baseline_suffix_list = ['png', 'wav', 'txt'] +_log = logging.getLogger(__name__) + # FIXME: Should TestResultWriter know how to compute this string? def _baseline_name(fs, test_name, suffix): return fs.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + "." + suffix class AbstractRebaseliningCommand(AbstractDeclarativeCommand): - def __init__(self): - options = [ + def __init__(self, options=None): + options = options or [] + options.extend([ optparse.make_option('--suffixes', default=','.join(_baseline_suffix_list), action='store', - help='file types to rebaseline')] + help='file types to rebaseline')]) AbstractDeclarativeCommand.__init__(self, options=options) self._baseline_suffix_list = _baseline_suffix_list @@ -70,6 +75,14 @@ class RebaselineTest(AbstractRebaseliningCommand): help_text = "Rebaseline a single test from a buildbot. (Currently works only with build.chromium.org buildbots.)" argument_names = "BUILDER_NAME TEST_NAME [PLATFORMS_TO_MOVE_EXISTING_BASELINES_TO]" + def __init__(self): + options = [ + optparse.make_option("--print-scm-changes", action="store_true", help="Print modifcations to the scm (as a json dict) rather than actually modifying the scm"), + ] + AbstractRebaseliningCommand.__init__(self, options=options) + self._print_scm_changes = False + self._scm_changes = {} + def _results_url(self, builder_name): # FIXME: Generalize this command to work with non-build.chromium.org builders. builder = self._tool.chromium_buildbot().builder_with_name(builder_name) @@ -89,12 +102,12 @@ class RebaselineTest(AbstractRebaseliningCommand): port = self._tool.port_factory.get(platform) old_baseline = port.expected_filename(test_name, "." + suffix) if not self._tool.filesystem.exists(old_baseline): - print("No existing baseline for %s." % test_name) + _log.info("No existing baseline for %s." % test_name) continue new_baseline = self._tool.filesystem.join(port.baseline_path(), self._file_name_for_expected_result(test_name, suffix)) if self._tool.filesystem.exists(new_baseline): - print("Existing baseline at %s, not copying over it." % new_baseline) + _log.info("Existing baseline at %s, not copying over it." % new_baseline) continue old_baselines.append(old_baseline) @@ -104,11 +117,11 @@ class RebaselineTest(AbstractRebaseliningCommand): old_baseline = old_baselines[i] new_baseline = new_baselines[i] - print("Copying baseline from %s to %s." % (old_baseline, new_baseline)) + _log.info("Copying baseline from %s to %s." % (old_baseline, new_baseline)) self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dirname(new_baseline)) self._tool.filesystem.copyfile(old_baseline, new_baseline) if not self._tool.scm().exists(new_baseline): - self._tool.scm().add(new_baseline) + self._add_to_scm(new_baseline) def _save_baseline(self, data, target_baseline): if not data: @@ -117,7 +130,13 @@ class RebaselineTest(AbstractRebaseliningCommand): filesystem.maybe_make_directory(filesystem.dirname(target_baseline)) filesystem.write_binary_file(target_baseline, data) if not self._tool.scm().exists(target_baseline): - self._tool.scm().add(target_baseline) + self._add_to_scm(target_baseline) + + def _add_to_scm(self, path): + if self._print_scm_changes: + self._scm_changes['add'].append(path) + else: + self._tool.scm().add(path) def _update_expectations_file(self, builder_name, test_name): port = self._tool.port_factory.get_from_builder_name(builder_name) @@ -148,7 +167,7 @@ class RebaselineTest(AbstractRebaseliningCommand): if platforms_to_move_existing_baselines_to: self._copy_existing_baseline(platforms_to_move_existing_baselines_to, test_name, suffix) - print "Retrieving %s." % source_baseline + _log.info("Retrieving %s." % source_baseline) self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline) def _rebaseline_test_and_update_expectations(self, builder_name, test_name, platforms_to_move_existing_baselines_to): @@ -158,12 +177,16 @@ class RebaselineTest(AbstractRebaseliningCommand): def execute(self, options, args, tool): self._baseline_suffix_list = options.suffixes.split(',') + self._print_scm_changes = options.print_scm_changes + self._scm_changes = {'add': [], 'delete': []} if len(args) > 2: platforms_to_move_existing_baselines_to = args[2:] else: platforms_to_move_existing_baselines_to = None self._rebaseline_test_and_update_expectations(args[0], args[1], platforms_to_move_existing_baselines_to) + if self._print_scm_changes: + print json.dumps(self._scm_changes) class OptimizeBaselines(AbstractRebaseliningCommand): @@ -257,10 +280,10 @@ class RebaselineExpectations(AbstractDeclarativeCommand): builder_name = builders.builder_name_for_port_name(port_name) if not builder_name: return - print "Retrieving results for %s from %s." % (port_name, builder_name) + _log.info("Retrieving results for %s from %s." % (port_name, builder_name)) for test_name in self._tests_to_rebaseline(self._tool.port_factory.get(port_name)): self._touched_test_names.add(test_name) - print " %s" % test_name + _log.info(" %s" % test_name) # FIXME: need to extract the correct list of suffixes here. self._run_webkit_patch(['rebaseline-test', builder_name, test_name]) @@ -273,7 +296,7 @@ class RebaselineExpectations(AbstractDeclarativeCommand): if not options.optimize: return for test_name in self._touched_test_names: - print "Optimizing baselines for %s." % test_name + _log.info("Optimizing baselines for %s." % test_name) self._run_webkit_patch(['optimize-baselines', test_name]) @@ -285,7 +308,7 @@ class Rebaseline(AbstractDeclarativeCommand): def _builder_to_pull_from(self): builder_statuses = self._tool.buildbot.builder_statuses() red_statuses = [status for status in builder_statuses if not status["is_green"]] - print "%s failing" % (pluralize("builder", len(red_statuses))) + _log.info("%s failing" % (pluralize("builder", len(red_statuses)))) builder_choices = [status["name"] for status in red_statuses] chosen_name = self._tool.user.prompt_with_list("Which builder to pull results from:", builder_choices) # FIXME: prompt_with_list should really take a set of objects and a set of names and then return the object. @@ -315,7 +338,7 @@ class Rebaseline(AbstractDeclarativeCommand): results_url = self._results_url_for_test(build, test) # Port operates with absolute paths. expected_file = port.expected_filename(test, '.txt') - print test + _log.info(test) self._replace_expectation_with_remote_result(expected_file, results_url) # FIXME: We should handle new results too. diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index 46d9ed47b..f8d9dfc1b 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py @@ -55,11 +55,11 @@ BUGA DEBUG : fast/css/large-list-of-rules-crash.html = TEXT tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "fast/css/large-list-of-rules-crash.html"), "Dummy test contents") tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents") - expected_stdout = """Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png. + expected_logs = """Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_logs=expected_logs) new_expectations = tool.filesystem.read_text_file(lion_port.path_to_test_expectations_file()) self.assertEqual(new_expectations, """BUGB MAC LINUX XP DEBUG : fast/dom/Window/window-postmessage-clone-really-deep-array.html = PASS @@ -75,11 +75,11 @@ BUGA DEBUG : fast/css/large-list-of-rules-crash.html = TEXT tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), "BUGX MAC : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n") tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents") - expected_stdout = """Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png. + expected_logs = """Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_logs=expected_logs) new_expectations = tool.filesystem.read_text_file(lion_port.path_to_test_expectations_file()) self.assertEqual(new_expectations, "BUGX LEOPARD SNOWLEOPARD : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n") @@ -87,8 +87,18 @@ Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-resu def test_rebaseline_test(self): command = RebaselineTest() command.bind_to_tool(MockTool()) - expected_stdout = "Retrieving http://example.com/f/builders/Webkit Linux/results/layout-test-results/userscripts/another-test-actual.txt.\n" - OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Linux", "userscripts/another-test.html", None, "txt"], expected_stdout=expected_stdout) + expected_logs = "Retrieving http://example.com/f/builders/Webkit Linux/results/layout-test-results/userscripts/another-test-actual.txt.\n" + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Linux", "userscripts/another-test.html", None, "txt"], expected_logs=expected_logs) + + def test_rebaseline_test_and_print_scm_changes(self): + command = RebaselineTest() + command.bind_to_tool(MockTool()) + expected_logs = "Retrieving http://example.com/f/builders/Webkit Linux/results/layout-test-results/userscripts/another-test-actual.txt.\n" + command._print_scm_changes = True + command._scm_changes = {'add': [], 'delete': []} + command._tool._scm.exists = lambda x: False + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Linux", "userscripts/another-test.html", None, "txt"], expected_logs=expected_logs) + self.assertEquals(command._scm_changes, {'add': ['/mock-checkout/LayoutTests/platform/chromium-linux/userscripts/another-test-expected.txt'], 'delete': []}) def test_rebaseline_and_copy_test(self): command = RebaselineTest() @@ -98,20 +108,20 @@ Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-resu lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7") tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test-expected.txt"), "Dummy expected result") - expected_stdout = """Copying baseline from /mock-checkout/LayoutTests/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt. + expected_logs = """Copying baseline from /mock-checkout/LayoutTests/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_logs=expected_logs) def test_rebaseline_and_copy_test_no_existing_result(self): command = RebaselineTest() tool = MockTool() command.bind_to_tool(tool) - expected_stdout = """No existing baseline for userscripts/another-test.html. + expected_logs = """No existing baseline for userscripts/another-test.html. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_logs=expected_logs) def test_rebaseline_and_copy_test_with_lion_result(self): command = RebaselineTest() @@ -121,11 +131,11 @@ Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-resu lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7") tool.filesystem.write_text_file(os.path.join(lion_port.baseline_path(), "userscripts/another-test-expected.txt"), "Dummy expected result") - expected_stdout = """Copying baseline from /mock-checkout/LayoutTests/platform/chromium-mac/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt. + expected_logs = """Copying baseline from /mock-checkout/LayoutTests/platform/chromium-mac/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt. Copying baseline from /mock-checkout/LayoutTests/platform/chromium-mac/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-leopard/userscripts/another-test-expected.txt. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard", "chromium-mac-leopard"], "txt"], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard", "chromium-mac-leopard"], "txt"], expected_logs=expected_logs) def test_rebaseline_and_copy_no_overwrite_test(self): command = RebaselineTest() @@ -138,10 +148,10 @@ Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-resu snowleopard_port = tool.port_factory.get_from_builder_name("Webkit Mac10.6") tool.filesystem.write_text_file(os.path.join(snowleopard_port.baseline_path(), "userscripts/another-test-expected.txt"), "Dummy expected result") - expected_stdout = """Existing baseline at /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt, not copying over it. + expected_logs = """Existing baseline at /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt, not copying over it. Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt. """ - OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout) + OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_logs=expected_logs) def test_rebaseline_expectations(self): command = RebaselineExpectations() @@ -155,7 +165,7 @@ Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-resu # Don't enable logging until after we create the mock expectation files as some Port.__init__'s run subcommands. tool.executive = MockExecutive(should_log=True) - expected_stdout = """Retrieving results for chromium-linux-x86 from Webkit Linux 32. + expected_logs = """Retrieving results for chromium-linux-x86 from Webkit Linux 32. userscripts/another-test.html userscripts/images.svg Retrieving results for chromium-linux-x86_64 from Webkit Linux. @@ -200,9 +210,9 @@ MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/images. """ command._tests_to_rebaseline = lambda port: ['userscripts/another-test.html', 'userscripts/images.svg'] - OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=False), [], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr) + OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=False), [], tool], expected_logs=expected_logs, expected_stderr=expected_stderr) - expected_stdout_with_optimize = expected_stdout + ( + expected_logs_with_optimize = expected_logs + ( "Optimizing baselines for userscripts/another-test.html.\n" "Optimizing baselines for userscripts/images.svg.\n") expected_stderr_with_optimize = expected_stderr + ( @@ -210,4 +220,4 @@ MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/images. "MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/images.svg'], cwd=/mock-checkout\n") command._tests_to_rebaseline = lambda port: ['userscripts/another-test.html', 'userscripts/images.svg'] - OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True), [], tool], expected_stdout=expected_stdout_with_optimize, expected_stderr=expected_stderr_with_optimize) + OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True), [], tool], expected_logs=expected_logs_with_optimize, expected_stderr=expected_stderr_with_optimize) diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py index 09660f609..369070982 100644 --- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py +++ b/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py @@ -23,6 +23,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import BaseHTTPServer +import logging +import json import os from webkitpy.common.memoized import memoized @@ -33,6 +35,9 @@ from webkitpy.layout_tests.models.test_configuration import TestConfigurationCon from webkitpy.layout_tests.port import builders +_log = logging.getLogger(__name__) + + class BuildCoverageExtrapolator(object): def __init__(self, test_configuration_converter): self._test_configuration_converter = test_configuration_converter @@ -171,15 +176,43 @@ class GardeningHTTPRequestHandler(ReflectionHandler): builders_to_fallback_paths[builder] = fallback_path return builders_to_fallback_paths.keys() - def rebaselineall(self): - # FIXME: Optimize this to run in parallel, cache zips, etc. - test_list = self._read_entity_body_as_json() + def _rebaseline_commands(self, test_list): + path_to_webkit_patch = self.server.tool.path() + cwd = self.server.tool.scm().checkout_root + commands = [] + for test in test_list: + for builder in self._builders_to_fetch_from(test_list[test]): + suffixes = ','.join(test_list[test][builder]) + cmd_line = [path_to_webkit_patch, 'rebaseline-test', '--print-scm-changes', '--suffixes', suffixes, builder, test] + commands.append(tuple([cmd_line, cwd])) + return commands + + def _files_to_add(self, command_results): + files_to_add = set() + for output in [result[1] for result in command_results]: + try: + files_to_add.update(json.loads(output)['add']) + except ValueError, e: + _log.warning('"%s" is not a JSON object, ignoring' % output) + + return list(files_to_add) + + def _optimize_baselines(self, test_list): + # We don't run this in parallel because modifying the SCM in parallel is unreliable. for test in test_list: all_suffixes = set() - builders = self._builders_to_fetch_from(test_list[test]) - for builder in builders: - suffixes = test_list[test][builder] - all_suffixes.update(suffixes) - self._run_webkit_patch(['rebaseline-test', '--suffixes', ','.join(suffixes), builder, test]) + for builder in self._builders_to_fetch_from(test_list[test]): + all_suffixes.update(test_list[test][builder]) self._run_webkit_patch(['optimize-baselines', '--suffixes', ','.join(all_suffixes), test]) + + def rebaselineall(self): + test_list = self._read_entity_body_as_json() + + commands = self._rebaseline_commands(test_list) + command_results = self.server.tool.executive.run_in_parallel(commands) + + files_to_add = self._files_to_add(command_results) + self.server.tool.scm().add_list(list(files_to_add)) + + self._optimize_baselines(test_list) self._serve_text('success') diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py index e1798f65e..dcecb500c 100644 --- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py +++ b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py @@ -27,6 +27,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import json +import sys import unittest from webkitpy.common.system.outputcapture import OutputCapture @@ -170,8 +171,8 @@ class GardeningExpectationsUpdaterTest(unittest.TestCase): class GardeningServerTest(unittest.TestCase): - def _post_to_path(self, path, body=None, expected_stderr=None, expected_stdout=None): - handler = TestGardeningHTTPRequestHandler(MockServer()) + def _post_to_path(self, path, body=None, expected_stderr=None, expected_stdout=None, server=None): + handler = TestGardeningHTTPRequestHandler(server or MockServer()) handler.path = path handler.body = body OutputCapture().assert_outputs(self, handler.do_POST, expected_stderr=expected_stderr, expected_stdout=expected_stdout) @@ -186,9 +187,18 @@ class GardeningServerTest(unittest.TestCase): "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])}, "MOCK builder (Debug)": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier", "debug"])}, } - expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', u'%s', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\nMOCK run_command: ['echo', 'optimize-baselines', '--suffixes', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\n" + expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', '--print-scm-changes', '--suffixes', u'%s', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\nMOCK run_command: ['echo', 'optimize-baselines', '--suffixes', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\n" expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n" - self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder": ["txt","png"]}}', expected_stderr=expected_stderr % ('txt,png', 'MOCK builder', 'txt,png'), expected_stdout=expected_stdout) + server = MockServer() + + self.output = ['{"add": [], "delete": []}', ''] + + def run_command(args, cwd=None, **kwargs): + print >> sys.stderr, "MOCK run_command: %s, cwd=%s" % (args, cwd) + return self.output.pop(0) + + server.tool.executive.run_command = run_command + self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder": ["txt","png"]}}', expected_stderr=expected_stderr % ('txt,png', 'MOCK builder', 'txt,png'), expected_stdout=expected_stdout, server=server) self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt","png"]}}', expected_stderr=expected_stderr % ('txt,png', 'MOCK builder (Debug)', 'txt,png'), expected_stdout=expected_stdout) diff --git a/Tools/TestWebKitAPI/Configurations/Base.xcconfig b/Tools/TestWebKitAPI/Configurations/Base.xcconfig index c321d194a..5f5094f34 100644 --- a/Tools/TestWebKitAPI/Configurations/Base.xcconfig +++ b/Tools/TestWebKitAPI/Configurations/Base.xcconfig @@ -23,6 +23,7 @@ #include "CompilerVersion.xcconfig" +CLANG_WARN_CXX0X_EXTENSIONS = NO; HEADER_SEARCH_PATHS = ${BUILT_PRODUCTS_DIR}/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST GTEST_HAS_TR1_TUPLE=0; diff --git a/Tools/WebKitTestRunner/Configurations/Base.xcconfig b/Tools/WebKitTestRunner/Configurations/Base.xcconfig index ab87999e9..4015b3e31 100644 --- a/Tools/WebKitTestRunner/Configurations/Base.xcconfig +++ b/Tools/WebKitTestRunner/Configurations/Base.xcconfig @@ -23,6 +23,7 @@ #include "CompilerVersion.xcconfig" +CLANG_WARN_CXX0X_EXTENSIONS = NO; HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders ${SRCROOT}/../../Source/JavaScriptCore/icu $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index 5e52ee8ba..819ea4600 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -54,6 +54,7 @@ module WTR { void setAllowUniversalAccessFromFileURLs(in boolean value); void setAllowFileAccessFromFileURLs(in boolean value); void setFrameFlatteningEnabled(in boolean value); + void setPluginsEnabled(in boolean value); void setGeolocationPermission(in boolean value); void setJavaScriptCanAccessClipboard(in boolean value); void setPrivateBrowsingEnabled(in boolean value); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 05d4ea687..c9c3fec3d 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -230,7 +230,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) m_layoutTestController->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates")); - page()->reset(); + page()->prepare(); WKBundleClearAllDatabases(m_bundle); WKBundleClearApplicationCache(m_bundle); @@ -260,7 +260,9 @@ void InjectedBundle::done() WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get()); closeOtherPages(); - + + page()->resetAfterTest(); + m_state = Idle; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 57d2e1496..dc2ad3d39 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -330,7 +330,7 @@ void InjectedBundlePage::stopLoading() WKBundlePageStopLoading(m_page); } -void InjectedBundlePage::reset() +void InjectedBundlePage::prepare() { WKBundlePageClearMainFrameName(m_page); @@ -347,6 +347,17 @@ void InjectedBundlePage::reset() WKBundlePageSetTracksRepaints(m_page, false); } +void InjectedBundlePage::resetAfterTest() +{ + WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page); + JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame); +#if PLATFORM(QT) + DumpRenderTreeSupportQt::injectInternalsObject(context); +#else + WebCoreTestSupport::resetInternalsObject(context); +#endif +} + // Loader Client Callbacks // String output must be identical to -[WebFrame _drt_descriptionSuitableForTestResult]. diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index bce8ac038..4e1fce171 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -42,7 +42,8 @@ public: void stopLoading(); - void reset(); + void prepare(); + void resetAfterTest(); void dumpBackForwardList(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index 250fa5c95..cca4de681 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -371,6 +371,11 @@ void LayoutTestController::setFrameFlatteningEnabled(bool enabled) WKBundleSetFrameFlatteningEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled); } +void LayoutTestController::setPluginsEnabled(bool enabled) +{ + WKBundleSetPluginsEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled); +} + void LayoutTestController::setGeolocationPermission(bool enabled) { WKBundleSetGeolocationPermission(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled); @@ -478,13 +483,6 @@ void LayoutTestController::evaluateInWebInspector(long callID, JSStringRef scrip #endif // ENABLE(INSPECTOR) } -void LayoutTestController::setJavaScriptProfilingEnabled(bool enabled) -{ -#if ENABLE(INSPECTOR) - WKBundleInspectorSetJavaScriptProfilingEnabled(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), enabled); -#endif // ENABLE(INSPECTOR) -} - typedef WTF::HashMap<unsigned, WKRetainPtr<WKBundleScriptWorldRef> > WorldMap; static WorldMap& worldMap() { diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index 8ca09f61a..945a6609e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -88,6 +88,7 @@ public: void setAllowUniversalAccessFromFileURLs(bool); void setAllowFileAccessFromFileURLs(bool); void setFrameFlatteningEnabled(bool); + void setPluginsEnabled(bool); void setGeolocationPermission(bool); void setJavaScriptCanAccessClipboard(bool); void setPrivateBrowsingEnabled(bool); @@ -174,7 +175,6 @@ public: void showWebInspector(); void closeWebInspector(); void evaluateInWebInspector(long callId, JSStringRef script); - void setJavaScriptProfilingEnabled(bool); void setPOSIXLocale(JSStringRef); diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp index 72d04878a..5de8ae71a 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp @@ -64,9 +64,7 @@ void LayoutTestController::platformInitialize() // which makes the use of QFontDatabase unnecessary. // See https://bugs.webkit.org/show_bug.cgi?id=53427 QWebSettings::clearMemoryCaches(); -#if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2)) QFontDatabase::removeAllApplicationFonts(); -#endif activateFonts(); QObject::connect(&m_waitToDumpWatchdogTimer, SIGNAL(timeout()), WatchdogTimerHelper::instance(), SLOT(timerFired())); } diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index a7c3b6a05..ffdc2cc66 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -49,7 +49,7 @@ namespace WTR { static const double defaultLongTimeout = 30; -static const double defaultShortTimeout = 5; +static const double defaultShortTimeout = 15; static const double defaultNoTimeout = -1; static WKURLRef blankURL() @@ -498,9 +498,9 @@ bool TestController::runTest(const char* test) if (!resetStateToConsistentValues()) { #if PLATFORM(MAC) pid_t pid = WKPageGetProcessIdentifier(m_mainWebView->page()); - fprintf(stderr, "#CRASHED - WebProcess (pid %ld)\n", static_cast<long>(pid)); + fprintf(stderr, "#PROCESS UNRESPONSIVE - WebProcess (pid %ld)\n", static_cast<long>(pid)); #else - fputs("#CRASHED - WebProcess\n", stderr); + fputs("#PROCESS UNRESPONSIVE - WebProcess\n", stderr); #endif fflush(stderr); return false; diff --git a/Tools/qmake/config.tests/libpng/libpng.pro b/Tools/qmake/config.tests/libpng/libpng.pro index d35b5dae6..23a39a971 100644 --- a/Tools/qmake/config.tests/libpng/libpng.pro +++ b/Tools/qmake/config.tests/libpng/libpng.pro @@ -1,3 +1,3 @@ SOURCES = libpng.cpp OBJECTS_DIR = obj -LIBS += -lpng12 +LIBS += -lpng diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index c37d71b62..78c93d7c0 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -21,6 +21,8 @@ isEmpty(OBJECTS_DIR): OBJECTS_DIR = obj/$$activeBuildConfig() DEFINES += \ BUILDING_QT__=1 +haveQt(5): DEFINES += HAVE_QT5=1 + CONFIG(release, debug|release): DEFINES *= NDEBUG CONFIG += depend_includepath diff --git a/Tools/qmake/mkspecs/features/features.pri b/Tools/qmake/mkspecs/features/features.pri index b5191701d..4de5c64cb 100644 --- a/Tools/qmake/mkspecs/features/features.pri +++ b/Tools/qmake/mkspecs/features/features.pri @@ -22,6 +22,7 @@ FEATURE_DEFAULTS = \ ENABLE_CSS_EXCLUSIONS=1 \ ENABLE_CSS_FILTERS=1 \ ENABLE_CSS_GRID_LAYOUT=0 \ + ENABLE_CSS_IMAGE_RESOLUTION=0 \ ENABLE_CSS_REGIONS=1 \ ENABLE_CSS_SHADERS=0 \ ENABLE_CSS_VARIABLES=0 \ diff --git a/Tools/qmake/mkspecs/features/unix/default_post.prf b/Tools/qmake/mkspecs/features/unix/default_post.prf index 3fc5c25f9..0064b3e46 100644 --- a/Tools/qmake/mkspecs/features/unix/default_post.prf +++ b/Tools/qmake/mkspecs/features/unix/default_post.prf @@ -18,9 +18,7 @@ linux-g++* { greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) { !contains(QMAKE_CXXFLAGS, -std=(c|gnu)\\+\\+(0x|11)) { # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr). - QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat - QMAKE_CFLAGS += -Wno-c++0x-compat QMAKE_CXXFLAGS += -Wno-c++0x-compat } } diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog index 88c1255f1..40813902f 100644 --- a/WebKitLibraries/ChangeLog +++ b/WebKitLibraries/ChangeLog @@ -1,3 +1,26 @@ +2012-05-29 Jessie Berlin <jberlin@apple.com> + + [Win] ~1/2 of all the iframe seamless tests fail + https://bugs.webkit.org/show_bug.cgi?id=87543 + + Rubber-stamped by Eric Seidel. + + Finish enabling IFRAME_SEAMLESS on Windows. + + * win/tools/vsprops/FeatureDefines.vsprops: + +2012-05-28 Vivek Galatage <vivekgalatage@gmail.com> + + Remove obsolete feature define ENABLE_3D_CANVAS from FeatureDefines.vsprops for windows + https://bugs.webkit.org/show_bug.cgi?id=87622 + + Reviewed by Eric Seidel. + + Removed the ENABLE_3D_CANVAS from the property define as this is + obsolete since bug #53041 + + * win/tools/vsprops/FeatureDefines.vsprops: + 2012-05-24 John Mellor <johnme@chromium.org> Font Boosting: Add compile flag and runtime setting diff --git a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops index 7747ef3f8..ad08ce803 100644 --- a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops +++ b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops @@ -9,7 +9,7 @@ > <Tool Name="VCCLCompilerTool" - PreprocessorDefinitions="$(ENABLE_REQUEST_ANIMATION_FRAME);$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_ACCELERATED_2D_CANVAS);$(ENABLE_BLOB);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CSS3_FLEXBOX);$(ENABLE_CSS_FILTERS);$(ENABLE_CSS_GRID_LAYOUT);$(ENABLE_CSS_SHADERS);$(ENABLE_CSS_REGIONS);$(ENABLE_CSS_EXCLUSIONS);$(ENABLE_SQL_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DATA_TRANSFER_ITEMS);$(ENABLE_DETAILS);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DIRECTORY_UPLOAD);$(ENABLE_FILTERS);$(ENABLE_FILE_SYSTEM);$(ENABLE_FONT_BOOSTING);$(ENABLE_FULLSCREEN_API);$(ENABLE_GAMEPAD);$(ENABLE_GEOLOCATION);$(ENABLE_HIGH_DPI_CANVAS);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_INPUT_TYPE_COLOR);$(ENABLE_INPUT_SPEECH);$(ENABLE_INPUT_TYPE_DATE);$(ENABLE_INPUT_TYPE_DATETIME);$(ENABLE_INPUT_TYPE_DATETIMELOCAL);$(ENABLE_INPUT_TYPE_MONTH);$(ENABLE_INPUT_TYPE_TIME);$(ENABLE_INPUT_TYPE_WEEK);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_LEGACY_CSS_VENDOR_PREFIXES);$(ENABLE_LEGACY_NOTIFICATIONS);$(ENABLE_LINK_PREFETCH);$(ENABLE_LINK_PRERENDER);$(ENABLE_MATHML);$(ENABLE_METER_TAG);$(ENABLE_MICRODATA);$(ENABLE_MUTATION_OBSERVERS);$(ENABLE_NOTIFICATIONS);$(ENABLE_PAGE_VISIBILITY_API);$(ENABLE_PROGRESS_TAG);$(ENABLE_QUOTA);$(ENABLE_REGISTER_PROTOCOL_HANDLER);$(ENABLE_SCRIPTED_SPEECH);$(ENABLE_SHADOW_DOM);$(ENABLE_SHARED_WORKERS);$(ENABLE_STYLE_SCOPED);$(ENABLE_SVG);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_VIDEO);$(ENABLE_MEDIA_SOURCE);$(ENABLE_MEDIA_STATISTICS);$(ENABLE_WEB_SOCKETS);$(ENABLE_WEB_TIMING);$(ENABLE_WORKERS);$(ENABLE_XSLT)" + PreprocessorDefinitions="$(ENABLE_IFRAME_SEAMLESS);$(ENABLE_REQUEST_ANIMATION_FRAME);$(ENABLE_3D_RENDERING);$(ENABLE_ACCELERATED_2D_CANVAS);$(ENABLE_BLOB);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CSS3_FLEXBOX);$(ENABLE_CSS_FILTERS);$(ENABLE_CSS_GRID_LAYOUT);$(ENABLE_CSS_SHADERS);$(ENABLE_CSS_REGIONS);$(ENABLE_CSS_EXCLUSIONS);$(ENABLE_SQL_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DATA_TRANSFER_ITEMS);$(ENABLE_DETAILS);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DIRECTORY_UPLOAD);$(ENABLE_FILTERS);$(ENABLE_FILE_SYSTEM);$(ENABLE_FONT_BOOSTING);$(ENABLE_FULLSCREEN_API);$(ENABLE_GAMEPAD);$(ENABLE_GEOLOCATION);$(ENABLE_HIGH_DPI_CANVAS);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_INPUT_TYPE_COLOR);$(ENABLE_INPUT_SPEECH);$(ENABLE_INPUT_TYPE_DATE);$(ENABLE_INPUT_TYPE_DATETIME);$(ENABLE_INPUT_TYPE_DATETIMELOCAL);$(ENABLE_INPUT_TYPE_MONTH);$(ENABLE_INPUT_TYPE_TIME);$(ENABLE_INPUT_TYPE_WEEK);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_LEGACY_CSS_VENDOR_PREFIXES);$(ENABLE_LEGACY_NOTIFICATIONS);$(ENABLE_LINK_PREFETCH);$(ENABLE_LINK_PRERENDER);$(ENABLE_MATHML);$(ENABLE_METER_TAG);$(ENABLE_MICRODATA);$(ENABLE_MUTATION_OBSERVERS);$(ENABLE_NOTIFICATIONS);$(ENABLE_PAGE_VISIBILITY_API);$(ENABLE_PROGRESS_TAG);$(ENABLE_QUOTA);$(ENABLE_REGISTER_PROTOCOL_HANDLER);$(ENABLE_SCRIPTED_SPEECH);$(ENABLE_SHADOW_DOM);$(ENABLE_SHARED_WORKERS);$(ENABLE_STYLE_SCOPED);$(ENABLE_SVG);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_VIDEO);$(ENABLE_MEDIA_SOURCE);$(ENABLE_MEDIA_STATISTICS);$(ENABLE_WEB_SOCKETS);$(ENABLE_WEB_TIMING);$(ENABLE_WORKERS);$(ENABLE_XSLT)" /> <UserMacro Name="ENABLE_3D_RENDERING" @@ -348,7 +348,6 @@ def build(bld): excludes.append('JSSVGStyleTable.cpp') excludes.append('JSSVGTests.cpp') excludes.append('JSSVGStylable.cpp') - excludes.append('JSSVGZoomAndPan.cpp') # These are files that expect methods not in the base C++ class, usually XYZAnimated methods. excludes.append('JSSVGFitToViewBox.cpp') |